/* ── Triage board: a standard dashboard ──────────────────────────
   A fixed sidebar, a top bar, a row of key numbers, then cards for
   the charts, the mentions, the score's reasons and the memo. It sits
   on top of landing.css and app.css and reuses their colour tokens. */

.dash {
  --canvas: #f5f6f8;
  --card: #ffffff;
  --line: #e6e7eb;
  --side-w: 248px;
  --top-h: 68px;
  background: var(--canvas);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dash { --canvas: #0c0c0e; --card: #161619; --line: #26262b; }
}
:root[data-theme="dark"] .dash { --canvas: #0c0c0e; --card: #161619; --line: #26262b; }

.dash-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

/* ── Sidebar ── */

.dash-side {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 28px;
  height: 100vh; padding: 22px 16px 20px;
  overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--line);
}
.dash-side__logo { display: inline-flex; padding: 0 10px; }
.dash-side__logo img, .dash-side__logo svg, .dash-top__logo img, .dash-top__logo svg { height: 34px; width: auto; }

.dash-nav ul, .dash-menu__sheet ul { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; }
.dash-nav__link {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px;
  border-radius: 10px;
  color: var(--fg-2); font-size: 16px; font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.dash-nav__link:hover { background: var(--tint); color: var(--fg); }
.dash-nav__link[aria-current] { background: var(--tint); color: var(--fg); font-weight: 600; }
.dash-nav__link[aria-current] .dash-icon { color: var(--red); }
.dash-icon { flex: none; }

.dash-side__foot { display: grid; gap: 14px; margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--line); }
.dash-side__note { color: var(--fg-2); font-size: 15px; line-height: 1.45; }
.dash-side__note strong { color: var(--fg); }
.dash-side__cta { justify-content: center; }
.dash-side__user { color: var(--fg); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

/* ── Top bar ── */

.dash-main { display: flex; flex-direction: column; min-width: 0; }
.dash-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  min-height: var(--top-h); padding: 12px clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.dash-top__logo { display: none; }
.dash-top__title { display: grid; gap: 2px; min-width: 0; }
.dash-top__title h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; overflow-wrap: anywhere; }
.dash-top__title p { color: var(--fg-2); font-size: 15px; }
.dash-top__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.dash-top .tag { min-height: 32px; padding: 0 12px; font-size: 15px; }

.dash-menu { display: none; position: relative; }
.dash-menu summary {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 10px; cursor: pointer; list-style: none;
}
.dash-menu summary::-webkit-details-marker { display: none; }
.dash-menu summary:hover { background: var(--tint); }
.dash-menu__icon, .dash-menu__icon::before, .dash-menu__icon::after {
  display: block; width: 20px; height: 2px; border-radius: 1px; background: var(--fg); content: "";
}
.dash-menu__icon { position: relative; }
.dash-menu__icon::before { position: absolute; top: -6px; }
.dash-menu__icon::after { position: absolute; top: 6px; }
.dash-menu__sheet {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(280px, calc(100vw - 32px)); padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.12);
}

/* ── Content ── */

.dash-content {
  display: grid; gap: 20px; align-content: start;
  width: 100%; max-width: 1480px;
  padding: 24px clamp(16px, 3vw, 32px) 40px;
}
.app main.dash-content > section { padding-block: 0; }

