/* Readability pass (UI audit 2026-11-22). Loaded last, after newfeatures.css.
   Presentation only: no markup or data changes. One type scale (12 caps labels / 13 floor / 15 body / 17 / 20 / 26 / 34),
   darker greys that pass WCAG AA, status colours that mean status, phone tap targets and dark-mode fixes.
   Accents unchanged: active tab #e6f8f4 with #44fbdf outline, lime chips #e6fbb0.
   Page-specific rules use [data-view="<page>"], set on the page container by route() in app.js. */

/* =========================== Type scale and tokens, Brand Workspace =========================== */
/* ---------- 1. Tokens ---------------------------------------------------- */
/* Type scale: 12 / 13 / 15 / 17 / 20 / 26 / 34 (about 1.15-1.3 steps).
   12 is only for UPPERCASE bold labels (caps read about 1px larger);
   13 is the floor for anything you read (meta, badges, chart axes, captions);
   15 is body, table cells and list titles. */
:root {
  --fs-cap: 12px;
  --fs-meta: 13px;
  --fs-body: 15px;
  --fs-title: 17px;
  --fs-kpi-sm: 20px;
  --fs-kpi: 26px;
  --fs-h1: 34px;
  --lh-body: 1.5;
  --lh-tight: 1.2;
  font-size: 15px;   /* was 14px in app.css; rem users scale with body */
}
/* Light mode. theme-3d.css sets --muted to a neutral #5f6673 with this same
   (0,2,0) selector, which beats wavdesk.css's navy #64708a; one value here ends that.
   #56617a: navy-tinted to match the palette, 5.9:1 on cards, 5.4:1 on the page,
   5.0:1 on the grey tab capsule (#e8e6e0). */
:root:not([data-theme="dark"]) {
  --muted: #56617a;
  --text-2: #3b4a63;          /* unchanged, 8.6:1 */
  --wd-green: #356b0b;        /* eyebrows and links: was #3f7d0e, 4.4:1 on the page, now 5.6:1 */
  --link: #356b0b;
  --bad: #b91c1c;             /* red text was #dc2626, 4.2:1 on the page; now 5.6:1 */
  /* --warn stays #d97706 for rings, bars and dots (graphics need 3:1); amber TEXT uses the ink below */
}
:root:not([data-theme="dark"]) [style*="color:var(--warn)"], :root:not([data-theme="dark"]) [style*="color: var(--warn)"],
:root:not([data-theme="dark"]) .sla.warn, :root:not([data-theme="dark"]) .rel-risks li.warn { color: var(--wd-orange-ink) !important; }   /* #b45309, 4.8:1 */
/* Dark mode: status text failed on navy cards (#dc2626 3.5:1, #b45309 3.4:1). */
:root[data-theme="dark"] {
  --bad: #f87171;             /* 6.1:1 on #141d31 */
  --warn: #fbbf24;            /* 10:1 */
  --ok: #34d399;              /* 8.7:1 */
  --muted: #9aa5ba;           /* was #8a96ad (5.6:1); 6.8:1 for long reading */
}

/* ---------- 2. Base type -------------------------------------------------- */
body { font-size: var(--fs-body); line-height: var(--lh-body); }
.small { font-size: var(--fs-meta); }
.muted { color: var(--muted); }
.list-item .t1 { font-size: var(--fs-body); }
.list-item .t2 { font-size: var(--fs-meta); color: var(--muted); line-height: 1.4; }
.card-h h3 { font-size: var(--fs-title); }
.card-h .actions.small { font-size: var(--fs-meta); }

/* Labels/eyebrows: one style everywhere; 12px floor, bold, never paler than --text-2 */
.eyebrow, .ws-head .acc-head .eyebrow { font-size: var(--fs-cap); }
table.t th { font-size: var(--fs-cap); font-weight: 800; letter-spacing: .06em; color: var(--text-2); }
table.t td { font-size: var(--fs-body); }

