/* ==========================================================================
   Market Signals – stylesheet
   Navy ink sidebar, white working surfaces, brass for focus and selection,
   green/red reserved strictly for buy/sell and price direction.
   ========================================================================== */

:root {
  color-scheme: light;
  --ink: #14213D;
  --ink-2: #1D2E52;
  --ink-text: #C9D3E6;
  --brass: #B7862B;
  --brass-soft: #F5EBD6;
  --paper: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #DCE3EC;
  --line-strong: #C3CDDA;
  --text: #1B2433;
  --muted: #5B6B82;
  --link: #1F4FA3;
  --buy: #0E7A55;
  --buy-bg: #E2F3EB;
  --sell: #B42335;
  --sell-bg: #FBE6E9;
  --hold: #5B6577;
  --hold-bg: #ECEFF4;
  --warn: #8A5A00;
  --warn-bg: #FFF3D1;
  --chart-close: #14213D;
  --chart-sma20: #7A8CA8;
  --chart-sma50: #B7862B;
  --chart-sma200: #6A3FA0;
  --chart-band: rgba(31, 79, 163, 0.08);
  --shadow: 0 1px 2px rgba(20, 33, 61, 0.06);
  --shadow-pop: 0 10px 30px rgba(20, 33, 61, 0.18);
  --r-s: 3px;
  --r-m: 6px;
  --r-l: 10px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-cond: "IBM Plex Sans Condensed", "Arial Narrow", "IBM Plex Sans", system-ui, sans-serif;
  --side-w: 228px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #0C1426;
    --ink-2: #16223D;
    --ink-text: #B5C1D8;
    --brass: #D1A24A;
    --brass-soft: #3A2F18;
    --paper: #0F1729;
    --surface: #152036;
    --surface-2: #1A2741;
    --line: #26344F;
    --line-strong: #34456A;
    --text: #E4E9F2;
    --muted: #97A5BD;
    --link: #8FB4FF;
    --buy: #3FC48E;
    --buy-bg: #12352A;
    --sell: #FF7486;
    --sell-bg: #3D1822;
    --hold: #A9B3C5;
    --hold-bg: #233049;
    --warn: #F2C35B;
    --warn-bg: #3A2F12;
    --chart-close: #E4E9F2;
    --chart-sma20: #8796B0;
    --chart-sma50: #D1A24A;
    --chart-sma200: #B08BE8;
    --chart-band: rgba(143, 180, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 12px 36px rgba(0, 0, 0, 0.5);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-cond); font-weight: 600; line-height: 1.2; margin: 0; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brass); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.up { color: var(--buy); }
.down { color: var(--sell); }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

