/* Design system: calm fintech. Brand blue + navy ink, flat white surfaces, 1px lines.
   Green / red are reserved for price up / down. Font self-hosted (Plus Jakarta Sans, OFL).
   Charts read: --surface --text-2 --grid --border --up --down --up-soft --down-soft --accent */
@font-face {
  font-family: "Jakarta";
  src: url("/static/vendor/fonts/jakarta-latin-wght-normal.woff2") format("woff2-variations"),
       url("/static/vendor/fonts/jakarta-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --raised: #ffffff;
  --border: #e9ecf2;
  --border-strong: #d9dde6;
  --grid: #f0f2f6;
  --navy: #0f1f4b;
  --text: #1b2232;
  --text-2: #44475b;
  --muted: #6e7180;          /* #7c7e8c nudged darker for AA on white */
  --accent: #2155e6;
  --accent-hover: #1a47c8;
  --accent-deep: #1a47c8;
  --accent-soft: #eaf0ff;
  --accent-ink: #2155e6;
  --cta: #2155e6;
  --cta-hover: #1a47c8;
  --cta-ink: #ffffff;
  --amber: #c98a12; --amber-soft: #fff5e0; --amber-ink: #8a5a00;
  --up: #00825a;  --up-soft: rgba(0, 168, 107, .24);  --up-bg: #e6f7f0;   /* #00a86b family, darkened to pass AA as text */
  --down: #c9401f; --down-soft: rgba(235, 91, 60, .24); --down-bg: #fdeeea; /* #eb5b3c family, darkened to pass AA */
  --warn-bg: #fff5e0; --warn: #8a5a00;
  --bad-bg: #fdeeea;
  --tint: 27 34 50;
  --shadow: none;
  --shadow-lg: 0 12px 32px -14px rgb(var(--tint) / .18);
  --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 14px;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --topbar-h: 60px;
  --tabbar-h: 0px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #16181d;
  --surface-2: #1d2026;
  --raised: #1d2026;
  --border: #2a2e36;
  --border-strong: #363b45;
  --grid: #20232a;
  --navy: #eceef2;
  --text: #eceef2;
  --text-2: #c3c6cf;
  --muted: #8b8f9a;
  --accent: #4d7cff;
  --accent-hover: #6a91ff;
  --accent-deep: #3a6af0;
  --accent-soft: #1b2440;
  --accent-ink: #7f9fff;
  --cta: #3a6af0;
  --cta-hover: #4d7cff;
  --cta-ink: #ffffff;
  --amber: #f0b44c; --amber-soft: #2a2312; --amber-ink: #f5c86a;
  --up: #1ec48a; --up-soft: rgba(30, 196, 138, .24); --up-bg: #12291f;
  --down: #ff6b57; --down-soft: rgba(255, 107, 87, .24); --down-bg: #33191a;
  --warn-bg: #2a2312; --warn: #f5c86a;
  --bad-bg: #33191a;
  --tint: 0 0 0;
  --shadow: none;
  --shadow-lg: 0 18px 40px -20px rgb(0 0 0 / .7);
}

* { box-sizing: border-box; border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 15px/1.55 "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  min-width: 0;
}
/* last-resort safety net only; layouts are built to fit */
html, body { overflow-x: clip; }
img, svg, video, canvas { max-width: 100%; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
a { color: var(--accent-ink); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.015em; font-weight: 600; color: var(--text); }
h1 { color: var(--navy); font-weight: 700; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
code { overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .05em .4em; font-size: .88em; }
a, button, input, label, select, summary, textarea { touch-action: manipulation; }
button:not(:disabled), summary, select, label:has(input[type="radio"]), label:has(input[type="checkbox"]) { cursor: pointer; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
strong { font-weight: 700; }

.wrap { max-width: 80rem; margin: 0 auto; padding: 0 24px; }
.main { padding-top: 24px; padding-bottom: 56px; min-height: 70vh; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .mt { margin-top: 1.4em; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand:hover { text-decoration: none; }
.menu { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.nav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; min-width: 0; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); padding: 7px 10px; border-radius: 8px; font-size: .9rem; font-weight: 600;
  white-space: nowrap; line-height: 1.3; transition: color .15s, background-color .15s;
}
.nav a .ico { display: none; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.on { color: var(--accent-ink); background: var(--accent-soft); }
.search { margin-left: auto; flex-shrink: 1; min-width: 0; position: relative; }
.search input { width: 150px; height: 36px; border-radius: 8px; padding: 6px 12px; font-size: .88rem; background: var(--surface-2); border-color: var(--border); }
.search input:focus { background: var(--surface); }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.menu > .topbar-actions:first-child { margin-left: auto; }
.nav + .topbar-actions { margin-left: auto; }
.topbar-actions form { margin: 0; }
.menu-label { display: none; }
.icon-btn, .nav-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); border-radius: 8px; height: 36px; min-width: 36px; padding: 0 8px; font: inherit; font-size: .9rem; font-weight: 600; flex-shrink: 0;
}
.nav-toggle { display: none; }
.icon-btn:hover, .nav-toggle:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--accent-ink); font: inherit; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.link-btn:hover { background: var(--surface-2); }
.link-btn.down { color: var(--down); }
.topbar-actions .link-btn { color: var(--text-2); height: 36px; }
.topbar-actions .hide-sm { display: none; }
.user-chip { white-space: nowrap; }

/* market status pill */
.mkt-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap;
  font-size: .76rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.mkt-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.mkt-open .mkt-dot { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 22%, transparent); }
.mkt-pre_open .mkt-dot { background: var(--amber); }
.mkt-open.mkt-pill { color: var(--up); background: var(--up-bg); border-color: transparent; }
.mkt-pre_open.mkt-pill { color: var(--amber-ink); background: var(--amber-soft); border-color: transparent; }
.mkt-card { display: grid; gap: 4px; align-content: start; }
.mkt-card-label { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; margin: 0; }
.mkt-card-label .mkt-dot { width: 9px; height: 9px; }
.mkt-card p { margin: 0; }
.mkt-hours { padding-top: 8px; margin-top: 6px !important; border-top: 1px solid var(--border); }

/* tab bar (phones only) */
.tabbar { display: none; }

/* ---------- layout ---------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h1 > .ico { width: 22px; height: 22px; color: var(--accent); }
.page-head h1 .ico-badge { display: none; }
.crumbs { margin: 0 0 6px; font-size: .86rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .88rem; white-space: nowrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0;
}
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 > .ico, .card h2 > .ico { color: var(--accent); width: 18px; height: 18px; }
.grid > .card { margin-bottom: 0; }
.card-link { display: block; color: var(--text); font-weight: 500; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.bearish { border-left: 3px solid var(--down); }
.empty { text-align: center; padding: 40px 20px; }
.stack { display: grid; gap: 14px; }

/* ---------- forms ---------- */
label { display: grid; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text-2); }
input, select, textarea {
  font: inherit; font-weight: 500; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 9px 12px; min-height: 42px;
  transition: border-color .15s, box-shadow .15s; max-width: 100%; min-width: 0;
}
textarea { min-height: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: .92rem; font-weight: 700; white-space: nowrap; border-radius: var(--r-md);
  min-height: 42px; padding: 8px 18px; line-height: 1.2;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink) !important; }
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-ghost { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent) 12%); border-color: transparent; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .ico { width: 17px; height: 17px; vertical-align: middle; }
.filters, .goal-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.goal-form input { width: 130px; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- alerts, pills, badges ---------- */
.alert { display: block; border-radius: var(--r-md); padding: 11px 14px; margin: 12px 0; font-size: .9rem; font-weight: 500; border: 1px solid transparent; }
.alert > .ico { margin-right: 4px; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.alert-bad { background: var(--bad-bg); color: var(--down); border-color: color-mix(in srgb, var(--down) 18%, transparent); }
.alert-ok { background: var(--up-bg); color: var(--up); border-color: color-mix(in srgb, var(--up) 18%, transparent); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 1px solid var(--border); line-height: 1.5;
}
.pill .ico { width: 12px; height: 12px; }
.pill-uptrend { background: var(--up-bg); color: var(--up); border-color: transparent; }
.pill-downtrend { background: var(--down-bg); color: var(--down); border-color: transparent; }
.pill-sideways { background: var(--amber-soft); color: var(--amber-ink); border-color: transparent; }
.count { font-weight: 700; font-size: .82rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.rs { font-weight: 700; } .rs-hi { color: var(--accent-ink); } .rs-lo { color: var(--muted); }
.chg { white-space: nowrap; font-weight: 700; }
.chg-pill { display: inline-flex; align-items: center; font-weight: 700; font-size: .92rem; padding: 3px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chg-pill.up { background: var(--up-bg); color: var(--up); }
.chg-pill.down { background: var(--down-bg); color: var(--down); }

/* ---------- index + breadth ---------- */
.index-head, .preview-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.preview-head h3 { margin: 0; }
.index-price { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 10px; }
.index-price .chg { font-size: .9rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px 14px; margin: 12px 0 0; }
.kv-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.kv div { display: flex; flex-direction: column; min-width: 0; }
.kv-2 div { flex-direction: row; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding: 9px 0; }
.kv dt { font-size: .76rem; font-weight: 600; color: var(--muted); }
.kv-2 dt { font-size: .86rem; font-weight: 500; }
.kv dd { margin: 0; font-weight: 700; }
.breadth-row { display: flex; justify-content: space-between; margin-top: 10px; font-weight: 600; font-size: .9rem; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0; min-width: 60px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.cell-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cell-bar .bar { width: 64px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
.data th, .data td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.data th { font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface); position: sticky; top: 0; }
.data th a { color: inherit; font-weight: 600; }
.data th.sorted a { color: var(--accent-ink); }
.data th.sorted.desc a::after { content: " ↓"; } .data th.sorted.asc a::after { content: " ↑"; }
.data tbody tr:hover { background: var(--surface-2); }
.data tbody tr:last-child td { border-bottom: 0; }
.data td.name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.num { text-align: right !important; }
.mini td { padding: 9px 4px; border-bottom: 1px solid var(--border); }
.mini tr:last-child td { border-bottom: 0; }
.sym { font-weight: 700; letter-spacing: .01em; color: var(--text); }
a.sym:hover { color: var(--accent-ink); }

/* list rows (Groww-style): name left, price + change right */
.qlist { list-style: none; margin: 0; padding: 0; }
.qrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 500; min-width: 0; }
.qlist > :last-child .qrow, .qlist > .qrow:last-child { border-bottom: 0; }
a.qrow:hover { text-decoration: none; }
a.qrow:hover .sym { color: var(--accent-ink); }
.qrow-main { display: grid; min-width: 0; }
.qrow-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow-end { display: grid; justify-items: end; text-align: right; flex: none; }
.qrow-price { font-weight: 700; }
.qrow-end .chg { font-size: .82rem; }

/* ---------- stock page ---------- */
.stock-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.name-sub { font-size: 1rem; font-weight: 500; }
.stock-price { text-align: right; display: grid; gap: 6px; justify-items: end; }
.stock-price .big { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.chart-card { padding: 16px; }
.chart-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.toggle { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: 8px; color: var(--text-2); }
.toggle input { width: 15px; height: 15px; }
.chart { height: 500px; width: 100%; }
.chart-note { margin: 8px 0 0; }
.match-list { list-style: none; padding: 0; margin: 0; display: grid; }
.match-list li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--border); }
.match-list li:last-child { border-bottom: 0; }
.match-list li.bearish { border-left: 0; }
.match-list li.bearish a { color: var(--down); }
.news ul { padding-left: 18px; margin: 6px 0; } .news li { margin-bottom: 9px; }

/* ---------- goal result ---------- */
.verdict h2 { font-size: 1.4rem; }
.verdict-realistic { border-left: 4px solid var(--up); }
.verdict-stretch { border-left: 4px solid var(--amber); }
.verdict-high-risk { border-left: 4px solid #e8742a; }
.verdict-unrealistic, .verdict-no-matching-stocks { border-left: 4px solid var(--down); }
.realistic { font-size: 1.05rem; }

/* ---------- rules + prose ---------- */
.rules summary { font-weight: 700; }
.rules ol, .prose ol, .prose ul { padding-left: 22px; } .rules li, .prose li { margin-bottom: 5px; }
.prose { max-width: 860px; } .prose h2 { margin-top: .6em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prose p, .prose li { color: var(--text-2); }

/* ---------- chat ---------- */
.chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.chat-card { padding: 0; overflow: hidden; }
.chat-log { height: 60vh; min-height: 320px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: min(78%, 640px); padding: 10px 14px; border-radius: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.bot .bubble { background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.msg.me .bubble { background: var(--cta); color: #fff; border-bottom-right-radius: 4px; }
.msg.me .bubble a { color: #fff; text-decoration: underline; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; border-radius: 12px; }
#chat-typing { padding: 0 16px 10px; margin: 0; background: var(--surface); }

/* ---------- admin ---------- */
.new-code { border-left: 3px solid var(--accent); background: var(--surface-2); box-shadow: none; }
.code-big { font: 800 1.8rem/1.2 "Jakarta", system-ui, sans-serif; letter-spacing: .08em; color: var(--accent-ink); margin: 6px 0 10px; user-select: all; }
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.admin-tabs a { padding: 8px 12px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .9rem; }
.admin-tabs a:hover { text-decoration: none; color: var(--text); }
.admin-tabs a.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input { padding: 6px 10px; width: 170px; min-height: 36px; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 74vh; }
.login-card { width: 100%; max-width: 400px; padding: 28px; border-radius: 16px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand img { border-radius: 10px; }
.login-brand h1 { margin: 0; font-size: 1.35rem; }
.login-card .btn { width: 100%; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); font-size: .8rem; color: var(--muted); }
.footer-inner { padding: 18px 24px; } .footer p { margin: 4px 0; }
.footer strong { color: var(--text-2); }
.footer a { font-weight: 600; color: var(--text-2); }

/* ---------- business panel ---------- */
.brand-tag { font-style: normal; font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-left: 8px; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: middle; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: .85rem; border-radius: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-grid .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.stat-value small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.stat-value.warn { color: var(--amber-ink); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-items: end; }
.form-actions { display: flex; align-items: end; }
.form-actions .btn { width: 100%; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.toggle.check { background: none; border: 0; padding: 0 0 10px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.plan-grid .card { margin-bottom: 0; }
.plan-price { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 6px 0; }
.plan-price small { font-size: .85rem; color: var(--muted); font-weight: 600; }
.plan-off { opacity: .55; }
.membership { display: grid; gap: 6px; justify-items: start; }
.membership > * { margin: 0; }
.membership-ok { border-left: 3px solid var(--accent); }
.membership-off { border-left: 3px solid var(--down); }
.pay-note { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--r-md); padding: 12px 14px; margin-top: 8px; white-space: pre-line; }

/* ---------- chat v2 (messenger) ---------- */
.chat-shell { max-width: 820px; margin: 0 auto; }
.chat-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.chat-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-title img { border-radius: 10px; flex: none; }
.chat-title h1 { margin: 0; font-size: 1.25rem; }
.chat-title p { margin: 0; }
.chat-shell .chat-log { height: calc(100vh - 330px); min-height: 340px; border: 1px solid var(--border); border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface); padding: 18px 16px; gap: 14px; }
.chat-shell .msg { align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.chat-shell .msg.bot { flex-wrap: nowrap; }
.avatar { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; background: var(--accent-deep); }
.chat-shell .bubble { font-size: .95rem; animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; vertical-align: middle; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cursor { display: inline-block; margin-left: 1px; color: var(--accent); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.copy-btn { margin-left: 36px; margin-top: -6px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .76rem; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.copy-btn:hover { color: var(--accent-ink); background: var(--surface-2); }
.chat-suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--surface); }
.chat-suggest[hidden] { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: .86rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; min-height: 36px; white-space: nowrap; }
.chip .ico { width: 15px; height: 15px; color: var(--accent); }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.chat-shell .chat-form { border: 1px solid var(--border); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-xl) var(--r-xl); padding: 10px; gap: 8px; align-items: flex-end; }
.chat-shell .chat-form textarea { min-height: 44px; max-height: 160px; padding: 11px 14px; border-radius: 12px; line-height: 1.4; background: var(--surface-2); border-color: var(--border); }
.chat-shell .chat-form textarea:focus { background: var(--surface); border-color: var(--accent); }
.send-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; margin: 0; flex: none; }
.chat-form.is-busy .send-btn { opacity: .5; }
#chat-stop { height: 44px; margin: 0; flex: none; }
.chat-foot { text-align: center; margin-top: 8px; }

/* ---------- icons (Lucide sprite: {{ icon('name') }}) ---------- */
.ico { width: 1.1em; height: 1.1em; flex: none; display: inline-block; vertical-align: -0.18em;
       fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 1.3em; height: 1.3em; }
.ico-xl { width: 1.8em; height: 1.8em; stroke-width: 1.75; }
/* small, quiet icon tile (not a blob) */
.ico-badge { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px;
             background: var(--accent-soft); color: var(--accent-ink); }
.ico-badge .ico, .ico-badge .ico-lg { width: 18px; height: 18px; }
.ico-badge.amber { background: var(--amber-soft); color: var(--amber-ink); }
.ico-badge.red { background: var(--down-bg); color: var(--down); }
.ico-badge.green { background: var(--up-bg); color: var(--up); }
.btn .ico, .nav a .ico, .tabbar .ico { vertical-align: -0.2em; }
.tabbar a .tab-ico { width: 22px; height: 22px; stroke-width: 1.8; }
.icon-btn .ico, .nav-toggle .ico { width: 18px; height: 18px; vertical-align: middle; }
.link-btn .ico { width: 17px; height: 17px; }
.ico-filled { fill: currentColor; }

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .topbar-inner { gap: 10px; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .menu {
    display: none; position: absolute; top: calc(var(--topbar-h) - 1px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 12px;
    background: var(--surface); padding: 14px 16px 18px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  }
  .menu.open { display: flex; }
  .nav { flex-direction: column; align-items: stretch; gap: 2px; order: 2; }
  .nav a { padding: 11px 12px; font-size: .96rem; gap: 12px; }
  .nav a .ico { display: inline-block; width: 18px; height: 18px; color: var(--muted); }
  .nav a.on .ico { color: var(--accent-ink); }
  .search { order: 1; margin: 0; }
  .search input { width: 100%; height: 44px; font-size: 16px; }
  .topbar-actions { order: 3; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); margin: 0 !important; }
  .topbar-actions > * { flex: 1 1 calc(50% - 4px); }
  .topbar-actions form { display: flex; }
  .topbar-actions .icon-btn, .topbar-actions .btn, .topbar-actions .link-btn { width: 100%; height: 44px; min-height: 44px; justify-content: center; border: 1px solid var(--border); border-radius: 10px; color: var(--text-2); background: var(--surface); }
  .menu-label { display: inline; }
  .topbar-actions .hide-sm { display: inline !important; }
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  :root { --tabbar-h: calc(60px + env(safe-area-inset-bottom)); --topbar-h: 56px; }
  .wrap { padding: 0 16px; }
  .main { padding-top: 16px; padding-bottom: calc(var(--tabbar-h) + 24px); }
  .footer { padding-bottom: var(--tabbar-h); }
  .footer-inner { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .brand { font-size: 1rem; gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; border-radius: var(--r-lg); }
  .chart { height: 360px; }
  .bubble { max-width: 86%; }
  .goal-form input { width: 100%; }
  .goal-form label, .filters label { flex: 1 1 140px; }
  .goal-form .btn, .filters .btn { width: 100%; }
  .stock-price { text-align: left; justify-items: start; }
  .data th, .data td { padding: 10px 10px; }
  .data th:first-child, .data td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .data th:first-child { z-index: 2; }
  input, select, textarea { font-size: max(16px, 1em); }       /* no iOS zoom on focus */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 30;
    left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
    padding: 0 4px env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
    color: var(--muted); font-size: .68rem; font-weight: 600; text-decoration: none; -webkit-user-select: none; user-select: none;
    position: relative;
  }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a.on { color: var(--accent-ink); }
  .tabbar a.on::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent); }
  .row-2 { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.4rem; }
  .chat-shell .chat-log { height: calc(100vh - 290px - var(--tabbar-h)); min-height: 260px; padding: 12px 10px; }
  .avatar { flex-basis: 26px; height: 26px; }
  .chat-title h1 { font-size: 1.1rem; }
  .hide-sm { display: none; }
  .inline-form input { width: 100%; }
}
@media (max-width: 380px) {
  .mkt-pill .mkt-word { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (pointer: coarse) { html, body { overscroll-behavior-y: none; } }

/* ---------- small additions ---------- */
.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--down) 45%, var(--border)); color: var(--down); }
.btn-danger:hover { background: var(--down-bg); border-color: var(--down); }
.table-wrap.card { padding: 4px 6px; }
.table-wrap.card > h3, .table-wrap.card > p { padding: 0 10px; }
.table-wrap.card > h3:first-child { padding-top: 12px; }
.card.filters { padding: 16px; }
.card.form-grid { padding: 18px; }
@media (max-width: 720px) {
  .chat-suggest { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chat-suggest::-webkit-scrollbar { display: none; }
  .chat-suggest .chip { flex: none; }
  .chat-shell .chat-log { height: calc(100dvh - 330px - var(--tabbar-h)); min-height: 240px; }
  .chat-top { align-items: flex-start; }
  .chat-title img { width: 32px; height: 32px; }
}
[data-theme="dark"] .brand img, [data-theme="dark"] .chat-title img, [data-theme="dark"] .login-brand img { box-shadow: 0 0 0 1px var(--border-strong); }


/* ---- Mascot (the blue bull calf). Used only in friendly spots: greeting, login, chat, explainers, empty states. ---- */
.mascot { display: inline-block; object-fit: contain; flex: none; user-select: none; -webkit-user-drag: none; }
.s-hello.has-mascot { display: flex; align-items: center; gap: 12px; }
.s-hello.has-mascot h1 { margin: 0; }
.mascot-hello { width: 56px; height: 56px; }
.mascot-login { display: block; width: 120px; height: 120px; margin: -8px auto 4px; }
.mascot-empty { width: 96px; height: 96px; }
.avatar.avatar-mascot { background: var(--accent-soft); overflow: hidden; padding: 0; }
.avatar.avatar-mascot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nx-title { display: flex; align-items: center; gap: 8px; }
.nx-title .mascot { width: 32px; height: 32px; }
.nx-loading { display: flex; align-items: center; gap: 10px; }
.nx-loading .mascot { width: 44px; height: 44px; animation: mascot-bob 1.6s ease-in-out infinite; }
@keyframes mascot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .nx-loading .mascot { animation: none; } }
@media (max-width: 600px) { .mascot-hello { width: 48px; height: 48px; } .mascot-login { width: 96px; height: 96px; } }

/* ---------- stale-data banner (base.html) ---------- */
.stale-bar { background: var(--amber-soft); color: var(--amber-ink); border-bottom: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); font-size: .86rem; font-weight: 500; }
.stale-inner { display: flex; align-items: flex-start; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
.stale-inner > .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.stale-inner strong { font-weight: 700; }

/* ---------- nav group (Research menu) ---------- */
.nav-group { position: relative; }
.nav-group > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); padding: 7px 10px; border-radius: 8px;
  font-size: .9rem; font-weight: 600; white-space: nowrap; line-height: 1.3; transition: color .15s, background-color .15s; user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary > .ico:first-child { display: none; }
.nav-group > summary .nav-caret { width: 14px; height: 14px; transition: transform .15s; }
.nav-group[open] > summary .nav-caret { transform: rotate(180deg); }
.nav-group > summary:hover { color: var(--text); background: var(--surface-2); }
.nav-group.on > summary { color: var(--accent-ink); background: var(--accent-soft); }
.nav-drop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 270px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  display: grid; gap: 2px;
}
.nav .nav-drop a { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 9px 10px; white-space: normal; }
.nav .nav-drop a .ico { display: inline-block; width: 16px; height: 16px; color: var(--muted); grid-row: span 2; }
.nav .nav-drop a.on .ico { color: var(--accent-ink); }
.nav-hint { grid-column: 2; font-size: .76rem; font-weight: 500; color: var(--muted); }
@media (max-width: 1120px) {
  .nav-group > summary { display: flex; padding: 11px 12px; font-size: .96rem; gap: 12px; }
  .nav-group > summary > .ico:first-child { display: inline-block; width: 18px; height: 18px; color: var(--muted); }
  .nav-group > summary .nav-caret { margin-left: auto; }
  .nav-drop { position: static; min-width: 0; box-shadow: none; border: 0; border-left: 2px solid var(--border); border-radius: 0; margin: 0 0 4px 20px; padding: 0 0 0 6px; }
  .nav .nav-drop a { padding: 9px 10px; font-size: .92rem; }
}
.c-disclosure { font-size: .8rem; }

/* ---------- Shared stock table (web/stocktable.py, _stock_table.html) ----------
   Flat white card, the table scrolls sideways INSIDE it (never the page), sticky first column, tabular numbers. */
.st-bar { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; min-width: 0; }
.st-seg { display: flex; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); align-self: flex-start; }
.st-seg::-webkit-scrollbar { display: none; }
.st-seg a { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px; border-radius: 8px;
  font-weight: 600; font-size: .84rem; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.st-seg a .ico { width: 15px; height: 15px; color: var(--muted); }
.st-seg a:hover { color: var(--text); }
.st-seg a.on { background: var(--surface); color: var(--accent-ink); box-shadow: 0 0 0 1px var(--border-strong); }
.st-seg a.on .ico { color: var(--accent-ink); }
.st-seg a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.st-seg-sm a { padding: 4px 10px; font-size: .8rem; }
.st-seg-lab { flex: none; align-self: center; padding: 0 6px 0 8px; font-size: .76rem; font-weight: 600; color: var(--muted); }
.st-count { margin: 0 0 8px; }
.st-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); overscroll-behavior-x: contain; }
.st-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.st-table th, .st-table td { padding: 10px 12px; }
.st-table th { white-space: nowrap; }
.st-table th a { text-decoration: none; }
.st-table th[title] a { text-decoration: underline dotted var(--border-strong); text-underline-offset: 3px; }
.st-table .st-first { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.st-table thead .st-first { z-index: 3; }
.st-table tbody tr:hover td, .st-table tbody tr:hover .st-first { background: var(--surface-2); }
.st-name { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-table .t-chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.st-table .t-chip-info { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.st-legend { margin-top: 12px; font-size: .86rem; }
.st-legend summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-ink); }
.st-legend summary .ico { width: 15px; height: 15px; }
.st-legend dl { display: grid; gap: 6px; margin: 10px 0 6px; }
.st-legend dl > div { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr); gap: 10px; }
.st-legend dt { font-weight: 600; color: var(--text); }
.st-legend dd { margin: 0; color: var(--text-2); }
@media (max-width: 640px) {
  .st-table th, .st-table td { padding: 9px 10px; }
  .st-name { max-width: 7.5rem; }
  .st-table .st-first { max-width: 9.5rem; }
  .st-legend dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ---------- Order book (/orders, stock page "Orders") ---------- */
.ord-feed { list-style: none; margin: 0; padding: 0; display: grid; }
.ord-item { padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.ord-item:last-child { border-bottom: 0; }
.ord-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ord-co, .ord-line, .ord-head, .ord-src { margin: 4px 0 0; overflow-wrap: anywhere; }
.ord-amt { color: var(--navy); font-variant-numeric: tabular-nums; }
.ord-na { display: inline-block; font-size: .8rem; font-weight: 600; padding: 1px 8px; border-radius: 6px;
  background: var(--amber-soft); color: var(--amber-ink); }
.st-table .ord-na { font-size: .74rem; }
.ord-head { color: var(--text-2); }
.ord-src { color: var(--muted); }
.ord-src a { display: inline-flex; align-items: center; gap: 4px; }
.ord-src a .ico { width: 13px; height: 13px; }
.ord-chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.ord-chip-primary { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.ord-more { display: flex; justify-content: center; padding-top: 12px; }
.ord-hidden { margin: -4px 0 12px; }
.ord-search label { flex: 1 1 240px; }
.announce-preview { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); line-height: 1.6; }
.announce-actions { display: flex; gap: 10px; margin-top: 12px; }
.announce-text { grid-column: 1 / -1; }
.announce-text textarea { width: 100%; }
.search { position: relative; }
.search-suggest { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 240px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 60vh; overflow-y: auto; }
.search:focus-within .search-suggest:not(:empty) { display: block; }
.ss-list { list-style: none; margin: 0; padding: 4px; }
.ss-list a { display: flex; gap: 8px; align-items: baseline; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.ss-list a:hover, .ss-list a:focus-visible { background: var(--accent-soft); }
.ss-none { margin: 0; padding: 10px 12px; }
.live-strip { display: flex; gap: 14px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 8px 12px; margin: 0 0 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); white-space: nowrap; font-size: .86rem; }
.live-strip::-webkit-scrollbar { display: none; }
.live-item { display: inline-flex; gap: 6px; align-items: baseline; color: var(--text); text-decoration: none; flex: none; }
.live-name { color: var(--text-2); font-weight: 600; }
.live-last { font-weight: 700; font-variant-numeric: tabular-nums; }
.live-badge { flex: none; font-size: .7rem; font-weight: 800; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; }
.live-badge.on { background: var(--down, #d93025); color: #fff; animation: livepulse 2s ease-in-out infinite; }
.live-badge.off { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
@keyframes livepulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .live-badge.on { animation: none; } }
.live-time { flex: none; }
.stock-live { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 6px 0 2px; }
.stock-live-last { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* India / Nepal market switch (topbar and admin panel) */
.mkt-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; flex: none; }
.mkt-switch a { padding: 5px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--muted); line-height: 1.2; }
.mkt-switch a.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.mkt-switch a:hover { color: var(--accent); }
.mkt-switch-panel { margin: 0 0 8px; align-self: flex-start; }
.remember { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-2); cursor: pointer; min-height: 44px; }
.remember input { width: 20px; height: 20px; accent-color: var(--accent); }
/* phones: with the India / Nepal switch in the topbar, show the logo without the wordmark so the menu fits */
@media (max-width: 480px) {
  .topbar-inner:has(.mkt-switch) .brand > span { display: none; }
  .topbar-inner:has(.mkt-switch) { gap: 8px; }
  .mkt-switch a { padding: 5px 10px; }
}
/* laptops (1121-1500px): the inline nav, the market pill and the India / Nepal switch share one row, so tighten it */
@media (min-width: 1121px) {
  .topbar-inner.wrap { max-width: 100rem; }
  .topbar-inner, .menu { gap: 8px; }
  .mkt-pill .mkt-word, .np .brand-tag { display: none; }
  .nav a, .nav-group > summary { padding: 7px 7px; font-size: .86rem; }
  .search input { width: 118px; }
  .mkt-switch a { padding: 5px 9px; }
}
@media (min-width: 1121px) and (max-width: 1300px) {
  .panel-word { display: none; }
  .search input { width: 104px; }
}
@media (min-width: 1121px) and (max-width: 1220px) {
  .nav a, .nav-group > summary { padding: 6px 5px; font-size: .82rem; }
  .brand > span { font-size: .98rem; }
}
@media (min-width: 1121px) and (max-width: 1160px) { .search input { width: 92px; } }

/* live movers (Home, Markets) and live watchlist prices */
.live-movers, .live-watch { margin-bottom: 16px; }
.live-movers-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.live-movers-head h2 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.live-movers-grid { display: grid; grid-template-columns: 1fr; gap: 6px 24px; }
.live-movers-grid h3 { margin: 6px 0 0; font-weight: 700; }
.ix-live { display: contents; }
.live-watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.live-watch-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--surface); }
.live-watch-item:hover { border-color: var(--accent); text-decoration: none; }
.live-watch-item strong { font-variant-numeric: tabular-nums; }
@media (min-width: 700px) { .live-movers-grid { grid-template-columns: 1fr 1fr; } }