.card {
  min-width: 0;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.card__head h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.card__head h2 span { color: var(--fg-2); font-weight: 500; }
.card__head > p:not(.tag) { color: var(--fg-2); font-size: 15px; }
.card__head .tag { min-height: 30px; padding: 0 12px; font-size: 15px; }


/* Key numbers: six cards in a row, the risk card a little wider. */
.kpis { display: grid; grid-template-columns: 1.6fr repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi { display: grid; align-content: start; gap: 6px; }
.kpi__label { color: var(--fg-2); font-size: 15px; font-weight: 500; }
.kpi__value {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi__value small { color: var(--fg-2); font-size: 16px; font-weight: 500; letter-spacing: 0; }
.kpi__value--red { color: var(--red); }
.kpi__sub { color: var(--fg-2); font-size: 15px; }
.kpi--risk .kpi__value { font-size: 40px; }
.kpi--risk .risk-route { margin: 10px 0 0; }
.kpi--risk .risk-route li { gap: 8px; font-size: 15px; }
.kpi--risk .risk-route li::before { height: 8px; }

/* Two columns: wide on the left, narrow on the right. */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-stack { display: grid; gap: 20px; align-content: start; }
.chart-card { align-self: stretch; }
.chart-card canvas { width: 100% !important; }
.chart-card--donut canvas { max-height: 280px; margin-inline: auto; }

/* Mentions: rows inside one card. */
.mentions-card .card__head { margin-bottom: 4px; }
.mentions-card .filters { display: inline-flex; gap: 2px; padding: 3px; margin-left: auto; border-radius: 10px; background: var(--tint); }
.seg {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px;
  background: none; color: var(--fg-2); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
}
.seg:hover { color: var(--fg); }
.seg[aria-pressed="true"] { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.btn-quiet {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--fg); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-quiet:hover { background: var(--tint); }
.mentions-card .load-more { display: block; width: 100%; margin-top: 12px; }

/* Why this score */
.why-card__line { color: var(--fg-2); font-size: 15px; line-height: 1.5; }
.why-card__line + .why-card__line { margin-top: 6px; }
.why-card #risk-drivers { display: grid; gap: 10px; margin: 14px 0 6px; padding: 0; list-style: none; }
.why-card #risk-drivers li { display: grid; grid-template-columns: auto 1fr; gap: 10px; font-size: 16px; line-height: 1.45; }
.why-card #risk-drivers li::before { content: ""; width: 7px; height: 7px; margin-top: 0.6em; border-radius: 50%; background: var(--red); }
.why-card .risk-evidence { margin-top: 8px; }
.why-card .risk-evidence p { color: var(--fg-2); font-size: 15px; line-height: 1.5; margin-top: 8px; }

/* Policy, memo, coverage, inbox: the existing pieces, inside cards. */
.card.policy .policy__scope { color: var(--fg-2); font-size: 15px; margin-bottom: 8px; }
.card.memo .memo__lede { max-width: 60em; color: var(--fg-2); font-size: 16px; margin-bottom: 14px; }
.card.coverage .coverage__lede { color: var(--fg-2); font-size: 16px; margin-bottom: 16px; }
.card .console { margin-top: 20px; }

/* ── Smaller screens ── */

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi--risk { grid-row: span 2; }
}
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .dash-shell { grid-template-columns: minmax(0, 1fr); }
  .dash-side { display: none; }
  .dash-top__logo { display: inline-flex; }
  .dash-menu { display: block; }
}
@media (max-width: 640px) {
  .dash-top { gap: 12px; }
  .dash-top__title h1 { font-size: 17px; }
  .dash-top .tag { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi--risk { grid-column: 1 / -1; grid-row: auto; }
  .kpi__value { font-size: 28px; }
  .card { padding: 16px; }
  .mentions-card .filters { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
}

/* Fixes for the narrow cards. */
.kpi--risk .risk-route ol { gap: 3px; }
.kpi--risk .risk-route li span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.kpi--risk .risk-route li { gap: 0; }
.card.policy .policy-item { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 14px 0; }
.card.policy .policy-item__title { font-size: 16px; line-height: 1.4; }
.card.policy .policy-item__meta { font-size: 15px; }
.dash-side__logo img { height: 40px; }
@media (max-width: 640px) {
  .kpis > .kpi:last-child { grid-column: 1 / -1; }
  .chart-card--donut canvas { max-height: 220px; }
}

/* Each view shows only its own sections. */
.dash [hidden] { display: none !important; }
@media (min-width: 1100px) {
  .why-card #risk-drivers { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
}
.app main.dash-content > section.card { padding: 20px 22px; }
.mentions-card .card__head h2 span { color: var(--fg); font-weight: 650; }

@media (max-width: 640px) {
  .app main.dash-content > section.card { padding: 16px; }
}

/* ── App shell ──
   The board fills the window like an app: the sidebar stays put and only the
   content panel scrolls. No site footer. */
html:has(body.dash) { height: 100%; overflow: hidden; }
body.dash { height: 100%; overflow: hidden; }
.dash-shell { height: 100dvh; min-height: 0; }
.dash-side { position: static; height: 100%; }
.dash-main { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.dash-content { max-width: none; padding-bottom: 32px; }
.dash-main::-webkit-scrollbar { width: 10px; }
.dash-main::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--canvas); }

/* Workspace under the logo. */
.dash-side { gap: 20px; }
.dash-org {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
}
.dash-org__mark {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--fg); color: var(--card); font-size: 16px; font-weight: 700;
}
.dash-org__name { display: grid; min-width: 0; font-size: 15px; font-weight: 650; line-height: 1.3; }
.dash-org__name small { color: var(--fg-2); font-size: 15px; font-weight: 450; }

/* Tighter cards, closer to a working tool. */
.card, .app main.dash-content > section.card { padding: 18px 20px; border-radius: 12px; }
.dash-content { gap: 16px; }
.kpis { gap: 16px; }
.kpi__value { font-size: 30px; }
.kpi--risk .kpi__value { font-size: 34px; }

/* Charts take a fixed height so the overview fits on one screen. */
.chart-box { position: relative; height: 260px; }
.chart-box canvas { position: absolute; inset: 0; }
.chart-box--donut { height: 260px; }
.chart-card canvas, .chart-card--donut canvas { max-height: none; margin: 0; }

/* Overview: numbers, then trends, then the latest mentions beside the reasons. */
.dash-content[data-view="overview"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "kpis kpis kpis" "trend trend split" "latest latest why";
  align-items: start;
}
.dash-content[data-view="overview"] > .kpis { grid-area: kpis; }
.dash-content[data-view="overview"] > .dash-grid { display: contents; }
.dash-content[data-view="overview"] .chart-card:not(.chart-card--donut) { grid-area: trend; }
.dash-content[data-view="overview"] .chart-card--donut { grid-area: split; }
.dash-content[data-view="overview"] > .mentions-card { grid-area: latest; align-self: stretch; }
.dash-content[data-view="overview"] > .why-card { grid-area: why; align-self: stretch; }
.dash-content[data-view="overview"] > .demo-toast, .dash-content[data-view="overview"] > #scan { grid-column: 1 / -1; }
.dash-content[data-view="overview"] .why-card #risk-drivers { grid-template-columns: minmax(0, 1fr); }

/* The overview shows only the five newest mentions, as plain rows. */
.dash-content[data-view="overview"] .mentions-card .filters,
.dash-content[data-view="overview"] .mentions-card #exportCsv,
.dash-content[data-view="overview"] .mentions-card .load-more,
.dash-content[data-view="overview"] .mentions-card .signal__more,
.dash-content[data-view="overview"] .mentions-card .signal:nth-child(n+6) { display: none; }
.card__more { display: inline-flex; align-items: center; margin-left: auto; text-decoration: none; }
.dash-content[data-view="overview"] .mentions-card .signal:nth-child(5) { border-bottom: 0; }

/* Demo notices float at the bottom of the window. */
.demo-toast:not([hidden]) {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  max-width: min(420px, calc(100vw - 32px)); margin: 0; padding: 14px 18px;
  background: var(--fg); color: var(--card); border-radius: 12px;
  font-size: 15px; line-height: 1.45; box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}

@media (max-width: 1100px) {
  .dash-content[data-view="overview"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "kpis" "trend" "split" "latest" "why";
  }
}
@media (max-width: 640px) {
  .chart-box { height: 220px; }
  .demo-toast:not([hidden]) { right: 16px; bottom: 16px; }
}

/* ── Mentions as a table ──
   One row per mention: ID, the headline with its source under it, priority,
   tone and time in fixed columns, so the eye can run down any one of them.
   The approved response and the tools sit under the headline, folded. */
.mentions-card { --cols: 92px minmax(0, 1fr) 118px 104px 104px; padding-bottom: 8px !important; }
.signal-cols, .mentions-card .signal {
  display: grid; grid-template-columns: var(--cols); column-gap: 20px; align-items: start;
}
.signal-cols {
  margin: 12px -20px 0; padding: 10px 20px;
  background: var(--canvas); border-block: 1px solid var(--line);
  color: var(--fg-2); font-size: 15px; font-weight: 600;
}
.signal-cols > :last-child, .mentions-card .signal__time { text-align: right; }
.mentions-card .signal-list { display: grid; }
.mentions-card .signal-list > .empty { padding: 32px 0; }
.mentions-card .signal {
  margin: 0; padding: 16px 0; row-gap: 10px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: none; box-shadow: none;
}
.mentions-card .signal:last-child { border-bottom: 0; }
.mentions-card .signal__id { padding-top: 2px; color: var(--fg-2); font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mentions-card .signal__main { display: grid; gap: 6px; min-width: 0; }
.mentions-card .signal__title { font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--fg); text-decoration: none; }
.mentions-card a.signal__title:hover { text-decoration: underline; text-underline-offset: 3px; }
.mentions-card .signal__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 15px; color: var(--fg-2); }
.mentions-card .signal__source { color: var(--fg-2); font-weight: 500; }
.mentions-card .signal__kw { font-size: 15px; }
.mentions-card .signal__kw::before { font-weight: 500; color: var(--fg-2); }
.mentions-card .signal__priority { display: flex; padding-top: 1px; }
.mentions-card .signal__priority .tag { min-height: 28px; font-size: 15px; }
.mentions-card .sentiment {
  display: inline-flex; align-items: center; gap: 8px; padding-top: 3px;
  font-size: 15px; font-weight: 600; text-transform: capitalize;
}
.mentions-card .sentiment::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mentions-card .sentiment--negative { color: var(--red); }
.mentions-card .sentiment--positive { color: var(--fg); }
.mentions-card .sentiment--neutral { color: var(--fg-2); }
.mentions-card .signal__time { padding-top: 3px; color: var(--fg-2); font-size: 15px; white-space: nowrap; }

.mentions-card .signal__more { grid-column: 2 / -1; display: grid; gap: 10px; min-width: 0; }
.mentions-card .signal__more:not(:has(> :not(.signal__actions))) { gap: 0; }
.mentions-card .signal__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0; font-size: 15px; }
.mentions-card .signal__tone { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-2); font-size: 15px; }
.mentions-card .signal__tone select {
  min-height: 36px; padding: 0 38px 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background-color: var(--card); background-position: right 12px center; color: var(--fg); font: inherit; font-size: 15px;
}
.mentions-card .signal__why summary, .mentions-card .signal__case summary { font-size: 15px; font-weight: 600; cursor: pointer; }

