/* Friends and Family Test dashboard.
 *
 * Phase 4C.45A. The monolith's `<style>` block from website/fft.html and the shared entity picker's
 * `<style>` block from website/partials/_entity_picker.html, taken at monolith commit cb02cf0 with no
 * selector, value or colour changed. The additions are at the end and are listed there: they exist
 * because the Content Security Policy admits no style attribute and no inline style element, so the
 * monolith's were moved here, and because the owner decisions of 2026-10-08 add two states (a
 * submitted return with no response total, and a PCN result that uses current membership) that the
 * source had no markup for.
 */
  /* Diverging rating scale: two hues either side of a neutral gray midpoint.
     Validated with modules/tools/ipc_audit/validate_palette.py — every adjacent
     and non-adjacent pair clears the CVD and normal-vision floors. A green/red
     scale was tried first and failed hard (protan dE 2.4), which is why the
     poles are blue and orange rather than the conventional traffic light.
     Re-run the validator before changing any of these:
       python3 modules/tools/ipc_audit/validate_palette.py \
         "#1a5fb4,#5f9ee0,#e89838,#b34700" light "#ffffff" all
     The two light steps carry a contrast WARN, so segments are always directly
     labelled and a table view of the same numbers sits beneath the chart. */
  :root {
    --fft-vg:#1a5fb4; --fft-g:#5f9ee0; --fft-n:#9aa5b1; --fft-p:#e89838; --fft-vp:#b34700;
    --fft-dk:#cbd5e1;
    --fft-border:#e6ebf1; --fft-ink:#0f172a; --fft-mut:#64748b; --fft-soft:#94a3b8;
    --fft-good:#15803d; --fft-goodbg:#e8f6ec; --fft-bad:#b91c1c; --fft-badbg:#fdeaea;
    --fft-warnbg:#fef6e7; --fft-warn:#92610a;
    --fft-blue:#0d5bb8; --fft-nat:#94a3b8;
  }

  .fft-wrap { max-width:1200px; margin:0 auto; padding:30px 20px 70px; }
  .fft-lead { color:var(--fft-mut); font-size:15px; margin:0 0 16px; max-width:860px; }
  .fft-note { background:#f6f8fc; border:1px solid var(--fft-border); border-left:3px solid var(--fft-blue);
    border-radius:8px; padding:13px 17px; font-size:13px; color:#4b5563; margin-bottom:18px; }

  .fft-card { background:#fff; border:1px solid var(--fft-border); border-radius:12px; padding:20px 22px; margin-bottom:18px; }
  .fft-h { font-size:16px; font-weight:800; color:var(--fft-ink); margin:0 0 4px; }
  .fft-sub { color:var(--fft-mut); font-size:12.5px; margin:0 0 14px; }
  .fft-cardhead { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; flex-wrap:wrap; }

  .fft-controls { display:flex; align-items:center; gap:16px; flex-wrap:wrap; min-height:46px; }
  .fft-modes { display:inline-flex; background:#eef2f7; border-radius:10px; padding:4px; }
  .fft-mode { border:none; background:none; padding:9px 20px; font-size:13.5px; font-weight:700; color:var(--fft-mut); border-radius:8px; cursor:pointer; }
  .fft-mode.active { background:#fff; color:var(--fft-ink); box-shadow:0 1px 3px rgba(15,23,42,.12); }
  .fft-monthwrap { display:flex; align-items:center; gap:9px; }
  .fft-ctl-label { font-size:12px; font-weight:700; color:var(--fft-soft); text-transform:uppercase; letter-spacing:.04em; }
  .fft-month { border:1px solid #d1d9e0; border-radius:9px; padding:9px 12px; font-size:13.5px; font-weight:600; color:var(--fft-ink); background:#fff; }
  .fft-msg { color:var(--fft-bad); font-size:13px; margin-top:10px; }

  .fft-empty { text-align:center; padding:70px 20px; color:var(--fft-mut); }

  .fft-context { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap;
    background:#fff; border:1px solid var(--fft-border); border-radius:12px; padding:18px 22px; margin-bottom:18px; }
  .fft-context h2 { font-size:19px; font-weight:800; color:var(--fft-ink); margin:0 0 3px; }
  .fft-context .meta { font-size:13px; color:var(--fft-mut); }

  .fft-tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; margin-bottom:18px; }
  .fft-tile { background:#fff; border:1px solid var(--fft-border); border-radius:12px; padding:16px 18px; }
  .fft-tile .lab { font-size:11.5px; font-weight:700; color:var(--fft-soft); text-transform:uppercase; letter-spacing:.05em; }
  .fft-tile .val { font-size:27px; font-weight:800; color:var(--fft-ink); margin-top:6px; line-height:1.1; }
  .fft-tile .val.na { color:var(--fft-soft); font-size:20px; font-weight:700; }
  .fft-tile .cmp { font-size:12px; color:var(--fft-mut); margin-top:5px; }
  .fft-pill { display:inline-block; padding:2px 8px; border-radius:999px; font-size:11.5px; font-weight:700; }
  .fft-pill.up { background:var(--fft-goodbg); color:var(--fft-good); }
  .fft-pill.down { background:var(--fft-badbg); color:var(--fft-bad); }
  .fft-pill.flat { background:#eef2f7; color:var(--fft-mut); }

  .fft-alert { display:flex; gap:12px; align-items:flex-start; border-radius:10px; padding:14px 17px; margin-bottom:18px; font-size:13.5px; }
  .fft-alert svg { margin-top:2px; }
  .fft-alert.warn { background:var(--fft-warnbg); border:1px solid #f0dcae; color:var(--fft-warn); }
  .fft-alert.bad { background:var(--fft-badbg); border:1px solid #f3c9c9; color:var(--fft-bad); }
  .fft-alert ul { margin:6px 0 0; padding-left:18px; }

  .fft-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
  @media (max-width:900px){ .fft-grid2 { grid-template-columns:1fr; } }
  .fft-chart { position:relative; height:290px; }
  .fft-chart.tall { height:330px; }

  .fft-legend { display:flex; flex-wrap:wrap; gap:14px; margin:12px 0 0; }
  .fft-legend span { display:inline-flex; align-items:center; gap:7px; font-size:12.5px; color:var(--fft-mut); }
  .fft-swatch { width:12px; height:12px; border-radius:3px; display:inline-block; }

  table.fft-table { width:100%; border-collapse:collapse; font-size:13px; }
  table.fft-table th, table.fft-table td { padding:9px 10px; border-bottom:1px solid #f0f3f6; text-align:right; }
  table.fft-table th:first-child, table.fft-table td:first-child { text-align:left; }
  table.fft-table th { font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--fft-soft); font-weight:700; }
  table.fft-table tbody tr:hover { background:#f9fbfd; }
  .fft-flagdot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--fft-warn); margin-left:6px; }
  .fft-muted { color:var(--fft-soft); }

  .fft-scroll { overflow-x:auto; }

  .fft-note-warn { border-left-color:#c2410c; background:#fff7ed; color:#7c2d12; }

  .fft-signal { display:flex; gap:12px; align-items:flex-start; padding:13px 15px; border-radius:9px;
    border:1px solid var(--fft-border); margin-bottom:10px; background:#fbfcfe; }
  .fft-signal svg { margin-top:2px; }
  .fft-signal.review { background:var(--fft-warnbg); border-color:#f0dcae; }
  .fft-signal.review svg { color:var(--fft-warn); }
  .fft-signal.info svg { color:var(--fft-blue); }
  .fft-signal .t { font-weight:800; color:var(--fft-ink); font-size:13.5px; }
  .fft-signal .d { color:var(--fft-mut); font-size:12.8px; margin-top:3px; }
  .fft-clear { display:flex; gap:11px; align-items:center; color:var(--fft-good);
    background:var(--fft-goodbg); border:1px solid #cce9d5; border-radius:9px; padding:13px 15px; font-size:13.5px; }
  .fft-me-row { background:#eef5ff !important; font-weight:700; }

  /* Controls sit at the very top; the long explanation is one click away
     rather than three paragraphs the reader must scroll past to reach a chart. */
  .fft-controls-card { margin-bottom:18px; }
  .fft-about-toggle { margin-left:auto; background:none; border:1px solid #d1d9e0; border-radius:9px;
    padding:8px 13px; font-size:12.5px; font-weight:700; color:var(--fft-mut); cursor:pointer; }
  .fft-about-toggle:hover { border-color:#b6c2cd; color:var(--fft-ink); }
  .fft-caution { display:flex; gap:9px; align-items:flex-start; margin-top:13px; padding:10px 13px;
    background:#fff7ed; border:1px solid #fed7aa; border-radius:8px; font-size:12.5px; color:#7c2d12; }
  .fft-caution svg { margin-top:2px; color:#c2410c; }
  .fft-about { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:16px;
    margin-top:14px; padding-top:16px; border-top:1px solid var(--fft-border); }
  .fft-about h4 { font-size:12.5px; font-weight:800; color:var(--fft-ink); margin:0 0 5px; }
  .fft-about p { font-size:12.5px; color:var(--fft-mut); margin:0; line-height:1.55; }

  /* The insight panel is the product; it reads first and looks like it matters. */
  .fft-insights-card { border-color:#cfe0f5; background:linear-gradient(180deg,#f7fbff,#fff 120px); }
  .fft-insights-card .fft-h svg { color:var(--fft-blue); margin-right:6px; }
  .fft-insight { display:flex; gap:13px; align-items:flex-start; padding:13px 0; border-top:1px solid #edf2f7; }
  .fft-insight:first-child { border-top:none; padding-top:2px; }
  .fft-insight .ico { width:26px; height:26px; border-radius:50%; display:flex; align-items:center;
    justify-content:center; flex:0 0 26px; font-size:12px; }
  .fft-insight.good .ico { background:var(--fft-goodbg); color:var(--fft-good); }
  .fft-insight.bad .ico { background:var(--fft-badbg); color:var(--fft-bad); }
  .fft-insight.warn .ico { background:var(--fft-warnbg); color:var(--fft-warn); }
  .fft-insight.neutral .ico { background:#eef2f7; color:var(--fft-mut); }
  .fft-insight .t { font-weight:800; color:var(--fft-ink); font-size:14px; }
  .fft-insight .d { color:var(--fft-mut); font-size:13px; margin-top:3px; line-height:1.55; }

  /* One-line takeaway under a chart, so no chart is left to speak for itself. */
  .fft-takeaway { margin-top:12px; padding:10px 13px; background:#f6f8fc; border-radius:8px;
    font-size:12.8px; color:#4b5563; border-left:3px solid var(--fft-blue); }

/* ── The shared entity picker (partials/_entity_picker.html) ── */
  .epick-chip { display:inline-flex; align-items:center; gap:10px; padding:10px 14px;
    background:#fff; border:1px solid #d1d9e0; border-radius:10px; font-size:14px;
    font-weight:600; color:#5a6b7b; cursor:pointer; transition:border-color .12s, box-shadow .12s; }
  .epick-chip:hover { border-color:#b6c2cd; }
  .epick-chip.set { color:#1a2a3b; border-color:#16a085; }
  .epick-chip .epick-trigger-val { font-weight:700; }

  .epick-modal { position:fixed; inset:0; z-index:100000; display:flex; align-items:flex-start; justify-content:center; }
  .epick-modal[hidden] { display:none; }
  .epick-backdrop { position:absolute; inset:0; background:rgba(15,30,42,.45); backdrop-filter:blur(2px); }
  .epick-box { position:relative; background:#fff; width:min(560px,92vw); margin-top:clamp(110px,16vh,200px);
    border-radius:14px; box-shadow:0 24px 60px rgba(0,0,0,.3); overflow:hidden; animation:epickPop .14s ease-out; }
  @keyframes epickPop { from { opacity:0; transform:translateY(-8px) scale(.98); } to { opacity:1; transform:none; } }
  .epick-head { display:flex; align-items:center; gap:11px; padding:16px 18px; border-bottom:1px solid #eef1f4; }
  .epick-head span { font-size:15px; font-weight:800; color:#1a2a3b; flex:1; }
  .epick-head button { background:none; border:none; font-size:22px; line-height:1; color:#b6bfc8; cursor:pointer; }
  .epick-head button:hover { color:#1a2a3b; }
  .epick-search { display:flex; align-items:center; gap:10px; padding:14px 18px; }
  .epick-search input { flex:1; border:none; outline:none; font-size:16px; color:#1a2a3b; background:none; }
  .epick-hint { padding:0 18px 8px; font-size:11.5px; color:#9aa5b1; }
  .epick-results { max-height:46vh; overflow-y:auto; border-top:1px solid #f0f3f6; }
  .epick-item { display:flex; align-items:center; gap:12px; padding:11px 18px; cursor:pointer; border-bottom:1px solid #f5f7f9; }
  .epick-item:hover, .epick-item.active { background:#f0faf8; }
  .epick-item .epick-code { font-size:11px; font-weight:700; color:#16a085; min-width:62px; }
  .epick-item .epick-name { flex:1; font-size:13.5px; color:#1a2a3b; }
  .epick-item .epick-name .epick-sub { color:#9aa5b1; font-size:11.5px; font-weight:600; }
  .epick-item .epick-go { color:#cdd3da; font-size:12px; }
  .epick-item.active .epick-go { color:#16a085; }
  .epick-empty { padding:24px 18px; text-align:center; color:#b6bfc8; font-size:13px; }


/* ── Phase 4C.45A: what the monolith's inline style="" attributes became ─────────────────────
   Each one the template carried is a class here with the same declarations. An element the monolith
   hid with `style="display:none;"` and its script later shows carries `data-ft-hidden`, which
   `fft.v1.js` turns into the same inline display through the style object model on load (the policy
   admits that). Markup the script builds still carries `style=""` in its strings, as the source's
   does; the script's safe `innerHTML` applies each one through the same object model. */
  .ft-ico { width:1em; height:1em; vertical-align:-.125em; fill:none; stroke:currentColor; stroke-width:2;
    stroke-linecap:round; stroke-linejoin:round; flex:none; }
  .fft-empty .ft-empty-ico { width:34px; height:34px; color:#cbd5e1; }
  .ft-mt14 { margin-top:14px; }
  .ft-mb6 { margin-bottom:6px; }
  .fft-ctl-label .ft-ico { margin-right:4px; }
  .fft-about-toggle .ft-ico { margin-right:4px; }
  .fft-clear .ft-ico { flex:none; }
  .fft-insight .ico .ft-ico { width:14px; height:14px; }
  .epick-chip > svg:last-child { color:#aab4be; font-size:12px; }
  .epick-head > svg { color:#16a085; }
  .epick-search svg { color:#b6bfc8; }
  .epick-item .epick-go { width:12px; height:12px; }

/* ── Phase 4C.45A: the two states the owner decisions added ──────────────────────────────────
   D4: a return was made and its response total is not available. D6: a PCN result uses the network's
   current membership for every month. Both reuse the source's own alert and note colours. */
  .fft-note-membership { margin:0 0 18px; }
  .fft-note-membership strong { color:#7c2d12; }
  .fft-tile .val.na.fft-val-text { font-size:17px; }

/* ── Phase 4C.45A: fitting the monolith's page inside this service's shell ──────────────────────
   The monolith's dashboard had the viewport to itself and a centred 1200px column. Here the shell's
   full-width workspace is the container, and a sidebar takes ~250px, so the breakpoints the source
   chose fire too late. These rules only move the column rules out. A table wider than its card scrolls
   inside the card (`.fft-scroll`), so the document never gains a horizontal scrollbar. */
.fft-wrap { max-width:none; margin:0; padding:0; }
.fft-title { font-size:28px; font-weight:800; color:var(--fft-ink); margin:0 0 16px; }
.fft-controls > *, .fft-tiles > *, .fft-grid2 > *, .fft-about > * { min-width:0; }
.fft-card, .fft-context { min-width:0; max-width:100%; }
@media (max-width:1100px){ .fft-grid2 { grid-template-columns:1fr; } }
.fft-tile { min-width:0; overflow-wrap:anywhere; }
.fft-chart { max-width:100%; }
table.fft-table thead th { font-size:11.5px; letter-spacing:.04em; text-transform:uppercase; }
table.fft-table tbody tr:last-child td { border-bottom:1px solid #f0f3f6; }
.fft-month { max-width:100%; }
