/* 13D Portfolio Monitor — app.css
   Nexus Light Palette, system sans-serif, desktop-first.
   No emoji. No decorative icons.
*/

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:          #F7F6F2;
  --surface:     #F9F8F5;
  --surface-alt: #FBFBF9;
  --border:      #D4D1CA;
  --text:        #28251D;
  --text-muted:  #7A7974;
  --text-faint:  #BAB9B4;
  --primary:     #01696F;
  --primary-hov: #0C4E54;
  --error:       #A12C7B;
  --warning:     #964219;
  --success:     #437A22;
  --gold:        #D19900;

  --bucket-blue:   #01696F;
  --bucket-green:  #437A22;
  --bucket-yellow: #D19900;
  --bucket-orange: #964219;
  --bucket-red:    #A12C7B;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
          "Liberation Sans", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Menlo, monospace;

  --radius: 6px;
  --shadow: 0 1px 4px rgba(40,37,29,.08);
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--text); }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--primary-hov); }

.topnav { display: flex; gap: 16px; }
.topnav a {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.topnav a:hover, .topnav a.active {
  color: var(--primary);
  text-decoration: none;
  border-bottom-color: var(--primary);
}

.user-name { font-size: 12px; color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
}
.btn-primary:hover { background: var(--primary-hov); color: #fff; text-decoration: none; }

.btn-outline {
  display: inline-flex; align-items: center;
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary); border-radius: var(--radius);
  padding: 6px 14px; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: var(--font);
}
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-success { background: var(--success); color: #fff; border: none; border-radius: var(--radius); padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-muted   { background: var(--text-faint); color: #fff; border: none; border-radius: var(--radius); padding: 4px 10px; font-size: 12px; cursor: pointer; }

/* ── Page structure ────────────────────────────────────────────────────────── */
.page-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}

.page-footer {
  text-align: center;
  padding: 12px 24px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.page-header-left { display: flex; align-items: baseline; gap: 12px; }
.page-header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.page-title { font-size: 24px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-muted); }

.as-of-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
}

/* ── Bucket pills / badges ─────────────────────────────────────────────────── */
.bucket-counts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.bucket-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  color: #fff;
}
.bucket-pill.blue   { background: var(--bucket-blue); }
.bucket-pill.green  { background: var(--bucket-green); }
.bucket-pill.yellow { background: var(--bucket-yellow); color: var(--text); }
.bucket-pill.orange { background: var(--bucket-orange); }
.bucket-pill.red    { background: var(--bucket-red); }

.bucket-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  color: #fff;
}
.bucket-badge.blue   { background: var(--bucket-blue); }
.bucket-badge.green  { background: var(--bucket-green); }
.bucket-badge.yellow { background: var(--bucket-yellow); color: var(--text); }
.bucket-badge.orange { background: var(--bucket-orange); }
.bucket-badge.red    { background: var(--bucket-red); }

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.filter-group select {
  font-family: var(--font);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--surface-alt);
  color: var(--text);
  min-width: 120px;
}

.filter-group input[type="text"] {
  font-family: var(--font);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  background: var(--surface-alt);
  color: var(--text);
  width: 160px;
}

.filter-search { align-self: flex-end; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead tr {
  background: var(--surface);
}

.data-table th {
  padding: 10px 10px 9px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
  user-select: none;
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--primary); }
.data-table th.sort-asc::after  { content: " \25B2"; font-size: 9px; color: var(--primary); }
.data-table th.sort-desc::after { content: " \25BC"; font-size: 9px; color: var(--primary); }

