/* Command Centre design system.
   Light is the default. Dark is used only when data-theme="dark"
   (the toggle writes that choice to localStorage). */

:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #141414;
  --text-muted: #3f3a33;
  --muted: #3f3a33;
  --line: rgba(20, 20, 20, 0.14);
  --accent: #7a4e0d;
  --accent-ink: #ffffff;
  --header: rgba(247, 246, 243, 0.96);
  --red: #9f1239;
  --amber: #8a5a10;
  --up: #166534;
  --down: #9f1239;
  --shadow: 0 8px 22px rgba(40, 30, 10, 0.08);
  --chart-band: rgba(122, 78, 13, 0.16);
  --chart-mid: #7a4e0d;
  --chart-gross: #0b5f8a;
  --danger: #9f1239;
  --focus: #7a4e0d;
  --s1: 4px;
  --s2: 8px;
  --s3: 16px;
  --s4: 24px;
  --s5: 32px;
  --s6: 48px;
  --gutter: 16px;
  --card-pad: var(--s3);
  --section-gap: var(--s4);
  --card-gap: 12px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12110e;
  --surface: #1c1b17;
  --surface-2: #2a2822;
  --text: #f7f4ee;
  --text-muted: #d2cdc3;
  --muted: #d2cdc3;
  --line: rgba(247, 244, 238, 0.16);
  --accent: #e4b15a;
  --accent-ink: #1a140c;
  --header: rgba(18, 17, 14, 0.94);
  --red: #ff8b8b;
  --amber: #e4b15a;
  --up: #7ddea6;
  --down: #ff8b8b;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --chart-band: rgba(228, 177, 90, 0.22);
  --chart-mid: #e4b15a;
  --chart-gross: #8fd0ff;
  --danger: #ff8b8b;
  --focus: #e4b15a;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.4;
  overflow-x: hidden;
}

body:has(.cc-bottom) {
  padding-bottom: calc(4.8rem + env(safe-area-inset-bottom));
}

img, svg, video, canvas { max-width: 100%; }

a { color: var(--accent); }

button, input, select, textarea { font-size: 16px; }

.btn, button, .cc-tap {
  min-height: 44px;
}

.cc-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--s2);
  min-height: 56px;
  padding: var(--s1) var(--gutter);
  background: var(--header);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.cc-brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  min-height: 44px;
  min-width: 0;
  flex: 0 1 auto;
}

.cc-brand span { white-space: nowrap; }

.cc-brand img { height: 32px; width: auto; }

.cc-header-spacer { flex: 1 1 auto; min-width: var(--s2); }

.cc-icon-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0 var(--s3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cc-header .cc-icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 auto;
}

.cc-hello {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 5.5rem;
  min-width: 0;
  flex: 0 1 auto;
}

@media (max-width: 399px) {
  .cc-hello { display: none; }
}

.cc-drawer {
  display: none;
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 28;
  overflow-y: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--s2) var(--gutter) calc(52px + env(safe-area-inset-bottom) + var(--s4));
}

.cc-drawer h2 {
  margin: var(--s4) 0 var(--s1);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cc-drawer h2:first-of-type { margin-top: var(--s3); }

body.nav-open { overflow: hidden; }

.cc-drawer.is-open { display: block; }

.cc-drawer a, .cc-drawer button.linkish {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.cc-main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: var(--s4) var(--gutter) var(--s3);
}

@media (min-width: 768px) {
  :root { --gutter: 24px; }
}

.cc-footer {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 1rem 0.8rem 0.4rem;
}

.cc-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--header);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.cc-bottom a {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.62rem;
  line-height: 1.1;
  text-align: center;
  padding: 0.3rem 0.05rem;
}

.cc-bottom a.is-current, .cc-bottom a:hover { color: var(--text); }

.cc-bottom i { font-size: 1.15rem; }

.cc-section { margin: 0 0 1.1rem; }

.cc-section h2, .cc-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.section-head a { min-height: 44px; display: inline-flex; align-items: center; }

.flag-row {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 0.2rem;
  scroll-snap-type: x mandatory;
}

.flag-card {
  flex: 0 0 min(240px, 78vw);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 44px;
  padding: 0.7rem 0.75rem;
  border-radius: 0.85rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  box-shadow: var(--shadow);
}