.side {
  background: var(--ink);
  color: var(--ink-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  padding: 0 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; color: var(--brass); }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-m);
  color: var(--ink-text);
  font-weight: 500;
  border-left: 3px solid transparent;
}
.side-nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--ink-2); color: #fff; border-left-color: var(--brass); border-radius: 0 var(--r-m) var(--r-m) 0; }
.side-nav a span { flex: 1; }
.side-nav .count {
  background: var(--brass);
  color: #1b1405;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 10px;
}
.side-group { font-size: 0.78rem; color: #7F8DA8; padding: 16px 12px 6px; }

.side-foot { display: flex; align-items: center; gap: 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; flex: 1; color: #fff; padding: 6px; border-radius: var(--r-m); min-width: 0; }
.side-user:hover, .side-user.active { background: var(--ink-2); text-decoration: none; }
.side-user-name { display: flex; flex-direction: column; font-size: 0.88rem; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-name small { color: var(--ink-text); font-size: 0.75rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brass); color: #1b1405;
  display: grid; place-items: center; font-weight: 700; flex: none;
}
.side-logout { color: var(--ink-text); padding: 8px; border-radius: var(--r-m); }
.side-logout:hover { background: var(--ink-2); color: #fff; }
.side-scrim { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; }

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { font-size: 1.45rem; flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 8px; }
.menu-btn { display: none; }

.qs { position: relative; width: 300px; display: flex; align-items: center; }
.qs > .ic { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.qs input { padding-left: 34px; width: 100%; }
.qs-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: var(--shadow-pop); max-height: 380px; overflow-y: auto; z-index: 50;
}
.qs-results a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.qs-results a:last-child { border-bottom: 0; }
.qs-results a:hover, .qs-results a.hl { background: var(--surface-2); text-decoration: none; }
.qs-results .qs-group { font-size: 0.75rem; color: var(--muted); padding: 8px 12px 4px; background: var(--surface-2); }
.qs-results .qs-empty { padding: 12px; color: var(--muted); }

.content { padding: 24px 28px 40px; flex: 1; }
.foot { padding: 14px 28px 22px; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- Forms ---------- */

input[type=text], input[type=search], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=url], select, textarea {
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  padding: 7px 10px;
  min-height: 36px;
  width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 4px; color: var(--muted); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--text); margin: 0 0 8px; font-weight: 400; }
.check-row input { width: 16px; height: 16px; min-height: 0; accent-color: var(--ink); }

/* One-line filter bars */
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r-l) var(--r-l) 0 0;
  scrollbar-width: thin;
}
.filters input, .filters select { width: auto; flex: none; min-width: 0; }
.filters .grow { flex: 1 1 200px; min-width: 160px; }
.filters .f-sm { width: 140px; }
.filters .f-xs { width: 112px; }
.filters .f-date { width: 150px; }
.filters .sep { flex: 1; }
.filters .f-label { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 7px 14px;
  min-height: 36px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  .btn-primary { background: var(--brass); border-color: var(--brass); color: #1b1405; }
  .btn-primary:hover { background: #E0B45C; border-color: #E0B45C; }
}
.btn-danger { color: var(--sell); border-color: var(--sell); }
.btn-danger:hover { background: var(--sell-bg); border-color: var(--sell); }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 0.83rem; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px;
  border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-icon {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-m);
  background: transparent; color: var(--muted); cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn-icon.spinning .ic { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Panels & layout ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; }
.panel-head .muted { font-size: 0.85rem; }
.panel-body { padding: 16px; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 0.88rem; }
.filters + .panel, .filters + .table-wrap { border-top-left-radius: 0; border-top-right-radius: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .sep { flex: 1; }
.toolbar input { width: 300px; }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); margin-bottom: 20px; box-shadow: var(--shadow); }
.stat { padding: 14px 18px; border-right: 1px solid var(--line); color: var(--text); }
.stat:last-child { border-right: 0; }
a.stat:hover { background: var(--surface-2); text-decoration: none; }
.stat b { display: block; font-family: var(--font-cond); font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 0.83rem; color: var(--muted); }
.stat.buy b { color: var(--buy); }
.stat.sell b { color: var(--sell); }
.stat.attn b { color: var(--brass); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel .table-wrap { border: 0; border-radius: 0; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data th {
  text-align: left; font-weight: 500; font-size: 0.8rem; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  white-space: nowrap; position: sticky; top: 0;
}
.data th.sortable { cursor: pointer; user-select: none; }
.data th.sortable:hover { color: var(--text); }
.data th.sorted::after { content: " ▾"; color: var(--brass); }
.data th.sorted.asc::after { content: " ▴"; }
.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:hover td { background: var(--surface-2); }
.data .num { text-align: right; white-space: nowrap; }
.data th.num { text-align: right; }
.data .actions { text-align: right; white-space: nowrap; width: 1%; }
.data .actions .btn-icon, .data .actions .btn { margin-left: 2px; }
.data .sub { display: block; font-size: 0.79rem; color: var(--muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data .sub.up { color: var(--buy); }
.data .sub.down { color: var(--sell); }
.data tr.empty td { text-align: center; color: var(--muted); padding: 28px 12px; }
.data tr.dim td { opacity: 0.6; }
.data tr.flash td { animation: rowflash 1.2s ease-out; }
@keyframes rowflash { from { background: var(--brass-soft); } to { background: transparent; } }
.data .contact { font-size: 0.85rem; }
.table-loading { opacity: 0.55; transition: opacity 0.15s; }

.tk {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
a.tk:hover { color: var(--link); }
.tk-sm { font-size: 0.85rem; background: var(--hold-bg); padding: 0 6px; border-radius: var(--r-s); }
.tk-cell { min-width: 150px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: 0.85rem; flex-wrap: wrap; }
.pager-btns { display: flex; align-items: center; gap: 8px; }

/* ---------- Badges ---------- */

.rating {
  display: inline-block; font-size: 0.78rem; font-weight: 600; white-space: nowrap;
  padding: 2px 8px; border-radius: var(--r-s); border: 1px solid transparent;
}
.rate-sbuy { background: var(--buy); color: #fff; }
.rate-buy { background: var(--buy-bg); color: var(--buy); border-color: color-mix(in srgb, var(--buy) 30%, transparent); }
.rate-hold { background: var(--hold-bg); color: var(--hold); }
.rate-sell { background: var(--sell-bg); color: var(--sell); border-color: color-mix(in srgb, var(--sell) 30%, transparent); }
.rate-ssell { background: var(--sell); color: #fff; }
.rate-none { background: transparent; color: var(--muted); border-color: var(--line); }
@media (prefers-color-scheme: dark) {
  .rate-sbuy { color: #06261A; }
  .rate-ssell { color: #2A0710; }
}

.sig {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.78rem; font-weight: 700; padding: 1px 8px 1px 6px; border-radius: var(--r-s);
}
.sig::before { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.sig-buy { background: var(--buy-bg); color: var(--buy); }
.sig-buy::before { border-bottom: 6px solid var(--buy); }
.sig-sell { background: var(--sell-bg); color: var(--sell); }
.sig-sell::before { border-top: 6px solid var(--sell); }
.sig-cell .sub { display: inline; margin-left: 6px; }
.sig-inline { display: block; margin-top: 3px; }
.sig-inline .sub { display: inline; margin-left: 4px; }

.rule { font-weight: 500; }

.dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.dots i.on { background: var(--brass); }

.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--hold-bg); color: var(--hold); white-space: nowrap; }
.pill-new { background: var(--brass-soft); color: var(--brass); }
.pill-client { background: var(--buy-bg); color: var(--buy); }
.pill-prospect { background: var(--brass-soft); color: var(--warn); }
.pill-lead { background: var(--hold-bg); color: var(--link); }
.pill-inactive { background: var(--hold-bg); color: var(--muted); }
.pill-admin { background: var(--brass-soft); color: var(--warn); }

/* Score meter: −10 … +10 */
.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter-track {
  position: relative; width: 64px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--sell) 0%, var(--sell-bg) 40%, var(--hold-bg) 50%, var(--buy-bg) 60%, var(--buy) 100%);
}
.meter-mark { position: absolute; top: -4px; width: 3px; height: 14px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
.meter-val { font-size: 0.82rem; font-weight: 600; min-width: 32px; }
.meter.pos .meter-val { color: var(--buy); }
.meter.neg .meter-val { color: var(--sell); }
.meter-lg .meter-track { width: 220px; height: 10px; border-radius: 5px; }
.meter-lg .meter-mark { top: -5px; height: 20px; width: 4px; margin-left: -2px; }
.meter-lg .meter-val { font-size: 1.05rem; }

.err-dot { color: var(--warn); margin-left: 4px; }
.err-dot .ic { width: 15px; height: 15px; }

/* ---------- Notices, toasts, modal ---------- */

.notice { padding: 10px 14px; border-radius: var(--r-m); margin-bottom: 16px; font-size: 0.92rem; border: 1px solid; }
.notice-ok { background: var(--buy-bg); color: var(--buy); border-color: color-mix(in srgb, var(--buy) 25%, transparent); }
.notice-error { background: var(--sell-bg); color: var(--sell); border-color: color-mix(in srgb, var(--sell) 25%, transparent); }
.notice-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 380px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 14px; border-radius: var(--r-m);
  box-shadow: var(--shadow-pop); font-size: 0.9rem; border-left: 4px solid var(--brass);
  animation: toastIn 0.18s ease-out;
}
.toast.err { border-left-color: var(--sell); }
.toast.ok { border-left-color: var(--buy); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal { position: fixed; inset: 0; background: rgba(12, 20, 38, 0.5); display: grid; place-items: center; z-index: 150; padding: 20px; }
.modal-card { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-pop); width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; padding: 22px; }
.modal-sm { max-width: 420px; }
.modal-card h2 { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Dashboard ---------- */

.movers { display: grid; grid-template-columns: 1fr 1fr; }
.movers > div:first-child { border-right: 1px solid var(--line); }
.mover-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.mover-row:last-child { border-bottom: 0; }
.mover-head { padding: 8px 16px; font-size: 0.8rem; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }

.affected { list-style: none; margin: 0; padding: 0; }
.affected li { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.affected li:last-child { border-bottom: 0; }
.affected .tks { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Activity timeline ---------- */

.acts { list-style: none; margin: 0; padding: 0; }
.act { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.act:last-child { border-bottom: 0; }
.act-body { flex: 1; min-width: 0; }
.act-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.act-type { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); padding: 0 6px; border-radius: var(--r-s); }
.act-links { display: inline-flex; gap: 6px; align-items: baseline; font-size: 0.88rem; }
.act-text { margin-top: 4px; font-size: 0.9rem; white-space: normal; overflow-wrap: anywhere; }
.act-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 0.8rem; }
.act.done .act-head strong { text-decoration: line-through; color: var(--muted); }
.act-del { opacity: 0; }
.act:hover .act-del, .act-del:focus-visible { opacity: 1; }
.act-empty { padding: 20px 16px; color: var(--muted); }
.due { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.due .ic { width: 14px; height: 14px; }
.due.overdue { color: var(--sell); font-weight: 600; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong);
  background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; margin-top: 1px; color: transparent;
}
.check .ic { width: 13px; height: 13px; stroke-width: 3; }
.check:hover { border-color: var(--buy); color: var(--buy); }
.check.on { background: var(--buy); border-color: var(--buy); color: #fff; }
.type-dot { width: 10px; height: 10px; border-radius: 50%; margin: 6px 6px 0; flex: none; background: var(--line-strong); }
.type-dot.t-call { background: var(--link); }
.type-dot.t-email { background: var(--chart-sma200); }
.type-dot.t-meeting { background: var(--brass); }

.act-form { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.act-form .inline { display: flex; gap: 8px; flex-wrap: nowrap; }
.act-form .inline select { width: 120px; flex: none; }
.act-form .inline input[type=date] { width: 160px; flex: none; }
.act-form textarea { margin-top: 8px; min-height: 60px; }
.act-form .act-form-foot { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- Stock page ---------- */

.stock-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 28px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.stock-id { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.stock-ticker { font-family: var(--font-cond); font-weight: 700; font-size: 2.6rem; line-height: 1; letter-spacing: 0.01em; }
.stock-name { font-size: 1.05rem; font-weight: 500; }
.stock-meta { color: var(--muted); font-size: 0.88rem; margin-top: 6px; }
.stock-price { display: flex; align-items: baseline; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.stock-price b { font-family: var(--font-cond); font-size: 2rem; font-weight: 600; }
.stock-price .chg { font-size: 1.05rem; font-weight: 600; }
.stock-rate { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.stock-rate .rating { font-size: 1rem; padding: 4px 12px; }
.stock-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.chart-tools { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-m); overflow: hidden; flex: none; }
.seg button { font: inherit; font-size: 0.83rem; padding: 4px 11px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.on { background: var(--brass); color: #1b1405; } }
.toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 0.83rem; color: var(--muted); margin: 0 0 0 8px; white-space: nowrap; font-weight: 400; cursor: pointer; }
.toggle input { accent-color: var(--ink); margin: 0; }
.swatch { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }

.chart-box { position: relative; height: 380px; padding: 8px 12px 0; }
.chart-sub { position: relative; height: 120px; padding: 0 12px; border-top: 1px solid var(--line); }
.chart-sub-label { position: absolute; left: 18px; top: 6px; font-size: 0.75rem; color: var(--muted); z-index: 2; background: var(--surface); padding: 0 4px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tri-up { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--buy); }
.tri-down { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 10px solid var(--sell); }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 20px; }

.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.reasons li:last-child { border-bottom: 0; }
.reasons .r-ic { width: 18px; text-align: center; font-weight: 700; flex: none; }
.reasons .pos .r-ic { color: var(--buy); }
.reasons .neg .r-ic { color: var(--sell); }

.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; margin-top: 12px; }
.levels div { background: var(--surface); padding: 10px 12px; }
.levels span { display: block; font-size: 0.78rem; color: var(--muted); }
.levels b { font-family: var(--font-cond); font-size: 1.15rem; font-weight: 600; }
.levels .lv-stop b { color: var(--sell); }
.levels .lv-target b { color: var(--buy); }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 16px; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.kv div span { color: var(--muted); }
.kv div b { font-weight: 500; text-align: right; }
.kv-tight div { padding: 7px 0; }

.news { list-style: none; margin: 0; padding: 0; }
.news li { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.news li:last-child { border-bottom: 0; }
.news a { color: var(--text); font-weight: 500; }
.news a:hover { color: var(--link); }
.news .sub { display: block; font-size: 0.8rem; color: var(--muted); }

/* ---------- Client page ---------- */

.client-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.client-head h2 { font-size: 1.6rem; }
.holding-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: nowrap; overflow-x: auto; align-items: center; }
.holding-form input, .holding-form select { width: auto; flex: none; }
.holding-form .h-tk { width: 130px; }
.holding-form .h-rel { width: 120px; }
.holding-form .h-num { width: 120px; }
.holding-form .h-notes { flex: 1 1 160px; min-width: 140px; }
.totals { display: flex; gap: 24px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.totals b { font-family: var(--font-cond); font-size: 1.05rem; }

/* ---------- Progress ---------- */

.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 8px 0 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--brass); transition: width 0.3s; }
.progress-note { font-size: 0.83rem; color: var(--muted); margin-top: 4px; }

/* ---------- Login ---------- */

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); background: var(--surface); }
.login-art { background: var(--ink); color: var(--ink-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { border: 0; padding: 0; font-size: 1.4rem; }
.login-art p { max-width: 30rem; font-size: 1.05rem; line-height: 1.6; }
.login-art svg.tape { position: absolute; left: 0; right: 0; bottom: 120px; width: 100%; height: 220px; opacity: 0.9; }
.login-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-form h1 { font-size: 1.8rem; margin-bottom: 6px; }
.login-form .btn-primary { width: 100%; justify-content: center; min-height: 42px; margin-top: 6px; }

/* ---------- Settings ---------- */

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; background: var(--surface-2); border: 1px solid var(--line); padding: 8px 10px; border-radius: var(--r-m); overflow-x: auto; white-space: nowrap; }

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 1100px) {
  .grid-2, .grid-2-even, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .qs { width: 220px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 120; transform: translateX(-100%); transition: transform 0.2s ease; }
  body.side-open .side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(12, 20, 38, 0.45); z-index: 110; }
  .menu-btn { display: inline-grid; }
  .top { padding: 10px 14px; flex-wrap: wrap; }
  .page-title { font-size: 1.2rem; }
  .qs { width: 100%; order: 5; }
  .content { padding: 16px 14px 32px; }
  .foot { padding: 12px 14px 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(odd) { border-right: 1px solid var(--line); }
  .stat:nth-child(even) { border-right: 0; }
  .stock-head { grid-template-columns: minmax(0, 1fr); }
  .stock-rate { align-items: flex-start; }
  .stock-actions { justify-content: flex-start; }
  .stock-ticker { font-size: 2rem; }
  .chart-box { height: 300px; }
  .movers { grid-template-columns: 1fr; }
  .movers > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .toolbar input { width: 100%; }
  .meter-lg .meter-track { width: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
