/* ===== Bảng màu & biến dùng chung ===== */
:root {
    color-scheme: light;

    --bg: #f7f5f1;
    --surface: #ffffff;
    --surface-2: #faf8f5;
    --line: #e7e2d9;
    --line-soft: #f0ece5;

    /* Khối tối dùng cho thẻ quy đổi và thanh trạng thái. */
    --ink: #17161a;
    --ink-2: #232128;
    --ink-line: #34313a;
    --ink-text: #f3f1ec;
    --ink-dim: #9c968c;

    --text: #1a1917;
    --text-dim: #6a655e;
    --text-faint: #8c867d;

    --gold: #c4922f;
    --gold-line: #d9a63f;
    --gold-deep: #966c18;
    --gold-wash: #fbf4e6;
    --gold-border: #ecd9ac;

    --up: #17915a;
    --down: #d64530;

    --radius: 12px;
    --radius-sm: 8px;

    --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.015em;
}

a {
    color: var(--gold-deep);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1:focus {
    outline: none;
}

/* Số liệu tài chính luôn dùng chữ số đều nhau để cột không nhảy khi cập nhật. */
.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* Ô số vừa đổi giá được nháy nhẹ để mắt bắt được thay đổi. */
.tick-up {
    animation: tick-up 900ms ease-out;
}

.tick-down {
    animation: tick-down 900ms ease-out;
}

@keyframes tick-up {
    0% { background-color: rgba(23, 145, 90, .18); }
    100% { background-color: transparent; }
}

@keyframes tick-down {
    0% { background-color: rgba(214, 69, 48, .18); }
    100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .tick-up, .tick-down {
        animation: none;
    }
}

.up { color: var(--up); }
.down { color: var(--down); }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.gold { color: var(--gold-deep); }

/* Nhãn nhỏ in hoa đứng trên mỗi khối số liệu. */
.eyebrow {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 700;
    color: var(--text-faint);
}

/* ===== Khối bố cục chung ===== */
.container {
    width: min(1180px, 100% - 2rem);
    margin-inline: auto;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--line-soft);
}

.card-head h2 {
    font-size: 1.08rem;
}

.card-head .sub {
    font-size: .8rem;
    color: var(--text-faint);
    margin-top: .15rem;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--line-soft);
    font-size: .76rem;
    color: var(--text-faint);
}

.card-foot .links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Nút, pill, badge ===== */
button, input, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    transition: border-color .15s, background .15s, color .15s;
}

.btn:hover {
    border-color: var(--gold);
    color: var(--gold-deep);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Nhóm pill chọn khoảng thời gian / loại vàng. */
.pills {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}

.pills .btn {
    padding: .35rem .75rem;
    font-size: .79rem;
}

.pills .btn.on {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.pills .btn.on:hover {
    color: #fff;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.chip.up {
    color: var(--up);
    background: #e9f6ef;
    border-color: #c6e6d5;
}

.chip.down {
    color: var(--down);
    background: #fdeeeb;
    border-color: #f6d0c8;
}

.chip.flat {
    color: var(--text-dim);
    background: var(--surface-2);
    border-color: var(--line);
}

/* ===== Bảng ===== */
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .89rem;
}

table.data th {
    text-align: right;
    font-size: .69rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-faint);
    font-weight: 700;
    padding: .6rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data th:first-child,
table.data td:first-child {
    text-align: left;
}

table.data td {
    text-align: right;
    padding: .7rem 1.25rem;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data tbody tr:hover {
    background: var(--surface-2);
}

.table-wrap {
    overflow-x: auto;
}

/* ===== Thành phần mặc định của Blazor ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Đã xảy ra lỗi."
}