.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--surface-alt); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .num-cell { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.data-table .sub      { color: var(--text-muted); font-size: 11px; }

.loading-row, .empty-row { text-align: center; color: var(--text-muted); padding: 24px !important; }
.error-row   { text-align: center; color: var(--error); padding: 24px !important; }

.name-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ticker-link { font-weight: 700; color: var(--primary); }
.theme-link  { color: var(--text-muted); font-size: 11px; }

.pos { color: var(--success); }
.neg { color: var(--error); }
.muted { color: var(--text-muted); }

.ri-flag { color: var(--warning); font-weight: 700; }

.cohort-flag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-faint); color: #fff;
  font-size: 9px; font-weight: 700; cursor: help;
  margin-left: 4px;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.cohort-suppressed-note { font-style: normal; }

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(40,37,29,.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.login-logo { margin-bottom: 4px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text); }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-top: -4px; }
.login-note { font-size: 11px; color: var(--text-muted); line-height: 1.6; margin-top: 8px; }
.login-footer { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 24px; }

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  margin-top: 8px;
  transition: box-shadow .15s, border-color .15s;
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(40,37,29,.12); border-color: var(--primary); text-decoration: none; color: var(--text); }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  width: 100%;
  text-align: left;
}
.alert-error { background: #FDF2F9; border: 1px solid var(--error); color: var(--error); }
.alert-success { background: #F0F7EC; border: 1px solid var(--success); color: var(--success); margin-bottom: 12px; }
.alert-detail { font-weight: 400; font-size: 11px; }

/* ── Ticker drill-down ─────────────────────────────────────────────────────── */
.ticker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.ticker-header-left { display: flex; align-items: baseline; gap: 12px; }
.ticker-header-right { display: flex; align-items: center; gap: 8px; }
.back-link { font-size: 12px; color: var(--text-muted); }
.ticker-title { font-size: 28px; font-weight: 800; }
.ticker-name { font-size: 16px; color: var(--text-muted); font-weight: 400; }
.cohort-label { font-size: 12px; color: var(--text-muted); background: var(--surface-alt); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; }

.ticker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.card-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }

.score-card { grid-column: 1; }
.fundamentals-card { grid-column: 2; }
.risk-card { grid-column: 3; }
.sparkline-card { grid-column: 1 / 3; }
.ri-card { grid-column: 3; }
.events-card { grid-column: 1 / 4; }

.big-score { font-size: 64px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.score-note { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.score-note.suppressed { color: var(--warning); }

.sub-scores { display: flex; flex-direction: column; gap: 6px; }
.sub-score-row { display: flex; align-items: center; gap: 8px; }
.ss-label { font-size: 11px; color: var(--text-muted); min-width: 90px; }
.ss-label small { font-size: 10px; color: var(--text-faint); }
.ss-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; }
.ss-bar { height: 6px; background: var(--primary); border-radius: 3px; }
.ss-val { font-size: 11px; color: var(--text); min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

.kv-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.kv-table th { text-align: left; padding: 4px 8px 4px 0; color: var(--text-muted); font-weight: 500; font-size: 11px; width: 42%; }
.kv-table td { text-align: right; padding: 4px 0; font-variant-numeric: tabular-nums; }
.kv-table tr { border-bottom: 1px solid var(--border); }
.kv-table tr:last-child { border-bottom: none; }

.sparkline-wrap { height: 140px; }
.sparkline-note { font-size: 10px; color: var(--text-muted); margin: 4px 0 0; }

.ri-type-badge {
  display: inline-block;
  background: var(--warning);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 6px;
}

.ticker-footer-row { margin-top: 16px; display: flex; gap: 12px; }

/* ── Themes table extra styles ─────────────────────────────────────────────── */
.themes-footnote { margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.bucket-blue   { color: var(--bucket-blue); font-weight: 700; }
.bucket-green  { color: var(--bucket-green); font-weight: 700; }
.bucket-orange { color: var(--bucket-orange); font-weight: 700; }
.bucket-red    { color: var(--bucket-red); font-weight: 700; }

/* ── Admin modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(40,37,29,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(40,37,29,.12);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--text-muted); }
.modal-footer { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-group input, .form-group select {
  font-family: var(--font); font-size: 13px;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 7px 10px; background: var(--surface-alt); color: var(--text);
}

.role-select {
  font-family: var(--font); font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 6px; background: var(--surface-alt); color: var(--text);
}

/* ── Error page ────────────────────────────────────────────────────────────── */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50vh; gap: 12px; }
.error-code { font-size: 72px; font-weight: 900; color: var(--text-faint); line-height: 1; }
.error-msg { font-size: 18px; color: var(--text-muted); }

/* ── Report buttons ────────────────────────────────────────────────────────── */
.report-btns { display: flex; gap: 8px; }

/* ── Trends page — chart grid & cards ─────────────────────────────────────── */
.charts-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.charts-grid-2col {
  grid-template-columns: 1fr 1fr;
}
.charts-grid-1col {
  grid-template-columns: 1fr;
}
@media (max-width: 900px) {
  .charts-grid-2col { grid-template-columns: 1fr; }
}

.chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.chart-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-card-body {
  position: relative;
}

.chart-card-body-tall canvas {
  max-height: 260px;
}

.chart-card-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* Accumulation notice banner */
.accumulation-notice {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Days selector and inline selects */
.days-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.days-select, .inline-select {
  font-family: var(--font);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}

.sort-hint {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Two-axis count strip ──────────────────────────────────────────────────── */
.axis-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.axis-block { display: flex; flex-direction: column; gap: 6px; }
.axis-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.axis-pills { display: flex; gap: 6px; flex-wrap: wrap; }

/* Conviction tier — neutral, score-based */
.conviction-pill, .conviction-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  display: inline-block;
}
.conviction-pill.buy,         .conviction-badge.buy         { background: #01696F; color: #fff; }
.conviction-pill.hold,        .conviction-badge.hold        { background: #437A22; color: #fff; }
.conviction-pill.trim,        .conviction-badge.trim        { background: #D19900; color: #28251D; }
.conviction-pill.avoid,       .conviction-badge.avoid       { background: #7A7974; color: #fff; }
.conviction-pill.spec,        .conviction-badge.speculative { background: #6E522B; color: #fff; }

/* Risk flag — calibrated to severity */
.risk-pill, .risk-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  display: inline-block;
  color: #fff;
}
.risk-pill.breakdown,     .risk-badge.breakdown     { background: #A12C7B; }
.risk-pill.deteriorating, .risk-badge.deteriorating { background: #964219; }
.risk-pill.early-warning, .risk-badge.early-warning { background: #D19900; color: #28251D; }
.risk-pill.clean,         .risk-badge.clean         { background: #437A22; }

/* Why column — signal chips */
.why-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sig-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  margin-right: 3px;
  margin-bottom: 2px;
  border-radius: 3px;
  background: rgba(150, 66, 25, 0.12);
  color: #964219;
  border: 1px solid rgba(150, 66, 25, 0.25);
}
.sig-count { font-weight: 600; }


/* === TEARSHEET === */
/* Phase 7c-1 — Ticker Tearsheet styles. Append-only, desktop-first. */
/* No @media queries in this section — responsive is Phase 7c-5. */

/* ── Loading banner ────────────────────────────────────────────────────────── */
.ts-loading-banner {
  min-height: 0;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0 4px 0;
  text-align: center;
}

/* ── Tearsheet sticky header ───────────────────────────────────────────────── */
.tearsheet-header {
  position: sticky;
  top: 52px; /* sits below the topbar (height 52px) */
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(40,37,29,.06);
  flex-shrink: 0;
  overflow: hidden;
}

.ts-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  overflow: hidden;
}

.ts-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ts-back-arrow {
  font-size: 18px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1;
  flex-shrink: 0;
}
.ts-back-arrow:hover { color: var(--primary); text-decoration: none; }

.ts-ticker {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.ts-name {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.ts-exchange-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-alt);
  white-space: nowrap;
  flex-shrink: 0;
}

.ts-divider {
  color: var(--border);
  font-size: 14px;
  flex-shrink: 0;
}

.ts-last-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.price-change {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.price-change.pos  { color: #2E7D32; }
.price-change.neg  { color: #C62828; }
.price-change.flat { color: var(--text-muted); }

/* ── 52-week range bar ─────────────────────────────────────────────────────── */
.fiftytwo-week-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  cursor: help;
}
.ftw-low-label, .ftw-high-label {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ftw-track {
  display: inline-block;
  width: 80px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.ftw-fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ── Size tier pill ────────────────────────────────────────────────────────── */
.size-tier-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-alt);
  white-space: nowrap;
  flex-shrink: 0;
}
.size-tier-pill.tier-mega  { background: #1B474D; color: #fff; border-color: transparent; }
.size-tier-pill.tier-large { background: #20808D; color: #fff; border-color: transparent; }
.size-tier-pill.tier-mid   { background: #437A22; color: #fff; border-color: transparent; }
.size-tier-pill.tier-small { background: #D19900; color: #28251D; border-color: transparent; }
.size-tier-pill.tier-micro { background: #964219; color: #fff; border-color: transparent; }

/* ── Header score block ────────────────────────────────────────────────────── */
.ts-score-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.ts-score-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.ts-score-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-delta {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-delta.pos  { color: #2E7D32; }
.score-delta.neg  { color: #C62828; }
.score-delta.flat { color: var(--text-muted); }

.ts-theme-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(1,105,111,0.1);
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Tearsheet sections (card-style) ───────────────────────────────────────── */
.tearsheet-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px 20px;
  margin-bottom: 24px;
}

.ts-section-header {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
  flex-shrink: 0;
}

.section-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 400;
}

.ts-controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ── Range toggle pills ────────────────────────────────────────────────────── */
.range-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.range-pill {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font);
  letter-spacing: 0.02em;
  transition: background .12s, color .12s;
}
.range-pill:last-child { border-right: none; }
.range-pill:hover { background: var(--border); color: var(--text); }
.range-pill.active {
  background: var(--primary);
  color: #fff;
}

/* ── MA toggles ────────────────────────────────────────────────────────────── */
.ma-toggles {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ma-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.ma-toggle-label input[type="checkbox"] {
  width: 12px;
  height: 12px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--primary);
}
.ma-toggle-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1.5px solid;
  background: transparent;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
  user-select: none;
}

/* ── Stat strip ────────────────────────────────────────────────────────────── */
.stat-strip {
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 10px;
  padding: 0;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 14px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.stat-item:last-child { border-right: none; }
.stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.stat-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Chart wrappers ────────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-wrap-price    { height: 320px; }
.chart-wrap-volume   { height: 80px;  margin-top: 6px; }
.chart-wrap-rsi      { height: 180px; }
.chart-wrap-score    { height: 260px; }
.chart-wrap-valuation { height: 260px; }

.chart-sublabel {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chart-empty-msg, .ts-empty-state {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
  margin: 0;
}

/* ── Peer cohort table ─────────────────────────────────────────────────────── */
.peer-table {
  width: 100%;
}

.peer-cohort-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.peer-row { }
.peer-self {
  background: rgba(1,105,111,0.05);
  font-weight: 600;
}
.peer-self td { border-left: 3px solid var(--primary); }

/* ── Risk indicator severity badges ────────────────────────────────────────── */
.ri-sev-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  color: #fff;
}
.ri-sev-high   { background: #A12C7B; }
.ri-sev-medium { background: #964219; }
.ri-sev-low    { background: #7A7974; }

.ri-date, .ri-duration {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Tearsheet footer row ──────────────────────────────────────────────────── */
.ts-footer-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Cohort label suppressed state ─────────────────────────────────────────── */
.cohort-label.suppressed {
  color: var(--warning);
  border-color: var(--warning);
  background: rgba(150,66,25,0.07);
}
