/* Tokens. Dark is the designed-first theme; light is composed separately, not inverted. */
:root {
  color-scheme: light;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --page: #f5efe3; --surface: #fdf9f1; --raised: #fffdf8; --border: #e6dccb;
  --text-1: #14110d; --text-2: #3f3b35; --text-3: #685f52; --text-4: #a39b8e;
  --brand: #1a6f7a; --accent: #1a6f7a; --accent-soft: #dcebe6; --on-accent: #ffffff;
  --praise: #1baf7a; --good: #eda100; --request: #2a78d6; --bad: #e87ba4; --nonsense: #4a3aa7; --complaint: #e34948;
  --stars: #eda100; --sentiment: #4a3aa7; --android: #2a78d6; --ios: #eb6834; --volume: #20808d; --neutral: #cfc8ba;
  --ramp-1: #e34948; --ramp-2: #f0a39f; --ramp-3: #cfc8ba; --ramp-4: #8fd4b7; --ramp-5: #1baf7a;
  --seq-1: #2f2478; --seq-2: #4a3aa7; --seq-3: #6a5bc4; --seq-4: #8b7edb; --seq-5: #aca2e8; --seq-6: #cdc7f2;
  --shadow: 0 10px 30px -12px rgba(60, 45, 20, 0.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e0f12; --surface: #15171c; --raised: #1c1f26; --border: #2a2d35;
    --text-1: #f4f4f2; --text-2: #c3c2b7; --text-3: #8d8c84; --text-4: #62615c;
    --brand: #4fb8c6; --accent: #4fb8c6; --accent-soft: #16303a; --on-accent: #0e0f12;
    --praise: #199e70; --good: #c98500; --request: #3987e5; --bad: #d55181; --nonsense: #9085e9; --complaint: #e66767;
    --stars: #c98500; --sentiment: #9085e9; --android: #3987e5; --ios: #d95926; --volume: #3aa6b5; --neutral: #55554f;
    --ramp-1: #e66767; --ramp-2: #a8504f; --ramp-3: #55554f; --ramp-4: #2f7d62; --ramp-5: #199e70;
    --seq-1: #c9c3f6; --seq-2: #aaa1ef; --seq-3: #9085e9; --seq-4: #7466d1; --seq-5: #5a4eb0; --seq-6: #463d8c;
    --shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e0f12; --surface: #15171c; --raised: #1c1f26; --border: #2a2d35;
  --text-1: #f4f4f2; --text-2: #c3c2b7; --text-3: #8d8c84; --text-4: #62615c;
  --brand: #4fb8c6; --accent: #4fb8c6; --accent-soft: #16303a; --on-accent: #0e0f12;
  --praise: #199e70; --good: #c98500; --request: #3987e5; --bad: #d55181; --nonsense: #9085e9; --complaint: #e66767;
  --stars: #c98500; --sentiment: #9085e9; --android: #3987e5; --ios: #d95926; --volume: #3aa6b5; --neutral: #55554f;
  --ramp-1: #e66767; --ramp-2: #a8504f; --ramp-3: #55554f; --ramp-4: #2f7d62; --ramp-5: #199e70;
  --seq-1: #c9c3f6; --seq-2: #aaa1ef; --seq-3: #9085e9; --seq-4: #7466d1; --seq-5: #5a4eb0; --seq-6: #463d8c;
  --shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--border) transparent; }
