/* GM3 console components (forked from the research.my house shell).
   Loaded after app.css. Base shell/typography/table styles live in app.css. */

/* Sidebar: guided-demo launcher */
.nav-item--tour { border: 1px dashed var(--accent-line); margin-bottom: 10px; }
.nav-item__badge--ghost { background: transparent; color: var(--accent-hover); border: 1px solid var(--accent-line); }

/* Topbar right-hand context (data window, freshness) */
.topbar__kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); white-space: nowrap; }

/* Insight callouts are information, not alerts. Keep them off the accent so
   an amber warning or a red critical badge still reads as the exceptional thing
   on the page. Only the icon and a hairline rule carry the accent. */
.callout {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  border-left: 2px solid var(--accent);
}
.callout svg { color: var(--accent-hover); }
.callout--insight .insight-line + .insight-line {
  border-top: 1px dashed var(--border-light);
}

/* Provenance footnote under a card or table - every figure says where it came from */
.src-note { margin-top: 10px; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }
.src-note strong { color: var(--text-tertiary); font-weight: 600; }

/* Chart legend - always present for >=2 series so identity is never colour-alone */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-item--self { color: var(--text); font-weight: 600; }

/* Hero figure (single headline number, no plot) */
.hero-figure { font-family: var(--font-display); font-size: 44px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.hero-figure--sm { font-size: 32px; }
.hero-sub { color: var(--text-secondary); font-size: 13px; margin-top: 6px; }

/* Price-position scale: market min to max track, with the focus brand price marked */
.pp-scale { position: relative; height: 8px; background: var(--bg-sunk); border-radius: 4px; margin: 14px 0 6px; }
.pp-scale__range { position: absolute; height: 100%; background: var(--border-strong); border-radius: 4px; }
.pp-scale__median { position: absolute; width: 2px; height: 16px; top: -4px; background: var(--text-secondary); }
.pp-scale__self { position: absolute; width: 13px; height: 13px; border-radius: 50%; top: -3px; transform: translateX(-50%);
  background: var(--c-self); border: 2px solid var(--text); box-shadow: 0 0 0 3px var(--accent-dim); }
.pp-scale__labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); }

/* Position wording - always carries a word, never colour alone */
.pos-below { color: var(--success); }
.pos-above { color: var(--warning); }
.pos-at { color: var(--text-secondary); }

/* AI mention matrix (brand x query-category grid) */
.matrix { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.matrix th { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-tertiary); font-weight: 500; padding: 4px 6px; text-align: left; vertical-align: bottom; }
.matrix td.matrix__brand { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; padding-right: 10px; }
.matrix tr.is-self td.matrix__brand { color: var(--text); font-weight: 600; }
.matrix__cell { width: 46px; height: 30px; border-radius: 4px; text-align: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text); background: var(--bg-sunk); }
.matrix__cell[data-lvl="0"] { background: var(--bg-sunk); color: var(--text-dim); }
.matrix__cell[data-lvl="1"] { background: rgba(57,135,229,0.18); }
.matrix__cell[data-lvl="2"] { background: rgba(57,135,229,0.38); }
.matrix__cell[data-lvl="3"] { background: rgba(57,135,229,0.62); }
.matrix__cell[data-lvl="4"] { background: rgba(57,135,229,0.85); color: #fff; }
.matrix__cell--gap { outline: 1.5px solid var(--warning); outline-offset: -1.5px; }

/* Store network - map toolbar (lens / rings / tier chips) */
.map-toolbar { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; }
.map-toolbar__group { display: flex; align-items: center; gap: 10px; }
.chip-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-sunk); border: 1px solid var(--border-light); color: var(--text-tertiary);
  border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  font-family: var(--font-body); cursor: pointer; transition: all var(--transition);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip--on { background: var(--bg-elevated); color: var(--text); border-color: var(--border-strong); }
.chip .legend-swatch { width: 9px; height: 9px; }

