/* StockTrade Pro — giao diện vàng gold, hiệu ứng kính (glass), theo phong cách Smart Sales */
:root {
  --bg: #fbf3e6;
  --bg-2: #f6ead6;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --panel-2: #f8efe1;
  --line: #ecdcc2;
  --text: #3b2a16;
  --head: #7a4a1a;
  --muted: #8d7556;
  --gold-1: #e3c27f;
  --gold-2: #c99a55;
  --gold-3: #a8743a;
  --gold-4: #8a5a26;
  --gold-grad: linear-gradient(160deg, #dcb873 0%, #c8984f 45%, #a8743a 100%);
  --up: #11a05a;
  --down: #e0443e;
  --ref: #c38d12;
  --ceil: #a24ad6;
  --floor: #1592c2;
  --accent: #b9853f;
  --flash: rgba(201, 154, 85, 0.22);
  --shadow: 0 10px 30px rgba(138, 90, 38, 0.12), 0 2px 6px rgba(138, 90, 38, 0.06);
  --glass-hi: rgba(255, 255, 255, 0.9);
  --radius: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15110c;
  --bg-2: #1d170f;
  --panel: rgba(40, 32, 22, 0.78);
  --panel-solid: #241c13;
  --panel-2: #2c2318;
  --line: #3e3222;
  --text: #f4e9d6;
  --head: #e9c98d;
  --muted: #b39d7e;
  --gold-grad: linear-gradient(160deg, #6b4c22 0%, #54391a 50%, #3d2913 100%);
  --up: #2bd07b;
  --down: #ff5d57;
  --ref: #f0c14b;
  --ceil: #c98cff;
  --floor: #45c4ef;
  --accent: #e0b56a;
  --flash: rgba(224, 181, 106, 0.18);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glass-hi: rgba(255, 255, 255, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); }
body {
  background: radial-gradient(1200px 600px at 85% -10%, var(--bg-2), transparent 60%), var(--bg);
  background-attachment: fixed;
  font: 14px/1.45 Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- khung ứng dụng ---------- */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--gold-grad); color: #fff;
  display: flex; flex-direction: column; padding: calc(14px + env(safe-area-inset-top)) 12px 12px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.25);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.25); margin-bottom: 8px; }
