/* =============================================================================
   SHARED COMPONENTS -- one definition for every piece that appears in more
   than one view (P0 step 5, design unification). Tokens in tokens.css.
   View CSS (css/<CMD>.css) only adds what is specific to that view and
   must not restyle these. Dense terminal look: 13px mono, 28px rows.

   Colour rules (00b-family-ui §1): orange = active / selected / context,
   teal = primary action + up ▲, magenta = down / danger and only ever
   together with light blue (pill or fill), never as text on navy.
   ============================================================================= */

/* ---------- base ---------- */
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
/* Links: ink and underlined, like the header category tabs, so they read
   as links without a colour of their own. */
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:not([class]):hover { color: var(--orange); }
h1, h2, h3, h4, h5, h6 { line-height: 1.25; }
::placeholder { color: var(--faint); opacity: 1; }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-dark); }

/* ---------- view frame ----------
   <div class="view x-view-container">       outer frame, centred
     <div class="view-body x-container">     the panel inside it
       <div class="view-header x-header">    title row: h3 + ctx label + actions */
.view {
  box-sizing: border-box;
  width: 95%;
  max-width: var(--view-max);
  margin: var(--sp-4) auto;
  padding: var(--sp-4);
  background: var(--frame);
  border-radius: 1rem;
  color: var(--ink);
  line-height: 1.6;
}
.view-body {
  box-sizing: border-box;
  width: 100%;
  padding: var(--sp-4);
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.view-body + .view-body { margin-top: var(--sp-3); }
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  margin: 0 0 var(--sp-3);
}
.view-header h2, .view-header h3 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}
/* Section title inside a view (Summary, Holder Composition, ...). */
.view-body h3, .view-body h4 { color: var(--ink); }
.section-title, .summary-section > h3, .summary-header h3 {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 600;
}

/* "(CC: MK  TICK: KMB)" on views with a loaded ticker
   (macro ui.ctx_label, P0 spec §10). */
.ctx-label {
  margin-left: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--orange);
  white-space: nowrap;
}
.ctx-label b { font-weight: 600; color: var(--teal-text); margin: 0 var(--sp-2) 0 var(--sp-1); }
.ctx-label b:last-child { margin-right: 0; }

/* ---------- buttons ---------- */
.btn, .filter-btn, .export-btn, .download-btn, .csv-button, .eqs-run-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 2.5rem;
  padding: var(--sp-2) var(--sp-4);
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover, .download-btn:hover, .csv-button:hover { background: var(--surface-3); }
/* Export CSV / secondary action: teal fill, light-blue text. */
.export-btn, .btn-primary, .view-header .download-btn { background: var(--teal); color: var(--ink); }
.export-btn:hover, .btn-primary:hover, .view-header .download-btn:hover { background: var(--teal-dark); }
/* Filter / Run: wide orange bar, centred in its row. */
.filter-btn, .eqs-run-btn {
  width: 100%;
  max-width: 55%;
  margin: 0 auto;
  background: var(--orange);
  color: var(--on-orange);
}
.filter-btn:hover, .eqs-run-btn:hover { background: var(--orange-dark); }
/* Danger (delete, refund): magenta fill + light-blue text and border. */
.btn-danger, .danger-button {
  background: var(--magenta);
  border-color: var(--ink);
  color: var(--ink);
}
.btn-danger:hover, .danger-button:hover { background: var(--magenta-dark); }
.btn:disabled, .filter-btn:disabled, .export-btn:disabled, button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
/* Row that holds the Filter button: the button sits centred. */
.button-controls, .filter-button, .button-group-filter {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}

/* Segmented buttons: period D/W/M..., statement IS/BS/CF, tabs.
   Active = teal. */
.button-group, .g-period-group, .mcap-period-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.g-period-btn, .mcap-period-btn, .financial-btn, .mgmt-btn, .seg-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}
.g-period-btn:hover, .mcap-period-btn:hover, .financial-btn:hover, .mgmt-btn:hover, .seg-btn:hover {
  color: var(--ink);
  border-color: var(--line);
}
.g-period-btn.active, .mcap-period-btn.active, .financial-btn.active, .mgmt-btn.active, .seg-btn.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--ink);
}