/* Chips and badges: 11.5 -> 13 */
.badge { font-size: var(--fs-meta); padding: 2px 10px; line-height: 1.45; }
.chip { font-size: var(--fs-meta); }
/* "Key account" (green on peach, 4.1:1): darker ink, same peach */
.badge.brand { color: #2f6309; }

/* Buttons */
.btn { font-size: 14px; }
.btn.xs { font-size: var(--fs-meta); height: 30px; }

/* KPI tiles: label 13 bold, value 26, meta 13 */
.kpi .lbl { font-size: var(--fs-meta); font-weight: 700; color: var(--text-2); }
.kpi .val { font-size: var(--fs-kpi); line-height: var(--lh-tight); }
.kpi .meta { font-size: var(--fs-meta); color: var(--muted); line-height: 1.4; }

/* Chart axes: 11 -> 12/13, darker */
.chart-x, .chart-y { font-size: var(--fs-cap); color: var(--text-2); }

/* Empty states: body text one step darker; buttons inside keep button-sized icons
   (bug: ".empty svg" made the Pick a company / New company icons 40px) */
.empty { color: var(--text-2); }
.empty .btn svg { width: 16px; height: 16px; margin: 0; color: currentColor; }

/* Phone keeps the same floors (mobile.css shrinks KPI meta to 11.5 and labels to 11) */
@media (max-width: 760px) {
  .kpi .lbl { font-size: var(--fs-meta); }
  .kpi .meta { font-size: var(--fs-meta); }
  .kpi .val, .dash-kpis .val { font-size: 22px; }
  .page-head .eyebrow, .ws-head .eyebrow { font-size: var(--fs-cap); }
  .ws-head .acc-head .badge { font-size: var(--fs-meta); }
  #ac-table td[data-l]::before, table.tv td[data-l]::before, table.tm td[data-l]::before { font-size: var(--fs-cap); color: var(--text-2); }
}

/* ==========================================================================
   BRAND WORKSPACE
   ========================================================================== */

/* ---------- W1. Header + tabs -------------------------------------------- */
.ws-head .acc-head { font-size: 14px; color: var(--text-2); }
.ws-health { font-size: var(--fs-meta); }
.ws-nav .ws-mains button { font-size: var(--fs-body); }
.ws-nav .ws-subs button { font-size: 14px; padding: 6px 11px; }
.ws-nav .ws-subs button:not(.active) { color: var(--text-2); }
.ws-nav .ws-subs button.active { box-shadow: inset 0 -3px 0 var(--text); }

/* ---------- W2. Dashboard layout: act first, then the glance strip --------
   Before: Next steps | a mostly empty "Coming up" card (same height), then
   health + 8 KPI tiles in a 4x2 block below the fold.
   After (CSS grid only, children unchanged):
     [ Next steps (wide)            ][ Brand health ]
     [ Coming up (one slim strip)   ][              ]
     [ 8 KPI tiles in one row                        ]
     [ everything else, full width                   ]               */
@media (min-width: 1100px) {
  .dash {
    display: grid; gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(360px, 420px);
    grid-template-areas: "next next health" "soon soon health" "kpis kpis kpis";
    grid-template-rows: auto 1fr auto;
    align-items: start;
  }
  .dash-next, .dash-top { display: contents; }
  .dash > .mt, .dash-top.mt { margin-top: 0; }
  .dash-next > .card:first-child { grid-area: next; }
  .dash-next > .card:last-child { grid-area: soon; align-self: stretch; }
  .dash-top > .dash-health { grid-area: health; align-self: stretch; }
  .dash-top > .dash-kpis { grid-area: kpis; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .dash > :not(.dash-next):not(.dash-top) { grid-column: 1 / -1; }
}
@media (min-width: 1320px) { .dash-top > .dash-kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); } }   /* one glance row */

/* Next steps: bigger title, cause in readable meta, a real button */
.dash-step { padding-top: 12px; padding-bottom: 12px; }
.dash-step a.t1 { font-size: var(--fs-body); font-weight: 700; }
.dash-step .t2 { font-weight: 600; color: var(--bad); }
.dash-step .btn { border: 1.5px solid var(--border-2); font-size: var(--fs-meta); height: 32px; padding: 0 14px; white-space: nowrap; }