.flag-card.sev-red { border-left-color: var(--red); }
.flag-card.sev-amber { border-left-color: var(--amber); }
.flag-card strong { font-size: 0.92rem; line-height: 1.25; }
.flag-kicker { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }

.kpi-grid, .tile-grid, .rep-grid {
  display: grid;
  gap: 0.6rem;
}

.kpi-card, .tile, .panel, .day-card, .league-row, .alert-row, .target-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.75rem 0.8rem;
}

.kpi-card h3 {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.kpi-note, .source-line, .empty, .muted { color: var(--muted); font-size: 0.8rem; }

.split { display: flex; justify-content: space-between; gap: 0.4rem; margin-top: 0.35rem; font-size: 0.85rem; }
.split b { font-variant-numeric: tabular-nums; }
.chg-up { color: var(--up); }
.chg-down { color: var(--down); }

.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-band { fill: var(--chart-band); }
.chart-mid { fill: none; stroke: var(--chart-mid); stroke-width: 1.6; stroke-dasharray: 4 3; }
.chart-gross { fill: none; stroke: var(--chart-gross); stroke-width: 2.2; }
.chart-label { fill: var(--muted); font-size: 9px; }

.day-list, .league-list, .alert-list { display: grid; gap: 0.45rem; }

.day-card { display: grid; gap: 0.15rem; }
.day-card .tier {
  display: inline-block;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.78rem;
}
.tier-weather-caution { border-color: #e8b931; }
.tier-puja-festive { border-color: #f472b6; }
.tier-holiday { border-color: #7c6af7; }
.tier-weekend { border-color: #3db8e0; }
.tier-working-weekday { border-color: #8b949e; }
.tier-festive { border-color: #c2410c; }

.league-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.6rem;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
}
.league-row .rank { font-weight: 700; color: var(--muted); }
.league-meta { grid-column: 2; color: var(--text-muted); font-size: 0.82rem; }

.cc-home .cc-section { margin-bottom: 0.55rem; }
.cc-home .section-head { margin-bottom: 0.2rem; }
.cc-home .kpi-card { padding: 0.45rem 0.5rem; }
.cc-home .kpi-value { font-size: 1.05rem; }
.cc-home .kpi-grid { gap: 0.4rem; }
.cc-home .league-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 0.3rem 0.55rem;
}
.cc-home .league-meta { grid-column: auto; font-size: 0.75rem; white-space: nowrap; }
.cc-home .alert-row, .cc-home .target-row { padding: 0.45rem 0.6rem; }
.cc-home .tile { padding: 0.5rem 0.6rem; }
.cc-home .chart-wrap { padding: 0.35rem 0.4rem 0.2rem; }

.window-sub { margin: 0 0 0.35rem; color: var(--text-muted); font-size: 0.85rem; }
.day-badge {
  display: inline-block;
  margin: 0.15rem 0.35rem 0.15rem 0;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
}

.kpi-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  margin-top: 0.3rem;
}
.kpi-chips span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 0.55rem;
  padding: 0.15rem 0.1rem;
  font-size: 0.68rem;
  line-height: 1.15;
  text-align: center;
}

.day-row { display: flex; gap: 0.35rem; overflow-x: auto; max-width: 100%; min-width: 0; }
.day-chip {
  flex: 0 0 4.5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.3rem 0.2rem 0.35rem;
  text-align: center;
  font-size: 0.68rem;
}
.day-chip strong { display: block; font-size: 0.82rem; color: var(--text); }
.day-tier { display: block; color: var(--text-muted); line-height: 1.15; margin-top: 0.12rem; }
.rep-line { margin: 0.2rem 0 0; color: var(--text); font-size: 0.82rem; }
.league-split {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.info-note summary {
  list-style: none;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.info-note summary::-webkit-details-marker { display: none; }
.info-note p, .info-note li { color: var(--text); font-size: 0.8rem; margin: 0.15rem 0 0; }
.info-note.info-inline { display: block; margin: 0 0 0.45rem; }
.info-note.info-inline summary { min-height: 32px; justify-content: flex-start; }

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.55rem; }
.filters a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
}
.filters a.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.alert-row, a.target-row { border-left: 4px solid var(--amber); }
a.target-row {
  display: block;
  color: inherit;
  text-decoration: none;
}
.tile h3 { margin: 0 0 0.25rem; font-size: 1rem; color: var(--text); }
.tile ul { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.tile li { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; font-size: 0.88rem; color: var(--text); }
.tile li span { min-width: 0; }
.tile li b { font-variant-numeric: tabular-nums; }

.tool-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tool-row a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  border-radius: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.flag-group { margin: 0 0 1rem; }
.flag-full {
  display: block;
  padding: 0.75rem 0.8rem;
  margin: 0 0 0.45rem;
  border-radius: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  color: var(--text);
}
.flag-full.sev-red { border-left-color: var(--red); }
.flag-full p { margin: 0.25rem 0 0; }

.cal-sheet {
  position: fixed;
  inset: auto 0 4.6rem 0;
  z-index: 40;
  background: var(--surface);
  color: var(--text);
  border-top: 1px solid var(--line);
  padding: 0.8rem 0.9rem 1rem;
  max-height: 55vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.cal-sheet[hidden] { display: none; }
.cal-sheet button { margin-top: 0.4rem; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1rem 1rem;
}
.login-card {
  margin: auto;
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.4rem 1.2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-card img { width: 120px; height: auto; }
.login-card .btn { width: 100%; }

.card,
.modal-content,
.list-group-item,
.dropdown-menu,
.accordion-item,
.accordion-body,
.offcanvas,
.toast,
.popover {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-hover-color: var(--text);
  color: var(--text);
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: none;
}

.form-control::placeholder { color: var(--text-muted); opacity: 1; }

.text-muted,
.text-secondary,
.text-body-secondary { color: var(--text-muted) !important; }

html[data-theme="light"] .text-light,
html[data-theme="light"] .text-white,
html[data-theme="light"] .text-info { color: var(--text) !important; }

.card.bg-dark,
.card.bg-dark .text-white,
div.bg-dark,
div.bg-dark .text-light,
div.bg-dark .text-white,
.bg-white {
  background-color: var(--surface) !important;
  color: var(--text) !important;
}

html[data-theme="light"] .btn-outline-light {
  color: var(--text);
  border-color: var(--line);
}

html .store-health,
html .store-health a,
html .store-health h1,
html .store-health h2,
html .store-health h3,
html .store-health p,
html .store-health li,
html .store-health td,
html .store-health th,
html .store-health .cal-line,
html .store-health .cal-line b,
html .store-health .contract,
html .store-health .contract code,
html .store-health .identity li,
html .store-health .sub-value,
html .store-health .value { color: var(--text); }

html .store-health .eyebrow,
html .store-health .box-source,
html .store-health .metric h3,
html .store-health .metric .note,
html .store-health .sub-label,
html .store-health .dow,
html .store-health .range-note,
html .store-health .match-hint,
html .store-health .public-name,
html .store-health .context-meta,
html .store-health .last-updated h2,
html .store-health .cal-table th { color: var(--text-muted); }

html .store-health .health-box,
html .store-health .last-updated {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

html .store-health .metric,
html .store-health .cal-cell,
html .store-health .menu-mix-row,
html .store-health .empty-state,
html .store-health .map-slot,
html .store-health .insight-col,
html .store-health .badge-soft,
html .store-health .caveat {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

html .store-health .cal-cell.pad {
  background: transparent;
  border-color: transparent;
}

html .store-health .form-control,
html .store-health .form-select,
html .store-health .form-control:focus,
html .store-health .form-select:focus {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

html .store-health .var-down { color: var(--down); }
html .store-health .var-up { color: var(--up); }

html .store-health .box-index {
  background: var(--accent);
  color: var(--accent-ink);
}

@media (max-width: 767px) {
  .store-health .cal-scroll { overflow-x: hidden; }
  .store-health .dow-grid,
  .store-health .cal-grid { min-width: 0; gap: 0.15rem; }
  .store-health .cal-cell { min-height: 3.1rem; padding: 0.15rem; }
  .store-health .cal-line { display: none; }
  .store-health .cal-line:first-of-type {
    display: block;
    font-size: 0.62rem;
    line-height: 1.15;
  }
  .store-health .cal-line:first-of-type span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .store-health .day-num { font-size: 0.72rem; display: block; }
  .store-health form .btn { width: 100%; }
}

.table-responsive { max-width: 100%; }
.table-responsive th:first-child,
.table-responsive td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}

@media (min-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .rep-grid, .tile-grid { grid-template-columns: 1fr 1fr; }
}

.cc-search { position: relative; margin: 0 0 var(--s3); }
.cc-search-desktop { display: none; margin: 0; min-width: 0; }
.cc-search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0 var(--s3);
}
.cc-search-results {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: var(--s2);
  max-height: 240px;
  overflow: auto;
}
.cc-search-results a {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s3);
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.cc-search-results .kind {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cc-header .cc-search-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + var(--s1));
  left: 0;
  right: 0;
  margin: 0;
  box-shadow: var(--shadow);
}

.cc-filters {
  display: grid;
  gap: var(--s2);
  margin: 0 0 var(--section-gap);
  width: 100%;
  min-width: 0;
}
.cc-filters > * { min-width: 0; }
.cc-filters label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cc-filters select,
.cc-filters input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0 var(--s3);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.cc-range-custom { display: none; gap: var(--s2); }
.cc-filters.is-custom .cc-range-custom { display: grid; }
.cc-apply { width: 100%; }

.stat-block { display: block; }
.stat-name { display: block; font-weight: 400; margin-bottom: var(--s1); }
.stat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  min-height: 28px;
}
.stat-row span { font-weight: 400; }
.stat-row b {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.list-search {
  display: block;
  min-width: 0;
  margin: 0 0 var(--s2);
}
.cc-filters .list-search,
form.filters .list-search,
form.mc-filters .list-search,
form.pc-form .list-search,
.filters .list-search {
  grid-column: 1 / -1;
  margin: 0;
}
.list-search-label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
  margin: 0;
}
.list-search-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.list-search-field {
  position: relative;
  display: block;
  min-width: 0;
}
.list-search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0 48px 0 var(--s3);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.list-search-input::placeholder { color: var(--text-muted); }
.list-search-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.list-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.list-search-clear {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
}
.list-search-count {
  margin: 0 0 var(--s2);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.list-search-empty { margin: 0 0 var(--s2); }

@media (max-width: 767px) {
  .cc-filters > .list-search,
  form.filters > .list-search,
  nav.filters > .list-search,
  .filters > .list-search {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 24;
    box-sizing: border-box;
    margin: 0;
    padding: var(--s2) var(--gutter);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .list-search-spacer { height: 68px; }
  .list-search.is-sticky {
    position: sticky;
    top: 56px;
    z-index: 24;
    background: var(--bg);
    padding: var(--s2) 0;
  }
}

@media (min-width: 768px) {
  .cc-search-desktop { display: block; flex: 1 1 180px; max-width: 280px; }
  .cc-filters { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; }
  .cc-filters.is-custom { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1fr) auto; }
  .cc-apply { width: auto; }
}

.lazy-section {
  box-sizing: border-box;
}
.lazy-skeleton {
  display: grid;
  gap: 12px;
  padding: var(--s3) 0;
}
.lazy-bar {
  display: block;
  height: 14px;
  border-radius: 8px;
  background: var(--surface-2);
}
.lazy-bar.short { width: 55%; }
.lazy-more {
  min-height: 44px;
  margin: var(--s2) 0 var(--s3);
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
@media (prefers-reduced-motion: no-preference) {
  .lazy-bar { animation: lazy-pulse 1.2s ease-in-out infinite; }
}
@keyframes lazy-pulse {
  50% { opacity: 0.45; }
}

.cc-main:has(.cc-chat) {
  width: min(760px, 100%);
  min-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  padding: 8px 24px 28px;
}
.cc-main:has(.cc-chat) .cc-footer { display: none; }

body:has(.cc-chat) {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
}
body:has(.cc-chat) .cc-header {
  border-bottom: 0;
  background: var(--bg);
  box-shadow: none;
  min-height: 52px;
}
body:has(.cc-chat) .cc-brand {
  font-weight: 560;
  letter-spacing: -0.03em;
  font-size: 0.95rem;
}
body:has(.cc-chat) .cc-brand img { height: 26px; }
body:has(.cc-chat) .cc-hello { display: none; }
body:has(.cc-chat) .cc-header .cc-icon-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
}
body:has(.cc-chat) .cc-header .cc-icon-btn:hover,
body:has(.cc-chat) .cc-header .cc-icon-btn:focus-visible {
  background: var(--surface);
  color: var(--text);
}
body:has(.cc-chat) .cc-drawer {
  top: 58px;
  left: auto;
  right: 16px;
  bottom: auto;
  width: min(240px, calc(100% - 32px));
  padding: 8px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(40, 30, 10, 0.12);
}
body:has(.cc-chat) .cc-drawer h2 {
  margin: 8px 12px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
body:has(.cc-chat) .cc-drawer a {
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
}
body:has(.cc-chat) .cc-drawer a:hover { background: var(--surface-2); }

.cc-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(720px, 100%);
  margin: 0 auto;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
}
.cc-chat.is-chatting { justify-content: flex-start; }
.cc-chat.is-chatting .cc-empty { display: none; }
.cc-chat.is-chatting .cc-chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 12px;
}
.cc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.cc-cal { margin: 12px 0; }
.cc-cal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.cc-day { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; font-size: 0.78rem; background: var(--surface); }
.cc-day.is-down { border-color: var(--down); }
.cc-day.is-up { border-color: var(--up); }
.cc-day i { color: var(--text-muted); font-style: normal; }
.cc-today {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px auto 0;
  max-width: 880px;
  text-align: left;
}
.cc-insight {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  min-height: 72px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px rgba(40, 30, 10, 0.05);
  text-align: left;
  line-height: 1.35;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.cc-insight:hover { background: var(--surface-2); }
.cc-insight:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cc-insight-copy { min-width: 0; }
.cc-insight-copy strong { display: block; font-weight: 600; }
.cc-insight-copy span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.88rem; }
@media (max-width: 720px) {
  .cc-today { grid-template-columns: 1fr; }
}
.cc-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.cc-sheet[hidden] { display: none; }
.cc-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 10, 0.42);
}
.cc-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  padding: 8px 16px 16px;
}
.cc-sheet-body { overflow: auto; min-height: 0; }
.cc-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0 8px;
  background: var(--bg);
}
.cc-sheet-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: left;
}
.cc-sheet-x {
  margin-left: auto;
  appearance: none;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px rgba(40, 30, 10, 0.05);
}
.cc-sheet-kicker { margin: 0 0 8px; color: var(--text-muted); font-size: 0.9rem; text-align: left; }
.cc-sheet-lead { margin: 0 0 12px; font-size: 1.05rem; text-align: left; }
.cc-sheet-notes { margin: 0 0 16px; padding: 0; list-style: none; text-align: left; }
.cc-sheet-notes li { margin: 0 0 6px; color: var(--text-muted); font-size: 0.85rem; }
.cc-sheet-facts { margin: 0 0 14px; padding-left: 18px; text-align: left; }
.cc-sheet-facts li { margin: 0 0 6px; }
.cc-sheet-more { margin: 14px 0; text-align: left; }
.cc-sheet-more summary { cursor: pointer; color: var(--text-muted); }
.cc-sheet-more p { margin: 8px 0 0; color: var(--text-muted); font-size: 0.88rem; }
.cc-sheet-table .is-total th, .cc-sheet-table .is-total td { font-weight: 650; }
.cc-sheet h3 { margin: 18px 0 8px; font-size: 0.95rem; text-align: left; }
.cc-sheet-legend { display: flex; gap: 14px; margin: 0 0 8px; color: var(--text-muted); font-size: 0.8rem; }
.cc-sheet-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.cc-sheet-legend .is-now { background: var(--accent); }
.cc-sheet-legend .is-then { background: var(--chart-band); }
.cc-sheet-chart { width: 100%; height: 140px; margin-bottom: 4px; }
.cc-sheet-chart .is-now { fill: var(--accent); }
.cc-sheet-chart .is-then { fill: var(--chart-band); }
.cc-sheet-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; text-align: left; }
.cc-sheet-table th, .cc-sheet-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cc-sheet-table th { font-weight: 560; }
.cc-sheet-table .is-prior th, .cc-sheet-table .is-prior td { color: var(--text-muted); }
.cc-sheet-table .is-move td { color: var(--text-muted); font-size: 0.82rem; border-bottom-width: 8px; border-bottom-color: transparent; }
.cc-sheet-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.cc-sheet-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cc-sheet-list strong { display: block; }
.cc-sheet-list span { display: block; margin-top: 2px; color: var(--text-muted); font-size: 0.88rem; }
.cc-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 4px;
  background: var(--bg);
}
.cc-sheet-actions button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px rgba(40, 30, 10, 0.05);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.cc-sheet-actions .is-primary { background: var(--accent); color: var(--accent-ink); }
body.cc-sheet-open { overflow: hidden; }
@media (min-width: 900px) {
  .cc-sheet-panel {
    top: 0;
    bottom: 0;
    left: auto;
    width: min(460px, 100%);
    max-height: none;
    border-radius: 0;
    padding: 12px 20px 16px;
  }
}
.cc-empty { text-align: center; margin-bottom: 22px; }
.cc-empty h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.cc-chat-hello, .cc-chat-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.5;
}
.cc-chat-note { margin-top: 8px; font-size: 0.95rem; }