/* Links to other commands ("> G", "> HP" on DES). */
.command-link { text-decoration: none; }
.command-item {
  display: inline-block;
  padding: 0 var(--sp-1);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  color: var(--orange);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.command-link:hover .command-item { background: var(--orange); color: var(--on-orange); }

/* ---------- form controls ---------- */
.view input[type="date"], .view input[type="text"], .view input[type="number"],
.view input[type="email"], .view input[type="password"], .view input[type="tel"],
.view select, .view textarea {
  box-sizing: border-box;
  height: var(--row-h);
  padding: 0 var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--well);
  color: var(--ink);
  font-size: var(--fs-md);
  color-scheme: dark;
}
.view textarea { height: auto; padding: var(--sp-1) var(--sp-2); }
/* Date text centred vertically in the box (Chromium pads the inner
   field; Firefox follows line-height). */
.view input[type="date"] { line-height: calc(var(--row-h) - 2px); }
.view input[type="date"]::-webkit-datetime-edit { padding: 0; line-height: 1; }
.view input[type="date"]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.view input[type="date"]::-webkit-calendar-picker-indicator { margin: 0; padding: 0 0 0 var(--sp-1); }
.view input:focus, .view select:focus, .view textarea:focus {
  outline: none;
  border-color: var(--orange);
}
.view input:disabled, .view select:disabled { color: var(--faint); border-color: var(--line-soft); }
.view label { color: var(--muted); font-size: var(--fs-md); }

/* Date range row (Start / End + toggles + Export). */
.date-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-4);
  margin: 0 0 var(--sp-4);
}
.date-pair { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* Toggle switch: <div class="switch-container"><span>A</span>
   <label class="switch"><input type="checkbox"><span class="slider"></span></label><span>B</span></div> */
.switch-container {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-md);
  white-space: nowrap;
}
.switch {
  --switch-w: 2.25rem;
  --switch-h: 1.25rem;
  --knob: 0.875rem;
  --gap: calc((var(--switch-h) - var(--knob)) / 2);
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--switch-w);
  height: var(--switch-h);
  margin: 0;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  background: var(--surface-3);
  cursor: pointer;
  transition: background-color 0.15s;
}
.slider:before {
  content: "";
  position: absolute;
  left: var(--gap);
  top: var(--gap);
  width: var(--knob);
  height: var(--knob);
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}
.switch input:checked + .slider { background: var(--teal); }
/* Same gap to the right edge when on as to the left edge when off. */
.switch input:checked + .slider:before { transform: translateX(calc(var(--switch-w) - var(--knob) - 2 * var(--gap))); background: #fff; }
.switch input:focus-visible + .slider { outline: 1px solid var(--orange); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: 0.4; cursor: not-allowed; }

/* ---------- summary / stat tiles ---------- */
.summary-section {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface);
  border-radius: var(--radius-lg);
}
.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.summary-meta-row, .summary-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg);
  border-radius: var(--radius-lg);
}
.summary-grid { margin-top: var(--sp-3); background: transparent; padding: var(--sp-2) 0; }
.summary-meta-row > * { border: 0; padding: 0; }
.summary-grid > * { flex: 1 1 120px; padding: 0 var(--sp-3); border-right: 1px solid var(--line); }
.summary-grid > *:last-child { border-right: 0; }
.summary-meta-row h4, .summary-grid h4 {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 400;
}
.summary-meta-row p, .summary-grid p {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 600;
}

/* ---------- tables ---------- */
.table-wrapper {
  box-sizing: border-box;
  width: 100%;
  max-height: 70vh;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  scrollbar-color: var(--teal) var(--surface);
}
/* Table scrollbars: teal thumb on the panel colour. */
.table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: var(--surface); border-radius: 10px; }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--teal); border-radius: 10px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: var(--teal-dark); }
.table-wrapper::-webkit-scrollbar-corner { background: var(--surface); }
.table-wrapper table, table.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: var(--fs-md);
}
.table-wrapper th, .table-wrapper td, .data-table th, .data-table td {
  height: var(--row-h);
  padding: 0 var(--sp-2);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.table-wrapper thead th, .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table-wrapper tbody tr:hover, .data-table tbody tr:hover { background: var(--teal-tint); }
.table-wrapper tbody th { color: var(--muted); font-weight: 600; text-align: left; }

/* Text left, numbers and dates right: script.js (initTables) marks the
   numeric columns with .num. First column is the row label: bold and
   sticky when the table scrolls sideways. */
.table-wrapper th, .table-wrapper td { text-align: left; }
.table-wrapper th.num, .table-wrapper td.num { text-align: right; }
.table-wrapper tbody td:first-child, .table-wrapper thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  background: var(--surface);
}
.table-wrapper thead th:first-child { z-index: 3; background: var(--surface-2); }

