/* Outfit and IBM Plex Mono — SIL Open Font License. Latin subsets. */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/_auth/static/fonts/outfit-400.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/_auth/static/fonts/outfit-500.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/_auth/static/fonts/outfit-600.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/_auth/static/fonts/outfit-700.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/_auth/static/fonts/plex-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/_auth/static/fonts/plex-500.woff2") format("woff2");
}

:root {
  --bg: #0c0e12;
  --bg-elev: #14181f;
  --bg-elev-2: #1c232c;
  --bg-inset: #0e1217;
  --line: rgba(232, 220, 196, 0.1);
  --line-strong: rgba(232, 220, 196, 0.2);
  --text: #f4f0e6;
  --muted: #a8b2bd;
  --faint: #8b97a3;
  --gold: #e2b15a;
  --gold-2: #f3d7a1;
  --ink: #1c1508;
  --buy: #3dcc8e;
  --buy-ink: #c8f8e0;
  --sell: #ff6d5c;
  --sell-ink: #ffd2cb;
  --neutral: #b7c5d4;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.32);
  --radius: 16px;
  --sans: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
}
body.app-body {
  background:
    radial-gradient(980px 460px at 100% -12%, rgba(226, 177, 90, 0.08), transparent 52%),
    radial-gradient(760px 380px at -8% -4%, rgba(61, 204, 142, 0.05), transparent 46%),
    var(--bg);
}
img, svg { display: block; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: rgba(226, 177, 90, 0.35); color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: #3c4652 transparent; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  background: var(--gold);
  color: var(--ink);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 240px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 1.15rem 0.9rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(12, 14, 18, 0.88);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.2rem 0.45rem 1rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.brand-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.03em; }