/* The approved response, folded until opened. */
.mentions-card .signal__approved {
  display: block; margin: 0; padding: 0; max-width: 820px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--canvas);
}
.mentions-card .signal__approved > summary {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  font-size: 15px; font-weight: 600; cursor: pointer; list-style: none;
}
.mentions-card .signal__approved > summary::-webkit-details-marker { display: none; }
.mentions-card .signal__approved > summary::before {
  content: ""; width: 7px; height: 7px; margin-right: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s;
}
.mentions-card .signal__approved[open] > summary::before { transform: rotate(45deg); }
.mentions-card .signal__approved > summary span { margin-left: auto; color: var(--fg-2); font-weight: 500; }
.mentions-card .signal__approved > :not(summary) { margin: 12px 14px 0; }
.mentions-card .signal__approved > :last-child { margin-bottom: 14px; }
.mentions-card .signal__approved blockquote { margin-top: 4px; font-size: 17px; line-height: 1.5; }

@media (max-width: 860px) {
  .signal-cols { display: none; }
  .mentions-card .signal {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "id prio time" "main main main" "tone tone tone" "more more more";
    row-gap: 8px;
  }
  .mentions-card .signal__id { grid-area: id; }
  .mentions-card .signal__priority { grid-area: prio; }
  .mentions-card .signal__time { grid-area: time; }
  .mentions-card .signal__main { grid-area: main; }
  .mentions-card .sentiment { grid-area: tone; padding: 0; }
  .mentions-card .signal__more { grid-area: more; }
}