/* Click-to-sort headers (every data table; script.js adds them). */
.th-with-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.th-label { color: inherit; text-decoration: none; }
.th-with-sort:hover .th-label { color: var(--ink); }
.sort-icon {
  flex-shrink: 0;
  stroke: currentColor;
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.th-with-sort:hover .sort-icon { opacity: 1; }
.sort-icon[data-dir="asc"], .sort-icon[data-dir="desc"] { opacity: 1; stroke: var(--orange); }
.sort-icon[data-dir="asc"] { transform: rotate(180deg); }

/* ---------- up / down ---------- */
.chg-up, .up { color: var(--ink); }
.chg-up::before, .up::before { content: "▲ "; color: var(--teal); }
.chg-down, .down {
  display: inline-block;
  padding: 0 var(--sp-1);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--magenta);
  font-weight: 600;
  line-height: 1.4;
}
.chg-down::before, .down::before { content: "▼ "; }

/* ---------- notes, messages, empty state ---------- */
.note, .g-mk-note {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--orange);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
}
/* Error / alert: magenta on a light-blue panel. */
.alert, .g-error {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--magenta);
  font-weight: 600;
}
/* "Data coming · <source> · Phase n" (P0 spec §4) and the old
   placeholder text block in the empty views. */
.empty-state {
  margin: var(--sp-2) 0;
  padding: var(--sp-4);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--fs-md);
  text-align: center;
}

/* ---------- panels (P0 spec §4: full layout + empty state) ---------- */
.panel {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-2);
}
.panel-head .section-title { margin: 0; }
.panel-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-left: auto; }
.panel .empty-state { margin: 0; }
.panel .summary-grid { margin: 0 0 var(--sp-2); }
.empty-note { display: block; margin-top: var(--sp-1); color: var(--faint); font-size: var(--fs-sm); }
.empty-cell { padding: var(--sp-2) !important; white-space: normal !important; }
.empty-cell .empty-state { margin: 0; }
.tier-tag {
  padding: 0 var(--sp-2);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  color: var(--orange);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
}

/* Two / three panels side by side; they stack on phones. */
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-3); }
.panel-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--sp-3); }
.panel-grid > .span-2, .panel-grid-3 > .span-2 { grid-column: span 2; }

/* Empty chart: a framed area with faint grid lines. */
.chart-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 220px;
  padding: var(--sp-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background-color: var(--bg);
  background-image:
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px);
  background-size: 100% 25%, 12.5% 100%;
}
.chart-frame--sm { min-height: 140px; }
.chart-frame--lg { min-height: 320px; }
.chart-frame .empty-state { align-self: center; background: var(--bg); }
.chart-legend { position: absolute; top: var(--sp-2); left: var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-3); color: var(--muted); font-size: var(--fs-sm); }

/* Live chart (Chart.js canvas) with a message over it until it has data. */
.chart-box { position: relative; height: 340px; }
.chart-box > .chart-msg { position: absolute; inset: 40% 15% auto; margin: 0; background: var(--surface); }
.ticker-link { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ticker-link:hover { color: var(--orange); }



/* Tab bar above a set of [data-tab-panel] blocks. */
.tab-bar { margin: 0 0 var(--sp-3); }
[data-tab-panel][hidden] { display: none; }
/* hidden wins over the display of buttons, panels and blocks. */
[hidden] { display: none !important; }

/* Inactive form field (label + disabled input). */
.field { display: inline-flex; align-items: center; gap: var(--sp-2); }
.field input:disabled { cursor: not-allowed; }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin: 0 0 var(--sp-3); }

/* Card: one record shown as label / value pairs (rating, person). */
.card-kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-1) var(--sp-4); margin: 0 0 var(--sp-2); font-size: var(--fs-md); }
.card-kv dt { color: var(--muted); }
.card-kv dd { margin: 0; color: var(--ink); font-weight: 600; }

/* Plain list of text items (changelog, data sources). */
.plain-list { margin: 0; padding-left: 1.25rem; color: var(--ink); font-size: var(--fs-md); line-height: 1.7; }
.plain-list li::marker { color: var(--orange); }

/* Changelog item kinds (CHANGE). */
.change-list li { margin-bottom: var(--sp-1); }
.change-kind { display: inline-block; min-width: 5.5rem; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; }
.change-kind--new { color: var(--teal-text); }
.change-kind--improved { color: var(--orange); }
.change-kind--fixed { color: var(--muted); }
.change-kind--source { color: var(--ink); }
.change-kind--upcoming { color: var(--faint); }

/* Short inline label next to controls. */
.hint { color: var(--muted); font-size: var(--fs-sm); }

/* Small tags (asset class, badges). */
.tag, .ticker-item {
  display: inline-block;
  padding: 0 var(--sp-1);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  color: var(--teal-text);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.5;
  vertical-align: middle;
}