body { margin: 0; background: var(--page); color: var(--text-2); font: 400 14px/22px var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: var(--on-accent); }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
h1, h2, h3, h4 { color: var(--text-1); font-weight: 600; text-wrap: balance; }
h1 { font-size: 32px; line-height: 36px; letter-spacing: -0.02em; color: var(--brand); }
h2 { font-size: 20px; line-height: 26px; letter-spacing: -0.01em; }
h3 { font-size: 15px; line-height: 20px; }
h4 { font-size: 14px; line-height: 20px; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.note { color: var(--text-3); font-size: 12px; line-height: 16px; }
.error { color: var(--text-1); padding: 24px; border: 1px solid var(--complaint); border-radius: 14px; background: var(--surface); }
.icon { width: 16px; height: 16px; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.with-dot { display: inline-flex; align-items: center; gap: 8px; }
.shell { width: min(1280px, 100% - 48px); margin-inline: auto; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Controls */
button, .button, select, input { font: 500 13px/18px var(--font-sans); color: var(--text-1); }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; text-decoration: none; transition: background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out; }
button:hover, .button:hover { background: var(--raised); border-color: var(--text-4); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text-1)); border-color: var(--accent); }
button:disabled { color: var(--text-4); cursor: not-allowed; background: transparent; border-color: var(--border); }
select, input[type="search"], input[type="date"] { min-height: 40px; width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); caret-color: var(--accent); }
input::placeholder { color: var(--text-3); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.field { display: grid; gap: 6px; }
.field > span { color: var(--text-3); font-size: 12px; line-height: 16px; font-weight: 500; }

/* Header and navigation */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 44px 0 28px; flex-wrap: wrap; }
.subtitle { color: var(--text-3); margin-top: 8px; font-size: 14px; }
.byline { color: var(--text-3); margin-top: 6px; font-size: 13px; line-height: 20px; }
.byline strong { color: var(--text-1); font-weight: 600; }
.byline a { color: var(--brand); font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 3px; }
.byline a:hover { text-decoration-color: var(--brand); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.control-wrap { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px); border-block: 1px solid var(--border); }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; flex-wrap: wrap; }
#tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
#tabs button { border-color: transparent; background: transparent; color: var(--text-3); white-space: nowrap; }
#tabs button:hover { color: var(--text-1); background: var(--surface); }
#tabs button[aria-selected="true"] { color: var(--text-1); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.segmented button { min-height: 30px; padding: 5px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--text-3); }
.segmented button .num { font-size: 12px; color: var(--text-3); }
.segmented button:hover { color: var(--text-1); background: var(--raised); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.segmented button[aria-pressed="true"] .num { color: var(--on-accent); opacity: 0.8; }
main { padding: 28px 0 72px; min-height: 60vh; }
footer { padding: 28px 0 56px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; line-height: 18px; display: grid; gap: 6px; max-width: 1280px; }
footer p { max-width: 90ch; }

/* Layout */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-12 { grid-column: span 12; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 44px 0 14px; flex-wrap: wrap; }
.section-heading p { color: var(--text-3); font-size: 12px; }
.card, .chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; min-width: 0; }

/* Stat band: one surface, not six cards */
.stat-band { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 16px; }
.stat { padding: 18px 20px; border-left: 1px solid var(--border); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-name { color: var(--text-3); font-size: 12px; line-height: 16px; font-weight: 500; }
.stat-value { color: var(--text-1); font: 500 30px/36px var(--font-mono); letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--text-3); font-size: 12px; line-height: 16px; margin-top: 6px; }

/* Briefing */
.key-points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.key-point { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; min-width: 0; }
.key-point-index { color: var(--text-3); font: 500 12px/16px var(--font-mono); font-variant-numeric: tabular-nums; }
.key-point > p:not(.key-point-index) { color: var(--text-2); font-size: 13px; line-height: 19px; }
.key-point-link { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; color: var(--brand); font-size: 13px; font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 3px; }
.key-point-link:hover { text-decoration-color: var(--brand); }
.key-point-link .icon { width: 14px; height: 14px; }
.key-point { gap: 6px; padding: 16px 18px; scroll-margin-top: 90px; transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out; }
.key-point.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.key-point h3 { font-size: 14px; line-height: 19px; }
.key-point h3:focus { outline: none; }
.key-point > p.key-point-evidence { font-size: 12.5px; line-height: 18px; }
.key-point .key-point-link { font-size: 12.5px; padding-top: 6px; }
.key-point-link.secondary { color: var(--text-2); font-weight: 400; font-size: 12.5px; text-decoration-color: color-mix(in srgb, var(--text-3) 50%, transparent); }
.key-point-link.secondary:hover { color: var(--brand); text-decoration-color: var(--brand); }
/* Next step disclosure, shared by takeaway cards and opportunity cards */
.next-step { border-left: 3px solid var(--brand); padding-left: 10px; margin-top: 2px; }
.next-step summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-size: 12.5px; line-height: 18px; font-weight: 600; }
.next-step summary::-webkit-details-marker { display: none; }
.next-step summary .icon { width: 12px; height: 12px; transition: transform 0.15s ease-out; }
.next-step[open] summary .icon { transform: rotate(90deg); }
.next-step summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.next-step > p { color: var(--text-2); font-size: 12.5px; line-height: 18px; margin-top: 4px; }
.next-step > .key-point-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.next-step > .key-point-link .icon { width: 13px; height: 13px; }
.opportunity .next-step > p { font-size: 13px; line-height: 19px; }
/* Start here, under the priority matrix */
.start-here { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-top: 16px; }
.start-here h2 { font-size: 16px; line-height: 22px; }
.start-here > .muted { font-size: 12px; margin: 2px 0 10px; }
.start-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.start-head { color: var(--text-3); font-size: 12px; line-height: 16px; }
.start-head strong { color: var(--text-1); font-weight: 600; font-size: 13px; }
.start-items { color: var(--text-3); font-size: 13px; line-height: 20px; margin-top: 2px; }
.start-items a { color: var(--brand); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 3px; }
.start-items a:hover { text-decoration-color: var(--brand); }
.chart-takeaways { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.chart-takeaway { color: var(--text-2); font-size: 12px; line-height: 17px; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text-3) 50%, transparent); text-underline-offset: 3px; }
.chart-takeaway:hover { color: var(--brand); text-decoration-color: var(--brand); }
.chart-takeaway::before { content: "↑ "; color: var(--text-3); text-decoration: none; }