/* Map inspector overlay (aria-live selection card) */
.map-inspector {
  position: absolute; top: 12px; right: 12px; z-index: 500;
  background: rgba(19,19,20,0.94); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 9px 13px; max-width: 260px;
  box-shadow: var(--shadow); pointer-events: none;
}
.map-inspector__kicker { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-hover); }
.map-inspector__title { font-family: var(--font-display); font-size: 13.5px; font-weight: 600; margin: 2px 0 1px; }
.map-inspector__meta { font-size: 11.5px; color: var(--text-secondary); }

/* Leaflet popups (stores.js binds className "store-popup") kept on the dark surface */
.store-popup .leaflet-popup-content-wrapper {
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  box-shadow: var(--shadow); font-family: var(--font-body); font-size: 12.5px;
}
.store-popup .leaflet-popup-content { margin: 10px 14px; line-height: 1.55; }
.store-popup .leaflet-popup-tip { background: var(--bg-elevated); border: 1px solid var(--border-light); }
.store-popup a.leaflet-popup-close-button { color: var(--text-tertiary); }

/* Map legend strip */
.map-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 500;
  display: flex; gap: 12px; flex-wrap: wrap;
  background: rgba(19,19,20,0.92); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 11px; pointer-events: none;
}
.map-legend .legend-item { font-size: 11px; }

/* Key-value rows inside the drilldown panel */
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-row--hot { background: var(--accent-dim); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 4px; }
.kv-row--click { cursor: pointer; transition: background var(--transition); }
.kv-row--click:hover { background: var(--bg-hover); }

/* Audience-lens muting in the store list */
.store-row--muted { opacity: 0.35; }

/* Store network */
.store-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
@media (max-width: 1000px) { .store-grid { grid-template-columns: 1fr; } }
.store-list { max-height: 620px; overflow-y: auto; }
.store-row { display: block; padding: 11px 13px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); }
.store-row:last-child { border-bottom: none; }
.store-row:hover { background: var(--bg-hover); }
.store-row.active { background: var(--accent-dim); }
.store-row__name { font-size: 13px; font-weight: 600; color: var(--text); }
.store-row__meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
#storeMap { height: 620px; border-radius: var(--radius); background: var(--bg-sunk); }
@media (max-width: 1000px) { #storeMap { height: 420px; } }

/* Site Signals: the four way grade distribution strip.
   The shortlist table below it deliberately shows only the two actionable
   grades, so this strip carries the whole population and stops the table from
   implying the brand is thin everywhere. Each cell wears the same colour as its
   badge in the table, and always carries its word, so meaning is never colour
   alone. */
.vdist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.vdist__cell { background: var(--bg-elevated); padding: 12px 14px; border-top: 2px solid var(--border-light); }
.vdist__n { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--text); }
.vdist__lab { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-tertiary); margin-top: 3px; }
.vdist__cell--absent        { border-top-color: var(--accent-hover); }
.vdist__cell--under-indexed { border-top-color: var(--warning); }
.vdist__cell--at-par        { border-top-color: var(--border-strong); }
.vdist__cell--over-indexed  { border-top-color: var(--success); }
.vdist__cell--absent .vdist__lab        { color: var(--accent-hover); }
.vdist__cell--under-indexed .vdist__lab { color: var(--warning); }
.vdist__cell--over-indexed .vdist__lab  { color: var(--success); }
/* The grade badge holds two words, so it must never wrap into a block. The
   table already scrolls inside .table-wrap if the extra width costs anything. */
.col-grade { white-space: nowrap; }
.col-grade .badge { white-space: nowrap; }
.vdist__note { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; margin: 12px 0 14px; max-width: 820px; }
.vdist__note strong { color: var(--text); font-weight: 600; }
@media (max-width: 720px) { .vdist { grid-template-columns: repeat(2, 1fr); } }

