/* ============================================================
   Ledger — fixed income portfolio dashboard
   Design tokens. Light is the default palette on :root; dark
   applies only when the reader has explicitly chosen it, so the
   dashboard opens light regardless of the operating system.
   ============================================================ */
:root {
  color-scheme: light;

  --surface-1: #fcfcfb;        /* cards, chart surface */
  --surface-2: #f4f3f0;        /* insets, table stripes */
  --surface-3: #eceae5;        /* hover wash */
  --plane:     #f9f9f7;        /* page background */

  --text-1: #0b0b0b;
  --text-2: #52514e;
  --text-3: #898781;

  --rule:     #e1e0d9;
  --rule-2:   #c3c2b7;
  --ring:     rgba(11, 11, 11, 0.10);

  --pos: #006300;              /* gain text  — 7.35:1 */
  --neg: #a4231f;              /* loss text  — 7.21:1 */
  --pos-mark: #0ca30c;
  --neg-mark: #d03b3b;
  --warn: #fab219;
  --pos-wash: rgba(12, 163, 12, 0.10);
  --neg-wash: rgba(208, 59, 59, 0.10);

  --series-1: #2a78d6;         /* categorical slot 1 — blue */
  --series-2: #eb6834;         /* categorical slot 2 — orange */
  --ord-strong: #2a78d6;       /* ordinal ramp: certain */
  --ord-soft:   #86b6ef;       /* ordinal ramp: projected */
  --accent: #2a78d6;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --brand: #17244b;              /* the shield navy */

  --shadow-1: 0 1px 2px rgba(11, 11, 11, 0.05), 0 0 0 1px var(--ring);
  --shadow-2: 0 10px 30px rgba(11, 11, 11, 0.12), 0 0 0 1px var(--ring);

  --radius: 10px;
  --radius-sm: 6px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1560px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --surface-2: #212120;
  --surface-3: #2c2c2a;
  --plane:     #0d0d0d;
  --text-1: #ffffff;
  --text-2: #c3c2b7;
  --text-3: #898781;
  --rule:   #2c2c2a;
  --rule-2: #383835;
  --ring:   rgba(255, 255, 255, 0.10);
  --pos: #3fbf3f;
  --neg: #ff6b6b;
  --pos-mark: #0ca30c;
  --neg-mark: #e66767;
  --pos-wash: rgba(12, 163, 12, 0.16);
  --neg-wash: rgba(230, 103, 103, 0.16);
  --series-1: #3987e5;
  --series-2: #d95926;
  --ord-strong: #3987e5;
  --ord-soft:   #184f95;
  --accent: #3987e5;
  --accent-wash: rgba(57, 135, 229, 0.16);
  --brand: #b8c6e8;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--ring);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--ring);
}

* { box-sizing: border-box; }
/* Any author rule that sets `display` beats the UA stylesheet's [hidden]
   rule, so `hidden` silently stops working on flex/grid elements. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--plane);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--text-3); }
.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;
}

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface-1);
  border-bottom: 1px solid var(--rule);
}
.appbar-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; gap: 20px; height: 60px;
}
.brand { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 24px; height: 30px;      /* shield is taller than it is wide */
  color: var(--brand);
  align-self: center; flex-shrink: 0;
}
.brand h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.brand .sub {
  font-size: 12px; color: var(--text-3);
  padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--rule-2);
}
.appbar-spacer { flex: 1; }

.search {
  position: relative; flex-shrink: 1; min-width: 140px;
}
.search input {
  width: 240px; max-width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 7px 10px 7px 30px;
  font: inherit; font-size: 13px; color: var(--text-1);
}
.search input::placeholder { color: var(--text-3); }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: inherit; font-size: 10px; color: var(--text-3);
  border: 1px solid var(--rule-2); border-radius: 4px; padding: 0 4px;
}