.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.nav-link.is-active {
  color: var(--text);
  background: rgba(226, 177, 90, 0.12);
}
.nav-link.is-active svg { color: var(--gold); }
.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.user-chip { display: flex; align-items: center; gap: 0.65rem; min-width: 0; padding: 0 0.35rem; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2a2418;
  color: var(--gold-2);
  font-family: var(--mono);
  font-size: 0.8rem;
  flex: none;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-label { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.user-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signout {
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}
.signout:hover { color: var(--text); border-color: var(--gold); }

.workspace {
  flex: 1;
  min-width: 0;
  padding: 1.4rem 1.6rem 3rem;
}
.workspace > * { max-width: 1180px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}
.kicker, .stat-label, .dist-label, legend {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
h1 {
  margin: 0.15rem 0 0;
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 600;
}
.page-sub { margin: 0.4rem 0 0; color: var(--muted); max-width: 58ch; }
.page-sub:empty { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; justify-content: flex-end; }
.clock {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(14, 18, 23, 0.7);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.62rem 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  line-height: 1.2;
}
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: var(--gold-2); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { color: var(--sell-ink); background: transparent; padding-inline: 0.55rem; }
.btn-danger:hover { background: rgba(255, 109, 92, 0.1); }
.btn-small { padding: 0.38rem 0.65rem; font-size: 0.82rem; border-radius: 8px; }
.text-link { color: var(--gold-2); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.filter { display: flex; flex-direction: column; gap: 0.25rem; }
.filter input {
  width: 220px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b97a3' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='6'/><path d='M20 20l-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: 0.7rem center;
  background-size: 16px;
  padding-left: 2.15rem;
}
.filter-status { color: var(--faint); font-size: 0.75rem; font-family: var(--mono); }
.filter-status:empty { display: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem 0.85rem;
}
.stat-value {
  margin: 0.25rem 0 0.1rem;
  font-family: var(--mono);
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  font-weight: 500;
}
.stat-hint { margin: 0; color: var(--faint); font-size: 0.8rem; }
.stat-dip { box-shadow: inset 3px 0 0 var(--buy); }
.stat-rally { box-shadow: inset 3px 0 0 var(--sell); }
.stat-calm { box-shadow: inset 3px 0 0 #7f93a8; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
  background: var(--neutral);
}
.swatch.dip, .mark.dip { background: var(--buy); }
.swatch.rally, .mark.rally { background: var(--sell); }
.swatch.price, .mark.price { background: var(--gold); }
.swatch.calm { background: #7f93a8; }

.banner, .alert {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}
.banner {
  background: rgba(226, 177, 90, 0.1);
  color: var(--gold-2);
  border: 1px solid rgba(226, 177, 90, 0.28);
}
.alert {
  background: rgba(255, 109, 92, 0.12);
  color: var(--sell-ink);
  border: 1px solid rgba(255, 109, 92, 0.35);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 1.4rem 0 0.7rem;
}
.section-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.section-note {
  margin: 0;
  color: var(--faint);
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.8rem;
  font-weight: 500;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.9rem;
}
.asset-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 0;
  box-shadow: inset 3px 0 0 #7f93a8;
}
.asset-card.zone-buy {
  box-shadow: inset 3px 0 0 var(--buy);
  background: linear-gradient(180deg, rgba(61, 204, 142, 0.09), var(--bg-elev) 110px);
}
.asset-card.zone-sell {
  box-shadow: inset 3px 0 0 var(--sell);
  background: linear-gradient(180deg, rgba(255, 109, 92, 0.09), var(--bg-elev) 110px);
}
.asset-card.is-blind { box-shadow: inset 3px 0 0 #5c6772; }
.asset-card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.ticker-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ticker, .ticker-cell {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.03em;
}
.ticker { margin: 0; font-size: 1.25rem; }
.asset-name, .sub { color: var(--muted); margin: 0.15rem 0 0; font-size: 0.88rem; }
.price-block { text-align: right; }
.price {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.price-label, .dist-level, .range-scale, .range-note, .card-notes { color: var(--faint); }
.price-label { margin: 0; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }

.pill, .zone-pill, .status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(183, 197, 212, 0.28);
  color: var(--neutral);
  background: rgba(183, 197, 212, 0.08);
  white-space: nowrap;
}
.zone-pill.zone-buy, .pill.action-buy, .status-pill.status-live {
  color: var(--buy-ink);
  background: rgba(61, 204, 142, 0.14);
  border-color: rgba(61, 204, 142, 0.38);
}
.zone-pill.zone-sell, .pill.action-sell {
  color: var(--sell-ink);
  background: rgba(255, 109, 92, 0.14);
  border-color: rgba(255, 109, 92, 0.4);
}
.pill.action-signal {
  color: var(--gold-2);
  background: rgba(226, 177, 90, 0.12);
  border-color: rgba(226, 177, 90, 0.38);
}
.status-pill.status-paused { color: var(--muted); }

.range-scale, .range-key {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.range-scale { margin-bottom: 0.35rem; }
.range-key { list-style: none; padding: 0; margin: 0.45rem 0 0; color: var(--muted); flex-wrap: wrap; }
.range-key li { display: flex; align-items: center; gap: 0.35rem; }
.range-line { position: relative; margin: 0.2rem 6px 0; height: 18px; }
.range-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 8px;
  border-radius: 999px;
  background: #242c36;
  overflow: hidden;
}
.wash { position: absolute; top: 0; bottom: 0; }
.wash.dip { left: 0; width: clamp(0%, var(--p), 100%); background: rgba(61, 204, 142, 0.35); }
.wash.rally { left: clamp(0%, var(--p), 100%); right: 0; background: rgba(255, 109, 92, 0.32); }
.mark {
  position: absolute;
  top: 9px;
  left: clamp(0%, var(--p), 100%);
  width: 2px;
  height: 16px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
}
.mark.price {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(226, 177, 90, 0.22);
  z-index: 1;
}
.range-note { margin: 0.45rem 0 0; font-size: 0.78rem; }

.dists { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.dist {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}
.dist strong {
  display: block;
  margin-top: 0.12rem;
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 500;
}
.dist .in-zone { color: var(--gold-2); }
.dist .away { display: inline; margin-left: 0.25rem; color: var(--faint); font-family: var(--sans); font-size: 0.78rem; font-weight: 500; }
.quote-miss { margin: 0; color: var(--muted); font-size: 0.9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; margin: 0; }
.chips li {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: rgba(8, 10, 14, 0.35);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
}
.card-notes {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot { display: flex; justify-content: flex-end; margin-top: auto; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
}
.table-wrap.scroll { max-height: min(70vh, 760px); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 0.72rem 0.85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #202833;
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-row]:hover td { background: rgba(255, 255, 255, 0.03); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-family: var(--mono); font-size: 0.86rem; }
.ticker-cell { font-size: 0.92rem; }
.name-stack { display: flex; flex-direction: column; gap: 0.1rem; }
.when { display: flex; flex-direction: column; font-family: var(--mono); font-size: 0.78rem; line-height: 1.3; }
.when-time, .source, .reason-note { color: var(--faint); }
.reason { min-width: 180px; max-width: 420px; }
.reason-note { display: block; margin-top: 0.15rem; font-size: 0.82rem; }
td.actions { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; align-items: center; gap: 0.25rem; }
.inline-form { display: inline; }
tr.is-paused .ticker-cell { color: var(--muted); }
.empty-row td { color: var(--muted); text-align: center; padding: 1.4rem; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 2.4rem 1.25rem;
  text-align: center;
  background: rgba(20, 24, 31, 0.65);
}
.empty h2 { margin: 0.25rem 0 0.35rem; letter-spacing: -0.03em; }
.empty p { margin: 0 auto 1.1rem; max-width: 48ch; color: var(--muted); }
.empty-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.form-card {
  max-width: 760px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem 1.2rem 1.2rem;
  box-shadow: var(--shadow);
}
fieldset { border: 0; margin: 0 0 0.4rem; padding: 1rem 0 0.2rem; border-top: 1px solid var(--line); }
fieldset:first-of-type { border-top: 0; padding-top: 0.2rem; }
legend { margin-bottom: 0.8rem; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem 1rem; }
.field.span-2 { grid-column: span 2; }
.field > span { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9rem; }
.field small { display: block; margin-top: 0.35rem; color: var(--faint); font-size: 0.78rem; line-height: 1.4; }
abbr { text-decoration: none; color: var(--gold); }
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.68rem 0.75rem;
  outline: none;
}
input[type="number"] { font-family: var(--mono); }
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(226, 177, 90, 0.18);
}
::placeholder { color: #8b97a3; }
.switch {
  position: relative;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-inset);
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
}
.switch-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #2c3540;
  position: relative;
  flex: none;
  margin-top: 0.1rem;
}
.switch-ui::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d5dde6;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.15s ease;
}
.switch input:checked + .switch-ui { background: #217a4d; }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: #f3fff8; }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px rgba(226, 177, 90, 0.35); }
.switch strong { display: block; }
.switch small { display: block; color: var(--faint); font-size: 0.8rem; }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.form-note { margin: 0.8rem 0 0; color: var(--faint); font-size: 0.8rem; }

.login-stage { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); }
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 3.2rem;
  background:
    radial-gradient(520px 240px at 18% 12%, rgba(226, 177, 90, 0.18), transparent 62%),
    linear-gradient(165deg, #16140f 0%, #0c0e12 58%, #10161c 100%);
  border-right: 1px solid var(--line);
}
.login-brand h1 {
  margin-top: 1.4rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
  max-width: 12ch;
}
.login-lead { color: var(--muted); max-width: 42ch; font-size: 1.05rem; }
.login-points { margin: 0.4rem 0 1.4rem; padding: 0; list-style: none; color: var(--text); }
.login-points li { position: relative; padding-left: 1.1rem; margin: 0.45rem 0; }
.login-points li::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--gold);
  position: absolute;
  left: 0;
  top: 0.5rem;
}
.preview {
  max-width: 380px;
  background: rgba(20, 24, 31, 0.86);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 0.95rem 1rem 1rem;
  box-shadow: inset 3px 0 0 var(--buy), var(--shadow);
}
.preview-top, .preview-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.preview-symbol { font-family: var(--mono); font-size: 1.1rem; }
.preview-price { margin: 0.7rem 0 0.15rem; font-family: var(--mono); font-size: 1.7rem; letter-spacing: -0.04em; }
.preview-label { margin: 0 0 0.7rem; color: var(--faint); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.preview-track { height: 8px; border-radius: 999px; background: #242c36; position: relative; overflow: hidden; }
.preview-track span { position: absolute; left: 0; top: 0; bottom: 0; width: 34%; background: rgba(61, 204, 142, 0.4); }
.preview-dot {
  position: absolute;
  left: 46%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(226, 177, 90, 0.2);
}
.preview-meta { margin-top: 0.7rem; color: var(--muted); font-family: var(--mono); font-size: 0.72rem; }
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.4rem;
}
.login-card { width: min(100%, 400px); }
.login-card h2 { margin: 0 0 0.3rem; font-size: 1.5rem; letter-spacing: -0.03em; }
.login-card .page-sub { margin-bottom: 1.1rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.85rem; }
.login-card .btn { width: 100%; margin-top: 0.2rem; padding: 0.75rem; }

@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.6rem;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.7rem 0.8rem 0.55rem;
  }
  .brand { padding: 0 0.2rem 0 0; }
  .nav {
    order: 3;
    flex: 1 1 100%;
    flex-direction: row;
    overflow-x: auto;
  }
  .nav-link { padding: 0.45rem 0.7rem; }
  .sidebar-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; padding-top: 0; }
  .user-label, .signout { white-space: nowrap; }
  .workspace { padding: 1rem 0.9rem 2.5rem; }
  .login-stage { grid-template-columns: 1fr; }
  .login-brand { padding: 1.6rem 1.2rem 1.2rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-brand h1 { max-width: none; }
  .preview { display: none; }
}
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-actions { justify-content: space-between; }
  .filter input { width: 100%; }
  .fields { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .stats { grid-template-columns: 1fr; }
  .user-meta, .avatar { display: none; }
  h1 { font-size: 1.55rem; }
  .table-wrap, .table-wrap.scroll { overflow: visible; max-height: none; border: 0; background: transparent; }
  .table-wrap table { min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tr[data-row] {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0.85rem;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 14px;
  }
  .table-wrap tr[data-row] td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    text-align: right;
    padding: 0.55rem 0;
  }
  .table-wrap tr[data-row] td::before {
    content: attr(data-label);
    color: var(--faint);
    font-family: var(--sans);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    text-align: left;
  }
  .table-wrap td.reason { max-width: none; align-items: flex-start; }
  .table-wrap td.actions { justify-content: flex-end; }
  .table-wrap td.actions::before { content: none; }
  .table-wrap .name-stack, .table-wrap .reason, .table-wrap .when { text-align: right; align-items: flex-end; }
  .table-wrap .empty-row td { display: block; text-align: center; }
  .table-wrap .empty-row td::before { content: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .switch-ui::after { transition: none; }
}

/* ---------- Portfolio ---------- */
.gl-pos { color: var(--buy); }
.gl-neg { color: var(--sell); }
.gl-flat { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.84rem; }

.chart-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  padding: 0.9rem 0.9rem 0.6rem;
}
.pf-chart { display: block; width: 100%; height: auto; }
.pf-chart .grid { stroke: rgba(232, 220, 196, 0.09); stroke-width: 1; }
.pf-chart .axis { fill: var(--faint); font-family: var(--mono); font-size: 12px; }
.pf-chart circle { cursor: default; }
.chart-legend { margin: 0.4rem 0 0.2rem; }
.chart-note { margin: 0.3rem 0 0.2rem; color: var(--faint); font-size: 0.82rem; }