/* Coming up: no stretching blank space, readable date column */
.dash-date { font-size: var(--fs-meta); width: 56px; color: var(--text); }
.dash-next > .card:last-child .empty { padding: 16px !important; text-align: left; }

/* Brand health card: label as caps, readable explainer, bigger sparkline */
.dash-health { padding: 20px 22px; gap: 20px; }
.dash-health .lbl { font-size: var(--fs-cap); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.dash-health p.small { font-size: var(--fs-meta); color: var(--text-2); line-height: 1.45; }
.dash-health .ring small { font-size: 12px; color: var(--text-2); }
.dash-trend .spark { width: 180px; height: auto; }
.dash-trend .ht-chip { font-size: var(--fs-meta); }
.dash-trend .small { font-size: var(--fs-meta); }

/* KPI tiles: colour means status, not position. The rotating lime/blue/orange/purple
   rule said nothing; lime by default, red only when the tile reports a breach. */
.dash-kpis .kpi { padding: 18px 16px 16px; }
.dash-kpis .kpi::before { background: var(--wd-lime, #c6f432) !important; height: 4px; }
.dash-kpis .kpi:has(.meta [style*="--bad"])::before { background: var(--bad) !important; height: 4px; }
.dash-kpis .val { font-size: var(--fs-kpi); font-variant-numeric: tabular-nums; }
.dash-kpis .val small { font-size: var(--fs-meta) !important; color: var(--muted); }
.dash-kpis .meta { display: block; white-space: normal; }

/* ---------- W3. KPI rows on Grow / Renewal etc. ---------------------------
   "Dec 12, 2026" and "Not started" wrapped to two 30px lines; 5 tiles left a
   blank 6th column. */
.ws-main .kpis:not(.dash-kpis) { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ws-main .kpis:not(.dash-kpis) .kpi .val { font-size: 24px; text-wrap: balance; }

/* ---------- W4. Info lists (Sound & music, Company) ------------------------ */
.info-list small, .ii small { font-size: var(--fs-meta); color: var(--muted); }

@media (max-width: 760px) {
  .dash-kpis .val { font-size: 22px; }
  .ws-nav .ws-subs button { font-size: 14px; }
  .dash-step .btn { height: 30px; padding: 0 10px; }
}

/* Empty chart cards don't stretch to their neighbour's height */
.dash > .grid { align-items: start; }
/* Dark: the sparkline's light fill (#e6f8f4, set in healthtrend.js) glared on navy */
:root[data-theme="dark"] .dash-trend .spark-area { fill: rgba(68, 251, 223, .12); }


/* =========================== Global pages =========================== */
:root { --st-bad: #c81e1e; --st-warn: #a85400; --st-ok: #0f7a4a; }
:root[data-theme="dark"] { --st-bad: #ff8a80; --st-warn: #ffb74d; --st-ok: #5ee0a0; }

/* --------------------------------------------------------------------------
   1. KPI tiles mean something: the coloured top bar follows the tile's status
      (it is currently decided by position: 1st lime, 2nd blue, 3rd orange,
      4th purple, so "Tickets at risk" is purple and "My accounts" is lime).
      Neutral tiles keep the brand lime; only bad/warn tiles turn red/amber,
      and their sub-line turns into a readable status line.
   -------------------------------------------------------------------------- */
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi::before { background: var(--wd-lime, #c6f432); height: 4px; }
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi:has(> .ico.tone-bad)::before { background: var(--st-bad); }
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi:has(> .ico.tone-warn)::before { background: #f59e0b; }
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi .meta { font-size: 13.5px; line-height: 1.35; color: var(--text-2); }
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi:has(> .ico.tone-bad) .meta { color: var(--st-bad); font-weight: 700; }
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi .lbl { font-size: 14px; font-weight: 700; color: var(--text); }
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis > .kpi .val { font-variant-numeric: tabular-nums; }
/* Tiles stretch across the row instead of leaving an empty right third. */
:is([data-view="home"], [data-view="tickets"], [data-view="teamview"]) .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* Tickets "Past target" sub-line is a sentence; keep tile heights even. */
#tk-kpis .kpi .meta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --------------------------------------------------------------------------
   2. TODAY: put the ranked "Needs you now" queue directly under the KPIs.
      Today the 4-brand scan is ~1,000px tall at 1440 wide, so the single
      most actionable list starts below the second screen.
   -------------------------------------------------------------------------- */
[data-view="home"] { display: flex; flex-direction: column; }
[data-view="home"] > .page-head { order: 0; }
[data-view="home"] > .kpis { order: 1; }
[data-view="home"] > .alert { order: 2; }
[data-view="home"] > .g-main { order: 3; }
[data-view="home"] > .mt:has(> .scan) { order: 4; }

/* Queue rows: bigger, darker sub-lines and SLA chips. */
.hm-queue .q-row { padding-top: 12px; padding-bottom: 12px; }
.hm-queue .q-row .t1 { font-size: 15px; font-weight: 700; }
.hm-queue .q-row .t2 { font-size: 13.5px; color: var(--text-2); }
.hm-queue .q-row .t2 span { color: var(--st-bad); }
.hm-queue .q-row .sla { font-size: 13.5px; font-weight: 700; }
.hm-queue .q-row .sla.breached { color: var(--st-bad); }
.hm-queue .q-row .sla.warn { color: var(--st-warn); }
.hm-queue .q-row .btn.xs { height: 32px; font-size: 13.5px; }

/* Brand scan: legible counters, chips and sub-lines. */
.scan .scan-sum .scan-note, .scan .grow > .t2 { font-size: 13.5px; color: var(--text-2); }
.scan .scan-chip { font-size: 13px; padding: 3px 9px; }
.scan .scan-chip svg { width: 14px; height: 14px; }
.scan .scan-chip.bad { color: var(--st-bad); }
.scan .scan-item { font-size: 14.5px; }
.scan .scan-item .btn.xs { height: 32px; font-size: 13.5px; }

/* Right column lists (renewals, calendar) on Today. */
[data-view="home"] .g-main .list-item .t2,
[data-view="home"] .g-main .right.small { font-size: 13.5px; }
[data-view="home"] .g-main .right.small > div { font-weight: 700; }

/* Plan nudge: brand names in the alert read as links but not as "OK green". */
[data-view="home"] > .alert .small { font-size: 14px; }
[data-view="home"] > .alert .small a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   3. BRANDS list: severity reads in the row, numbers line up, header sticks.
   -------------------------------------------------------------------------- */
/* "Needs" was link-green for every row, even "1 critical ticket open". */
#ac-table td.ac-needs { font-size: 14px; }
#ac-table td.ac-needs a { color: var(--text); font-weight: 700; text-decoration: none; }
#ac-table td.ac-needs a:hover { text-decoration: underline; }
#ac-table tr:has(.health.risk) td.ac-needs a { color: var(--st-bad); }
#ac-table tr:has(.health.watch) td.ac-needs a { color: var(--st-warn); }
#ac-table td.ac-needs .muted { color: var(--text-2); font-weight: 400; }
/* At-risk rows get a red left rule, like the hover rule but permanent. */
#ac-table tr:has(.health.risk) > td:first-child { box-shadow: inset 4px 0 0 var(--st-bad); }
/* Health score: the column people sort by, make it the strongest number. */
#ac-table .health { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
#ac-table .health .dot { width: 11px; height: 11px; }
/* Money / counts / dates aligned and tabular. */
#ac-table td.right, #ac-table td.nowrap, #ac-table th.right { font-variant-numeric: tabular-nums; }
#ac-table td.right { font-size: 15px; font-weight: 600; }
/* Status chips sit side by side (rows were 96-126px tall from stacked chips). */
#ac-table td:nth-child(2) { white-space: nowrap; }
#ac-table td .badge { font-size: 13px; padding: 4px 10px; }
#ac-table td .badge:first-child { min-width: 0; }
#ac-table td .badge.ok { background: transparent; padding-left: 0; padding-right: 2px; color: var(--st-ok); }
#ac-table .name-cell b { white-space: nowrap; font-size: 15.5px; }
#ac-table .name-cell > div > span { font-size: 13.5px; color: var(--text-2); }
#ac-table td.small { font-size: 14px; }
#ac-table table.t td { padding-top: 12px; padding-bottom: 12px; }
/* Subtle zebra so the eye can follow a row across 8 columns. */
#ac-table table.t tbody tr:not(.grp-row):nth-child(even) > td { background: color-mix(in srgb, var(--text) 2.5%, transparent); }
#ac-table .grp-row td { font-size: 14px; }
#ac-table .grp-row .muted.small { font-size: 13.5px; color: var(--text-2); }
/* Sticky column header: overflow:clip keeps the rounded card but is not a
   scroll container, so position:sticky works against the page. */
@media (min-width: 1100px) {
  .card:has(> #ac-table), #ac-table, [data-view="tickets"] > .card, [data-view="tickets"] > .card .table-wrap { overflow: clip; }
}
#ac-table table.t thead th, [data-view="tickets"] table.t thead th { position: sticky; top: var(--sticky-top, 138px); z-index: 2; background: var(--card); box-shadow: 0 1px 0 var(--card-border, var(--border)); }
/* Column headers: 11.5px uppercase grey -> 12.5px, darker, less tracking. */
#ac-table table.t th, [data-view="tickets"] table.t th, table.t.tv th { font-size: 12.5px; letter-spacing: .03em; color: var(--text-2); }

/* --------------------------------------------------------------------------
   4. TICKETS: SLA is the column that matters; breached rows flagged.
   -------------------------------------------------------------------------- */
[data-view="tickets"] table.t td .sla { font-size: 14px; font-weight: 700; }
[data-view="tickets"] table.t td .sla.breached { color: var(--st-bad); }
[data-view="tickets"] table.t td .sla.warn { color: var(--st-warn); }
[data-view="tickets"] table.t tr:has(.sla.breached) > td:first-child { box-shadow: inset 4px 0 0 var(--st-bad); }
[data-view="tickets"] table.t tr:has(.sla.warn) > td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
[data-view="tickets"] table.t td .badge { font-size: 13px; }
[data-view="tickets"] table.t td .badge:first-child { min-width: 0; }
[data-view="tickets"] table.t td.small, [data-view="tickets"] table.t td.muted, [data-view="tickets"] table.t td .small.muted { font-size: 13.5px; color: var(--text-2); }
[data-view="tickets"] table.t td { padding-top: 12px; padding-bottom: 12px; }
[data-view="tickets"] table.t tbody tr:nth-child(even) > td { background: color-mix(in srgb, var(--text) 2.5%, transparent); }
/* Filter row on one line at 1440: search shrinks instead of pushing "Mine" to row 2. */
[data-view="tickets"] > .toolbar { flex-wrap: wrap; row-gap: 10px; }
[data-view="tickets"] > .toolbar input[type=search] { flex: 1 1 180px; min-width: 160px; width: auto; }
[data-view="tickets"] > .toolbar select { width: auto; min-width: 0; }
#tk-view .btn.sm { font-size: 14px; }

/* --------------------------------------------------------------------------
   5. TEAM VIEW: numbers line up, the small lines are readable.
   -------------------------------------------------------------------------- */
table.t.tv td { font-variant-numeric: tabular-nums; font-size: 15.5px; }
table.t.tv .tv-n { font-weight: 700; }
table.t.tv .tv-n small { font-size: 13px; color: var(--text-2); }
table.t.tv .tv-n.bad small { color: var(--st-bad); }
table.t.tv .health { font-size: 16px; font-weight: 800; }
table.t.tv .name-cell > div > span { font-size: 13.5px; color: var(--text-2); }
table.t.tv tbody tr:nth-child(even) > td { background: color-mix(in srgb, var(--text) 2.5%, transparent); }

/* --------------------------------------------------------------------------
   6. CALENDAR: chips show two lines instead of "11:08 AM Send Q4 mu…";
      other-month dates readable; today's badge passes contrast.
   -------------------------------------------------------------------------- */
.cal .ev { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: clip; overflow-clip-margin: content-box; font-size: 13.5px; line-height: 1.3; }
.cal .day.today .dn { background: #c2410c; color: #fff; }

/* --------------------------------------------------------------------------
   Small fixes on the other global pages (census offenders <13px).
   -------------------------------------------------------------------------- */
.jb-col header small.muted, .jb-col header .n { font-size: 13px; }       /* Production board stage counts / day budgets */
.jb-col .jb-none { color: var(--text-2); }
#view .list-item .grow > .t2 { font-size: 13.5px; color: var(--text-2); } /* Year plans "QSR · Ben Cruz" etc. */
.ai-where span { font-size: 13.5px; }                                    /* Charlie page */
.adm-go { font-size: 14px; }                                             /* Admin cards "Open" */
p.muted.small { font-size: 13.5px; }
.seg .btn.xs { font-size: 13px; height: 32px; }                          /* Production / Ad billing segment toggles */

/* --------------------------------------------------------------------------
   PHONE (<=640px): Tickets status tabs were squeezed into half the toolbar
   grid, so the six labels overprinted ("Oper s atte each…"). Make it a full-
   width, horizontally scrollable segmented row.
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  #tk-view { grid-column: 1 / -1; display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 100%; }
  #tk-view .btn { flex: 0 0 auto; white-space: nowrap; height: 40px; font-size: 14px; }
  :is([data-view="home"], [data-view="tickets"]) .kpis > .kpi .meta { font-size: 13px; }
  :is([data-view="home"], [data-view="tickets"]) .kpis > .kpi .lbl { font-size: 13.5px; }
  #ac-table td.ac-needs { font-size: 15px; }
  #ac-table td .badge.ok { padding-left: 0; }
  #ac-table .name-cell b { white-space: normal; }
  #ac-table table.t thead th, [data-view="tickets"] table.t thead th { position: static; }
  #ac-table table.t tbody tr:not(.grp-row):nth-child(even) > td { background: none; }
}

/* Census follow-ups (Today scan + Brands): remaining sub-13px / sub-4.5:1 text. */
#ac-table .badge.brand, .scan .badge.brand, .hm-queue .badge.brand { color: #2f5e0a; }      /* "Key" text 4.1:1 -> ~6.5:1; chip fill unchanged */
.scan .scan-stat.bad > b { color: var(--st-bad); }
.scan .scan-stat.ok > b { color: var(--st-ok); }                                           /* "0 all clear" green 3.6:1 -> 5.3:1 */
.scan .scan-stat > span, .scan .scan-happened, .scan .scan-happened .small, .scan .scan-h, .scan .scan-h a, .scan .scan-h .muted { font-size: 13.5px; }
.scan .scan-happened .small.muted, .scan .scan-h .muted { color: var(--text-2); }
[data-view="home"] .card-h > .actions.small { font-size: 13.5px; color: var(--text-2); }
[data-view="home"] .g-main .small.nowrap { font-size: 13.5px; }


/* =========================== Toasts, overlays, dark mode, phone =========================== */
/* ---------- 1. Toasts: white text on the green/red toasts ----------
   theme-3d.css paints .toast.ok/.bad green/red (0,2,0) but premium.css sets
   .toast { color: var(--text) } (navy), so the "Saved" toast is navy on green:
   3.35:1 for the title, 2.89:1 for the line under it. */
.toast { font-size: 14.5px; line-height: 1.4; padding: 14px 18px; gap: 12px; }
.toast b { font-size: 15px; font-weight: 700; }
.toast small { display: block; font-size: 13.5px; opacity: 1; color: var(--text-2); margin-top: 2px; }
.toast.ok, .toast.bad { color: #fff; }
.toast.ok { background: #03734a; } .toast.bad { background: #9f1d33; }   /* same colours, opaque: page text no longer shows through */
.toast.ok small, .toast.bad small { color: rgba(255, 255, 255, .92); }
.toast.ok svg.lucide, .toast.bad svg.lucide { color: #fff; }
.toast svg.lucide { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ---------- 2. Dark mode: charts, edges, numbers, placeholders ---------- */
:root[data-theme="dark"] {
  --border: rgba(255, 255, 255, .13);
  --card-border: rgba(255, 255, 255, .12);
}
/* Health trend + KPI sparklines hard-code a light #e6f8f4 fill: a white block on a navy card. */
:root[data-theme="dark"] .kp .spark-area { fill: rgba(68, 251, 223, .12); }
:root[data-theme="dark"] .dash-trend .spark-line, :root[data-theme="dark"] .kp .spark-line { stroke: #5eead4; }
:root[data-theme="dark"] .dash-trend .spark-dot, :root[data-theme="dark"] .kp .spark-dot { fill: #5eead4; }
/* Scan totals: red #dc2626 on a red tint was 3.2:1, green 3.7:1 */
:root[data-theme="dark"] .scan-stat.bad b { color: #fca5a5; }
:root[data-theme="dark"] .scan-stat.ok b { color: #6ee7b7; }
/* Placeholders were 3.4-3.7:1 in dark */
:root[data-theme="dark"] ::placeholder { color: #8f9bb3; opacity: 1; }

/* Today's date: white on orange was 2.6:1 (light and dark); greyed other-month days were 1.6:1 */
.cal .day.other .dn { color: var(--muted); }

/* ---------- 3. Forms and input surfaces ---------- */
/* Placeholder examples ("SM Megamall", "Store Manager") look like filled-in values.
   Italic tells them apart and keeps 4.5:1. */
input::placeholder, textarea::placeholder { font-style: italic; color: var(--muted); opacity: 1; }
input[type=search]::placeholder, #cmdk-q::placeholder { font-style: normal; }   /* search boxes stay plain */
label.f > small, small#tk-sla { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.modal-h h3 { font-size: 19px; }

/* ---------- 4. Overlays: a readable type floor (13px, primary 14.5px) ---------- */
.gnav-drop a { font-size: 14.5px; padding: 10px 12px; }
.gnav-drop .who span { font-size: 13px; }
.bell-drop { width: 420px; }
.bell-row b { font-size: 14.5px; }
.bell-row small, .bell-more, .bell-empty small, .bell-foot, .bell-snooze { font-size: 13px; color: var(--text-2); }
.bell-sec, .cmdk-grp { font-size: 12px; letter-spacing: .05em; color: var(--text-2); }
.bell-tabs button { font-size: 13px; padding: 7px 8px; }
.bell-tabs .n { font-size: 12px; }
.cmdk-t { font-size: 15px; }
.cmdk-t small { font-size: 13px; }
.cmdk-foot { font-size: 13px; }
.cmdk-in input { font-size: 17px; }
.cw-title b { font-size: 15px; }
.cw-ctx { font-size: 12.5px; }
.cw-bub, .cw-hello { font-size: 14.5px; }
.cw-in textarea { font-size: 15px; }
.cw-chip, .cw-tool { font-size: 13px; }
.cw-rule { font-size: 12.5px; color: var(--text-2); }

/* ---------- 5. Phone (<=640px) ---------- */
@media (max-width: 640px) {
  /* iOS zooms the page when a field under 16px gets focus; 38px fields are below the 44px target. */
  input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=color]), select { height: 44px; }
  .cmdk-in input { height: 32px; }
  label.f > span { font-size: 14px; }

  /* Top bar: 7 icons at 34px. Help lives in the profile menu (Operating Manual) and Charlie;
     dropping it here frees room for 40px buttons with a 44px hit area. */
  .gnav-right > .gnav-item:has(#help-btn) { display: none; }
  .gnav .icon-btn, .gnav .me { width: 40px; height: 40px; position: relative; }
  .gnav .icon-btn::after, .gnav .me::after { content: ''; position: absolute; inset: -2px; }
  .gnav .icon-btn svg { width: 19px; height: 19px; }
  .gnav-right { gap: 3px; }

  /* Bottom bar labels 10.5px grey -> 12px */
  .tabbar a, .tabbar button { font-size: 12px; font-weight: 600; color: var(--text-2); min-height: 48px; }

  /* Workspace tabs: 31-33px tall -> 40px */
  .ws-nav button { min-height: 40px; font-size: 14px; }

  /* Bell on phone: a sheet with tap-sized controls */
  .bell-drop { max-height: calc(100vh - 170px); }
  .bell-tabs button { min-height: 38px; }
  .bell-acts .btn.icon { width: 40px; height: 40px; }
  .bell-acts svg.lucide { width: 18px !important; height: 18px !important; }
  .bell-acts { gap: 0; right: 2px; }
  .bell-item .bell-row { padding-right: 84px !important; }
  #bell-read { min-height: 36px; }

  /* Charlie window header buttons and chips */
  .cw-b { width: 40px; height: 40px; }
  .cw-chip, .cw-tool { min-height: 36px; padding: 6px 12px; }
  .cw-in .btn { width: 40px; height: 40px; }

  /* Calendar: a 7-column month leaves ~50px per day, so every item reads "1…".
     On phones show it as an agenda: one row per day that has something (and today). */
  .cal { grid-template-columns: minmax(0, 1fr); border-left: 0; border-top: 0; }
  .cal .dow, .cal .day.other { display: none; }
  .cal .day:not(:has(.ev)):not(.today) { display: none; }
  .cal .day { min-height: 0; display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 10px; align-items: start; padding: 12px 14px; border-right: 0; }
  .cal .day .dn { grid-row: 1 / span 6; width: 44px; height: 44px; font-size: 18px; display: inline-grid; place-items: center; position: relative; }
  .cal .day .dn::after { position: absolute; top: 46px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
  .cal .day:nth-child(7n+8) .dn::after { content: 'SUN'; }
  .cal .day:nth-child(7n+9) .dn::after { content: 'MON'; }
  .cal .day:nth-child(7n+10) .dn::after { content: 'TUE'; }
  .cal .day:nth-child(7n+11) .dn::after { content: 'WED'; }
  .cal .day:nth-child(7n+12) .dn::after { content: 'THU'; }
  .cal .day:nth-child(7n+13) .dn::after { content: 'FRI'; }
  .cal .day:nth-child(7n+14) .dn::after { content: 'SAT'; }
  .cal .day:has(.ev) { min-height: 72px; }
  .cal .ev { grid-column: 2; white-space: normal; overflow: visible; font-size: 15px; line-height: 1.35; padding: 8px 10px; margin-top: 0; margin-bottom: 6px; min-height: 40px; display: flex; align-items: center; }
  .cal .more { grid-column: 2; font-size: 13px; }
  .card:has(> .card-b > .cal), .card:has(.cal) { overflow: hidden; }
}

/* =========================== Phase 4: compact brand header on phones ===========================
   The header (name, chips, switcher, then a row of three labelled buttons) took about 47% of the screen before any
   brand content. On phones: a smaller logo, the "Brand workspace" label dropped (the page already says it), and the
   switcher shares one row with icon-only buttons (each keeps its title and its words for screen readers). */
@media (max-width: 640px) {
  .ws-head { grid-template-columns: 40px minmax(0, 1fr); row-gap: 10px; }
  .ws-head .avatar.md { width: 40px; height: 40px; font-size: 15px; }
  .ws-head .ws-title h1, .ws-head h1 { font-size: 22px; }
  .ws-head .acc-head { margin-top: 4px; gap: 4px 8px; }
  .ws-head .acc-head .eyebrow.ws-kind { display: none; }
  .ws-head .actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
  .ws-head .actions .ws-switch { flex: 1 1 auto; min-width: 0; width: auto; height: 44px; }
  .ws-head .actions .ws-switch select { min-width: 0; width: 100%; }
  .ws-head .actions > .btn, .ws-head .actions #ws-all, .ws-head .actions #a-del { flex: none; width: 44px; height: 44px; padding: 0; font-size: 0; gap: 0; justify-content: center; }
  .ws-head .actions > .btn svg { width: 19px; height: 19px; }
}