.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 7px 12px; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-icon { padding: 7px; }
.btn .spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status strip ---------- */
.statusbar {
  border-bottom: 1px solid var(--rule);
  background: var(--surface-1);
  position: sticky; top: 60px; z-index: 39;
}
.statusbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 8px 24px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.dot.ok { background: var(--pos-mark); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--neg-mark); }
.dot.busy { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.status-item { display: inline-flex; align-items: center; gap: 6px; }
.status-sep { color: var(--rule-2); }

/* ---------- Tabs ---------- */
.tabs {
  max-width: var(--max); margin: 0 auto; padding: 0 24px;
  display: flex; gap: 2px;
}
.tabsbar { background: var(--plane); border-bottom: 1px solid var(--rule); position: sticky; top: 97px; z-index: 38; }
.tab {
  font: inherit; font-size: 13px; font-weight: 500;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-2); padding: 11px 14px; cursor: pointer; margin-bottom: -1px;
}
.tab:hover { color: var(--text-1); }
.tab[aria-selected="true"] { color: var(--text-1); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- Layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 22px 24px 80px; }
.panel[hidden] { display: none; }
.section { margin-bottom: 22px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 10px;
}
.section-head h2 { font-size: 14px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.section-head p { margin: 0; font-size: 12px; color: var(--text-3); }

.card {
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.card-title { font-size: 13px; font-weight: 620; margin: 0; }
.card-note { font-size: 11px; color: var(--text-3); margin: 0; }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

/* ---------- Hero band ---------- */
.hero {
  background: var(--surface-1); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 20px 22px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 28px; flex-wrap: wrap;
}
.hero-label { font-size: 12px; color: var(--text-2); margin: 0 0 4px; }
.hero-value { font-size: 48px; font-weight: 620; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
.hero-delta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.hero-facts { display: flex; gap: 30px; flex-wrap: wrap; }
.hero-fact span { display: block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.hero-fact strong { display: block; font-size: 19px; font-weight: 600; margin-top: 3px; letter-spacing: -0.01em; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 550; padding: 2px 8px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-2);
}
.chip.up { background: var(--pos-wash); color: var(--pos); }
.chip.down { background: var(--neg-wash); color: var(--neg); }

/* ---------- Stat tiles ---------- */
.tile {
  background: var(--surface-1); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 13px 15px 12px;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.tile-label {
  font-size: 11px; color: var(--text-2); font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.tile-value { font-size: 22px; font-weight: 620; letter-spacing: -0.02em; line-height: 1.2; }
.tile-value.sm { font-size: 18px; }
.tile-sub { font-size: 11px; color: var(--text-3); }

.info {
  display: inline-grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%; padding: 0;
  border: 1px solid var(--rule-2); background: none; color: var(--text-3);
  font: inherit; font-size: 9px; font-weight: 700; line-height: 1;
  cursor: pointer; flex-shrink: 0;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.info:hover { color: var(--accent); border-color: var(--accent); }
.info[aria-expanded="true"] {
  color: #fff; background: var(--accent); border-color: var(--accent);
}

.infopop {
  position: fixed; z-index: 92; max-width: 280px;
  background: var(--surface-1); color: var(--text-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  padding: 10px 12px; font-size: 12px; line-height: 1.55;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.infopop.open { opacity: 1; transform: none; }
.infopop[hidden] { display: none; }
.infopop b {
  display: block; color: var(--text-1);
  font-size: 12px; font-weight: 650; margin-bottom: 3px;
}

/* ---------- Charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart-wrap { position: relative; margin-top: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); margin-top: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.axis-text { font-size: 10px; fill: var(--text-3); }
.axis-line { stroke: var(--rule-2); stroke-width: 1; }
.grid-line { stroke: var(--rule); stroke-width: 1; }
.bar-label { font-size: 11px; fill: var(--text-2); }
.bar-value { font-size: 11px; fill: var(--text-1); font-weight: 550; font-variant-numeric: tabular-nums; }

.tooltip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--surface-1); color: var(--text-1);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  padding: 9px 11px; font-size: 12px; max-width: 300px;
  opacity: 0; transition: opacity 0.1s ease;
}
.tooltip.show { opacity: 1; }
.tooltip h4 { margin: 0 0 5px; font-size: 12px; font-weight: 620; }
.tooltip-row { display: flex; justify-content: space-between; gap: 16px; color: var(--text-2); }
.tooltip-row b { color: var(--text-1); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Table ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.seg button {
  font: inherit; font-size: 12px; font-weight: 500;
  background: none; border: 0; border-radius: 5px;
  padding: 5px 11px; cursor: pointer; color: var(--text-2);
}
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-1); box-shadow: var(--shadow-1); font-weight: 600; }

.table-card { background: var(--surface-1); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-1);
  text-align: right; font-size: 11px; font-weight: 600; color: var(--text-2);
  padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--rule-2); cursor: pointer; user-select: none;
}
thead th:first-child { text-align: left; }
thead th:hover { color: var(--text-1); }
thead th .arrow { opacity: 0; margin-left: 3px; }
thead th[aria-sort] .arrow { opacity: 1; color: var(--accent); }
tbody td {
  text-align: right; padding: 9px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums;
}
tbody td:first-child { text-align: left; font-variant-numeric: normal; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr.unfunded td:first-child { opacity: 1; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td {
  text-align: right; padding: 11px 12px; font-weight: 650;
  border-top: 1px solid var(--rule-2); font-variant-numeric: tabular-nums;
  background: var(--surface-2); white-space: nowrap;
}
tfoot td:first-child { text-align: left; }

.pos-name { display: flex; flex-direction: column; gap: 1px; min-width: 210px; max-width: 320px; }
.pos-name b { font-weight: 570; font-size: 13px; white-space: normal; line-height: 1.3; }
.pos-name span { font-size: 11px; color: var(--text-3); }
.tag {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
  padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2);
  text-transform: uppercase;
}
.tag.bond { background: var(--accent-wash); color: var(--accent); }
.tag.fund { background: rgba(235, 104, 52, 0.12); color: var(--series-2); }
.tag.perp { background: var(--surface-3); color: var(--text-2); }

.wbar { display: flex; align-items: center; gap: 7px; justify-content: flex-end; }
.wbar-track {
  display: block; width: 58px; height: 5px; border-radius: 3px;
  background: var(--surface-3); overflow: hidden; flex-shrink: 0;
}
.wbar-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); min-width: 1px; }

.spark { display: block; }

/* ---------- Drawer ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(11, 11, 11, 0.42);
  opacity: 0; transition: opacity 0.18s ease;
}
.scrim.open { opacity: 1; }
.scrim[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(560px, 100vw);
  background: var(--surface-1);
  box-shadow: var(--shadow-2);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer.open { transform: none; }
.drawer[hidden] { display: none; }
.drawer-head {
  padding: 16px 20px; border-bottom: 1px solid var(--rule);
  display: flex; align-items: flex-start; gap: 14px;
}
.drawer-head h3 { margin: 0 0 3px; font-size: 15px; font-weight: 620; line-height: 1.3; }
.drawer-head .meta { font-size: 12px; color: var(--text-3); }
.drawer-head a { color: var(--accent); text-decoration: none; }
.drawer-head a:hover { text-decoration: underline; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.drawer-foot {
  padding: 10px 20px; border-top: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-3); background: var(--surface-2);
}
.close-x {
  font: inherit; background: none; border: 0; cursor: pointer;
  color: var(--text-3); font-size: 20px; line-height: 1; padding: 2px 6px; margin-left: auto;
}
.close-x:hover { color: var(--text-1); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.field input, .field textarea {
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 7px 9px; width: 100%;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.field .hint { font-size: 10px; color: var(--text-3); }
.field-auto {
  font: inherit; font-size: 10px; background: none; border: 0; padding: 0;
  color: var(--accent); cursor: pointer; text-align: left;
}
.field-auto:hover { text-decoration: underline; }
.auto-badge {
  font-size: 9px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--accent-wash); color: var(--accent); padding: 1px 5px; border-radius: 3px;
}

.readout {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; background: var(--rule); border-radius: var(--radius-sm); overflow: hidden;
}
.readout div { background: var(--surface-2); padding: 9px 11px; }
.readout span { display: block; font-size: 10px; color: var(--text-3); }
.readout strong { display: block; font-size: 15px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.subhead {
  font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-3); margin: 22px 0 9px;
}
.subhead:first-child { margin-top: 0; }

/* ---------- Banners, empty, toast ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--accent-wash); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
  box-shadow: 0 0 0 1px var(--ring);
}
.banner b { display: block; font-size: 13px; margin-bottom: 2px; }
.banner p { margin: 0; font-size: 12px; color: var(--text-2); }
.progress-track { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 9px; max-width: 320px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s ease; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 12px);
  z-index: 95; background: var(--text-1); color: var(--plane);
  padding: 9px 15px; border-radius: 20px; font-size: 13px; font-weight: 500;
  opacity: 0; transition: opacity 0.18s ease, transform 0.18s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footnote {
  max-width: var(--max); margin: 0 auto; padding: 0 24px 40px;
  font-size: 11px; color: var(--text-3); line-height: 1.6;
}
.footnote strong { color: var(--text-2); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .appbar-inner { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .statusbar, .tabsbar { position: static; }
  .statusbar-inner, .tabs, main, .footnote { padding-left: 16px; padding-right: 16px; }
  .tabs { overflow-x: auto; }
  .g6, .g5, .g4, .g3, .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: span 2; }
  .hero-value { font-size: 36px; }
  .hero { gap: 18px; }
  .search input { width: 100%; }
}
@media (max-width: 560px) {
  .g6, .g5, .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
  .drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- HTML bar marks ---------- */
.ranked { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ranked-row {
  display: grid; grid-template-columns: minmax(90px, 1.4fr) minmax(60px, 2fr) auto;
  align-items: center; gap: 10px;
}
.ranked-label {
  font-size: 12px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ranked-track { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.ranked-fill { height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
.ranked-value { font-size: 12px; font-weight: 550; text-align: right; min-width: 62px; }
.ranked-row:hover .ranked-label { color: var(--text-1); }

.propbar { display: flex; gap: 2px; height: 26px; margin-top: 12px; }
.propbar-seg:first-child { border-radius: 4px 0 0 4px; }
.propbar-seg:last-child { border-radius: 0 4px 4px 0; }
.propbar-seg:only-child { border-radius: 4px; }


/* The first subhead inside the computed block resets its own top margin,
   so the block itself carries the gap from the fields above it. */
#drawerComputed { margin-top: 22px; }

/* ---------- Add / remove instruments ---------- */
.field select {
  font: inherit; font-size: 13px;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 7px 9px; width: 100%;
}
.field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.field.span2 { grid-column: span 2; }

.btn-remove { font-size: 12px; padding: 4px 10px; }
.btn-danger {
  background: var(--neg-mark); border-color: transparent; color: #fff; font-weight: 600;
}
.btn-danger:hover { background: var(--neg-mark); filter: brightness(1.08); }

.form-error {
  margin: 16px 0 0; padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--neg-wash); color: var(--neg); font-size: 12px;
}
.form-error[hidden] { display: none; }

/* Value read out while scrubbing the portfolio chart */
.scrub {
  font-variant-numeric: tabular-nums; font-weight: 620;
  margin-left: 8px; color: var(--accent);
}

/* Prices update only on the schedule, so the bar states when — no manual trigger */
.next-close {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 7px 11px; white-space: nowrap;
}

/* ---------- Sign in / setup ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface-1); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: 28px 26px;
}
.auth-card.wide { max-width: 560px; }
.auth-lead { margin: 0 0 20px; font-size: 13px; color: var(--text-2); text-align: center; }
.auth-card .field { margin-bottom: 14px; }
.auth-submit { width: 100%; justify-content: center; margin-top: 6px; padding: 10px; }
.auth-step { margin: 22px 0 10px; font-size: 12px; font-weight: 650; color: var(--text-1); }
.auth-qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--radius-sm); }
.auth-qr svg { width: 190px; height: 190px; }
.auth-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 11px;
  word-break: break-all; text-align: center; letter-spacing: 0.04em;
}
.auth-codes {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px;
}
.auth-warn {
  background: var(--neg-wash); color: var(--neg); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 12px; margin: 12px 0;
}

/* A range with no data behind it is offered but inert */
.seg button:disabled { opacity: 0.35; cursor: not-allowed; }
.seg button:disabled:hover { background: none; }

/* ---------- Position detail header ---------- */
.drawer { width: min(680px, 100vw); }
.pos-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  background: var(--surface-2); border-radius: var(--radius);
  padding: 16px 18px;
}
.pos-hero-label { margin: 0 0 3px; font-size: 11px; color: var(--text-2); }
.pos-hero-value { margin: 0; font-size: 30px; font-weight: 620; letter-spacing: -0.02em; line-height: 1.1; }
.pos-hero-facts { display: flex; gap: 22px; }
.pos-hero-facts span { display: block; font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.pos-hero-facts strong { display: block; font-size: 16px; font-weight: 600; margin-top: 2px; }

/* The account being signed in as, once the email step is done */
.auth-who {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 9px 12px; margin-bottom: 14px; font-size: 13px;
}