.cc-chat-form { margin: 0; }
.cc-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.05), 0 12px 32px rgba(40, 30, 10, 0.08);
}
.cc-pill input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  box-shadow: none;
}
.cc-pill input::placeholder { color: var(--text-muted); }
.cc-pill button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0;
  cursor: pointer;
}
.cc-pill button:focus-visible,
.cc-chip:focus-visible,
.cc-show-all:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cc-chat-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.cc-chat-chips .cc-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  min-height: 72px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px rgba(40, 30, 10, 0.05);
  text-align: left;
  line-height: 1.35;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.cc-chat-chips .cc-chip:hover { background: var(--surface-2); }
.cc-chip-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--accent);
}
.cc-chip-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-turn { display: flex; gap: 12px; margin: 22px 0 0; }
.cc-turn.user { justify-content: flex-end; }
.cc-turn.user p {
  margin: 0;
  max-width: min(34rem, 88%);
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.05);
  line-height: 1.45;
}
.cc-turn.bot { align-items: flex-start; }
.cc-mark {
  width: 22px;
  height: 22px;
  margin-top: 3px;
  border-radius: 6px;
  object-fit: contain;
}
.cc-turn-body {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}
.cc-answer { margin: 0; line-height: 1.55; }
.cc-answer p { margin: 0 0 10px; }
.cc-answer .cc-lead { font-size: 1.12rem; line-height: 1.4; margin-bottom: 12px; }
.cc-answer h3 { margin: 16px 0 8px; font-size: 0.98rem; font-weight: 650; letter-spacing: -0.01em; }
.cc-answer ul, .cc-answer ol { margin: 0 0 12px; padding-left: 1.2rem; }
.cc-answer li { margin: 4px 0; }
.cc-answer li.cc-nested { margin-left: 0.6rem; list-style: circle; }
.cc-answer .cc-data-note { margin-top: 12px; color: var(--text-muted); font-size: 0.82rem; }
.cc-answer .cc-table-wrap { margin: 8px 0 14px; }
.cc-answer .cc-table-scroll { overflow-x: auto; }
.cc-answer .cc-mini { width: max-content; min-width: 100%; }
.cc-answer .cc-mini tbody tr:nth-child(even) { background: var(--surface-2); }
.cc-answer .cc-mini td.cc-num, .cc-answer .cc-mini th.cc-num { text-align: right; font-variant-numeric: tabular-nums; }
.cc-asof { margin: 8px 0 0; color: var(--text-muted); font-size: 0.82rem; }
.cc-shimmer { display: none; }
.cc-turn.is-streaming .cc-shimmer {
  display: block;
  width: 38%;
  height: 12px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%;
  animation: cc-shimmer 1.1s ease-in-out infinite;
}
@keyframes cc-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cc-act {
  min-height: 40px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(0, 0, 0, 0.12));
  background: var(--surface, #fff);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
}
.cc-act:hover { background: var(--surface-2); }
@media (max-width: 640px) {
  .cc-act { flex: 1 1 calc(50% - 8px); }
}