/* ---------- modals ---------- */
.modal-overlay {
  background: rgba(15, 20, 28, 0.7);
}
.modal-box {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* ---------- phone: panels stack, tables scroll sideways ---------- */
@media (max-width: 768px) {
  .panel-grid, .panel-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .panel-grid > .span-2, .panel-grid-3 > .span-2 { grid-column: auto; }
  .panel-tools { margin-left: 0; }
  /* One thin frame on phones: full width, no double padding. */
  .view { width: 100%; margin: var(--sp-2) 0; padding: var(--sp-2); border-radius: var(--radius-lg); }
  .view-body { padding: var(--sp-3); }
  .filter-btn, .eqs-run-btn { max-width: 100%; }
  .view { padding: 0 var(--sp-2); }
  .view-body { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
  .date-controls { gap: var(--sp-2); }
  .date-pair { flex: 1 1 100%; flex-wrap: wrap; }
  .date-pair label { flex: 0 0 6rem; white-space: nowrap; }
  .date-pair input[type="date"] { flex: 1 1 calc(100% - 7rem); min-width: 0; }
  .summary-meta-row, .summary-grid { gap: var(--sp-2) var(--sp-4); }
  .button-controls .filter-btn, .filter-button .filter-btn { flex: 1 1 auto; }
}

/* "Source: ..." under a table or chart (ui.source). */
.table-source { margin: var(--sp-2) 0 0; color: var(--muted); font-size: var(--fs-xs); text-align: right; }

/* As-of date picker (ui.asof), same look as the EQS one. */
.asof-control { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--ink); font-size: var(--fs-sm); }
.asof-control input[type="date"] {
  padding: var(--sp-2); background-color: var(--surface-2); color: var(--ink);
  border: 1px solid var(--ink); border-radius: var(--radius); font-size: var(--fs-sm); color-scheme: dark;
}
.asof-control input[type="date"]:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

/* QM: tickers of the list being edited, each removable. */
.qm-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.qm-chip { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-2); height: var(--row-h); background: var(--surface-2); border-radius: var(--radius); color: var(--ink); font-size: var(--fs-md); }
.qm-chip button { all: unset; cursor: pointer; color: var(--muted); padding: 0 2px; }
.qm-chip button:hover { color: var(--orange); }
.qm-add { min-width: var(--row-h); min-height: var(--row-h); height: var(--row-h); font-size: var(--fs-lg); font-weight: 700; padding: 0 var(--sp-3); }

/* CALE week / month grids. */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.cal-title { min-width: 14rem; text-align: center; color: var(--ink); font-size: var(--fs-lg); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-bottom: var(--sp-3); }
.cal-head { padding: var(--sp-1) var(--sp-2); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.cal-day { min-height: 5rem; padding: var(--sp-1) var(--sp-2); background: var(--well); }
.cal-grid--week .cal-day { min-height: 12rem; }
.cal-day--outside { opacity: 0.45; }
.cal-day--today { outline: 1px solid var(--orange); outline-offset: -1px; }
.cal-date { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 600px) { .cal-day { min-height: 3rem; } .cal-grid--week .cal-day { min-height: 6rem; } }

/* Ticker picker (ui.ticker_picker): suggestions drop under the field,
   styled like the command bar's (styles.css .suggestion-*). */
.ticker-picker { margin: 0 0 var(--sp-2); }
.tp-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.tp-box { position: relative; display: inline-block; }
.tp-input { width: 22rem; max-width: 70vw; }
.tp-suggest { left: 0; top: calc(100% + 2px); }
.suggestion-item.active { background-color: var(--surface-2); }
.ticker-picker .qm-chips { margin-bottom: var(--sp-2); }

/* Interval picker (ui.interval): G's "Interval:" label + letter buttons. */
.interval-control { flex-wrap: wrap; }
@media (max-width: 600px) { .tp-input { width: 100%; max-width: none; } .tp-box, .tp-row .field { width: 100%; } }
/* MOST: the tab bar shares the interval's line. */
.most-controls .tab-bar { margin: 0; }
.chart-wrapper > .chart-msg { position: absolute; inset: 40% 15% auto; margin: 0; background: var(--surface); }

/* QM: saved lists on top, the list being edited under a rule. */
.qm-lists-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.qm-editor { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.qm-editor-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-2); }
.qm-editor-row .field input { width: 16rem; max-width: 60vw; }
.qm-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.qm-editor .ticker-picker { margin-bottom: 0; }
.qm-run-row { margin-top: var(--sp-2); }