.sort-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.sort-btn::after { content: "↕"; opacity: 0.35; font-size: 0.8em; }
th[aria-sort="ascending"] .sort-btn::after { content: "↑"; opacity: 1; color: var(--gold); }
th[aria-sort="descending"] .sort-btn::after { content: "↓"; opacity: 1; color: var(--gold); }
.sort-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
th.num .sort-btn { flex-direction: row-reverse; }

tfoot .totals-row td, tr.totals-row td {
  background: rgba(226, 177, 90, 0.06);
  border-top: 1px solid var(--line-strong);
  font-weight: 600;
}
tfoot .totals-row td.num, tr.totals-row td.num { font-family: var(--mono); font-size: 0.86rem; }

.trade-filters {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1fr 0.8fr 0.9fr 0.9fr auto;
  gap: 0.6rem 0.7rem;
  align-items: end;
  margin-bottom: 0.8rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
}
.trade-filters .field > span { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.trade-filters input, .trade-filters select {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  outline: none;
  color: var(--text);
  font: inherit;
}
.trade-filters input:focus, .trade-filters select:focus { border-color: var(--gold); }
.trade-filter-actions { display: flex; gap: 0.4rem; padding-bottom: 0.1rem; }
@media (max-width: 980px) {
  .trade-filters { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 640px) {
  .trade-filters { grid-template-columns: 1fr 1fr; }
  tfoot { display: none; }
}

/* ---------- Contrast pass (Dec 4): lift muted text to WCAG AA on all dark surfaces ---------- */
:root {
  --muted: #c2ccd6;
  --faint: #b4bfca;
  --th-bg: #1a212b;
  --th-text: #e4eaf0;
}
::placeholder { color: #aeb9c4; opacity: 1; }
th {
  background: var(--th-bg);
  color: var(--th-text);
  font-size: 0.76rem;
}
.sort-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  color: var(--th-text);
}
.sort-btn::after { opacity: 0.7; }
.pf-chart .grid { stroke: rgba(232, 220, 196, 0.16); }
.pf-chart .axis { fill: #d3dbe3; font-size: 13px; font-weight: 500; }
.section-note, .stat-hint, .chart-note, .sub, .acct-mask { color: var(--muted); }
.stat-label { color: #d8c08a; }

/* ---------- Account tabs ---------- */
.acct-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.acct-tab {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  min-width: 120px;
}
.acct-tab:hover { border-color: var(--gold); }
.acct-tab.is-active {
  border-color: var(--gold);
  background: rgba(226, 177, 90, 0.14);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.acct-tab-value { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.acct-note {
  margin: -0.3rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(226, 177, 90, 0.28);
  background: rgba(226, 177, 90, 0.08);
  color: #f1e3c4;
  font-size: 0.88rem;
}
.acct-link, .ticker-link { color: var(--text); text-decoration: none; font-weight: 600; }
.ticker-link { color: var(--gold-2); font-family: var(--mono); }
.ticker-link:hover, .acct-link:hover { text-decoration: underline; color: var(--gold-2); }
.acct-mask { display: block; font-family: var(--mono); font-size: 0.74rem; color: var(--muted); font-weight: 400; }
tr.is-selected td { background: rgba(226, 177, 90, 0.07); }

/* ---------- Ticker page ---------- */
.ticker-title { font-family: var(--mono); }
.ticker-title-name { font-size: 0.62em; color: var(--muted); font-weight: 500; margin-left: 0.4rem; }
.stats.stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats.stats-6 .stat-value { font-size: 1.35rem; }
.perf-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.6rem;
}
.perf {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  padding: 0.65rem 0.75rem;
}
.perf-label { margin: 0; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: #d8c08a; font-weight: 600; }
.perf-value { margin: 0.2rem 0 0.1rem; font-family: var(--mono); font-size: 1.15rem; }
.perf-sub { margin: 0; font-size: 0.76rem; color: var(--muted); }
.mk { stroke: #0c0e12; stroke-width: 1.2; }
.mk.buy { fill: #3dcc8e; }
.mk.sell { fill: #ff6d5c; }
.mk-key.buy { color: var(--buy); }
.mk-key.sell { color: var(--sell); }
@media (max-width: 1100px) {
  .stats.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .perf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stats.stats-6, .perf-grid { grid-template-columns: 1fr 1fr; }
}

/* Sort indicators drawn with CSS (no font glyph needed) */
.sort-btn::after {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  border-bottom: 0;
  opacity: 0.45;
}
th[aria-sort="ascending"] .sort-btn::after {
  content: "";
  border-top: 0;
  border-bottom: 5px solid var(--gold);
  opacity: 1;
}
th[aria-sort="descending"] .sort-btn::after {
  content: "";
  border-bottom: 0;
  border-top: 5px solid var(--gold);
  opacity: 1;
}
.acct-cell { white-space: nowrap; }
.acct-mask { display: inline; margin-left: 0.35rem; }
.mk-stem { stroke: rgba(244, 240, 230, 0.55); stroke-width: 1.2; }
.mk { stroke: #0c0e12; stroke-width: 1; }

/* ======================= UI v3 (Dec 4) ======================= */
/* Chart text: explicit colors live on the SVG elements too; this is a second layer. */
svg.pf-chart text.axis { fill: #dbe3ea; font-size: 14px; }
svg.pf-chart .grid { stroke: #3a4553; }
.chart-lead { margin: 0 0 0.6rem; color: #cfd8e0; font-size: 0.9rem; }

/* Table headers: one flat dark header row, plain light text, no button boxes */
thead th {
  background: #1b2330 !important;
  color: #eef2f6 !important;
  border-bottom: 1px solid #3a4553;
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
thead th .sort-btn,
button.sort-btn {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  color: #eef2f6 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
thead th .sort-btn:hover { color: #f0cd86 !important; }

/* Account cells: one string "Individual - TOD (6253)", never wrapped, never underlined */
.acct-cell { white-space: nowrap; }
.acct-cell .acct-link, a.acct-link { text-decoration: none; color: #e8edf2; font-weight: 500; }
.acct-cell .acct-link:hover { text-decoration: underline; color: #f0cd86; }

/* ---------- Ticker page (per account) ---------- */
.acct-tabs { align-items: center; }
.acct-tabs-label { color: #cfd8e0; font-size: 0.85rem; font-weight: 600; margin-right: 0.2rem; }
.acct-tab { flex-direction: row; align-items: center; min-width: 0; padding: 0.5rem 0.9rem; }
.acct-tab-quiet { color: #cfd8e0; border-style: dashed; font-weight: 500; }

.chooser {
  border: 1px solid rgba(226, 177, 90, 0.35);
  background: rgba(226, 177, 90, 0.06);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1.2rem;
}
.chooser h2 { margin: 0.15rem 0 0.3rem; font-size: 1.2rem; }
.chooser p { margin: 0 0 0.8rem; color: #cfd8e0; }
.chooser-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
.chooser-card {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.7rem 0.85rem; border-radius: 12px;
  border: 1px solid #3a4553; background: #14181f;
  color: #eef2f6; text-decoration: none;
}
.chooser-card:hover { border-color: #e2b15a; }
.chooser-name { font-weight: 600; }
.chooser-value { font-family: var(--mono); font-size: 1.15rem; }
.chooser-sub { font-size: 0.82rem; color: #c2ccd6; }

.acct-section {
  border: 1px solid #2c3542;
  border-radius: 18px;
  background: #10141a;
  padding: 1.1rem 1.2rem 1.3rem;
  margin-bottom: 1.4rem;
}
.acct-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap;
  padding-bottom: 0.8rem; margin-bottom: 1rem;
  border-bottom: 1px solid #2c3542;
}
.acct-head-title { margin: 0.1rem 0 0; font-size: 1.35rem; }
.acct-head-meta { display: flex; gap: 0.6rem; align-items: center; color: #c2ccd6; font-size: 0.88rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #2c3542;
  border: 1px solid #2c3542;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.sg { background: #151a21; padding: 0.8rem 0.95rem; min-width: 0; }
.sg-label { margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: #e0c68f; font-weight: 600; }
.sg-value { margin: 0.25rem 0 0.1rem; font-family: var(--mono); font-size: 1.35rem; color: #f4f0e6; white-space: nowrap; }
.sg-sub { margin: 0; font-size: 0.8rem; color: #c2ccd6; }
.sg-value.gl-pos, .sg-sub.gl-pos { color: var(--buy); }
.sg-value.gl-neg, .sg-sub.gl-neg { color: var(--sell); }

.chart-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.1rem; }
.chart-panel {
  border: 1px solid #2c3542; border-radius: 14px; background: #14181f;
  padding: 0.85rem 0.9rem 0.6rem; min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.panel-head h3 { margin: 0; font-size: 1rem; }
.trades-head { margin-top: 0.4rem; }
.perf-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem;
  margin-top: 0.5rem; padding-top: 0.6rem; border-top: 1px solid #2c3542;
}
.perf-item { display: flex; flex-direction: column; gap: 0.1rem; }
.perf-item .perf-label { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: #e0c68f; font-weight: 600; }
.perf-item .perf-value { font-family: var(--mono); font-size: 1rem; }
.swatch-dash { background-image: linear-gradient(90deg, transparent 40%, #14181f 40%, #14181f 60%, transparent 60%); }

@media (max-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .perf-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Wider content on large screens so tables and charts use the space */
.workspace > * { max-width: 1560px; }
table.fit-table { table-layout: fixed; width: 100%; min-width: 0; }
table.fit-table th, table.fit-table td { overflow-wrap: anywhere; }
table.fit-table td.num, table.fit-table th.num { overflow-wrap: normal; white-space: nowrap; }
table.fit-table .acct-cell { white-space: nowrap; overflow-wrap: normal; }
/* Portfolio account tabs: stack name over value */
.acct-tabs .acct-tab { flex-direction: column; align-items: flex-start; }
.chart-stack { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.1rem; }
.chart-panel-snap svg.pf-chart { max-width: 1100px; }
table.fit-table th, table.fit-table td { padding-left: 0.6rem; padding-right: 0.6rem; }
table.fit-table .ticker-cell { overflow-wrap: break-word; word-break: normal; }
.gl-combo span { display: block; white-space: nowrap; }
.gl-combo .gl-pct { font-size: 0.8rem; margin-top: 0.1rem; }
table.fit-table .ticker-cell { overflow-wrap: normal; word-break: normal; }
table.fit-table thead th .sort-btn { white-space: normal; text-align: right; line-height: 1.25; }
table.fit-table thead th:not(.num) .sort-btn { text-align: left; }

/* ================================================================ v4 */
/* ---- sidebar: scrollable nav + Accounts group ---- */
.sidebar { overflow: hidden; }
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 0.15rem; }
.nav-group { margin: 0; }
.nav-group > summary { list-style: none; cursor: pointer; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-summary.is-within { color: var(--text); }
.nav-summary.is-within svg:first-child { color: var(--gold); }
.nav-count {
  margin-left: auto; font-family: var(--mono); font-size: 0.72rem; color: #c9d2db;
  background: #1f2732; border-radius: 999px; padding: 0.05rem 0.45rem;
}
.nav-caret { width: 14px !important; height: 14px !important; transition: transform 0.15s ease; color: #c9d2db; }
.nav-group[open] .nav-caret { transform: rotate(90deg); }
.nav-sub { list-style: none; margin: 0.1rem 0 0.35rem; padding: 0 0 0 1.05rem; border-left: 1px solid #2c3542; margin-left: 1.3rem; }
.nav-sublink {
  display: flex; flex-direction: column; gap: 0.05rem; padding: 0.38rem 0.6rem; border-radius: 8px;
  color: #c9d2db; text-decoration: none; font-size: 0.86rem; line-height: 1.25;
}
.nav-sublink:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-sublink.is-active { background: rgba(226, 177, 90, 0.14); color: var(--text); box-shadow: inset 2px 0 0 var(--gold); }
.nav-sub-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub-mask { font-family: var(--mono); font-size: 0.72rem; color: #aab5c0; }
.nav-sub-empty { color: #aab5c0; font-size: 0.82rem; padding: 0.35rem 0.6rem; }
/* ticker page: one section per asset when a ticker names two assets (BTC ETF vs Bitcoin) */
.asset-group-head { margin: 1.6rem 0 0.8rem; padding: 0.8rem 1rem; border: 1px solid #2c3542; border-left: 3px solid #e2b15a; border-radius: 12px; background: #14181f; }
.asset-group-head:first-of-type { margin-top: 0.4rem; }
.asset-group-head h2 { margin: 0.1rem 0 0.2rem; font-size: 1.15rem; color: #f4f0e6; }
.asset-group-head .section-note { margin: 0; color: #c2ccd6; }
.asset-note { margin: 0 0 1rem; }
/* institution sub-headings (only when accounts span more than one institution) */
.nav-sub-head { padding: 0.55rem 0.6rem 0.15rem; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: #aab5c0; font-weight: 600; }
.nav-sub-head:first-child { padding-top: 0.2rem; }

/* ---- range controls ---- */
.section-head { flex-wrap: wrap; }
.range-ctl { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.range-presets { display: inline-flex; border: 1px solid #3a4553; border-radius: 10px; overflow: hidden; }
.range-btn {
  padding: 0.32rem 0.62rem; font-family: var(--mono); font-size: 0.78rem; color: #dbe3ea; text-decoration: none;
  border-right: 1px solid #3a4553; background: #151a21;
}
.range-btn:last-child { border-right: 0; }
.range-btn:hover { background: #1f2732; color: #fff; }
.range-btn.is-active { background: #e2b15a; color: #1c1508; font-weight: 600; }
.range-custom { display: inline-flex; align-items: center; gap: 0.3rem; }
.range-custom input[type="date"] {
  background: #0e1217; border: 1px solid #3a4553; border-radius: 8px; color: #eef2f6;
  padding: 0.26rem 0.4rem; font-family: var(--mono); font-size: 0.76rem; color-scheme: dark;
}
.range-custom .btn.is-active { border-color: var(--gold); color: var(--gold-2); }
.range-dash { color: #aab5c0; }
.range-label { color: #c2ccd6; font-size: 0.8rem; }
.chart-panel .range-ctl { margin: 0.1rem 0 0.5rem; }
.est-note { max-width: 110ch; line-height: 1.45; color: #c2ccd6; }
.est-note strong { color: #f0d9a8; }
.swatch-est { background-image: linear-gradient(90deg, transparent 45%, #14181f 45%, #14181f 60%, transparent 60%); opacity: 0.85; }
.legend.chart-legend { margin: 0.5rem 0 0.2rem; }

/* ---- overview account cards ---- */
.acct-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
.acct-card {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 0.85rem 0.95rem 0.8rem;
  border: 1px solid #2c3542; border-radius: 14px; background: #14181f; color: #eef2f6; text-decoration: none;
  box-shadow: inset 3px 0 0 var(--acct, #e2b15a);
}
.acct-card:hover { border-color: #e2b15a; background: #171c24; }
.acct-card-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.acct-card-name { font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.acct-card-type { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: #e0c68f; font-weight: 600; white-space: nowrap; }
.acct-card-inst { margin-top: -0.2rem; font-size: 0.74rem; color: #c2ccd6; }   /* only when >1 institution */
.acct-card-value { font-family: var(--mono); font-size: 1.35rem; letter-spacing: -0.03em; color: #f4f0e6; }
.acct-card-row { display: flex; justify-content: space-between; gap: 0.5rem; font-family: var(--mono); font-size: 0.8rem; }
.acct-card-k { font-family: var(--sans); color: #aab5c0; font-size: 0.78rem; }
.acct-card-foot { margin-top: 0.15rem; padding-top: 0.4rem; border-top: 1px solid #2c3542; color: #c2ccd6; font-size: 0.76rem; }
.acct-card abbr { color: #e0c68f; }
.dim { color: #8b97a3; }

/* ---- collapsible sections ---- */
details.pf-section {
  border: 1px solid #2c3542; border-radius: 14px; background: #10141a; margin: 0 0 0.8rem;
}
details.pf-section > summary {
  display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; cursor: pointer; list-style: none;
  padding: 0.85rem 1rem; border-radius: 14px;
}
details.pf-section > summary::-webkit-details-marker { display: none; }
details.pf-section > summary::before {
  content: "▸"; color: #e2b15a; font-size: 0.85rem; width: 0.8rem; transition: transform 0.15s ease; display: inline-block;
}
details.pf-section[open] > summary::before { transform: rotate(90deg); }
details.pf-section > summary:hover { background: #151a21; }
details.pf-section[open] > summary { border-bottom: 1px solid #2c3542; border-radius: 14px 14px 0 0; }
.pf-section-title { font-weight: 600; font-size: 1.05rem; color: #eef2f6; }
.pf-section-meta { color: #c2ccd6; font-size: 0.82rem; }
details.pf-section > .table-wrap { margin: 0.8rem; }
details.pf-section > form, details.pf-section > .section-foot { margin: 0.8rem 1rem; }
.section-foot { margin: 0.5rem 0 0; font-size: 0.88rem; }

/* ---- notes / overrides ---- */
.badge-override {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 6px; vertical-align: 1px;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: #1c1508; background: #e2b15a; font-weight: 600;
}
.sg-label .badge-override { margin-left: 0.3rem; }
.pos-note { display: block; color: #f0d9a8; font-size: 0.78rem; font-style: italic; line-height: 1.3; }
.pos-note-block {
  margin: -0.2rem 0 1rem; padding: 0.55rem 0.8rem; border-left: 3px solid #e2b15a; background: rgba(226, 177, 90, 0.08);
  color: #f4f0e6; border-radius: 0 10px 10px 0;
}
.pos-note-k { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: #e0c68f; font-weight: 600; margin-right: 0.4rem; }
.notes-form { margin-top: 1rem; }
.override-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0.8rem 1rem; align-items: start; }
.override-form .form-actions { grid-column: 1 / -1; margin-top: 0; }
.override-form textarea { min-height: 70px; }
.override-form input[type="text"], .override-form textarea {
  width: 100%; background: #0e1217; border: 1px solid #3a4553; border-radius: 10px; color: #eef2f6; padding: 0.55rem 0.7rem;
}

/* ---- ticker page compact account switcher ---- */
.acct-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0 0 1rem; }
.acct-switch-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: #e0c68f; font-weight: 600; margin-right: 0.3rem; }
.acct-switch-link {
  padding: 0.28rem 0.65rem; border: 1px solid #3a4553; border-radius: 999px; color: #dbe3ea; text-decoration: none; font-size: 0.82rem;
}
.acct-switch-link:hover { border-color: #e2b15a; }
.acct-switch-link.is-active { background: rgba(226, 177, 90, 0.16); border-color: #e2b15a; color: #f4f0e6; }
.acct-switch-quiet { border-style: dashed; color: #c2ccd6; }

/* ---- pills for activity / reconciliation ---- */
.pill.action-dividend, .pill.action-interest, .pill.action-cap_gain, .pill.action-return_of_capital, .pill.action-other,
.pill.action-reward {
  color: #f3d7a1; background: rgba(226, 177, 90, 0.12); border-color: rgba(226, 177, 90, 0.4);
}
/* transfers / conversions / deposits: not trades, not income -> cool neutral blue */
.pill.action-transfer_in, .pill.action-transfer_out, .pill.action-conversion, .pill.action-deposit,
.pill.action-withdrawal, .pill.action-other_activity {
  color: #cfe3ff; background: rgba(120, 170, 235, 0.12); border-color: rgba(120, 170, 235, 0.4);
}
.pill-yes { color: var(--buy-ink); background: rgba(61, 204, 142, 0.14); border-color: rgba(61, 204, 142, 0.38); }
.pill-no { color: #dbe3ea; }
.pill-warn { color: #ffd2cb; background: rgba(255, 109, 92, 0.12); border-color: rgba(255, 109, 92, 0.4); }
.pill-quiet { color: #c2ccd6; }
.recon-note { color: #c2ccd6; font-size: 0.82rem; }

/* ---- account page panels ---- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1rem; margin-top: 1.4rem; }
.panel { border: 1px solid #2c3542; border-radius: 14px; background: #14181f; padding: 0.85rem 0.95rem; min-width: 0; }
.panel .table-wrap { margin: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0.3rem 0 0.8rem; }
.mini-stats > div { display: flex; flex-direction: column; gap: 0.1rem; }
.mini-k { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: #e0c68f; font-weight: 600; }
.mini-v { font-family: var(--mono); font-size: 1.02rem; color: #f4f0e6; }
table.compact-table { min-width: 0; }
table.compact-table th, table.compact-table td { padding: 0.45rem 0.5rem; }
.stats.stats-6 .stat-hint { font-size: 0.76rem; }

/* ---- dividends month table, activity pager ---- */
.month-table-wrap { margin-top: 0.8rem; }
/* 14 columns must fit the ~970px content box at 1280px: fixed layout, whole-dollar cells, tight padding.
   The wrap keeps overflow-x as a last resort for very narrow desktop windows. */
table.month-table { table-layout: fixed; width: 100%; min-width: 820px; }
table.month-table col.c-acct { width: 15%; }
table.month-table col.c-total { width: 7.5%; }
table.month-table th, table.month-table td { padding: 0.5rem 0.3rem; font-size: 0.76rem; }
table.month-table th:first-child, table.month-table td:first-child { padding-left: 0.6rem; }
table.month-table th:last-child, table.month-table td:last-child { padding-right: 0.6rem; }
table.month-table td.num, table.month-table th.num { white-space: nowrap; overflow: hidden; text-overflow: clip; }
table.month-table td.month-acct { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
table.month-table .swatch { margin-right: 0.35rem; vertical-align: 1px; }

/* ---- activity table: fixed columns, one-line dates, wrapping account labels ---- */
table.activity-table { table-layout: fixed; width: 100%; min-width: 720px; }
table.activity-table.activity-table-solo { min-width: 520px; }
table.activity-table th, table.activity-table td { padding-left: 0.55rem; padding-right: 0.55rem; }
table.activity-table td.date-cell { white-space: nowrap; font-size: 0.82rem; }
table.activity-table td.act-acct { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
table.activity-table td.act-acct .acct-link { text-decoration: none; color: #e8edf2; font-weight: 500; }
table.activity-table td.act-acct .acct-link:hover { text-decoration: underline; color: #f0cd86; }
table.activity-table .pill { white-space: normal; text-align: center; line-height: 1.2; }

/* ---- like-for-like change scope ---- */
.stat-scope { font-size: 0.74rem; color: #c2ccd6; line-height: 1.35; }
.chart-change { margin: 0.45rem 0 0.1rem; color: #c2ccd6; font-size: 0.86rem; }
/* ---- round 2: positions tables with Avg cost, live prices ---- */
/* 9 columns must fit the ~985px content box at 1280px: tighter padding and slightly smaller digits */
table.fit-table th, table.fit-table td { padding-left: 0.45rem; padding-right: 0.45rem; }
table.fit-table td.num { font-size: 0.82rem; }
table.fit-table td.pos-acct { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
td.pos-acct .acct-link { text-decoration: none; color: #e8edf2; font-weight: 500; }
td.pos-acct .acct-link:hover { text-decoration: underline; color: #f0cd86; }
/* price vs average cost: green above, red below (AA: 8.7:1 and 6.4:1 on #14181f) */
.price-cell.px-above, .sg-value.px-above { color: var(--buy); }
.price-cell.px-below, .sg-value.px-below { color: var(--sell); }
.px-src {
  display: block; width: fit-content; margin: 0.15rem 0 0 auto; padding: 0 0.3rem;
  font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.04em; line-height: 1.5;
  color: #c2ccd6; border: 1px dashed #5a6878; border-radius: 6px;
}
.price-status .px-src { display: inline; margin: 0; }
.price-status { margin: -0.2rem 0 0.9rem; color: #c2ccd6; font-size: 0.8rem; line-height: 1.5; }
.px-badge {
  display: inline-block; padding: 0 0.4rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.6; vertical-align: 1px;
}
.px-badge.px-live { color: #c8f8e0; background: rgba(61, 204, 142, 0.16); border: 1px solid rgba(61, 204, 142, 0.45); }
.px-badge.px-snap { color: #dbe3ea; background: rgba(139, 151, 163, 0.16); border: 1px dashed #5a6878; }
.near-zero { color: #c2ccd6; font-size: 0.92em; }
.exit-note { color: #dbe3ea; }

.swatch.swatch-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; box-shadow: 0 0 0 2px #14181f; }
.chart-change strong { font-family: var(--mono); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin: 1rem 0; }
.pager-status { color: #c2ccd6; font-family: var(--mono); font-size: 0.82rem; }
.btn.is-disabled { opacity: 0.45; pointer-events: none; }
table.activity-table td.num { white-space: nowrap; }
/* units paid in coins: the number stays on one line, the coin wraps under it instead of overflowing */
table.activity-table td.num.units-cell { white-space: normal; }
table.activity-table td.num.units-cell .qty-unit { white-space: nowrap; font-size: 0.78rem; color: #c2ccd6; }
table.activity-table td.num { overflow: hidden; text-overflow: ellipsis; }

/* ---- settings ---- */
.settings-table td { vertical-align: middle; }
.settings-table .sub { display: block; font-size: 0.76rem; }
.cell-input {
  width: 100%; min-width: 12rem; background: #0e1217; border: 1px solid #3a4553; border-radius: 8px;
  color: #eef2f6; padding: 0.42rem 0.55rem;
}
.cell-input:focus { border-color: var(--gold); outline: none; }
.cell-input-sm { min-width: 7rem; }
.cell-input-num { min-width: 0; width: 5.5rem; text-align: right; font-family: var(--mono); }
.check { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; color: #dbe3ea; }
.check input { width: 1rem; height: 1rem; accent-color: #e2b15a; }
.settings-notes { margin: 1rem 0 0; padding-left: 1.1rem; color: #c2ccd6; font-size: 0.86rem; line-height: 1.5; max-width: 95ch; }
.settings-notes strong { color: #eef2f6; }
/* crypto review: fit 7 columns in ~990px (1280 viewport - sidebar) without overflow; inputs are
   fluid inside fixed column widths, so "iTrust Capital" fits and the Account column stays readable */
.settings-table .acct-id, .settings-table .acct-synced { display: block; font-size: 0.76rem; overflow-wrap: break-word; }
.settings-table .acct-link { overflow-wrap: break-word; }
@media (min-width: 861px) {
  table.settings-table { table-layout: fixed; min-width: 0; }
  table.settings-table th, table.settings-table td { padding-left: 0.5rem; padding-right: 0.5rem; }
  table.settings-table .cell-input { min-width: 0; width: 100%; font-size: 0.86rem; padding: 0.4rem 0.45rem; }
  table.settings-table td.num { white-space: nowrap; }
}
code { font-family: var(--mono); font-size: 0.86em; color: #f3d7a1; }

@media (max-width: 1200px) {
  .two-col { grid-template-columns: 1fr; }
  .stats.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .nav { overflow-y: visible; }
  .nav-group { position: relative; }
  .nav-sub { margin-left: 0; }
  .override-form { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats.stats-6 { grid-template-columns: 1fr 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  /* card layout: rows become blocks, so drop the fixed desktop grid */
  table.activity-table, table.activity-table.activity-table-solo, table.month-table { table-layout: auto; min-width: 0; }
  table.activity-table td.act-acct, table.month-table td.month-acct { text-align: right; }
}

/* ================================================================ v5 */
/* ---- ticker ribbon (every signed-in page): CSS-only seamless loop ---- */
.ribbon {
  position: relative; overflow: hidden; margin: -0.4rem 0 1rem; border: 1px solid #2c3542; border-radius: 10px;
  background: #0e1217; color: #eef2f6; font-family: var(--mono); font-size: 0.8rem; line-height: 1;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}
.ribbon:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ribbon-track { display: flex; width: max-content; animation: ribbon-scroll var(--ribbon-dur, 120s) linear infinite; }
.ribbon:hover .ribbon-track, .ribbon:focus .ribbon-track, .ribbon:focus-within .ribbon-track { animation-play-state: paused; }
.ribbon-list { display: flex; flex: none; list-style: none; margin: 0; padding: 0 1.4rem 0 0; gap: 1.4rem; }
.rb-item { flex: none; white-space: nowrap; }
.rb-link { display: inline-flex; align-items: baseline; gap: 0.4rem; padding: 0.55rem 0; color: #eef2f6; text-decoration: none; }
.rb-link:hover .rb-name, .rb-link:focus-visible .rb-name { text-decoration: underline; color: #f3d7a1; }
.rb-name { font-family: var(--sans); font-weight: 600; color: #eef2f6; }
.rb-price { color: #dbe3ea; }
.rb-up .rb-chg { color: #5fe0a6; }
.rb-down .rb-chg { color: #ff8f80; }
.rb-flat .rb-chg { color: #c2ccd6; }
@keyframes ribbon-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ribbon { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .ribbon-track { animation: none; }
  .ribbon-list[aria-hidden="true"] { display: none; }
  .ribbon-list { padding-left: 0.8rem; }
}

/* ---- shared change colours (an arrow/sign is always shown too) ---- */
.chg { font-family: var(--mono); font-size: 0.86rem; white-space: nowrap; }
.chg-up { color: #5fe0a6; }
.chg-down { color: #ff8f80; }
.chg-flat { color: #c2ccd6; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #3a4553; border-radius: 10px; overflow: hidden; }
.seg-btn { padding: 0.3rem 0.62rem; font-family: var(--mono); font-size: 0.78rem; color: #dbe3ea; text-decoration: none;
  background: #151a21; border-right: 1px solid #3a4553; }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: #1f2732; color: #fff; }
.seg-btn.is-active { background: #e2b15a; color: #1c1508; font-weight: 600; }
.empty-note { color: #dbe3ea; background: #151a21; border: 1px dashed #3a4553; border-radius: 12px; padding: 0.8rem 0.9rem; margin: 0.3rem 0; }

/* ---- market dashboard ---- */
.mkt-summary { border: 1px solid rgba(226, 177, 90, 0.35); background: #1a1710; border-radius: 14px;
  padding: 0.85rem 1rem; margin: 0 0 1rem; }
.mkt-summary h2 { margin: 0 0 0.3rem; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: #e0c68f; }
.mkt-summary p { margin: 0; color: #f1e9d8; line-height: 1.55; max-width: 140ch; }
.idx-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
.idx-card {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem 0.85rem 0.65rem; min-width: 0;
  border: 1px solid #2c3542; border-radius: 14px; background: #14181f; color: #eef2f6; text-decoration: none;
}
.idx-card:hover { border-color: #e2b15a; background: #171c24; }
.idx-card.is-selected { border-color: #e2b15a; box-shadow: inset 0 -2px 0 #e2b15a; }
.idx-head { display: flex; justify-content: space-between; gap: 0.4rem; align-items: baseline; }
.idx-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idx-key { font-family: var(--mono); font-size: 0.7rem; color: #aab5c0; }
.idx-last { font-family: var(--mono); font-size: 1.35rem; letter-spacing: -0.03em; color: #f4f0e6; }
.idx-card .spark { display: block; width: 100%; height: 40px; margin: 0.2rem 0 0.1rem; }
.idx-nospark { font-size: 0.78rem; color: #aab5c0; height: 40px; display: flex; align-items: center; }
.idx-foot { font-size: 0.74rem; color: #c2ccd6; }
.idx-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.6rem; }
.idx-tab { padding: 0.26rem 0.65rem; border: 1px solid #3a4553; border-radius: 999px; color: #dbe3ea; text-decoration: none; font-size: 0.82rem; }
.idx-tab:hover { border-color: #e2b15a; }
.idx-tab.is-active { background: #2a2418; border-color: #e2b15a; color: #f4f0e6; }
.section-head h2 .section-note { font-weight: 500; font-size: 0.8rem; margin-left: 0.4rem; color: #c2ccd6; }
.mkt-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; margin: 1.2rem 0 1rem; align-items: start; }
.mkt-two .panel { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.sector-table .table-wrap { margin: 0.6rem; }
.fng-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; }
.fng-big { display: flex; flex-direction: column; align-items: center; min-width: 7.5rem; padding: 0.5rem 0.8rem;
  border-radius: 14px; border: 1px solid #3a4553; background: #10141a; }
.fng-score { font-family: var(--mono); font-size: 2.6rem; line-height: 1.05; color: #f4f0e6; }
.fng-rating { font-weight: 600; font-size: 0.92rem; color: #f4f0e6; text-align: center; }
.fng-extreme-fear { box-shadow: inset 0 -3px 0 #ff6d5c; }
.fng-fear { box-shadow: inset 0 -3px 0 #f0a35e; }
.fng-neutral { box-shadow: inset 0 -3px 0 #8b97a3; }
.fng-greed { box-shadow: inset 0 -3px 0 #7fd1a8; }
.fng-extreme-greed { box-shadow: inset 0 -3px 0 #3dcc8e; }
.fng-meter { position: relative; padding-top: 4px; }
.fng-scale { display: grid; grid-template-columns: 25fr 20fr 10fr 20fr 25fr; height: 10px; border-radius: 999px; overflow: hidden; }
.fng-scale .b1 { background: #ff6d5c; }
.fng-scale .b2 { background: #f0a35e; }
.fng-scale .b3 { background: #8b97a3; }
.fng-scale .b4 { background: #7fd1a8; }
.fng-scale .b5 { background: #3dcc8e; }
.fng-pin { position: absolute; top: 0; width: 4px; height: 18px; margin-left: -2px; background: #f4f0e6; border-radius: 2px;
  box-shadow: 0 0 0 2px #0c0e12; }
.fng-scale-labels { display: flex; justify-content: space-between; gap: 0.4rem; margin-top: 0.35rem; font-size: 0.72rem; color: #c2ccd6; }
.fng-prev { list-style: none; margin: 0.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; }
.fng-prev li { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.45rem 0.55rem; border: 1px solid #2c3542; border-radius: 10px; background: #10141a; min-width: 0; }
.fng-prev-k { font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; color: #e0c68f; font-weight: 600; }
.fng-prev-v { font-family: var(--mono); font-size: 1rem; color: #f4f0e6; }
.fng-prev-v .sub { font-family: var(--sans); font-size: 0.74rem; display: block; }
.fng-comps { list-style: none; margin: 0.6rem 1rem 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.fng-comps li { display: flex; justify-content: space-between; gap: 0.8rem; font-size: 0.86rem; color: #eef2f6; }
.fng-comp-name .sub { display: block; font-size: 0.74rem; }
.fng-comp-v { font-family: var(--mono); white-space: nowrap; color: #f4f0e6; }
.news-panel { margin: 0 0 1rem; }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.4rem; }
.news-item { padding: 0.5rem 0; border-bottom: 1px solid #222a35; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.news-title { color: #eef2f6; text-decoration: none; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
a.news-title:hover, a.news-title:focus-visible { color: #f3d7a1; text-decoration: underline; }
.news-meta { font-size: 0.76rem; color: #c2ccd6; }
.news-compact { grid-template-columns: 1fr; }
.news-compact .news-item { display: block; }
.bot-link { margin-top: 0.4rem; }

/* ---- recommendations ---- */
.reco-disclaimer { margin: 0 0 1rem; padding: 0.7rem 0.95rem; border-radius: 12px; border: 1px solid #e2b15a;
  background: #2a2418; color: #f4f0e6; font-size: 0.95rem; line-height: 1.45; }
.reco-stats .stat-of { font-size: 0.95rem; color: #c2ccd6; }
.stat-value.stat-small { font-size: 1.05rem; letter-spacing: -0.01em; padding-top: 0.35rem; }
.reco-head, .reco-sum, .reco-pending {
  display: grid; align-items: center; gap: 0.6rem;
  grid-template-columns: 2.2rem minmax(8rem, 1.5fr) 8.5rem minmax(9rem, 1.4fr) repeat(4, 3.6rem) 7.5rem;
}
.reco-head { padding: 0.5rem 0.9rem; margin: 0 0 0.3rem; border-radius: 10px; background: #1b2330; color: #eef2f6;
  font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; }
.reco-head .num, .reco-sum .num { text-align: right; }
.reco-list { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.reco-row { border: 1px solid #2c3542; border-radius: 12px; background: #14181f; }
details.reco-row[open] { border-color: #4a5566; }
.reco-sum { padding: 0.6rem 0.9rem; cursor: pointer; list-style: none; border-radius: 12px; }
.reco-sum::-webkit-details-marker { display: none; }
.reco-sum:hover { background: #171c24; }
.reco-rank { font-family: var(--mono); color: #c2ccd6; font-size: 0.82rem; white-space: nowrap; }
details.reco-row .reco-rank::after { content: "\25B8"; color: #e2b15a; margin-left: 0.3rem; display: inline-block; transition: transform 0.15s ease; }
details.reco-row[open] .reco-rank::after { transform: rotate(90deg); }
.reco-tk { display: flex; flex-direction: column; min-width: 0; }
.reco-tk .ticker-cell { color: #f3d7a1; font-weight: 600; }
.reco-name { font-size: 0.74rem; color: #c2ccd6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reco-score { display: flex; align-items: center; gap: 0.45rem; }
.reco-score-n { font-family: var(--mono); font-size: 1.15rem; color: #f4f0e6; min-width: 2ch; text-align: right; }
.reco-bar { flex: 1; height: 6px; border-radius: 999px; background: #262f3b; overflow: hidden; }
.reco-bar span { display: block; height: 100%; background: #e2b15a; }
.reco-label { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.reco-f, .reco-held { font-family: var(--mono); font-size: 0.86rem; color: #eef2f6; }
.pill.reco-strong { color: #c8f8e0; background: #143326; border-color: #2f8f66; }
.pill.reco-good { color: #d9f5e6; background: #16281f; border-color: #4f8f70; }
.pill.reco-neutral { color: #dbe3ea; }
.pill.reco-wait { color: #ffd2cb; background: #2e1a18; border-color: #a5544a; }
.pill.tone-positive { color: #c8f8e0; border-color: #2f8f66; }
.pill.tone-negative { color: #ffd2cb; border-color: #a5544a; }
.reco-body { padding: 0.4rem 0.9rem 0.9rem; border-top: 1px solid #2c3542; }
.reco-body .table-wrap { margin: 0.5rem 0 0.8rem; }
.reco-table td.reco-why { color: #dbe3ea; font-size: 0.86rem; line-height: 1.35; }
.reco-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; }
.reco-cols h4 { margin: 0 0 0.35rem; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: #e0c68f; }
.reco-cols p { margin: 0 0 0.45rem; color: #eef2f6; font-size: 0.9rem; }
.reco-cols p.reco-years { font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; }
.reco-months summary { cursor: pointer; color: #f3d7a1; font-size: 0.85rem; margin: 0.2rem 0; }
.month-stats { max-width: 24rem; }
.reco-meta { margin: 0.6rem 0 0; font-size: 0.78rem; }
.reco-pending { padding: 0.6rem 0.9rem; border-style: dashed; background: #10141a; }
.reco-pending-note { grid-column: 3 / -1; color: #dbe3ea; font-size: 0.86rem; }
.watch-form { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr) auto; gap: 0.7rem; align-items: end; }
.watch-list { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.watch-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.35rem 0; border-bottom: 1px solid #222a35; }
.watch-list .inline-form { margin-left: auto; }
#watchlist { margin: 1.2rem 0 1rem; }
.explainer-body { padding: 0.4rem 1rem 0.8rem; color: #eef2f6; font-size: 0.9rem; line-height: 1.5; }
.explainer-body ul { padding-left: 1.1rem; }
.explainer-body li { margin: 0.35rem 0; }
.formula code { font-size: 0.92rem; color: #f3d7a1; white-space: normal; }

.chart-scroll { overflow-x: auto; }
@media (max-width: 1399px) {
  .mkt-two { grid-template-columns: minmax(0, 1fr); }
  .mkt-two .pf-chart { max-width: 760px; }
}
@media (max-width: 1200px) {
  .idx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .reco-head { display: none; }
  /* compact rows: rank | ticker (2 cols) | score (2 cols); then label; then the 4 factors; then held */
  .reco-sum, .reco-pending { grid-template-columns: 2rem repeat(4, minmax(0, 1fr)); row-gap: 0.4rem; }
  .reco-tk { grid-column: 2 / 4; }
  .reco-score { grid-column: 4 / 6; }
  .reco-label { grid-column: 2 / -1; }
  .reco-sum .reco-f[data-label="Trend"] { grid-column: 2; }
  .reco-sum .reco-held { grid-column: 2 / -1; }
  .reco-sum .reco-f, .reco-sum .reco-held { text-align: left; font-size: 0.8rem; }
  .reco-f::before, .reco-held::before { content: attr(data-label) " "; font-family: var(--sans); color: #c2ccd6; font-size: 0.7rem;
    letter-spacing: 0.05em; text-transform: uppercase; }
  .reco-pending-note { grid-column: 2 / -1; }
}
@media (max-width: 980px) {
  .reco-cols { grid-template-columns: minmax(0, 1fr); }
  .news-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .idx-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .idx-card { padding: 0.6rem 0.65rem 0.55rem; }
  .idx-last { font-size: 1.1rem; }
  .idx-card .chg { font-size: 0.74rem; white-space: normal; }
  .fng-top { grid-template-columns: minmax(0, 1fr); }
  .fng-prev { grid-template-columns: 1fr 1fr; }
  .watch-form { grid-template-columns: minmax(0, 1fr); }
  .reco-sum, .reco-pending { grid-template-columns: 1.6rem repeat(4, minmax(0, 1fr)); gap: 0.4rem 0.45rem; padding: 0.55rem 0.7rem; }
  .ribbon { margin-top: 0; }
  .chart-scroll > .pf-chart { min-width: 440px; }
}

/* ---------------------------------------------------------------- v5 security: Settings > Security, 2FA sign-in */
.settings-tabs { display: flex; gap: 0.4rem; margin: 0 0 1rem; border-bottom: 1px solid #2c3542; }
.settings-tab { padding: 0.5rem 0.9rem; color: #c9d2db; text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.settings-tab:hover { color: #f4f0e6; }
.settings-tab.is-active { color: #f4f0e6; border-bottom-color: var(--gold); }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.sec-panel { margin-bottom: 1rem; }
.sec-panel h3 { color: #eef2f6; }
.sec-sub { color: #c2ccd6; font-size: 0.84rem; }
.sec-note { color: #c2ccd6; margin: 0.4rem 0 0.8rem; line-height: 1.5; }
.sec-warn { color: #ffd2cb; margin: 0.4rem 0 0.8rem; font-weight: 600; }
.sec-status { color: #f3d7a1; margin: 0.5rem 0 0; }
.sec-facts { margin: 0.3rem 0 0; display: grid; gap: 0.45rem; }
.sec-facts div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #222a35; padding-bottom: 0.35rem; }
.sec-facts dt { color: #c2ccd6; }
.sec-facts dd { margin: 0; color: #eef2f6; text-align: right; }
.sec-inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.8rem; margin: 0.4rem 0 0.6rem; }
.sec-inline-form .field { flex: 1 1 220px; margin: 0; }
.sec-rename { display: flex; gap: 0.4rem; align-items: center; }
.sec-rename input[type="text"] { min-width: 10rem; padding: 0.35rem 0.55rem; }
.sec-table td { vertical-align: middle; color: #eef2f6; }
.sec-panel code, .twofa-card code { color: #f3d7a1; background: #0e1217; border: 1px solid #2c3542; border-radius: 6px; padding: 0.05rem 0.35rem; }
.totp-setup { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; }
.qr-box { background: #ffffff; padding: 0.4rem; border-radius: 10px; width: 232px; max-width: 100%; line-height: 0; }
.qr-box svg { width: 100%; height: auto; display: block; }
.totp-steps { flex: 1 1 280px; color: #eef2f6; }
.totp-steps ol { margin: 0 0 0.6rem; padding-left: 1.2rem; line-height: 1.6; }
.totp-secret { display: inline-block; margin-top: 0.3rem; font-family: var(--mono); letter-spacing: 0.06em; word-break: break-all; }
.recovery-box { border: 1px solid #a5544a; background: #2e1a18; border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 0.8rem; }
.recovery-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.45rem; }
.recovery-list code { font-family: var(--mono); font-size: 1rem; letter-spacing: 0.05em; color: #f4f0e6; }
.login-stage-single { grid-template-columns: 1fr; }
.twofa-card .btn { width: 100%; }
.twofa-method { margin: 0.4rem 0 0.2rem; }
.twofa-status { color: #f3d7a1; margin: 0.6rem 0 0; }
.twofa-or { display: flex; align-items: center; gap: 0.6rem; color: #c2ccd6; margin: 1rem 0 0.6rem; }
.twofa-or::before, .twofa-or::after { content: ""; flex: 1; border-top: 1px solid #2c3542; }
.twofa-foot { margin: 1rem 0 0; text-align: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