/* Income tier pill */
.tier { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.05em; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.tier--T20 { background: var(--success-dim); color: var(--success); }
.tier--M40 { background: rgba(57,135,229,0.16); color: #7cb3f0; }
.tier--B40 { background: var(--warning-dim); color: var(--warning); }
.tier--na  { background: var(--bg-hover); color: var(--text-dim); }

/* Value-proposition cards (Your Data / Insights pages) */
.value-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.value-card__icon { width: 38px; height: 38px; border-radius: var(--radius); background: var(--accent-dim); display: grid; place-items: center; margin-bottom: 13px; }
.value-card__icon svg { width: 19px; height: 19px; color: var(--accent-hover); }
.value-card h3 { margin-bottom: 7px; }
.value-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.value-card--locked { border-style: dashed; }

/* Numbered step list (sovereign-AI flow) */
.steps { display: grid; gap: 14px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: start; }
.step__n { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-dim); color: var(--accent-hover);
  display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.step__title { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.step__body { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* Alert rows */
.alert-row { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: start; padding: 13px 0; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: none; }
.alert-row__title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.alert-row__body { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }

/* Review / social cards */
.post-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.post-card__head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.post-card__who { font-size: 12.5px; font-weight: 600; }
.post-card__body { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.post-card__reply { margin-top: 10px; padding-left: 12px; border-left: 2px solid var(--border-light); font-size: 12.5px; color: var(--text-tertiary); }
.stars { color: var(--warning); font-size: 12px; letter-spacing: 1px; }

/* Segmented proportion bar - 2px surface gap between fills */
.segbar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg-sunk); }
.segbar span { display: block; height: 100%; }

/* Scrollable wide content must scroll inside its own container */
.scroll-x { overflow-x: auto; }

/* ============ BRAND MARKS ============
   BASIC company mark: assets/img/basic-logo.png, 600 x 105, aspect 5.714:1.
   Transparent PNG carrying exactly two ink colours, grey #818285 for the
   wordmark and green #71BF44 for the letter A. Ink fills the full canvas, so
   the rendered box height IS the cap height.

   LEGIBILITY ON DARK, measured not assumed. The grey ink against the surfaces
   it actually sits on:
     sidebar    #070707  ->  5.24:1
     login card #131314 over the page gradient, effectively #121213  ->  4.87:1
     board pack card #131314  ->  4.61:1
     board pack in print, on #ffffff  ->  3.85:1
   The green A runs 8.2:1 to 8.9:1 on the same dark surfaces. Every figure
   clears the 3:1 WCAG non text contrast floor for graphical objects, and the
   dark ones clear the stricter 4.5:1 text floor too. The artwork therefore
   ships unmodified: no brightness filter, no plate, no recolour. Lifting the
   grey would break its tuned relationship with the green A for no legibility
   gain, and the same untouched file is what prints on white in the board pack.

   ASPECT PROTECTION. Only width is ever declared. height:auto plus an explicit
   aspect-ratio keeps 5.714 even before the file decodes, and the intrinsic
   width/height attributes on the img reserve the right box on first paint.
   flex:0 0 auto stops a flex line from squashing the mark on the main axis,
   which is a live risk in .sidebar__brand because that row is locked to a
   60px height. align-self stops the cross axis stretch that a column flex
   parent's default align-items:stretch would otherwise apply. */
.basic-mark {
  display: block; height: auto; max-width: 100%;
  aspect-ratio: 600 / 105;
  flex: 0 0 auto; align-self: flex-start;
}
.basic-mark--sidebar { width: 112px; }  /* -> 19.6px tall */
.basic-mark--login   { width: 150px; align-self: center; }  /* -> 26.3px tall */
.basic-mark--doc     { width: 116px; }  /* board pack masthead -> 20.3px tall */

/* ============ PARTNER MARKS (co branding scaffolding, currently unused) ============
   No partner mark is shown at present: the console is BASIC's own work, so the
   sidebar foot and the login card carry the BASIC mark alone. The rules below are
   kept so a future partner logo can be dropped back in without redesigning the
   chrome, and they encode the subordination rule that governed the last one.

   Set width only, never height, so a mark can never be stretched. Size the
   partner mark by the area its INK actually covers, not by cap height, because
   logos differ widely in aspect ratio and internal padding. The house mark should
   carry roughly two and a half times the partner's ink at every size, and hold the
   primary position (top of the sidebar, top of the login card), while the partner
   sits at the foot behind a "Powered by" label at 0.88 opacity. The sizes below
   are calibrated for artwork of about 1.8:1 with generous padding.
*/
.ecv-mark {
  display: inline-block; height: auto; max-width: 100%;
  flex: 0 0 auto; align-self: flex-start;
}
.ecv-mark--sm { width: 56px; }  /* sidebar chrome  -> 31.0px box, 19.6px ink */
.ecv-mark--md { width: 76px; }  /* login card foot -> 42.0px box, 26.6px ink */

/* Sidebar: quiet "Powered by" lockup pinned above the user footer */
.sidebar__powered {
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar__powered-label {
  display: block; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
}
.sidebar__powered .ecv-mark { opacity: 0.88; }

/* Login card foot: research arm line, then the powered by lockup */
.login-partners__arm {
  display: block; margin-bottom: 16px;
  font-size: 11.5px; line-height: 1.5; color: var(--text-tertiary);
}
.login-partners__arm strong { color: var(--text-secondary); font-weight: 600; }
.powered-by { text-align: center; }
.powered-by__label {
  display: block; margin-bottom: 8px;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
}

/* Coverage aware verdicts.
   "Not covered" is NOT a verdict and NOT a finding. It records that the harvest
   captured nothing at all for that slice, so the console
   has nothing to compare and makes no claim. It must therefore never borrow a
   status colour, because red would read as a finding and green as a pass. It
   gets neutral ink, a dashed outline that says "outside the scored set", and it
   always ships with the words, never colour alone. */
.badge--notcov {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
}

/* Coverage statement. Sits above the figures on any page whose data is partial
   (state-level registrations, mention-based sentiment). It sets the limits of
   what the rest of the page may claim. A scope note, not an alert. */
.coverage-note {
  display: flex; gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-left: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.coverage-note > div { min-width: 0; flex: 1; }
.coverage-note svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; margin-top: 2px; }
.coverage-note__title { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.coverage-note__body { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }
.coverage-note__body strong { color: var(--text); font-weight: 600; }
.coverage-note__body .badge { vertical-align: baseline; }
.coverage-note__cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }

/* One chip per slice, so the capture count is legible at a glance and a slice
   with nothing captured is visibly a hole rather than a zero. */
.coverage-chip {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  padding: 5px 10px; border-radius: var(--radius-sm);
  background: var(--bg-sunk); border: 1px solid var(--border);
}
.coverage-chip__cat { font-weight: 600; color: var(--text); }
.coverage-chip__n { font-family: var(--font-mono); font-size: 11px; }
.coverage-chip--none { border-style: dashed; }
.coverage-chip--none .coverage-chip__cat { color: var(--text-secondary); }
.coverage-chip--none .coverage-chip__n { color: var(--text-tertiary); }

/* The not covered listing is deliberately quieter than the scored tables next
   to it, so it never competes with a real finding for attention. */
.card--muted { background: var(--bg-sunk); border-style: dashed; }

/* Print (Board Pack) */
@media print {
  .coverage-note { background: #fff; border-color: #ccc; border-left-color: #555; break-inside: avoid; }
  .coverage-chip { background: #fff; border-color: #ccc; }
  .badge--notcov { background: #fff; color: #333; border-color: #999; }
  .card--muted { background: #fff; }
  .sidebar, .topbar, .tour-veil, .tour-card, .btn, .card__tools, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; color: #111; }
  .card, .stat { border-color: #ccc; background: #fff; break-inside: avoid; }
  .content { padding: 0; max-width: none; }
  a { color: #111; }
}