/* Charts */
.chart-card { display: flex; flex-direction: column; scroll-margin-top: 90px; transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out; }
.chart-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chart-card h3:focus { outline: none; }
.chart-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.chart-header p { color: var(--text-3); font-size: 12px; line-height: 17px; margin-top: 4px; max-width: 72ch; }
.table-toggle { min-height: 28px; padding: 4px 10px; font-size: 12px; color: var(--text-3); border-radius: 8px; white-space: nowrap; flex: none; }
.chart-body { min-width: 0; flex: 1; display: grid; align-content: center; }
.chart-body.split.stacked { grid-template-columns: 1fr; gap: 18px; }
.chart-wrap { position: relative; min-width: 0; }
.chart-body.split { grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.legend-list { display: grid; gap: 2px; font-size: 12px; line-height: 16px; }
.legend-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto 38px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.legend-list li:first-child { border-top: 0; }
.legend-name { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); min-width: 0; }
.legend-list .num { color: var(--text-1); text-align: right; }
.legend-list .share { color: var(--text-3); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-3); font-size: 12px; font-weight: 500; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
td.num { color: var(--text-1); text-align: right; white-space: nowrap; }
th:not(:first-child) { text-align: right; }
tr:last-child td { border-bottom: 0; }
.meter-table td.muted { color: var(--text-3); }
.meter-table td:nth-child(2) { width: 42%; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; min-width: 60px; flex: 1; }
.meter-fill { display: block; height: 100%; border-radius: 3px; background: var(--complaint); }
.meter-row { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.meter-row .num { color: var(--text-1); }

/* Opportunities */
.evidence { color: var(--text-2); font-size: 13px; line-height: 20px; padding: 12px 16px; border: 1px dashed var(--border); border-radius: 12px; margin-bottom: 16px; max-width: 92ch; }
.opportunity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.opportunity { display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; scroll-margin-top: 90px; transition: border-color 0.2s ease-out; }
.opportunity::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone); }
.opportunity.fix { --tone: var(--complaint); } .opportunity.explore, .opportunity.request { --tone: var(--request); } .opportunity.strength { --tone: var(--praise); }
.opportunity.few { opacity: 0.6; }
.opportunity.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tag { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; line-height: 16px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 16%, transparent); }
.tag .icon { width: 14px; height: 14px; }
.opp-count { display: grid; justify-items: end; color: var(--text-3); font-size: 11px; line-height: 14px; }
.opp-count .num { color: var(--text-1); font-size: 26px; line-height: 28px; letter-spacing: -0.02em; }
.opp-desc { color: var(--text-2); font-size: 13px; line-height: 20px; flex: 1; }
.few-note { color: var(--text-3); font-size: 12px; }
.opp-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.opp-foot .split { display: flex; gap: 14px; color: var(--text-3); font-size: 12px; font-family: var(--font-mono); }
.see { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.rank-list { display: grid; gap: 14px; counter-reset: rank; }
.rank-list li { display: grid; gap: 6px; }
.rank-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--text-1); text-align: left; justify-content: flex-start; text-decoration: underline; text-decoration-color: var(--text-4); text-underline-offset: 3px; }
.link:hover { background: none; text-decoration-color: var(--accent); }

/* Deep dive */
.deep-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidebar { position: sticky; top: 76px; display: grid; gap: 12px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; padding-right: 4px; }
.sidebar .segmented { display: grid; grid-template-columns: 1fr 1fr; }
.sidebar .sidebar-select { display: none; }
.sidebar-list { display: grid; gap: 2px; }
.sidebar-list button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; justify-content: stretch; text-align: left; border-color: transparent; background: transparent; color: var(--text-2); font-weight: 400; padding: 8px 10px; min-height: 0; }
.sidebar-list button:hover { background: var(--surface); }
.sidebar-list button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text-1); font-weight: 500; box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-list .num { color: var(--text-3); font-size: 12px; }
.name-with-dot { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.segment-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.segment-bar span { min-width: 2px; }
.segment-bar.mini { grid-column: 1 / -1; height: 3px; gap: 1px; margin-left: 16px; opacity: 0.85; }
.composition { display: grid; gap: 10px; margin: 16px 0 4px; }
.composition-key { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-3); font: 500 12px/16px var(--font-mono); }
.detail-header { display: grid; gap: 12px; margin-bottom: 16px; }
.detail-header h2 { font-size: 24px; line-height: 30px; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--text-3); font: 500 12px/18px var(--font-mono); }
.takeaways { display: grid; gap: 8px; color: var(--text-2); max-width: 78ch; }
.takeaways li { padding-left: 16px; position: relative; }
.takeaways li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 1px; background: var(--text-3); }
.related h3, .topics h3 { font-size: 12px; line-height: 16px; color: var(--text-3); font-weight: 500; margin-bottom: 8px; }
.topics { margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-2); font-size: 12px; line-height: 16px; font-weight: 500; }
button.chip:hover { border-color: var(--text-4); background: var(--raised); }
button.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text-1); }
.review-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 16px 0 12px; }
.review-toolbar .field { min-width: 150px; }

