/* Sổ tài sản — kính ngân hàng xanh thẫm, vàng đồng, bảng giá tiệm vàng */
:root {
  --bg: #edf3f1; --panel: #ffffff; --panel2: #e3ece9; --ink: #0f2e2d; --muted: #587370; --line: #cddad6;
  --accent: #0f6461; --brass: #9a6a0c; --brass-soft: #f1e3bf; --up: #0d8a5e; --down: #c4392b;
  --board: #07191c; --board-ink: #e9f1ee; --board-mut: #7fa09b; --board-line: #173337;
  --c-crypto: #c4673b; --c-stock: #0f6461; --c-gold: #c9962e; --c-cash: #7a8f8c; --c-other: #6f6aa8;
  --shadow: 0 1px 2px rgba(15, 46, 45, .06), 0 8px 24px -12px rgba(15, 46, 45, .18);
  --r: 14px; --gut: 16px;
  --f-display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b2225; --panel: #11302f; --panel2: #163a3b; --ink: #e6efec; --muted: #8fa9a5; --line: #224549;
    --accent: #5db9b1; --brass: #e0ae4f; --brass-soft: #3a3217; --up: #5ed3a4; --down: #ff7a68;
    --board: #061417; --board-line: #143034;
    --c-crypto: #ff9a62; --c-stock: #3fa39b; --c-gold: #e0ae4f; --c-cash: #7f9693; --c-other: #9a94d8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .55);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--f-body); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; letter-spacing: -.01em; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.muted { color: var(--muted); }
.private .money { filter: blur(9px); user-select: none; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 20px; padding: 10px var(--gut); background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font: 700 19px var(--f-display); letter-spacing: -.01em; }
.ingot-a { fill: var(--c-gold); } .ingot-b { fill: #f4d58a; }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a { text-decoration: none; padding: 7px 13px; border-radius: 999px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
#nav a:hover { background: var(--panel2); color: var(--ink); }
#nav a[aria-current="page"] { background: var(--ink); color: var(--panel); }
.tools { display: flex; align-items: center; gap: 6px; }
.stamp { font: 400 12px var(--f-mono); color: var(--muted); margin-right: 6px; white-space: nowrap; }
.who { font: 400 12px var(--f-mono); color: var(--muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login { max-width: 440px; margin: 6vh auto 0; padding: 26px; }
.login h1 { font-size: 26px; margin: 6px 0 4px; }
.login .muted { margin: 0 0 18px; font-size: 14px; }
body.locked #board, body.locked #nav, body.locked #stamp, body.locked .icon-btn, body.locked #who { display: none; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; border-radius: 10px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); background: var(--panel2); }
.icon-btn[aria-pressed="true"] { color: var(--brass); border-color: var(--brass); }
.icon-btn.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- bảng giá (điểm nhấn) ---------- */
.board { display: flex; background: var(--board); color: var(--board-ink); overflow-x: auto; scrollbar-width: none; border-bottom: 3px solid var(--c-gold); }
.board::-webkit-scrollbar { display: none; }
.cell { flex: 1 0 168px; padding: 11px 18px 12px; border-right: 1px solid var(--board-line); min-width: 168px; }
.cell:last-child { border-right: 0; }
.cell .lab { white-space: nowrap; font: 500 10.5px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--c-gold); }
.cell .val { font: 600 21px/1.25 var(--f-mono); margin-top: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell .val small { font-size: 12px; font-weight: 400; color: var(--board-mut); margin-left: 4px; }
.cell .sub { font: 400 12px var(--f-mono); color: var(--board-mut); white-space: nowrap; }
.board .up { color: #5ed3a4; } .board .down { color: #ff7a68; }
.banner { background: var(--brass-soft); color: var(--ink); padding: 8px var(--gut); font-size: 13px; border-bottom: 1px solid var(--line); }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 22px var(--gut) 90px; outline: none; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h2, .card > .head h2 { font-size: 16px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.eyebrow { font: 500 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-title h1 { font-size: 26px; }
.page-title p { margin: 0; color: var(--muted); font-size: 13.5px; }
.stack { display: grid; gap: 16px; }

/* ---------- hero ---------- */
.hero { padding: 24px 24px 20px; background:
  linear-gradient(180deg, color-mix(in srgb, var(--c-gold) 9%, var(--panel)), var(--panel) 62%); }
.hero .worth { font: 700 clamp(34px, 6.4vw, 60px)/1.05 var(--f-display); letter-spacing: -.025em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.hero .worth small { font-size: .45em; color: var(--muted); font-weight: 500; margin-left: 6px; }
.delta { font: 500 15px var(--f-mono); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px; border-top: 1px solid var(--line); }
.kpi { padding: 12px 16px 2px 0; }
.kpi + .kpi { padding-left: 16px; border-left: 1px solid var(--line); }
.kpi .v { font: 600 17px var(--f-mono); margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font: 400 12px var(--f-mono); }
.ribbon { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; margin: 18px 0 10px; background: var(--panel2); }
.ribbon i { display: block; min-width: 3px; transition: flex-grow .4s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend b { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend em { font: 400 12px var(--f-mono); color: var(--muted); font-style: normal; }

.sect { font-size: 16px; margin: 0 0 12px; }
.bar { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c-gold); border-radius: 4px; }
details > summary { cursor: pointer; font-weight: 500; color: var(--muted); }
details > summary:hover { color: var(--ink); }
a { color: var(--accent); }
.only-m { display: none; }
.goal-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); }
.gc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gc-sub { font-size: 12.5px; margin: 2px 0 8px; }
.gc-when { font-size: 15px; margin-bottom: 10px; }
.gc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font: 600 14px var(--f-mono); }
.gc-grid span { display: block; font: 500 10.5px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }
.gc-status { margin-top: 10px; }
/* ---------- pills / tabs ---------- */
.pills { display: inline-flex; background: var(--panel2); border-radius: 999px; padding: 3px; gap: 2px; }
.pills button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); }
.pills button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); font-weight: 600; }
.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 340px; }
.chart-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.chart-stats b { font-family: var(--f-mono); font-weight: 600; }

/* ---------- tables ---------- */
.tw { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font: 500 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; text-align: right; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); white-space: nowrap; font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 13.5px; }
th:first-child, td:first-child { text-align: left; }
td.t-left, th.t-left { text-align: left; }
td:first-child { font-family: var(--f-body); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
.sym { font: 700 15px var(--f-display); display: block; }
.sym small { font: 400 12px var(--f-body); color: var(--muted); display: block; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font: 500 12px var(--f-body); background: var(--panel2); }
.badge.up { background: color-mix(in srgb, var(--up) 15%, transparent); } .badge.down { background: color-mix(in srgb, var(--down) 15%, transparent); }
.spark { display: block; margin-left: auto; } .spark path { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark.up path { stroke: var(--up); } .spark.down path { stroke: var(--down); }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 20px; margin-bottom: 6px; }
.empty .row { margin-top: 16px; }
.warn { color: var(--down); font-size: 13px; }

/* ---------- buttons / forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); padding: 8px 15px; border-radius: 10px; cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--panel2); }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--down); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .field > .lab { font-size: 12.5px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; min-height: 40px; }
input:focus, select:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.span2 { grid-column: span 2; } .span4 { grid-column: 1 / -1; }
.hint { font-size: 12.5px; color: var(--muted); }
.x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.x:hover { color: var(--down); background: var(--panel2); }

/* ---------- watchlist ---------- */
.wl { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.wcard { cursor: pointer; padding: 16px; position: relative; transition: transform .15s, border-color .15s; }
.wcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.wcard .px { font: 600 24px var(--f-mono); margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.wcard .top2 { display: flex; justify-content: space-between; align-items: center; }
.wcard .rm { position: absolute; right: 10px; top: 10px; opacity: 0; } .wcard:hover .rm, .wcard .rm:focus-visible { opacity: 1; }
.wcard .spark { margin: 8px 0 10px; width: 100%; height: 44px; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font: 400 12px var(--f-mono); }
.mini small { display: block; white-space: nowrap; }
.mini span { display: block; color: var(--muted); font: 500 10.5px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; }
.range { height: 6px; background: var(--panel2); border-radius: 3px; position: relative; margin: 14px 0 4px; }
.range i { position: absolute; top: -3px; width: 4px; height: 12px; border-radius: 2px; background: var(--brass); transform: translateX(-2px); }
.range-l { display: flex; justify-content: space-between; font: 400 11px var(--f-mono); color: var(--muted); }

/* ---------- modal / toast ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ink); width: min(820px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(4, 16, 18, .6); backdrop-filter: blur(2px); }
.dlg { padding: 22px; }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.dlg-head h2 { font-size: 28px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.metric { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.metric .eyebrow { font-size: 10px; } .metric .v { font: 600 16px var(--f-mono); margin-top: 2px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--down); color: #fff; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .g4, .metrics { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 8px; }
  .stamp, .who { display: none; }
}
@media (max-width: 720px) {
  .only-d { display: none; }
  .only-m { display: grid; gap: 12px; }
  .top { gap: 10px; }
  #nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--panel); border-top: 1px solid var(--line); justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; }
  #nav { overflow-x: auto; scrollbar-width: none; }
  #nav::-webkit-scrollbar { display: none; }
  #nav a { padding: 8px 8px; font-size: 11.5px; border-radius: 10px; white-space: nowrap; flex: 1 0 auto; text-align: center; }
  .tools { margin-left: auto; }
  .hero { padding: 18px 16px 14px; }
  .page-title h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