/* ── Daily memo, laid out as a briefing ──
   What changed on the left, where it reads like a page; Do and Don't on the
   right as two short checklists. No grey box inside the card. */
.card.memo .card__head { margin-bottom: 6px; }
.card.memo .memo__lede { max-width: none; margin-bottom: 20px; font-size: 15px; }
.card.memo .memo-card {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  grid-template-areas: "head head" "changed lists" "sent sent";
  gap: 20px 40px; max-width: none; margin: 0; padding: 0;
  background: none; border-radius: 0; box-shadow: none;
}
.card.memo .memo-card__head {
  grid-area: head; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.card.memo .memo-card__head .label { color: var(--fg); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; }
.card.memo .memo-card__head .tag { min-height: 30px; font-size: 15px; }
.card.memo .memo-card__changed { grid-area: changed; gap: 12px; align-content: start; font-size: 16px; line-height: 1.6; }
.card.memo .memo-card__changed > .label,
.card.memo .memo-card__lists .label {
  color: var(--fg-2); font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.card.memo .memo-card__changed p:has(+ ul) { margin-top: 6px; color: var(--fg); font-weight: 650; }
.card.memo .memo-card__changed ul { gap: 8px; }
.card.memo .memo-card__changed li::before { background: var(--red); }

.card.memo .memo-card__lists { grid-area: lists; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.card.memo .memo-card__lists > div {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas);
}
.card.memo .memo-card__lists > div > .label { display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 16px; font-weight: 700; }
.card.memo .memo-card__lists > div > .label::before {
  content: ""; display: grid; width: 22px; height: 22px; border-radius: 50%;
  background: var(--fg) no-repeat center / 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.4 4.8 9 10 3' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.card.memo .memo-card__lists > div > .memo-card__dont::before {
  background-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3l-6 6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.card.memo .memo-card__lists ul { gap: 10px; margin-top: 12px; font-size: 15px; line-height: 1.5; }
.card.memo .memo-card__lists li::before { width: 6px; height: 6px; }
.card.memo .memo-card > .signal__draft-meta {
  grid-area: sent; padding-top: 14px; border-top: 1px solid var(--line); color: var(--fg-2); font-size: 15px;
}
.card.memo .memo-history { max-width: none; margin-top: 28px; }
.card.memo .memo-history > .label { color: var(--fg-2); font-size: 15px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.card.memo .memo-history details { padding: 4px 0; box-shadow: 0 1px 0 var(--line); }
.card.memo .memo-history summary { min-height: 48px; font-size: 16px; }
.card.memo .memo-history .memo-card { margin-block: 8px 20px; }
@media (max-width: 1100px) {
  .card.memo .memo-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "changed" "lists" "sent"; }
}

/* ── Collapsible sidebar ──
   The button in the top bar shrinks the sidebar to a strip of icons; the
   choice is remembered. Labels stay in the page for screen readers. */
.dash-shell { transition: grid-template-columns 0.2s ease; }
.dash-collapse {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; margin-left: -8px;
  border: 0; border-radius: 10px; background: none; color: var(--fg-2); cursor: pointer;
}
.dash-collapse:hover { background: var(--tint); color: var(--fg); }
.dash-collapse:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.side-collapsed .dash { --side-w: 76px; }
.side-collapsed .dash-side { padding-inline: 12px; align-items: center; overflow-x: hidden; }
.side-collapsed .dash-side__logo { padding: 0; }
.side-collapsed .dash-side__logo img, .side-collapsed .dash-side__logo svg { width: 48px; height: auto; }
.side-collapsed .dash-org { padding: 0; border: 0; }
.side-collapsed .dash-nav { width: 100%; }
.side-collapsed .dash-nav__link { justify-content: center; padding: 0; }
.side-collapsed .dash-nav__link > span,
.side-collapsed .dash-org__name {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.side-collapsed .dash-side__foot { display: none; }
@media (max-width: 960px) {
  .dash-collapse { display: none; }
}

/* ════ Critique fixes, 16 Oct ════ */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ── Status line: the answer before the numbers ── */
.card.status {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px 32px; align-items: start;
}
.card.status:has(.status__response[hidden]) { grid-template-columns: minmax(0, 1fr); }
.status__lead { display: grid; gap: 8px; }
.status__level {
  display: inline-flex; align-items: center; gap: 10px; justify-self: start;
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15;
}
.status__level::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--fg-2); }
.card.status[data-level="critical"] .status__level { color: var(--red); }
.card.status[data-level="critical"] .status__level::before { background: var(--red); }
.card.status[data-level="elevated"] .status__level::before,
.card.status[data-level="watch"] .status__level::before { background: var(--fg); }
.status__text { max-width: 46em; font-size: 17px; line-height: 1.5; }
.status__response {
  display: grid; gap: 8px; padding: 16px 18px;
  border-left: 1px solid var(--line);
}
.status__label { color: var(--fg-2); font-size: 15px; font-weight: 600; }
.status__statement {
  margin: 0; font-size: 16px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.status__by { color: var(--fg-2); font-size: 15px; }
.status__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.status__actions .btn-quiet { display: inline-flex; align-items: center; text-decoration: none; }
.status__actions [data-approved-message] { color: var(--fg-2); font-size: 15px; }

/* Overview: status, numbers, the trend beside its reasons, then the latest mentions. */
.dash-content[data-view="overview"] {
  grid-template-areas: "status status status" "kpis kpis kpis" "trend trend why" "latest latest latest";
}
.dash-content[data-view="overview"] > .status { grid-area: status; }
.dash-content[data-view="overview"] > .why-card { align-self: stretch; }
.kpis { grid-template-columns: 1.6fr repeat(5, minmax(0, 1fr)); }

/* The "To review" tile opens that list. */
.kpi--link { color: inherit; text-decoration: none; transition: border-color 0.15s, background-color 0.15s; }
.kpi--link:hover { border-color: var(--fg-2); }
.kpi--link .kpi__sub { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.kpi--link:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* ── Red means danger only ──
   Critical stays red. Everything else is ink and grey: tone, the active nav
   icon, the negative count, the chart, the memo bullets. */
.dash-nav__link[aria-current] .dash-icon { color: var(--fg); }
.kpi__value--red { color: var(--fg); }
.card.memo .memo-card__changed li::before { background: var(--fg); }
.tag.tag--redline { background: var(--tint); color: var(--fg-2); box-shadow: none; border-color: transparent; }
.tag.tag--redline::before { background: var(--fg-2); opacity: 0.6; }
.tag.tag--ink { background: var(--fg); color: var(--card); }
.tag.tag--ink::before { background: var(--card); opacity: 0.7; }

/* ── Mentions table ── */
.mentions-card { --cols: 92px minmax(0, 1fr) 118px 132px 104px; }
.signal-table { display: block; }
.signal__tonecell { display: flex; align-items: flex-start; }
/* One tone control: the menu on Mentions, a plain label on the overview. */
.dash-content[data-view="mentions"] .signal__tonecell .sentiment { display: none; }
.dash-content[data-view="overview"] .signal__tonecell .tone-select { display: none; }
.mentions-card .sentiment--negative, .mentions-card .sentiment--positive { color: var(--fg); }
.mentions-card .sentiment--positive::before { background: none; box-shadow: inset 0 0 0 2px var(--fg); }
.mentions-card .sentiment--neutral::before { background: none; box-shadow: inset 0 0 0 2px var(--fg-2); }
.tone-select {
  width: 100%; min-height: 40px; padding: 0 34px 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card) var(--select-arrow) no-repeat right 10px center;
  color: var(--fg); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.tone-select:hover { border-color: var(--fg-2); }
.tone-select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.mentions-card .signal__kw { color: var(--fg-2); }
.mentions-card .signal__actions { gap: 6px 20px; }
.mentions-card .signal__more:not(:has(.signal__approved, .signal__case)) .signal__actions:empty { display: none; }

/* Approved response: title and who approved it, then the first line, folded. */
.mentions-card .signal__approved > summary { display: grid; gap: 4px; min-height: 0; padding: 12px 14px 12px 34px; position: relative; }
.mentions-card .signal__approved > summary::before { position: absolute; left: 14px; top: 19px; }
.signal__approved-title { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-weight: 600; }
.signal__approved-title span { color: var(--fg-2); font-weight: 500; }
.signal__approved-peek {
  color: var(--fg-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mentions-card .signal__approved[open] .signal__approved-peek { display: none; }
.mentions-card .signal__approved > summary span:not(.signal__approved-title):not(.signal__approved-peek) { margin-left: 0; }

/* Bigger targets. */
.dash-collapse { width: 44px; height: 44px; }
.btn-quiet { min-height: 44px; }
.seg { min-height: 40px; }

/* Memo: Do and Don't as columns divided by a rule, not boxes in a box. */
.card.memo .memo-card__lists > div { padding: 0 0 0 20px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: none; }
.card.memo .memo-card__lists { gap: 28px; }

/* Coverage: the placeholder meets contrast. */
.dash .entry input::placeholder { color: var(--fg-2); opacity: 1; }

@media (max-width: 1100px) {
  .card.status { grid-template-columns: minmax(0, 1fr); }
  .status__response { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .dash-content[data-view="overview"] { grid-template-areas: "status" "kpis" "trend" "why" "latest"; }
}
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .mentions-card .signal__tonecell { grid-area: tone; }
  .tone-select { width: auto; }
}
@media (max-width: 640px) {
  .dash-top .tag { display: inline-flex; min-height: 28px; padding: 0 10px; }
  .dash-top__title p { font-size: 15px; }
  .mentions-card .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .status__level { font-size: 22px; }
}
.mentions-card .signal__approved > summary { grid-template-columns: minmax(0, 1fr); }
.mentions-card .signal__approved > summary span { margin-left: 0; }
.signal__approved-peek { display: block; min-width: 0; }
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > .kpi--risk { grid-column: 1 / -1; }
  .dash-top__title { flex: 1; }
  .dash-top__title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 640px) {
  .dash-top { gap: 10px; }
  .dash-top__title { min-width: 0; flex: 1 1 auto; }
  .dash-top__title h1 { overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dash-top__actions { gap: 4px; }
}

/* ════ Settings ════
   Each section is one card: what it is on the left, the controls on the
   right. Saving lives in a bar under the only section you can change. */
.dash-nav__sep { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.settings { display: grid; gap: 16px; max-width: 1120px; }
.card.set, .app main.dash-content .card.set {
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 24px 56px; padding: 28px;
}
.set__intro { display: grid; align-content: start; gap: 8px; }
.set__intro h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.set__intro p { color: var(--fg-2); font-size: 15px; line-height: 1.5; }
.set__body { display: grid; gap: 28px; min-width: 0; }
.set__controls { display: grid; gap: 30px; }
.set__controls[hidden] { display: none; }
.set__notice {
  padding: 14px 16px; border-radius: 10px; background: var(--canvas);
  border: 1px solid var(--line); font-size: 15px; line-height: 1.5;
}
.set__notice a { color: var(--fg); font-weight: 600; text-underline-offset: 3px; }

.set__field { display: grid; gap: 12px; }
.set__label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.set__label-row label { font-size: 16px; font-weight: 650; }
.set__value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.set__count { color: var(--fg-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.set__hint { color: var(--fg-2); font-size: 15px; line-height: 1.5; }
.set__error { color: var(--red); font-size: 15px; font-weight: 600; }

/* The alert line on the same four bands as the risk score. */
.set-scale {
  position: relative; display: grid; grid-template-columns: 25fr 25fr 25fr 25fr; gap: 3px;
  padding-top: 26px;
}
.set-scale span {
  position: relative; height: 8px; border-radius: 4px; background: var(--line);
  font-size: 0;
}
.set-scale span::after {
  content: attr(data-band); position: absolute; left: 0; top: -24px;
  color: var(--fg-2); font-size: 15px; font-weight: 500; white-space: nowrap; text-transform: capitalize;
}
.set-scale span[data-band="watch"] { background: color-mix(in srgb, var(--red) 22%, var(--line)); }
.set-scale span[data-band="elevated"] { background: color-mix(in srgb, var(--red) 50%, var(--line)); }
.set-scale span[data-band="critical"] { background: var(--red); }
.set-scale__mark {
  position: absolute; bottom: -5px; width: 3px; height: 18px; margin-left: -1.5px;
  border-radius: 2px; background: var(--fg); box-shadow: 0 0 0 2px var(--card);
  transition: left 0.08s;
}
.set-range { width: 100%; height: 32px; margin: -6px 0 0; accent-color: var(--fg); cursor: pointer; }
.set-range:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 4px; }

/* Contacts as removable chips. */
.set-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.set-chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 6px 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--canvas);
  font-size: 15px; font-weight: 500; overflow-wrap: anywhere;
}
.set-chips--quiet .set-chip { padding: 0 14px; min-height: 36px; }
.set-chip__remove {
  display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: none; color: var(--fg-2); cursor: pointer;
}
.set-chip__remove:hover { background: var(--line); color: var(--fg); }
.set-chip__remove:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.set-chips__empty { color: var(--fg-2); font-size: 15px; }
.set-add { display: flex; gap: 8px; max-width: 520px; }
.set-add input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--fg); font: inherit; font-size: 16px;
}
.set-add input::placeholder { color: var(--fg-2); }
.set-add input:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; border-color: transparent; }
.set-add .btn-quiet:disabled { opacity: 0.5; cursor: not-allowed; }

/* Read-only facts. */
.set-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; padding-top: 22px; border-top: 1px solid var(--line); }
.set-facts dt { color: var(--fg-2); font-size: 15px; }
.set-facts dd { margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.set-list { display: grid; margin: 0; }
.set-list > div {
  display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.set-list > div:first-child { padding-top: 0; }
.set-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.set-list dt { color: var(--fg-2); font-size: 15px; }
.set-list dd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; font-size: 16px; }
.set-list .btn-quiet { display: inline-flex; align-items: center; text-decoration: none; }
.set__links { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 15px; }

/* Save bar, across the alerts card. */
.set__save {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin: 4px -28px -28px; padding: 16px 28px;
  border-top: 1px solid var(--line); background: var(--canvas); border-radius: 0 0 12px 12px;
}
.set__save[hidden] { display: none; }
.set__status { margin-right: auto; color: var(--fg-2); font-size: 15px; }
.set__status.is-error { color: var(--red); font-weight: 600; }
.set__save .btn-quiet:disabled { opacity: 0.5; cursor: default; }
.set-primary {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px;
  background: var(--fg); color: var(--card); font: inherit; font-size: 15px; font-weight: 650; cursor: pointer;
}
.set-primary:hover:not(:disabled) { opacity: 0.88; }
.set-primary:disabled { opacity: 0.35; cursor: default; }
.set-primary:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* Theme: three cards with a small picture of each. */
.set-theme { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.set-theme legend { margin-bottom: 12px; padding: 0; font-size: 16px; font-weight: 650; }
.set-theme__opt { position: relative; display: grid; gap: 10px; cursor: pointer; font-size: 15px; font-weight: 600; }
.set-theme__opt input { position: absolute; opacity: 0; pointer-events: none; }
.set-theme__preview {
  display: grid; grid-template-columns: 26% 1fr; grid-template-rows: 1fr 1fr; gap: 5px;
  height: 84px; padding: 8px; border-radius: 10px; border: 1px solid var(--line);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.set-theme__preview i { border-radius: 4px; }
.set-theme__preview i:first-child { grid-row: span 2; }
.set-theme__preview--light { background: #f5f6f8; }
.set-theme__preview--light i { background: #ffffff; box-shadow: inset 0 0 0 1px #e6e7eb; }
.set-theme__preview--dark { background: #0c0c0e; }
.set-theme__preview--dark i { background: #1d1d21; }
.set-theme__preview--system { background: linear-gradient(110deg, #f5f6f8 50%, #0c0c0e 50%); }
.set-theme__preview--system i { background: rgb(128 128 136 / 0.35); }
.set-theme__opt:hover .set-theme__preview { border-color: var(--fg-2); }
.set-theme__opt input:checked + .set-theme__preview { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.set-theme__opt input:focus-visible + .set-theme__preview { outline: 2px solid var(--fg); outline-offset: 3px; }

/* A real switch, built on a checkbox. */
.set-switch { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.set-switch input { position: absolute; opacity: 0; pointer-events: none; }
.set-switch__track {
  position: relative; flex: none; width: 44px; height: 26px; margin-top: 1px;
  border-radius: 13px; background: var(--line); transition: background-color 0.15s;
}
.set-switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
  transition: transform 0.15s;
}
.set-switch input:checked + .set-switch__track { background: var(--fg); }
.set-switch input:checked + .set-switch__track::after { transform: translateX(18px); }
.set-switch input:focus-visible + .set-switch__track { outline: 2px solid var(--fg); outline-offset: 3px; }
.set-switch__text { display: grid; gap: 2px; font-size: 16px; font-weight: 600; }
.set-switch__text small { color: var(--fg-2); font-size: 15px; font-weight: 400; }

@media (max-width: 960px) {
  .card.set, .app main.dash-content .card.set { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 22px; }
  .set__save { margin: 0 -22px -22px; padding: 14px 22px; }
}
@media (max-width: 640px) {
  .set-facts { grid-template-columns: minmax(0, 1fr); }
  .set-list > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .set-theme { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .set-theme__preview { height: 64px; }
  .set__save { flex-wrap: wrap; }
  .set__status { flex-basis: 100%; }
  .set-scale span::after { font-size: 0; }
  .set-scale { padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .set-switch__track, .set-switch__track::after, .set-scale__mark { transition: none; }
}