/* Reviews */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
.filters .field.search { grid-column: span 2; }
.filters > button { min-height: 40px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: var(--text-2); font-size: 13px; }
.results-heading { margin: 22px 0 12px; font-size: 16px; }
.review-list { display: grid; gap: 10px; }
.review-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: grid; gap: 10px; }
.review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--text-3); font: 500 12px/16px var(--font-mono); }
.stars { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 999px; color: var(--text-1); background: color-mix(in srgb, var(--band) 20%, transparent); }
.stars .icon { width: 12px; height: 12px; color: var(--band); }
.band-low { --band: var(--complaint); } .band-mid { --band: var(--text-3); } .band-high { --band: var(--praise); }
.badge { padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font-sans); }
.review-language { font-family: var(--font-sans); }
.review-title { font-size: 14px; }
.review-text { color: var(--text-2); font-size: 14px; line-height: 22px; max-width: 86ch; overflow-wrap: anywhere; white-space: pre-line; }
.review-text.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.review-content { display: grid; gap: 8px; }
.review-actions { display: flex; gap: 6px; }
.review-actions:empty { display: none; }
.review-actions button, .review-content > button { min-height: 26px; padding: 3px 10px; font-size: 12px; color: var(--text-3); border-radius: 8px; justify-self: start; }
.flags { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-3); font-size: 12px; }
.flags span { display: inline-flex; align-items: center; gap: 6px; }
.flags span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-4); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; color: var(--text-3); font: 500 12px/16px var(--font-mono); flex-wrap: wrap; }
.pager .buttons { display: flex; gap: 6px; }
.empty { display: grid; gap: 12px; justify-items: start; padding: 28px; border: 1px dashed var(--border); border-radius: 14px; color: var(--text-2); }

/* Drawer */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8, 9, 12, 0.55); display: flex; justify-content: flex-end; }
#drawer { width: min(720px, 100%); height: 100%; overflow-y: auto; background: var(--page); border-left: 1px solid var(--border); box-shadow: var(--shadow); padding: 0 24px 32px; animation: slide-in 0.2s cubic-bezier(0.16, 1, 0.3, 1); scrollbar-width: thin; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0 14px; background: var(--page); border-bottom: 1px solid var(--border); margin-bottom: 16px; }
#drawer-content { display: grid; gap: 12px; }
#drawer-content > .segmented { justify-self: start; }
body.drawer-open { overflow: hidden; }

/* Loading */
.skeleton { height: 320px; border-radius: 14px; border: 1px solid var(--border); background: linear-gradient(100deg, var(--surface) 30%, var(--raised) 50%, var(--surface) 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Responsive */
@media (max-width: 1100px) {
  .span-4, .span-5, .span-6, .span-7 { grid-column: span 12; }
  .key-points { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 639px) {
  .shell { width: calc(100% - 32px); }
  h1 { font-size: 26px; line-height: 30px; }
  .page-header { padding: 28px 0 20px; }
  .stat-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-left: 0; border-top: 1px solid var(--border); padding: 14px 16px; }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--border); }
  .stat-value { font-size: 24px; line-height: 30px; }
  .card, .chart-card, .key-point { padding: 16px; }
  .key-points { grid-template-columns: minmax(0, 1fr); }
  .chart-body.split { grid-template-columns: 1fr; }
  .chart-header { flex-wrap: wrap; }
  .deep-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .sidebar .sidebar-select { display: grid; }
  .sidebar-list { display: none; }
  .filters .field.search { grid-column: 1 / -1; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  #drawer { padding: 0 16px 24px; border-left: 0; }
  .controls { gap: 8px; }
  .segmented button { padding: 5px 9px; }
  .opportunity-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Category links on charts: a real link over each row label, and linked names in the table view. */
.row-link { position: absolute; left: 0; display: block; border-radius: 6px; }
.row-link:hover, .row-link:focus-visible { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.table-wrap td a { color: var(--brand); font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 3px; }
.table-wrap td a:hover { text-decoration-color: var(--brand); }
.detail-header h2:focus { outline: none; }