.brand strong { display: block; font-size: 15px; font-weight: 900; letter-spacing: 0.03em; white-space: nowrap; text-shadow: 0 1px 2px rgba(90, 50, 10, 0.3); }
.brand strong em { font-style: normal; color: #6b3f12; text-shadow: none; }
:root[data-theme="dark"] .brand strong em { color: #f3cf8a; }
.brand small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.22em; opacity: 0.9; }
.logo {
  width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: linear-gradient(150deg, #b98648, #7e4d1c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 14px rgba(80, 45, 10, 0.35);
}
.logo svg { width: 32px; height: 32px; fill: #f6dcaa; stroke: #fff2d6; }
.navsec { margin: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; opacity: 0.85; }
.tabs { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tabs button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: transparent; color: #fff; padding: 11px 14px; border-radius: 14px; cursor: pointer;
  font-size: 15px; font-weight: 500; text-shadow: 0 1px 1px rgba(90, 50, 10, 0.25);
}
.tabs button:hover { background: rgba(255, 255, 255, 0.14); }
.tabs button[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.92); color: var(--gold-4); text-shadow: none;
  box-shadow: 0 6px 16px rgba(90, 50, 10, 0.18), inset 0 1px 0 #fff;
}
:root[data-theme="dark"] .tabs button[aria-selected="true"] { background: rgba(255, 236, 200, 0.16); color: #ffe2a8; }
.pill { margin-left: auto; background: rgba(255, 255, 255, 0.28); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.tabs button[aria-selected="true"] .pill { background: var(--panel-2); }
.sidefoot { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 10px 8px 4px; border-top: 1px solid rgba(255, 255, 255, 0.25); opacity: 0.95; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #ddd; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); flex: none; }
.dot.ok { background: #36e08a; }
.dot.bad { background: #ff6b5f; }
.dot.wait { background: #ffd36a; }
.clock { font-variant-numeric: tabular-nums; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: calc(14px + env(safe-area-inset-top)) 28px 12px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.ttl { flex: 1; min-width: 180px; }
.ttl h1 { margin: 0; font-size: 28px; font-weight: 700; color: var(--head); letter-spacing: -0.01em; }
.ttl p { margin: 2px 0 0; font-size: 14px; }
.actions { display: flex; align-items: center; gap: 10px; }
.ibtn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer;
  background: var(--panel); display: grid; place-items: center; color: var(--head); box-shadow: var(--shadow);
}
.userchip {
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); font-weight: 700; color: var(--text);
}
.ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--gold-4); background: linear-gradient(150deg, #fbe9c6, #e9c88c); }
.logoutbtn {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 14px; text-decoration: none; font-weight: 700;
  color: var(--down); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.indexes { display: flex; gap: 10px; padding: 12px 28px 0; overflow-x: auto; scrollbar-width: none; }
.indexes::-webkit-scrollbar { display: none; }
.idx {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; white-space: nowrap;
  font-size: 13px; font-variant-numeric: tabular-nums; box-shadow: var(--shadow);
}
.idx b { font-weight: 700; margin-right: 8px; color: var(--head); }

.banner { margin: 12px 28px 0; padding: 10px 16px; border-radius: 14px; font-size: 13px; background: rgba(201, 154, 85, 0.16); border: 1px solid rgba(201, 154, 85, 0.4); color: var(--gold-4); }
:root[data-theme="dark"] .banner { color: #ffe2a8; }
.banner.err { background: rgba(224, 68, 62, 0.12); border-color: rgba(224, 68, 62, 0.35); color: var(--down); }
.greet {
  margin: 14px 28px 0; padding: 16px 22px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--panel), rgba(227, 194, 127, 0.12)); box-shadow: var(--shadow);
}
.greet h2 { margin: 0; font-size: 22px; color: var(--head); }
.greet h2 span { color: var(--gold-2); }
.greet p { margin: 4px 0 0; color: var(--muted); }

.panel { padding: 16px 28px; flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"], .toolbar select {
  padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
}
.toolbar input[type="search"] { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; max-width: 100%; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); white-space: nowrap; font-weight: 500; }
.seg button.on { background: var(--panel-solid); color: var(--gold-4); font-weight: 700; box-shadow: 0 2px 8px rgba(138, 90, 38, 0.15); }
:root[data-theme="dark"] .seg button.on { color: #ffe2a8; }

/* ---------- bảng giá ---------- */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 250px); background: var(--panel); box-shadow: var(--shadow); }
table.board { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.board th, .board td { padding: 6px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board th { position: sticky; top: 0; background: var(--panel-2); color: var(--head); font-weight: 700; z-index: 1; text-align: center; font-size: 12px; }
.board thead tr:nth-child(2) th { top: 29px; }
.board td.num, .board th.num { text-align: right; }
.board tbody tr { cursor: pointer; }
.board tbody tr:hover td { background: rgba(201, 154, 85, 0.1); }
.board td.sym { font-weight: 700; }
.board td.star, .board th.star { width: 28px; text-align: center; color: var(--muted); }
.board td.star.on { color: var(--gold-2); }
.board td.mid { background: rgba(201, 154, 85, 0.07); font-weight: 600; }
.flash { animation: flash 0.8s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: transparent; } }
.c-up { color: var(--up); }
.c-down { color: var(--down); }
.c-ref { color: var(--ref); }
.c-ceil { color: var(--ceil); }
.c-floor { color: var(--floor); }
.hint { color: var(--muted); font-size: 12.5px; margin: 12px 2px; }
.empty { color: var(--muted); padding: 28px 4px; }

/* ---------- thẻ tín hiệu ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--gold-grad); }
.card.s-MUA::before { background: linear-gradient(90deg, #1fbf74, #8be3b5); }
.card.s-BAN::before { background: linear-gradient(90deg, #e0443e, #f6a19c); }
.card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(138, 90, 38, 0.18); }
.card .row1 { display: flex; align-items: center; gap: 8px; }
.card .sym { font-size: 19px; font-weight: 900; color: var(--text); }
.card .ex { color: var(--muted); font-size: 12px; font-weight: 500; }
.card .score { margin-left: auto; font-weight: 900; font-size: 22px; color: var(--head); font-variant-numeric: tabular-nums; }
.card .price { margin: 6px 0 8px; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; }
.card .price .muted { font-weight: 400; font-size: 13px; }
.card dl { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 12px; margin: 10px 0 8px; font-size: 13px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.card ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.b-MUA { background: rgba(17, 160, 90, 0.14); color: var(--up); }
.b-BAN { background: rgba(224, 68, 62, 0.14); color: var(--down); }
.b-QS { background: rgba(195, 141, 18, 0.16); color: var(--ref); }
.prob { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); }
.prob b { font-variant-numeric: tabular-nums; }
.g-vh { background: color-mix(in srgb, var(--up) 22%, transparent); }
.g-h { background: color-mix(in srgb, var(--up) 12%, transparent); }
.g-vh.k-BAN { background: color-mix(in srgb, var(--down) 22%, transparent); }
.g-h.k-BAN { background: color-mix(in srgb, var(--down) 12%, transparent); }
.probline { margin: 4px 0 2px; }
.probbox { margin: 0 0 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; font-size: 13px; box-shadow: var(--shadow); }
.probbox summary { cursor: pointer; font-weight: 700; color: var(--head); }
.probbox table { border-collapse: collapse; margin: 8px 0; font-variant-numeric: tabular-nums; }
.probbox th, .probbox td { padding: 4px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.probbox th:first-child, .probbox td:first-child { text-align: left; }
.alert-sec h3 { margin: 18px 0 10px; font-size: 15px; color: var(--head); }

.disclaimer {
  position: sticky; bottom: 0; z-index: 5; padding: 10px 28px calc(10px + env(safe-area-inset-bottom)); font-size: 12.5px; color: var(--muted);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.disclaimer b { color: var(--head); }

/* ---------- chi tiết một mã ---------- */
dialog#detail {
  width: min(1440px, calc(100vw - 32px)); height: calc(100dvh - 32px); max-width: none; max-height: none; padding: 0;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 30px 80px rgba(60, 35, 10, 0.35);
  overflow: hidden;
}
dialog#detail[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(50, 32, 12, 0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dhead {
  display: flex; align-items: center; gap: 18px; padding: 16px 22px; flex: none;
  background: linear-gradient(120deg, var(--panel), rgba(227, 194, 127, 0.16)); border-bottom: 1px solid var(--line);
}
.dtitle { flex: 1; min-width: 0; }
.drow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dhead h2 { margin: 0; font-size: 28px; font-weight: 900; color: var(--head); }
.exb { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 8px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.dname { margin: 2px 0 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dprice { text-align: right; font-variant-numeric: tabular-nums; }
.dprice .p { font-size: 28px; font-weight: 900; line-height: 1.1; }
.dprice .chg { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--panel-2); }
.dprice .chg.c-up { background: rgba(17, 160, 90, 0.13); }
.dprice .chg.c-down { background: rgba(224, 68, 62, 0.13); }
.dprice .vol { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.close { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; width: 44px; height: 44px; cursor: pointer; font-size: 16px; flex: none; box-shadow: var(--shadow); }
.dgrid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 0; overflow: hidden; }
.dchart { min-width: 0; display: flex; flex-direction: column; padding: 12px 8px 12px 18px; overflow-y: auto; }
.chartwrap { position: relative; flex: 1; min-height: 340px; }
.chart { position: absolute; inset: 0; }
.subchart { height: 110px; flex: none; margin-top: 4px; border-top: 1px dashed var(--line); }
.dside { overflow-y: auto; padding: 14px 18px 24px; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.indbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.indbar button {
  --c: var(--accent); font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  background: var(--panel); color: var(--muted); font-weight: 500;
}
.indbar button.on { color: var(--text); border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, var(--panel)); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend .lg::before { content: ""; display: inline-block; width: 12px; height: 4px; border-radius: 2px; background: var(--c); margin-right: 6px; vertical-align: middle; }

/* nhãn giá dạng giọt nước (glass) trên biểu đồ */
.plabels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.plab {
  --c: #b9853f;
  position: absolute; right: var(--axis, 70px); transform: translateY(-50%); display: flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--text);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), color-mix(in srgb, var(--c) 22%, rgba(255, 255, 255, 0.86)));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.95), inset 0 -2px 6px color-mix(in srgb, var(--c) 25%, transparent), 0 4px 14px color-mix(in srgb, var(--c) 35%, transparent);
  backdrop-filter: blur(8px) saturate(1.4); -webkit-backdrop-filter: blur(8px) saturate(1.4);
  font-variant-numeric: tabular-nums;
}
.plab i { width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, var(--c) 60%); box-shadow: 0 0 6px var(--c); }
.plab span { color: var(--muted); font-weight: 500; }
:root[data-theme="dark"] .plab {
  background: linear-gradient(135deg, rgba(60, 46, 30, 0.9), color-mix(in srgb, var(--c) 35%, rgba(30, 22, 14, 0.88)));
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.4);
}
.plab.now { --c: #3d7bff; font-size: 12.5px; }
.plab.vol { right: auto; left: 4px; }

/* bảng bên phải */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.box h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--head); display: flex; align-items: center; gap: 6px; }
.hero { display: grid; grid-template-columns: auto 1fr; gap: 14px 18px; align-items: center; }
.hero .rings { display: flex; gap: 14px; padding-bottom: 16px; }
.hero .pr { position: relative; }
.hero .pr .info { position: absolute; top: -2px; right: -6px; }
.ring { position: relative; width: 84px; height: 84px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 900; color: var(--head); }
.ring small { position: absolute; left: 0; right: 0; bottom: -16px; text-align: center; font-size: 11px; color: var(--muted); }
.act { font-size: 16px; font-weight: 700; line-height: 1.3; }
.act small { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: 3px; }
.ladder { position: relative; height: 54px; margin: 8px 6px 4px; }
.ladder .track { position: absolute; left: 0; right: 0; top: 24px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgba(224, 68, 62, 0.35), rgba(201, 154, 85, 0.3), rgba(17, 160, 90, 0.35)); }
.ladder .zone { position: absolute; top: 20px; height: 14px; border-radius: 7px; background: rgba(61, 123, 255, 0.25); border: 1px solid rgba(61, 123, 255, 0.5); }
.ladder .mk { position: absolute; top: 0; transform: translateX(-50%); text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.ladder .mk::after { content: ""; display: block; width: 12px; height: 12px; margin: 3px auto 0; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, var(--c) 65%); box-shadow: 0 0 0 2px var(--panel-solid), 0 2px 6px var(--c); }
.ladder .mk.low { top: 21px; }
.ladder .mk.low::after { margin: 0 auto 3px; }
.ladder .mk.low { display: flex; flex-direction: column-reverse; }
table.lv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13.5px; }
table.lv td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
table.lv tr:last-child td { border-bottom: 0; }
table.lv td:nth-child(2) { text-align: right; font-weight: 700; }
table.lv td:nth-child(3) { text-align: right; font-size: 12px; color: var(--muted); width: 70px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: radial-gradient(circle at 30% 30%, #fff, var(--c) 65%); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--panel-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.kpi span { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.kpi b { display: block; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crit { display: grid; grid-template-columns: 96px 1fr 44px; gap: 8px 10px; align-items: center; font-size: 13px; }
.crit .bar { height: 10px; border-radius: 5px; background: var(--panel-2); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06); }
.crit .bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--gold-1), var(--gold-3)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6); transition: width 0.4s ease; }
.crit .bar i.hi { background: linear-gradient(90deg, #7fdcae, #13a35d); }
.crit .bar i.lo { background: linear-gradient(90deg, #f6b0ac, #e0443e); }
.crit em { font-style: normal; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 5px 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); line-height: 1.35; }
.chip.good { background: rgba(17, 160, 90, 0.1); border-color: rgba(17, 160, 90, 0.25); }
.chip.bad { background: rgba(224, 68, 62, 0.08); border-color: rgba(224, 68, 62, 0.22); }
.plan { font-size: 13px; line-height: 1.5; }
.links { margin: 6px 0 0; }
.links a { color: var(--accent); font-weight: 700; text-decoration: none; }

/* nút chú thích ⓘ và bong bóng chú thích */
.info {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-solid); color: var(--gold-3);
  font: 700 11px/16px Georgia, serif; font-style: italic; cursor: pointer; padding: 0; flex: none; vertical-align: middle;
}
.info:hover, .info.on { background: var(--gold-2); color: #fff; border-color: var(--gold-2); }
.tip {
  position: fixed; z-index: 1000; max-width: min(320px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 14px; font-size: 12.5px; line-height: 1.5;
  color: var(--text); background: color-mix(in srgb, var(--panel-solid) 92%, transparent); border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(60, 35, 10, 0.25); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

/* ---------- thiết lập ---------- */
dialog#settings { width: min(780px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); padding: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--bg); color: var(--text); }
dialog#settings .dhead h2 { font-size: 22px; }
dialog#settings .dhead { display: flex; justify-content: space-between; align-items: center; }
.setbody { padding: 0 22px 20px; }
.setsec { border-top: 1px solid var(--line); padding: 14px 0; }
.setsec:first-of-type { border-top: 0; }
.setsec h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--head); }
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.setgrid label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; }
.setgrid input, .setgrid select { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-solid); }
.setgrid small { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.setactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.setactions button, .setactions .btn { padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-solid); cursor: pointer; text-decoration: none; color: var(--text); font-size: 13px; font-weight: 500; }
.setactions .primary, .btn-gold { background: linear-gradient(180deg, #d8b26c, #b07d3c); border-color: #b07d3c; color: #fff; font-weight: 700; box-shadow: 0 6px 16px rgba(176, 125, 60, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45); text-shadow: 0 1px 1px rgba(90, 50, 10, 0.3); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.userlist { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.userlist li { display: flex; justify-content: space-between; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.userlist button { border: 0; background: transparent; color: var(--down); cursor: pointer; }

/* ---------- đăng nhập ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.lcard { width: min(1180px, 100%); display: grid; grid-template-columns: 1fr 1fr; border-radius: 28px; overflow: hidden; background: var(--panel-solid); box-shadow: 0 30px 70px rgba(138, 90, 38, 0.2); border: 1px solid var(--line); }
.lleft { position: relative; background: var(--gold-grad); color: #fff; padding: 40px 44px 48px; }
.lleft .brand { border: 0; padding: 40px 0 28px; margin: 0; }
.lleft .logo { width: 72px; height: 72px; border-radius: 18px; }
.lleft .logo svg { width: 48px; height: 48px; }
.lleft .brand strong { font-size: 30px; }
.lleft .brand small { font-size: 13px; margin-top: 4px; }
.lleft h1 { font-size: 34px; line-height: 1.2; margin: 24px 0 12px; text-shadow: 0 2px 4px rgba(90, 50, 10, 0.25); }
.lleft p { font-size: 17px; opacity: 0.92; margin: 0 0 24px; }
.lleft ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; font-size: 16px; }
.lleft li::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 12px; vertical-align: -1px; background: radial-gradient(circle at 30% 30%, #fff, #f1d9a8 70%); box-shadow: 0 0 6px rgba(255, 255, 255, 0.6); }
.ltoggle { position: absolute; top: 26px; right: 28px; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.25); border: 1px solid rgba(255, 255, 255, 0.5); }
.ltoggle button { width: 40px; height: 32px; border-radius: 999px; border: 0; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.ltoggle button.on { background: rgba(255, 255, 255, 0.92); color: var(--gold-4); box-shadow: 0 2px 6px rgba(90, 50, 10, 0.2); }
.lright { padding: 56px 56px 40px; display: flex; flex-direction: column; gap: 14px; background: var(--panel-solid); }
.lright h2 { margin: 0; font-size: 34px; color: var(--head); }
.lright label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; color: var(--head); text-transform: uppercase; }
.lright input[type="text"], .lright input[type="password"] { width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-solid); font-size: 16px; letter-spacing: normal; text-transform: none; font-weight: 400; color: var(--text); }
.lright input:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 4px rgba(201, 154, 85, 0.18); }
.pwbox { position: relative; }
.pwbox button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--head); cursor: pointer; padding: 6px; }
.lright .check { font-weight: 400; letter-spacing: normal; text-transform: none; color: var(--text); font-size: 15px; display: flex; }
.lright .btn-gold { padding: 16px; border-radius: 16px; font-size: 18px; cursor: pointer; border: 0; width: 100%; }
.lright .note { text-align: center; color: var(--muted); font-size: 14px; margin: 0; }
.lright .disc { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.lright .disc b { color: var(--head); }
.err { color: var(--down); margin: 0; font-size: 14px; }

/* ---------- màn hình vừa (iPad Pro dọc, laptop nhỏ): thanh menu thu gọn thành biểu tượng ---------- */
@media (max-width: 1180px) {
  .dgrid { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1100px) {
  .d3, .hide-l { display: none; }
  body.app { grid-template-columns: 84px minmax(0, 1fr); }
  .side { padding-left: 8px; padding-right: 8px; }
  .side .brand { justify-content: center; padding: 4px 0 12px; }
  .side .brand > div, .navsec, .tabs button span:not(.pill), .sidefoot #phase, .sidefoot .clock { display: none; }
  .tabs button { flex-direction: column; justify-content: center; gap: 2px; padding: 12px 4px; position: relative; }
  .tabs .pill { position: absolute; top: 4px; right: 6px; margin: 0; font-size: 10px; padding: 0 5px; }
  .sidefoot { justify-content: center; }
  .top, .panel { padding-left: 20px; padding-right: 20px; }
  .indexes, .greet, .banner { margin-left: 20px; margin-right: 20px; }
  .indexes { padding-left: 0; padding-right: 0; }
  .disclaimer { padding-left: 20px; padding-right: 20px; }
  /* chi tiết: biểu đồ trên, thông tin dưới */
  .dgrid { grid-template-columns: 1fr; overflow-y: auto; display: block; }
  .dchart { overflow: visible; padding: 12px 16px 0; }
  .chartwrap { flex: none; height: min(56vh, 520px); }
  .dside { border-left: 0; overflow: visible; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; align-items: start; padding: 14px 16px 24px; }
  .dside > .wide { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .d2, .hide-m { display: none; }
  .dside { grid-template-columns: 1fr; }
  .lcard { grid-template-columns: 1fr; }
  .lleft { padding: 28px 24px 28px; }
  .lleft .brand { padding: 8px 0 4px; }
  .lleft .logo { width: 52px; height: 52px; border-radius: 14px; }
  .lleft .logo svg { width: 34px; height: 34px; }
  .lleft .brand strong { font-size: 22px; }
  .lleft .brand small { font-size: 11px; }
  .ltoggle { top: 18px; right: 18px; }
  .lleft { padding-top: 64px; }
  .lleft h1 { font-size: 26px; margin-top: 12px; }
  .lleft p { font-size: 15px; }
  .lleft ul { font-size: 14px; }
  .lright { padding: 28px 24px; }
}
/* ---------- điện thoại: thanh menu chuyển xuống dưới ---------- */
@media (max-width: 760px) {
  body.app { display: block; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .side {
    position: fixed; z-index: 20; inset: auto 0 0 0; height: auto; overflow: visible; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; box-shadow: 0 -6px 20px rgba(90, 50, 10, 0.2);
  }
  .side .brand, .sidefoot, .navsec { display: none; }
  .tabs { flex-direction: row; justify-content: space-around; gap: 2px; }
  .tabs button { flex: 1; padding: 6px 2px; border-radius: 12px; font-size: 10.5px; gap: 2px; }
  .tabs button span:not(.pill) { display: block; font-size: 10.5px; white-space: nowrap; }
  .top { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 10px; }
  .ttl h1 { font-size: 22px; }
  .ttl p { display: none; }
  .userchip span:not(.ava), .logoutbtn span { display: none; }
  .logoutbtn { padding: 10px 12px; }
  .ibtn { width: 40px; height: 40px; }
  .panel { padding: 12px 14px; }
  .indexes, .greet, .banner { margin-left: 14px; margin-right: 14px; }
  .greet h2 { font-size: 18px; }
  .d1, .depth, .hide-s { display: none; }
  .cards { grid-template-columns: 1fr; }
  .card dl { grid-template-columns: auto 1fr; }
  .disclaimer { display: none; }
  dialog#detail { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .dhead { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 10px; flex-wrap: wrap; }
  .dhead h2 { font-size: 22px; }
  .dtitle { flex: 1 1 60%; }
  .dprice { order: 3; flex: 1 1 100%; display: flex; align-items: baseline; gap: 10px; text-align: left; }
  .dprice .p { font-size: 24px; }
  .close { order: 2; width: 40px; height: 40px; }
  .chartwrap { height: 46vh; min-height: 260px; }
  .dchart { padding: 8px 10px 0; }
  .subchart { height: 80px; }
  .dside { padding: 12px 10px 24px; }
  .plab { font-size: 10.5px; padding: 2px 8px 2px 6px; }
  .hero { grid-template-columns: 1fr; }
  .hero .rings { justify-content: center; gap: 28px; }
  dialog#settings { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
}