.cc-follow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cc-follow .cc-chip {
  min-height: 36px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.3;
  cursor: pointer;
}
.cc-follow .cc-chip:hover { color: var(--text); }

.cc-table-wrap { margin: 16px 0 0; }
.cc-table-wrap figcaption,
.cc-chart figcaption {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.cc-table-scroll {
  overflow-x: auto;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04);
}
.cc-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.cc-mini th, .cc-mini td {
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}
.cc-mini th {
  color: var(--text-muted);
  font-weight: 560;
  font-size: 0.78rem;
}
.cc-mini tr:last-child td { border-bottom: 0; }
.cc-extra { display: none; }
.cc-table-wrap.is-open .cc-extra { display: table-row; }
.cc-show-all {
  margin: 8px 0 0;
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.cc-chart { margin: 16px 0 0; color: var(--text); }
.cc-chart svg { width: 100%; height: auto; display: block; }
.cc-grid { stroke: var(--line); stroke-width: 1; }
.cc-bar { fill: var(--accent); opacity: 0.9; }
.cc-chart-label, .cc-chart-value {
  fill: currentColor;
  font-size: 13px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.cc-chart-value { font-variant-numeric: tabular-nums; }
.cc-chart-label { fill: var(--text-muted); }

html[data-theme="dark"] body:has(.cc-chat) .cc-drawer {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .cc-pill {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.28);
}
html[data-theme="dark"] .cc-turn.is-streaming .cc-shimmer {
  background: linear-gradient(90deg, var(--surface-2), #3a372f, var(--surface-2));
  background-size: 200% 100%;
}

.cc-rate {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}
.cc-thumb {
  width: 32px;
  height: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  cursor: pointer;
}
.cc-thumb svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cc-thumb.is-down svg { transform: rotate(180deg); transform-origin: 12px 12px; }
.cc-thumb:hover, .cc-thumb.is-on { background: var(--surface-2); color: var(--accent); }
.cc-note { display: flex; gap: 8px; flex: 1; min-width: 12rem; }
.cc-note[hidden] { display: none; }
.cc-note input {
  flex: 1;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 0.9rem;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.05);
}
.cc-note input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  box-shadow: none;
}
.cc-note button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

body:has(.cc-insights) .cc-header {
  border-bottom: 0;
  background: var(--bg);
  box-shadow: none;
}
body:has(.cc-insights) .cc-hello { display: none; }
body:has(.cc-insights) .cc-header .cc-icon-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
}
.cc-main:has(.cc-insights) { width: min(760px, 100%); }
.cc-main:has(.cc-insights) .cc-footer { display: none; }
.cc-insights {
  width: min(720px, 100%);
  margin: 0 auto;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.cc-insights h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  font-weight: 560;
  letter-spacing: -0.03em;
}
.cc-insights-lead, .cc-insights-empty { color: var(--text-muted); }
.cc-sample {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 560;
}
.cc-insight-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.cc-insight-counts article, .cc-insights section {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04);
}
.cc-insights section { margin-top: 12px; }
.cc-insights h2 { margin: 0 0 10px; font-size: 1rem; }
.cc-insights .kicker { margin: 0 0 6px; color: var(--text-muted); font-size: 0.78rem; }
.cc-insights ul { list-style: none; margin: 0; padding: 0; }
.cc-insights li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}
.cc-insights li:last-child { border-bottom: 0; }
.cc-insights li span { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
@media (max-width: 700px) {
  .cc-insight-counts { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .cc-main:has(.cc-chat) { padding: 0 16px 0; }
  .cc-chat {
    justify-content: flex-start;
    padding-top: 8vh;
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .cc-chat.is-chatting { padding-top: 4px; }
  .cc-empty h1 { font-size: 1.7rem; }
  .cc-chat-chips { grid-template-columns: 1fr; }
  .cc-chat-chips .cc-chip { width: 100%; }
  .cc-chat-form {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 24;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg);
  }
}
