/* Lorphic Autopilot — flight-deck operations console
   Palette: deep instrument navy field; functional status colours (green=healthy,
   amber=attention, red=off/problem, cyan=brand/active). Data set in monospace. */

:root {
  --bg:        #0E1620;   /* instrument field */
  --bg-2:      #0B1119;   /* deeper (sidebar) */
  --panel:     #16202D;   /* raised panel */
  --panel-2:   #1B2836;   /* hover / nested */
  --line:      #263241;   /* hairline border */
  --line-2:    #31404F;
  --ink:       #E6EDF3;   /* primary text */
  --ink-mut:   #8A97A6;   /* muted */
  --ink-dim:   #7A8794;   /* dimmest — WCAG AA compliant on dark bg (5.0:1) */

  --brand:     #38BDF8;   /* signal cyan — active / primary */
  --brand-hi:  #5CCBFA;   /* brand hover */
  --go:        #34D399;   /* healthy / live / on */
  --go-lt:     #6EE7B7;   /* go on dark bg */
  --warn:      #FBBF24;   /* attention / review */
  --stop:      #F87171;   /* off / problem */
  --stop-lt:   #FCA5A5;   /* stop on dark bg */
  --line-soft: rgba(255,255,255,.04); /* very subtle row separator */
  --fg-brand:  #04121C;   /* dark text on brand-coloured bg */

  /* ---- Design tokens (2026 system) ---- */

  /* Spacing scale (8px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Type scale */
  --fs-h1:    24px;
  --fs-h2:    16px;
  --fs-stat:  26px;
  --fs-body:  13.5px;
  --fs-label: 11px;

  /* Radius scale */
  --radius:       10px;
  --radius-sm:    7px;
  --radius-xs:    4px;
  --radius-pill:  999px;

  /* Elevation / shadow system */
  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow-2: 0 4px 16px -2px rgba(0,0,0,.4);
  --shadow-3: 0 24px 60px -20px rgba(0,0,0,.6);
  --shadow-glow: 0 0 20px -4px rgba(56,189,248,.15);

  /* Glass surface */
  --glass-bg: rgba(22,32,45,.72);
  --glass-blur: blur(14px);

  /* Sticky HUD height (desktop): 18px pad + 36px h1 (24px × 1.5 line-height)
     + 3px + ~16px span + 18px pad ≈ 91px (+1px border slack). Offsets sticky
     table headers below the HUD (z-index 100). Reset to 0 ≤820px, where the
     HUD is position:relative and does not stick. */
  --hud-h: 92px;

  /* Easing */
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  /* Gradients */
  --grad-brand: linear-gradient(180deg, #4FCBFB 0%, #38BDF8 100%);
  --grad-panel: linear-gradient(180deg, rgba(56,189,248,.03) 0%, transparent 60%);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --disp: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---------- App shell ---------- */
.fd-shell { display: flex; min-height: 100vh; }

.fd-nav {
  width: 232px; flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.fd-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 22px;
  border-bottom: 1px solid var(--line);
}
.fd-brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: radial-gradient(120% 120% at 30% 20%, var(--brand), #0EA5E9 60%, #0369A1);
  position: relative;
  box-shadow: 0 0 0 1px rgba(56,189,248,.35), 0 0 18px -4px var(--brand);
}
.fd-brand-mark::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg-2); box-shadow: 0 0 0 3px rgba(14,22,32,.9);
}
.fd-brand-name { font-family: var(--disp); font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.fd-brand-sub  { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .12em; text-transform: uppercase; margin-top: 1px; }

.fd-navgroup { padding: 14px 12px; flex: 1; overflow-y: auto; }
.fd-navlabel { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); padding: 0 8px 8px; }
.fd-navlabel.spaced { margin-top: 16px; }
.fd-light-dot.fd-dot-sm { width: 8px; height: 8px; }
.fd-hint.mb-sm { margin-bottom: 12px; }
.fd-hint.mb-xs { margin-bottom: 8px; }
.fd-hint.mt-sm { margin-top: 12px; }
.fd-hint.mt-md { margin-top: 20px; }
.fd-content.mt-none { margin-top: 0; }
.fd-sec-head.spaced { margin-top: 30px; }
.fd-flash.mt-sm { margin-top: 8px; }
.fd-check.mt-sm { margin-top: 10px; }
.mb-block { margin-bottom: 20px; }
.fd-navitem {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-mut); font-weight: 500; font-size: 13.5px;
  margin-bottom: 2px; cursor: pointer;
}
.fd-navitem:hover { background: var(--panel); color: var(--ink); }
.fd-navitem.is-active { background: var(--panel-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--brand); }
.fd-navitem.is-soon { opacity: .45; cursor: default; }
.fd-navitem.is-soon:hover { background: transparent; color: var(--ink-mut); }
.fd-navdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; opacity: .7; }
.fd-navicon { width: 16px; height: 16px; flex-shrink: 0; opacity: .6; transition: opacity .2s var(--ease-out); }
.fd-navitem:hover .fd-navicon, .fd-navitem.is-active .fd-navicon { opacity: 1; }
.fd-navitem.is-active .fd-navicon { color: var(--brand); }
.fd-soon-tag { margin-left: auto; font-family: var(--mono); font-size: 9px; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; letter-spacing: .08em; }

.fd-navfoot { padding: 12px; border-top: 1px solid var(--line); }
.fd-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.fd-user-name { font-size: 13px; font-weight: 500; }
.fd-user-mail { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }
.fd-logout {
  margin-top: 6px; width: 100%; text-align: left;
  background: transparent; border: 1px solid var(--line); color: var(--ink-mut);
  padding: 7px 10px; border-radius: var(--radius-sm); font-family: var(--body);
  font-size: 12.5px; cursor: pointer;
}
.fd-logout:hover { border-color: var(--stop); color: var(--stop); }

.fd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ============================================================
   DASHBOARD GREETING — personal hero line above the HUD.
   ============================================================ */
.fd-greet {
  padding: 28px 24px 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.fd-greet-text {
  font-family: var(--disp); font-size: 20px; font-weight: 600; color: var(--ink);
  letter-spacing: -.3px;
}
.fd-greet-sub {
  font-size: 13px; color: var(--ink-mut);
}

/* ---------- HUD status bar ---------- */
.fd-hud {
  display: flex; align-items: stretch; gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-1);
  position: sticky; top: 0; z-index: 100;
}
.fd-hud-title { padding: 18px 24px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); min-width: 220px; }
.fd-hud-title h1 { font-family: var(--disp); font-size: var(--fs-h1); font-weight: 600; margin: 0; letter-spacing: -.3px; }
.fd-hud-title span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); letter-spacing: .1em; text-transform: uppercase; margin-top: 3px; }
.fd-hud-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.fd-hud-sub span:first-child { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); letter-spacing: .1em; text-transform: uppercase; }
.fd-hud-sub .fd-badge { text-transform: none; letter-spacing: 0; font-size: 11px; }
.fd-hud-stats { display: flex; flex: 1; }
.fd-stat { padding: 14px 22px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.fd-stat-num { font-family: var(--disp); font-size: var(--fs-stat); font-weight: 600; line-height: 1; letter-spacing: -.5px; }
.fd-stat-num.sm { font-size: 14px; letter-spacing: 0; }
.fd-stat-lbl { font-family: var(--mono); font-size: 10px; color: var(--ink-mut); text-transform: uppercase; letter-spacing: .1em; margin-top: 6px; }
.fd-stat-num.accent { color: var(--brand); }
.fd-stat-num.go { color: var(--go); }
.fd-stat-num.warn { color: var(--warn); }

/* ---------- Content ---------- */
.fd-content { padding: 24px; }
.fd-sec-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 2px 16px; }
.fd-sec-head h2 { font-family: var(--disp); font-size: var(--fs-h2); font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin: 0; }
.fd-sec-head .rule { flex: 1; height: 1px; background: var(--line); }
.fd-sec-head .count { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }

/* ---------- Instrument channel (the signature element) ---------- */
.fd-channels { display: flex; flex-direction: column; gap: 10px; }
.fd-channel {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.fd-channel:hover { border-color: var(--line-2); background: var(--panel-2); }

.fd-chan-id { min-width: 0; }
.fd-chan-domain { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--ink); letter-spacing: -.2px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.fd-chan-client { font-size: 12.5px; color: var(--ink-mut); margin-top: 4px; }
.fd-readiness-badge { font-size: 9.5px; padding: 2px 8px; }

.fd-lights { display: flex; gap: 18px; }
.fd-light { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 62px; }
.fd-light-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-dim); position: relative;
}
.fd-light-dot.on   { background: var(--go);   box-shadow: 0 0 10px -1px var(--go); }
.fd-light-dot.warn { background: var(--warn); box-shadow: 0 0 10px -1px var(--warn); }
.fd-light-dot.off  { background: var(--stop); box-shadow: 0 0 10px -1px var(--stop); }
.fd-light-dot.idle { background: var(--ink-dim); }
.fd-light-lbl { font-family: var(--mono); font-size: 9.5px; color: var(--ink-mut); text-transform: uppercase; letter-spacing: .06em; }
.fd-light-val { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); }

.fd-chan-metrics { display: flex; gap: 22px; padding-left: 20px; border-left: 1px solid var(--line); }
.fd-chan-metrics-clean { padding-left: 0; border-left: none; gap: 8px; flex-wrap: wrap; }
.fd-metric { text-align: right; }
.fd-metric-num { font-family: var(--disp); font-size: 18px; font-weight: 600; line-height: 1; }
.fd-metric-num.pending { color: var(--warn); }
.fd-metric-num.zero { color: var(--ink-dim); }
.fd-metric-lbl { font-family: var(--mono); font-size: 9px; color: var(--ink-mut); text-transform: uppercase; letter-spacing: .08em; margin-top: 5px; }

.fd-empty { text-align: center; padding: 60px 20px; color: var(--ink-mut); }
.fd-empty h3 { font-family: var(--disp); font-weight: 600; color: var(--ink); margin: 0 0 8px; }
.fd-empty code { font-family: var(--mono); background: var(--panel); border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; font-size: 12.5px; color: var(--brand); }

/* ---------- Login (split-screen 2026 redesign) ---------- */
.fd-login-split { min-height: 100vh; display: flex; }
.fd-login-brand-panel {
  flex: 1; position: relative; overflow: hidden;
  background: var(--bg-2);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px; min-height: 100vh;
}
.fd-login-aurora {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(50% 50% at 30% 20%, rgba(56,189,248,.15), transparent 60%),
    radial-gradient(40% 40% at 70% 70%, rgba(52,211,153,.08), transparent 60%),
    radial-gradient(35% 35% at 50% 50%, rgba(167,139,250,.06), transparent 60%);
  animation: fd-aurora 12s ease-in-out infinite alternate;
}
@keyframes fd-aurora {
  0%   { transform: scale(1) rotate(0deg); opacity: .8; }
  100% { transform: scale(1.1) rotate(3deg); opacity: 1; }
}
.fd-login-brand-content { position: relative; z-index: 1; }
.fd-login-brand-mark { display: flex; align-items: center; gap: 12px; margin-bottom: auto; }
.fd-login-brand-mark .fd-brand-mark { width: 36px; height: 36px; }
.fd-login-brand-mark .n { font-family: var(--disp); font-size: 19px; font-weight: 600; }
.fd-login-brand-mark .s { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .14em; text-transform: uppercase; }
.fd-login-hero { margin: auto 0; max-width: 420px; }
.fd-login-hero h2 { font-family: var(--disp); font-size: 32px; font-weight: 700; line-height: 1.2; color: var(--ink); margin: 0 0 16px; letter-spacing: -.5px; }
.fd-login-hero p { font-size: 15px; line-height: 1.6; color: var(--ink-mut); margin: 0; }
.fd-login-feats { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.fd-login-feat { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-mut); }
.fd-login-feat-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--brand); flex-shrink: 0; }

.fd-login-form-panel {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; background: var(--bg); min-height: 100vh;
}
.fd-login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 36px 32px; box-shadow: var(--shadow-2); animation: fd-card-in .4s var(--ease-out) backwards; }
.fd-login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 24px; }
.fd-login-mobile-brand .n { font-family: var(--disp); font-size: 17px; font-weight: 600; }
.fd-login-card h1 { font-family: var(--disp); font-size: 24px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.3px; }
.fd-login-card p.sub { color: var(--ink-mut); font-size: 13.5px; margin: 0 0 24px; }
.fd-field { margin-bottom: 16px; }
.fd-field label { display: block; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-mut); margin-bottom: 7px; }
.fd-input {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2);
  color: var(--ink); padding: 11px 13px; border-radius: var(--radius-sm);
  font-family: var(--body); font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.fd-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(56,189,248,.14); }
.fd-check { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; color: var(--ink-mut); font-size: 13px; }
.fd-btn {
  width: 100%; background: var(--grad-brand); color: var(--fg-brand); border: none;
  padding: 12px; border-radius: var(--radius-sm); font-family: var(--disp);
  font-weight: 600; font-size: 14px; cursor: pointer; letter-spacing: .02em;
  box-shadow: var(--shadow-1), 0 0 0 1px rgba(56,189,248,.2);
  transition: box-shadow .2s var(--ease-out), transform .15s var(--ease-out);
}
.fd-btn:hover { box-shadow: var(--shadow-2), 0 0 0 1px rgba(56,189,248,.3), var(--shadow-glow); transform: translateY(-1px); }
.fd-error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.35); color: var(--stop-lt);
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.fd-login-foot { margin-top: 32px; font-size: 11.5px; color: var(--ink-dim); }

@media (max-width: 820px) {
  .fd-login-brand-panel { display: none; }
  .fd-login-mobile-brand { display: flex; }
}

@media (max-width: 820px) {
  .fd-nav { display: none; }
  .fd-hud { flex-direction: column; }
  .fd-hud-title { border-right: none; border-bottom: 1px solid var(--line); }
  .fd-hud-stats { overflow-x: auto; }
  .fd-channel { grid-template-columns: 1fr; gap: 16px; }
  .fd-chan-metrics { padding-left: 0; border-left: none; border-top: 1px solid var(--line); padding-top: 14px; justify-content: flex-start; }
  .fd-lights { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Nav badge + flash (Slice 2) ---------- */
.fd-nav-badge { margin-left: auto; background: var(--warn); color: #2A1D02; font-family: var(--mono); font-size: 10px; font-weight: 500; border-radius: 10px; padding: 1px 7px; }
.fd-flash { margin: 0; padding: 12px 24px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.fd-flash.ok  { background: rgba(52,211,153,.10); color: #6EE7B7; border-bottom-color: rgba(52,211,153,.3); }
.fd-flash.err { background: rgba(248,113,113,.10); color: #FCA5A5; border-bottom-color: rgba(248,113,113,.3); }

/* ---------- Queue cards ---------- */
.fd-qlist { display: flex; flex-direction: column; gap: 10px; }
.fd-q-empty { color: var(--ink-mut); font-size: 13.5px; padding: 18px 20px; background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.fd-q-empty code { font-family: var(--mono); color: var(--brand); font-size: 12.5px; }

.fd-qcard { display: flex; align-items: flex-start; gap: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.fd-qcard:hover { border-color: var(--line-2); }
.fd-qcard-main { flex: 1; min-width: 0; }
.fd-qbadges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.fd-qtitle { font-family: var(--disp); font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.fd-qmeta { font-size: 12.5px; color: var(--ink-mut); margin-top: 5px; }
.fd-qmeta .mono, .mono { font-family: var(--mono); }
.fd-qnote { font-size: 12.5px; color: var(--ink-mut); margin-top: 8px; line-height: 1.5; padding-left: 11px; border-left: 2px solid var(--line-2); }

/* Badge styles defined in the STATUS PILL section below (consolidated — single source of truth). */

.fd-qactions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.fd-qactions.row { flex-direction: row; gap: 10px; flex-wrap: wrap; }
.fd-qactions form { margin: 0; }
.fd-abtn { display: inline-block; width: auto; text-align: center; font-family: var(--body); font-size: 13px; font-weight: 500; padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--line-2); background: transparent; color: var(--ink); transition: background .2s var(--ease-out), border-color .2s var(--ease-out), color .2s var(--ease-out), transform .15s var(--ease-out), box-shadow .2s var(--ease-out); }
.fd-abtn.full { width: 100%; }
.fd-abtn.primary { background: var(--grad-brand); color: var(--fg-brand); border-color: transparent; font-weight: 600; box-shadow: var(--shadow-1), 0 0 0 1px rgba(56,189,248,.2); }
.fd-abtn.primary:hover { box-shadow: var(--shadow-2), 0 0 0 1px rgba(56,189,248,.3), var(--shadow-glow); transform: translateY(-1px); }
.fd-abtn.ghost { color: var(--ink-mut); }
.fd-abtn.ghost:hover { border-color: var(--stop); color: var(--stop); }
.fd-abtn.is-disabled, .fd-abtn:disabled { opacity: .4; cursor: not-allowed; }
.fd-abtn:focus-visible, .fd-navitem:focus-visible, .fd-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fd-abtn:active { transform: translateY(1px); }

/* ---------- Modal ---------- */
.fd-modal-scrim { display: none; position: fixed; inset: 0; background: rgba(6,11,18,.72); z-index: 9600; align-items: flex-start; justify-content: center; padding: 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fd-modal-scrim.open { display: flex; }
.fd-modal { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-3); margin: auto; max-height: calc(100vh - 48px); overflow-y: auto; }
.fd-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.fd-modal-head h3 { font-family: var(--disp); font-size: 16px; font-weight: 600; margin: 0; }
.fd-modal-x { background: none; border: none; color: var(--ink-mut); font-size: 22px; line-height: 1; cursor: pointer; padding: 8px; min-width: 36px; min-height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.fd-modal-x:hover { color: var(--ink); background: var(--panel-2); }
.fd-modal-x:hover { color: var(--ink); }
.fd-modal-body { padding: 20px 22px; }
.fd-modal-lead { font-size: 13.5px; color: var(--ink); margin: 0 0 16px; }
.fd-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-bottom: 18px; }
.fd-modal-grid .k { display: block; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-mut); margin-bottom: 3px; }
.fd-modal-grid .v { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.fd-diff { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.fd-diff-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 10px 13px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.fd-diff-row:last-child { border-bottom: none; }
.fd-diff-row .lbl { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--ink-mut); align-self: center; }
.fd-diff-row .old { color: var(--ink-dim); text-decoration: line-through; grid-column: 2; }
.fd-diff-row .new { color: var(--go); grid-column: 2; }
.fd-modal-warn { margin-top: 16px; background: rgba(248,113,113,.09); border: 1px solid rgba(248,113,113,.34); border-radius: var(--radius-sm); padding: 13px 15px; font-size: 12.5px; color: #FCA5A5; }
.fd-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.fd-modal-foot form { margin: 0; }
.fd-modal-foot .fd-abtn { width: auto; }

/* ---------- Settings / forms (Slice 3) ---------- */
.fd-hint { color: var(--ink-mut); font-size: 13px; margin: 0 0 18px; max-width: 720px; line-height: 1.55; }
.fd-hint code { font-family: var(--mono); color: var(--brand); font-size: 12px; }
.fd-form { max-width: 860px; }
.fd-formcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; margin-bottom: 14px; }
.fd-formcard-h { font-family: var(--disp); font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.fd-f { margin-bottom: 15px; }
.fd-f:last-child { margin-bottom: 0; }
.fd-f label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.fd-f label .hint { font-weight: 400; color: var(--ink-dim); font-size: 11.5px; font-family: var(--body); }
.fd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.fd-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.fd-grid2 .fd-f, .fd-grid3 .fd-f { margin-bottom: 15px; }
select.fd-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238A97A6' d='M6 8L2 4h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
textarea.fd-input { resize: vertical; line-height: 1.5; }

.fd-toggle { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.fd-toggle input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; }

.fd-confirm-card { background: rgba(52,211,153,.05); border-color: rgba(52,211,153,.25); }
.fd-confirm-card .fd-check { align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--ink); }
.fd-confirm-card .fd-check input { margin-top: 2px; }

/* Savebar styles defined later in the Card Polish section (consolidated). */
.fd-savebar .fd-abtn { box-shadow: 0 6px 20px -8px rgba(0,0,0,.5); }

/* ---------- Run / triggers (Slice 5) ---------- */
.fd-run-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.fd-run-row { display: flex; align-items: flex-end; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft, rgba(255,255,255,.04)); }
.fd-run-row:last-of-type { border-bottom: none; padding-bottom: 4px; }
.fd-run-row:first-of-type { padding-top: 4px; }
.fd-run-pick { width: 200px; flex-shrink: 0; }
.fd-run-opt { flex: 1; }
.fd-run-row label { display: block; font-size: 11.5px; color: var(--ink-mut); margin-bottom: 5px; }
.fd-run-row label .hint { color: var(--ink-dim); font-size: 10.5px; }
.fd-run-row .fd-abtn { width: auto; flex-shrink: 0; }
.fd-run-row .fd-input { padding: 8px 11px; font-size: 13px; }

.fd-runlog { display: flex; flex-direction: column; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.fd-runitem { display: flex; align-items: center; gap: 14px; background: var(--panel); padding: 12px 16px; font-size: 13px; flex-wrap: wrap; transition: background .15s; }
.fd-runitem:hover { background: var(--panel-2); }
.fd-run-label { font-weight: 500; color: var(--ink); min-width: 160px; }
.fd-run-site { color: var(--ink-mut); font-size: 12px; }
.fd-run-time { color: var(--ink-dim); font-size: 11.5px; margin-left: auto; }
.fd-run-err { flex-basis: 100%; color: #FCA5A5; font-size: 11.5px; padding-left: 2px; }

@media (max-width: 820px) {
  .fd-run-grid { grid-template-columns: 1fr; }
  .fd-run-row { flex-wrap: wrap; }
  .fd-run-pick, .fd-run-opt { width: 100%; }
}

/* ---------- Run activity: expandable output ---------- */
.fd-runitem.is-toggle { cursor: pointer; }
.fd-runitem.is-toggle:hover { background: var(--panel-2); }
.fd-run-caret { display: inline-block; width: 12px; color: var(--ink-mut); font-size: 15px; line-height: 1; transition: transform .15s; flex-shrink: 0; }
.fd-run-caret.spacer { visibility: hidden; }
.fd-runitem.open .fd-run-caret { transform: rotate(90deg); }
.fd-run-output { flex-basis: 100%; margin: 10px 0 2px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-mut); font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow: auto; display: none; }
.fd-runitem.open .fd-run-output { display: block; }
@media (prefers-reduced-motion: reduce) { .fd-run-caret { transition: none; } }

/* ---------- Insight panels (Slice 4) ---------- */
.fd-stat-num.stop   { color: var(--stop); }
.fd-stat-num.err    { color: var(--stop); }

/* Alerts (health badge + active-alerts list) */
.fd-alerts { display: flex; flex-direction: column; gap: 10px; }
.fd-alert { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s; }
.fd-alert:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.fd-alert .fd-light-dot { margin-top: 5px; flex-shrink: 0; }
.fd-alert-body { flex: 1; min-width: 0; }
.fd-alert-title { color: var(--ink); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fd-alert-tag { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--ink-dim); }
.fd-alert-detail { color: var(--ink-mut); font-size: 12px; margin-top: 3px; word-break: break-word; }
.fd-alert-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); margin-top: 5px; }

/* Site picker / filter bars */
.fd-sitebar, .fd-filterbar { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.fd-sitebar label, .fd-filter label { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.fd-sitebar .fd-input { min-width: 260px; }
.fd-filter .fd-input { min-width: 170px; }

/* Prompt preview block (voice editor) */
.fd-pre { font-family: var(--mono); font-size: 11.5px; color: var(--ink-mut); background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* Ramp readout (cadence scheduler) */
.fd-ramp-readout { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(0,0,0,.15); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-top: 12px; font-size: 12px; color: var(--ink-mut); }
.fd-ramp-readout .fd-light-dot { flex-shrink: 0; }
.fd-ramp-blocked { color: #FCA5A5; font-family: var(--mono); font-size: 11px; }

/* Role badge (RBAC) */
.fd-role-badge { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; color: var(--ink-dim); margin-left: 4px; vertical-align: middle; }

/* Trend indicators (GSC rolling history) */
.fd-trend { font-family: var(--mono); font-size: 10.5px; font-weight: 500; margin-left: 6px; vertical-align: middle; padding: 2px 6px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 2px; }
.fd-trend.up { color: var(--go-lt); background: rgba(52,211,153,.1); }
.fd-trend.down { color: var(--stop-lt); background: rgba(248,113,113,.1); }
.fd-trend.flat { color: var(--ink-dim); background: rgba(255,255,255,.03); }

/* Summary KPI tiles (renamed from .fd-metric to avoid collision with channel metrics) */
.fd-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.fd-kpi { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-1); overflow: hidden; transition: border-color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.fd-kpi::before { content: ''; position: absolute; inset: 0; background: var(--grad-panel); pointer-events: none; opacity: .7; }
.fd-kpi > * { position: relative; }
.fd-kpi:hover { border-color: var(--line-2); background: var(--panel-2); }
.fd-kpi-num { font-family: var(--disp); font-size: var(--fs-stat); font-weight: 600; color: var(--ink); line-height: 1; letter-spacing: -.5px; }
.fd-kpi-num .unit { font-size: 15px; color: var(--ink-mut); margin-left: 2px; font-weight: 500; }
.fd-kpi-lbl { margin-top: 9px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); font-weight: 500; }
.fd-kpi-trend { position: absolute; top: 18px; right: 18px; font-family: var(--mono); font-size: 11px; }

/* Two-column queries / pages */
.fd-perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }

/* Data tables */
.fd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fd-table thead th { text-align: left; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.fd-table thead th.num, .fd-table td.num { text-align: right; }
.fd-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft, rgba(255,255,255,.04)); color: var(--ink); vertical-align: middle; transition: background .12s; }
.fd-table tbody tr:hover { background: var(--panel-2, rgba(255,255,255,.02)); }
.fd-table tbody tr:last-child td { border-bottom: none; }
.fd-td-term { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-td-term:hover { white-space: normal; }
.fd-link { color: var(--brand, #38BDF8); text-decoration: none; }
.fd-link:hover { text-decoration: underline; }
.fd-dim { color: var(--ink-dim); }

/* Deliveries specifics */
.fd-deltable td { vertical-align: middle; }
.fd-del-title { color: var(--ink); font-size: 12.5px; margin-bottom: 2px; }
.fd-del-err { color: var(--stop-lt); font-size: 11.5px; }

/* Generic tag pill (replaces fd-soon-tag overloading for non-"SOON" labels) */
.fd-tag { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--ink-dim); margin-left: 6px; vertical-align: middle; text-transform: uppercase; }
.fd-tag.is-info { color: var(--brand); border-color: rgba(56,189,248,.3); }
.fd-tag.is-warn { color: var(--warn); border-color: rgba(251,191,36,.3); }
.fd-tag.is-go { color: var(--go); border-color: rgba(52,211,153,.3); }
.fd-tag.is-muted { color: var(--ink-dim); }

/* Activity log: who triggered the run */
.fd-run-user { font-size: 11px; color: var(--ink-dim); }

/* Savebar: opaque background so content doesn't bleed through the sticky bar */
.fd-savebar { position: sticky; bottom: 0; background: var(--bg-2); border-top: 1px solid var(--line); padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; align-items: center; z-index: 10; }

/* Read-only / display-only inputs (distinguish from editable) */
.fd-input[readonly], .fd-input.is-readonly { background: var(--bg-2); color: var(--ink-mut); cursor: default; border-style: dashed; }

/* Card hover lifts */
.fd-channel { box-shadow: var(--shadow-1); transition: border-color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.fd-channel:hover { border-color: var(--brand); background: var(--panel-2); }
.fd-qcard { box-shadow: var(--shadow-1); transition: border-color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.fd-qcard:hover { border-color: var(--line-2); }

/* Section spacing utility (replaces inline margin-top hacks) */
.fd-sec-spaced { margin-top: 36px; }

/* ===== Dashboard GSC section ===== */

/* Per-site GSC mini-stats line — spans full width below the channel grid */
.fd-chan-gsc { grid-column: 1 / -1; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft, rgba(255,255,255,.04)); font-family: var(--mono); font-size: 11px; display: flex; align-items: center; justify-content: space-between; }
.fd-chan-gsc .fd-trend { font-size: 10px; }

/* Expand/collapse toggle button on the GSC line */
.fd-chan-toggle { background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-dim); cursor: pointer; font-size: 11px; padding: 1px 7px; line-height: 1.4; transition: color .15s, border-color .15s; }
.fd-chan-toggle:hover { color: var(--brand); border-color: var(--line-2); }
.fd-channel.expanded .fd-chan-toggle { color: var(--brand); }
.fd-channel.expanded .fd-chan-toggle::before { content: '▾'; }
.fd-chan-toggle::before { content: '▸'; }
.fd-chan-toggle { font-size: 0; }
.fd-chan-toggle::before { font-size: 11px; }

/* Expandable GSC detail panel — CSS-only accordion via max-height transition */
.fd-chan-expand { grid-column: 1 / -1; max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.fd-channel.expanded .fd-chan-expand { max-height: 600px; }
.fd-perf-compact { grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft, rgba(255,255,255,.04)); }
.fd-expand-head { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }

/* Compact table variant for the expanded panel */
.fd-table-sm { font-size: 12px; }
.fd-table-sm thead th { padding: 4px 8px; font-size: 9.5px; }
.fd-table-sm tbody td { padding: 5px 8px; }

/* Sort/filter bar */
.fd-sortbar { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.fd-sortbar-form { display: flex; gap: 8px; align-items: center; }
.fd-sortbar-form label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-dim); white-space: nowrap; }
.fd-input-sm { font-size: 12px !important; padding: 4px 10px !important; width: auto !important; }
.fd-toggle-sm { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-mut); cursor: pointer; user-select: none; }
.fd-toggle-sm input { accent-color: var(--brand); }

/* GSC chart block */
.fd-gsc-chart-block { margin-bottom: 18px; }

/* Metric toggle tabs — GSC style: pill with colored dot + label + total */
.fd-chart-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fd-chart-tab { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 7px 14px; font-size: 12.5px; color: var(--ink-dim); cursor: pointer; transition: all .2s var(--ease-out); opacity: .5; }
.fd-chart-tab:hover { border-color: var(--line-2); opacity: .8; }
.fd-chart-tab.active { opacity: 1; color: var(--ink); }
.fd-chart-tab.active .fd-chart-dot { opacity: 1; }
.fd-chart-tab em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--ink); margin-left: 2px; }
.fd-chart-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* A metric whose series is entirely zero (e.g. no clicks) isn't plotted; its tab
   is shown muted + struck-through so the absence reads as "no data", not broken. */
.fd-chart-tab.is-empty { opacity: .3; cursor: default; text-decoration: line-through; }
.fd-chart-tab.is-empty:hover { opacity: .3; border-color: var(--line); }

/* Colored dots per metric (GSC palette: blue/purple/yellow/green) */
.fd-chart-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; opacity: .4; transition: opacity .2s; }
.fd-chart-dot.c-clicks { background: #4285F4; }
.fd-chart-dot.c-impr   { background: #A142F4; }
.fd-chart-dot.c-ctr    { background: #F9AB00; }
.fd-chart-dot.c-pos    { background: #34A853; }

/* SVG chart container */
.fd-chart { position: relative; background: linear-gradient(180deg, var(--bg-2) 0%, var(--panel) 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px 8px; overflow: visible; box-shadow: inset 0 1px 0 rgba(255,255,255,.03); }
.fd-chart-svg { width: 100%; height: 200px; display: block; }

/* Y-axis value labels — HTML overlay aligned to the SVG plot box.
   top:16px matches .fd-chart's top padding; height matches .fd-chart-svg. */
.fd-chart-yaxis { position: absolute; top: 16px; left: 12px; right: 12px; height: 200px; pointer-events: none; }
.fd-yaxis-set.is-hidden { display: none; }
.fd-yaxis-lbl {
  position: absolute; left: 0; width: 6.47%; box-sizing: border-box;
  padding-right: 6px; text-align: right; transform: translateY(-50%);
  font-family: var(--mono); font-size: 9px; line-height: 1; color: var(--ink-dim);
  white-space: nowrap; letter-spacing: -.02em;
}

/* Grid lines — subtle dashed */
.fd-chart-grid { stroke: rgba(255,255,255,.05); stroke-width: 1; stroke-dasharray: 2,4; }

/* Lines — smooth curves with glow */
.fd-chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; transition: opacity .2s, stroke-width .2s; }
.fd-chart-line.c-clicks { stroke: #4285F4; filter: drop-shadow(0 1px 3px rgba(66,133,244,.3)); }
.fd-chart-line.c-impr   { stroke: #A142F4; filter: drop-shadow(0 1px 3px rgba(161,66,244,.3)); }
.fd-chart-line.c-ctr    { stroke: #F9AB00; filter: drop-shadow(0 1px 3px rgba(249,171,0,.3)); }
.fd-chart-line.c-pos    { stroke: #34A853; filter: drop-shadow(0 1px 3px rgba(52,168,83,.3)); }
.fd-chart-line.is-hidden { opacity: 0; pointer-events: none; }
.fd-chart-line.is-dimmed { opacity: .15; }

/* Area fills — gradient from SVG defs, fades to transparent at bottom */
.fd-chart-area { stroke: none; transition: opacity .2s; }
.fd-chart-area.is-hidden { opacity: 0; pointer-events: none; }

/* Data point dots — subtle, brighten on hover via parent */
.fd-chart-pt { stroke-width: 0; transition: opacity .2s, r .15s; opacity: .7; }
.fd-chart-pt.c-clicks { fill: #4285F4; }
.fd-chart-pt.c-impr   { fill: #A142F4; }
.fd-chart-pt.c-ctr    { fill: #F9AB00; }
.fd-chart-pt.c-pos    { fill: #34A853; }
.fd-chart-pt.is-hidden { opacity: 0; pointer-events: none; }

/* Invisible hover zones */
.fd-chart-hover { fill: transparent; cursor: crosshair; }

/* Chart date axis */
.fd-chart-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--ink-dim); padding: 4px 4px 0; }

/* Chart tooltip (shown on hover) */
.fd-chart-tooltip { position: absolute; pointer-events: none; background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 12px; font-family: var(--mono); font-size: 10.5px; color: var(--ink); white-space: nowrap; opacity: 0; transition: opacity .1s; z-index: 10; box-shadow: var(--shadow-2); line-height: 1.7; }
.fd-chart-tooltip.show { opacity: 1; }
.fd-chart-tooltip b { color: var(--ink); }
.fd-chart-tooltip .tc { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* Top queries chips (per-site view) */
.fd-gsc-topq { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; padding: 14px 16px; background: var(--bg-2); border-radius: var(--radius); border: 1px solid var(--line); }
.fd-gsc-topq-lbl { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); margin-right: 6px; font-weight: 500; }
.fd-gsc-qchip { font-size: 12px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 4px 12px; transition: border-color .15s, transform .15s var(--ease-out); }
.fd-gsc-qchip:hover { border-color: var(--line-2); }
.fd-gsc-qchip em { font-family: var(--mono); font-style: normal; color: var(--brand); margin-left: 6px; font-weight: 600; }

/* Budget / progress bar widget (costs page) */
.fd-budget { max-width: 720px; margin: 0 auto 16px; padding: 14px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.fd-budget-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fd-budget-label { font-size: 13px; color: var(--ink-mut); }
.fd-budget-val { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.fd-budget-val.over { color: var(--stop-lt); }
.fd-budget-bar { height: 8px; background: var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.fd-budget-fill { height: 100%; border-radius: var(--radius-pill); transition: width .4s var(--ease-out); }
.fd-budget-fill.go { background: var(--go); }
.fd-budget-fill.warn { background: var(--warn); }
.fd-budget-fill.stop { background: var(--stop); }

/* Input size variant — auto width (for selects that don't need full width) */
.fd-input-auto { width: auto !important; min-width: 0; }

/* Password reset banner (forced change after admin reset) */
.fd-pwreset { margin-bottom: 16px; }
.fd-pwreset-form { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.fd-pwreset-form .fd-f label { font-size: 11px; }

/* GSC section footer */
.fd-gsc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }


/* Inline flash (per-page error block — not the global layout flash) */
.fd-flash-inline { border-radius: var(--radius-sm); margin-bottom: 16px; }

/* Field size utilities (replaces inline max-width hacks) */
.fd-field-sm { max-width: 160px; }

/* Hint spacing utility */
.fd-hint-tight { margin: 12px 0 0; }

/* Table scroll wrapper (for wide tables on mobile) */
.fd-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
  .fd-kpis { grid-template-columns: repeat(2, 1fr); }
  .fd-perf-grid { grid-template-columns: 1fr; }
}

/* ---------- Mobile navigation (<820px) ---------- */
.fd-menu-btn { display: none; }
@media (max-width: 820px) {
  .fd-menu-btn { display: flex; align-items: center; justify-content: center; position: fixed; top: 10px; left: 10px; z-index: 110; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); cursor: pointer; font-size: 20px; }
  .fd-nav { position: fixed; top: 0; left: 0; height: 100vh; z-index: 105; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 20px rgba(0,0,0,.4); }
  .fd-shell.nav-open .fd-nav { transform: translateX(0); }
  .fd-main { padding-top: 56px; } /* room for the hamburger */
  .fd-hud { position: relative; } /* HUD not sticky on mobile so hamburger stays accessible */
  .fd-table thead th { top: 0; } /* no sticky HUD above — headers stick to the viewport edge */
}

/* ===== Dashboard recent activity feed ===== */
.fd-activity-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: stretch; }
.fd-activity-feed { display: flex; flex-direction: column; gap: 2px; min-height: 200px; }
.fd-activity-shipped { display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.fd-activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); transition: background .15s, padding-left .15s var(--ease-out); }
.fd-activity-item:hover { background: var(--panel-2, rgba(255,255,255,.02)); padding-left: 18px; }
.fd-activity-item .fd-light-dot { margin-top: 5px; flex-shrink: 0; }
.fd-activity-body { min-width: 0; flex: 1; }
.fd-activity-label { font-size: 13px; color: var(--ink); line-height: 1.35; font-weight: 500; }
.fd-activity-meta { margin-top: 3px; font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }
.fd-activity-detail { color: var(--ink-mut); }

.fd-activity-shipped { display: flex; flex-direction: column; gap: 10px; }
.fd-activity-ship-head { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.fd-activity-ship-item { padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, transform .15s var(--ease-out); }
.fd-activity-ship-item:hover { border-color: var(--line-2); transform: translateX(2px); }
.fd-activity-ship-site { font-family: var(--mono); font-size: 10.5px; color: var(--brand); letter-spacing: .02em; }
.fd-activity-ship-title { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-activity-ship-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }

@media (max-width: 820px) {
  .fd-activity-grid { grid-template-columns: 1fr; }
}

/* ===== Quality page + dashboard summary ===== */

/* Dashboard quality mini-stats */
.fd-quality-mini { display: flex; gap: 16px; }
.fd-quality-stat { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 24px; min-width: 140px; box-shadow: var(--shadow-1); transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.fd-quality-stat:hover { border-color: var(--line-2); }
.fd-quality-num { font-family: var(--disp); font-size: 28px; font-weight: 600; line-height: 1; letter-spacing: -.5px; }
.fd-quality-num.go { color: var(--go-lt); }
.fd-quality-num.warn { color: var(--warn); }
.fd-quality-num.stop { color: var(--stop-lt); }
.fd-quality-lbl { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim); font-weight: 500; }

/* Quality page: score distribution bars */
.fd-qdist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fd-qdist-row { display: grid; grid-template-columns: 60px 1fr 40px; align-items: center; gap: 12px; }
.fd-qdist-lbl { font-size: 11px; color: var(--ink-dim); }
.fd-qdist-bar { height: 22px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.fd-qdist-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.fd-qdist-fill.go { background: var(--go); opacity: .7; }
.fd-qdist-fill.warn { background: var(--warn); opacity: .7; }
.fd-qdist-fill.stop { background: var(--stop); opacity: .7; }
.fd-qdist-num { font-size: 12px; color: var(--ink); text-align: right; }

/* Quality page: failing-check bars */
.fd-qfail-list { display: flex; flex-direction: column; gap: 8px; }
.fd-qfail-row { display: grid; grid-template-columns: 140px 1fr 100px; align-items: center; gap: 12px; }
.fd-qfail-lbl { font-size: 12px; color: var(--ink); }
.fd-qfail-bar { height: 16px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.fd-qfail-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.fd-qfail-fill.warn { background: var(--warn); opacity: .6; }
.fd-qfail-fill.stop { background: var(--stop); opacity: .6; }
.fd-qfail-num { font-size: 10.5px; color: var(--ink-dim); text-align: right; }

/* Fact-check review: claim cards */
.fd-fact-group { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft, rgba(255,255,255,.04)); }
.fd-fact-claim { background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--stop); border-radius: var(--radius-sm); padding: 12px 14px; }
.fd-fact-claim-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fd-fact-status { font-size: 11px; color: var(--stop-lt, #FCA5A5); font-weight: 500; }
.fd-badge.tiny { font-size: 9px; padding: 1px 6px; margin-left: 5px; opacity: .85; }
.fd-fact-text { font-size: 13px; color: var(--ink); line-height: 1.5; margin-bottom: 8px; }
.fd-fact-source { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; }
.fd-fact-note { font-size: 11.5px; color: var(--warn); font-style: italic; line-height: 1.4; background: rgba(251,191,36,.05); border-radius: 4px; padding: 6px 8px; }
.fd-fact-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft, rgba(255,255,255,.04)); }
.fd-key-health { display: flex; align-items: center; gap: 8px; }
.fd-key-health .fd-input { flex: 1; }

/* API Keys subpage */
.fd-key-card { margin-bottom: 16px; }
.fd-key-current { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.fd-key-current .mono { font-size: 13px; color: var(--ink-mut); flex: 1; }
.fd-key-update-form { display: flex; gap: 8px; margin-top: 10px; }
.fd-key-update-form .fd-input { flex: 1; }

/* GSC-style date range tabs */
.fd-range-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.fd-range-tab { padding: 6px 14px; font-size: 11px; font-family: var(--mono); color: var(--ink-dim); text-decoration: none; border-radius: 4px; transition: all .12s; }
.fd-range-tab:hover { background: var(--panel-2); color: var(--ink); }
.fd-range-tab.active { background: var(--brand); color: #000; font-weight: 500; }

/* ===== Onboarding + Team + Secret box ===== */
.fd-secret-box { display: flex; align-items: center; gap: 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; }
.fd-secret-value { font-size: 13px; color: var(--brand); word-break: break-all; flex: 1; user-select: all; }
.fd-copy-btn { flex-shrink: 0; }

.fd-steps { padding-left: 20px; margin: 8px 0; color: var(--ink-mut); line-height: 1.8; }
.fd-steps li { margin-bottom: 4px; }

.fd-link-btn { text-decoration: none; display: inline-flex; align-items: center; }
.fd-abtn-sm { font-size: 11px; padding: 5px 12px; }
.fd-table-wrap { overflow-x: auto; }

/* ===== Content preview / article reader ===== */
.fd-article-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-dim); margin-bottom: 18px; }

.fd-article { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 26px; }
.fd-article-body { padding: 32px 40px; max-width: 760px; margin: 0 auto; color: var(--ink); line-height: 1.75; font-size: 15px; }
.fd-article-body h2 { font-size: 22px; font-weight: 600; margin: 28px 0 12px; color: var(--ink); }
.fd-article-body h3 { font-size: 18px; font-weight: 600; margin: 22px 0 10px; color: var(--ink); }
.fd-article-body h4 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; color: var(--ink); }
.fd-article-body p { margin: 0 0 16px; }
.fd-article-body ul, .fd-article-body ol { margin: 0 0 16px; padding-left: 24px; }
.fd-article-body li { margin-bottom: 6px; }
.fd-article-body a { color: var(--brand); text-decoration: underline; }
.fd-article-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 16px 0; }
.fd-article-body blockquote { border-left: 3px solid var(--line-2); padding-left: 16px; margin: 16px 0; color: var(--ink-mut); font-style: italic; }
.fd-article-body table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.fd-article-body th, .fd-article-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.fd-article-body th { background: var(--bg-2); font-weight: 600; }
.fd-article-body code { background: var(--bg-2); padding: 2px 5px; border-radius: 3px; font-family: var(--mono); font-size: 13px; }
.fd-article-body pre { background: var(--bg-2); padding: 12px 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 16px 0; }
.fd-article-body strong { font-weight: 600; }

@media (max-width: 820px) {
  .fd-article-body { padding: 20px; }
}

/* Pagination */
nav[role="navigation"] { display: flex; gap: 4px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
nav[role="navigation"] a, nav[role="navigation"] span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; font-size: 13px; font-family: var(--mono); color: var(--ink-dim); border: 1px solid var(--line); border-radius: 4px; text-decoration: none; transition: all .12s; }
nav[role="navigation"] a:hover { border-color: var(--brand); color: var(--brand); }
nav[role="navigation"] span[aria-current="page"], nav[role="navigation"] .active { background: var(--brand); color: #000; border-color: var(--brand); font-weight: 600; }
nav[role="navigation"] .disabled { opacity: .3; cursor: default; }


/* Content editor */
.fd-content-editor { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; min-height: 500px; resize: vertical; white-space: pre-wrap; word-wrap: break-word; }

/* ===== Feedback board ===== */
.fd-feedback-list { display: flex; flex-direction: column; gap: 14px; }
.fd-feedback-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; transition: border-color .15s; }
.fd-feedback-card:hover { border-color: var(--line-2); }
.fd-feedback-main { min-width: 0; }
.fd-feedback-desc { font-size: 13.5px; color: var(--ink-mut); margin: 10px 0 0; line-height: 1.55; }
.fd-feedback-notes { font-size: 12px; color: var(--go); background: rgba(52,211,153,.05); border-radius: 4px; padding: 8px 10px; margin-top: 8px; }
.fd-feedback-rejected { font-size: 12px; color: var(--stop-lt); background: rgba(252,165,165,.05); border-radius: 4px; padding: 8px 10px; margin-top: 8px; }
.fd-feedback-task { font-size: 12px; color: var(--brand); background: rgba(56,189,248,.05); border-radius: 4px; padding: 8px 10px; margin-top: 8px; }
.fd-feedback-comments { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.fd-feedback-comment { font-size: 12px; color: var(--ink-mut); padding: 4px 0; border-bottom: 1px solid var(--line-soft, rgba(255,255,255,.03)); }
.fd-feedback-comment-form { display: flex; gap: 8px; margin-top: 8px; }
.fd-feedback-comment-form .fd-input { flex: 1; }
.fd-feedback-side { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; }
.fd-feedback-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.fd-upvote-btn { background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: all .12s; color: var(--ink-dim); }
.fd-upvote-btn:hover { border-color: var(--brand); color: var(--brand); }
.fd-upvote-btn.active { border-color: var(--brand); color: var(--brand); background: rgba(56,189,248,.05); }
.fd-upvote-arrow { font-size: 14px; }
.fd-upvote-count { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.fd-feedback-filters { display: flex; gap: 4px; }






/* BQ-17a: Batch approvals */
.fd-batch-bar { margin-bottom: 12px; padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; gap: 12px; }
.fd-batch-bar form { display: flex; align-items: center; gap: 8px; }
.fd-batch-check { margin-right: 8px; padding-top: 4px; }
.fd-batch-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* ===== Content Calendar ===== */
.fd-cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.fd-cal-monthnav { display: flex; align-items: center; gap: 12px; }
.fd-cal-monthlabel { font-size: 16px; font-weight: 600; }
.fd-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fd-cal-dow { text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); padding: 8px 4px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.fd-cal-cell { min-height: 90px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; position: relative; }
.fd-cal-cell:nth-child(7n) { border-right: none; }
.fd-cal-cell.empty { background: var(--bg-2); }
.fd-cal-daynum { font-size: 13px; font-weight: 600; color: var(--ink-dim); margin-bottom: 4px; }
.fd-cal-count { margin-bottom: 4px; }
.fd-cal-items { display: flex; flex-direction: column; gap: 2px; }
.fd-cal-item { font-size: 11px; color: var(--ink-mut); cursor: pointer; padding: 5px 2px; border-radius: 3px; transition: background .1s; }
.fd-cal-item:hover { background: var(--panel-2); }
.fd-cal-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.fd-cal-dot.go { background: var(--go); }
.fd-cal-dot.warn { background: var(--warn); }
.fd-cal-item-title { vertical-align: middle; }
.fd-cal-site { font-size: 9px; color: var(--ink-dim); }
.fd-cal-item-detail { display: none; font-size: 10px; margin-top: 2px; padding-left: 10px; }
.fd-cal-item.expanded .fd-cal-item-detail { display: block; }
.fd-cal-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.fd-cal-q-item { display: flex; gap: 8px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fd-cal-q-main { flex: 1; min-width: 0; }
.fd-cal-q-title { font-size: 13px; color: var(--ink); }
.fd-cal-q-meta { font-size: 10px; color: var(--ink-dim); margin-top: 3px; }

@media (max-width: 820px) {
  .fd-cal-grid { grid-template-columns: repeat(7, minmax(40px, 1fr)); }
  .fd-cal-cell { min-height: 50px; padding: 3px; position: relative; }
  .fd-cal-daynum { font-size: 10px; }
  /* On mobile, hide item details by default but make them expandable on tap.
     The count badge (.fd-cal-count) stays visible so users know posts exist. */
  .fd-cal-items { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 6px; box-shadow: var(--shadow-2); max-height: 200px; overflow-y: auto; }
  .fd-cal-cell.expanded .fd-cal-items,
  .fd-cal-cell:active .fd-cal-items { display: block; }
  .fd-cal-count { cursor: pointer; }
}

/* ---------- Chat assistant drawer ---------- */
#fdChatToggle {
  position: fixed; bottom: 20px; right: 20px; z-index: 999;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 12px rgba(0,0,0,.3);
  transition: transform .15s;
}
#fdChatToggle:hover { }

.fd-chat-drawer {
  position: fixed; bottom: 0; right: -400px; z-index: 1000;
  width: 380px; height: 520px; max-height: 80vh;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px 0 0 0; display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
  transition: right .25s ease;
}
.fd-chat-drawer.open { right: 0; }

.fd-chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 500; color: var(--ink);
}
.fd-chat-head span { flex: 1; }
.fd-chat-clear, .fd-chat-close {
  background: none; border: none; color: var(--ink-mut);
  cursor: pointer; font-size: 14px; padding: 8px;
  min-width: 32px; min-height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.fd-chat-clear:hover, .fd-chat-close:hover { color: var(--ink); }

.fd-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.fd-chat-bubble {
  max-width: 85%; padding: 8px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.45; word-wrap: break-word;
}
.fd-chat-bubble.user {
  align-self: flex-end; background: var(--brand); color: #fff;
}
.fd-chat-bubble.bot {
  align-self: flex-start; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
}
.fd-chat-typing { color: var(--ink-mut); font-style: italic; }

.fd-chat-input-row {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.fd-chat-input { flex: 1; font-size: 13px; }
.fd-chat-send-btn { padding: 8px 16px; font-size: 13px; }

@media (max-width: 600px) {
  .fd-chat-drawer { width: 100%; right: -100%; border-radius: 0; }
}

/* ============================================================
   TOAST NOTIFICATIONS — replaces the static flash banner.
   ============================================================ */
.fd-toast-wrap {
  position: fixed; bottom: 76px; right: 20px; z-index: 9000;
  display: flex; flex-direction: column-reverse; gap: 10px;
  max-width: 380px; pointer-events: none;
}
.fd-toast {
  pointer-events: auto;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 14px 16px; font-size: 13.5px;
  color: var(--ink); display: flex; align-items: flex-start; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  cursor: pointer; position: relative; overflow: hidden;
  animation: fd-toast-in .3s ease-out;
}
.fd-toast.ok  { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.08); }
.fd-toast.err { border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.fd-toast.ok  .fd-toast-icon { color: var(--go-lt); }
.fd-toast.err .fd-toast-icon { color: var(--stop-lt); }
.fd-toast-icon { font-size: 16px; flex-shrink: 0; line-height: 1.3; }
.fd-toast-body { flex: 1; line-height: 1.4; }
.fd-toast-bar {
  position: absolute; bottom: 0; left: 0; height: 2px;
  background: var(--brand); opacity: .5;
  animation: fd-toast-bar 5s linear forwards;
}
.fd-toast.ok  .fd-toast-bar { background: var(--go); }
.fd-toast.err .fd-toast-bar { background: var(--stop); }
.fd-toast.removing { animation: fd-toast-out .25s ease-in forwards; }
@keyframes fd-toast-in {
  from { transform: translateX(400px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fd-toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(400px); opacity: 0; }
}
@keyframes fd-toast-bar {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ============================================================
   BUTTON LOADING STATES — spinner + disabled on form submit.
   ============================================================ */
.fd-abtn.is-loading, button.is-loading {
  opacity: .65 !important;
  pointer-events: none !important;
  position: relative;
}
.fd-abtn.is-loading::before, button.is-loading::before {
  content: '';
  display: inline-block;
  width: 13px; height: 13px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: fd-spin .6s linear infinite;
}
@keyframes fd-spin { to { transform: rotate(360deg); } }

/* ============================================================
   PAGE TRANSITIONS — subtle fade+slide on .fd-main.
   ============================================================ */
.fd-main {
  animation: fd-page-in .28s ease-out;
}
.fd-main.is-leaving {
  animation: fd-page-out .14s ease-in forwards;
}
@keyframes fd-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fd-page-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-4px); }
}

/* Status badge smooth transition for /run live updates */
.fd-badge { transition: background .2s, color .2s, border-color .2s; }

@media (prefers-reduced-motion: reduce) {
  .fd-toast { animation: none !important; }
  .fd-toast-bar { animation: none !important; }
  .fd-main { animation: none !important; }
  .fd-abtn.is-loading::before, button.is-loading::before { animation: none !important; }
}

/* ============================================================
   AVATAR — initials circle with deterministic color.
   ============================================================ */
.fd-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  font-family: var(--disp); font-size: 13px; font-weight: 600;
  color: #fff; flex-shrink: 0; text-transform: uppercase;
  letter-spacing: -.02em;
}
.fd-avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.fd-avatar.lg { width: 40px; height: 40px; font-size: 15px; }

/* ============================================================
   STATUS PILL — tinted background + colored text (single source of truth).
   ============================================================ */
.fd-badge { font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-mut); white-space: nowrap; }
.fd-badge.go   { color: var(--go-lt);   border-color: rgba(52,211,153,.25);  background: rgba(52,211,153,.08); }
.fd-badge.warn { color: var(--warn);    border-color: rgba(251,191,36,.25);  background: rgba(251,191,36,.08); }
.fd-badge.stop { color: var(--stop-lt); border-color: rgba(248,113,113,.25); background: rgba(248,113,113,.08); }
.fd-badge.ghost { color: var(--ink-dim); border-color: var(--line); background: transparent; }
.fd-badge.accent { color: var(--brand-hi); border-color: rgba(56,189,248,.25); background: rgba(56,189,248,.08); }

/* Leading dot for dot-style badges */
.fd-badge-dot::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: var(--radius-pill); background: currentColor; flex-shrink: 0;
}

/* ============================================================
   TABLE POLISH — zebra striping + sticky headers + better hover.
   ============================================================ */
.fd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fd-table thead th {
  position: sticky; top: var(--hud-h, 0); z-index: 5;
  background: var(--bg-2);
  backdrop-filter: blur(4px);
}
.fd-table tbody tr:nth-child(even) { background: rgba(255,255,255,.015); }
.fd-table tbody tr:hover { background: var(--panel-2); }

/* ============================================================
   FOCUS VISIBLE — keyboard accessibility for all interactive elements.
   ============================================================ */
.fd-input:focus-visible,
.fd-channel:focus-visible,
.fd-qcard:focus-visible,
.fd-toast:focus-visible,
.fd-avatar:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ============================================================
   FEEDBACK CARD — elevated hover + shadow.
   ============================================================ */
.fd-feedback-card {
  box-shadow: var(--shadow-1);
  transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.fd-feedback-card:hover {
  border-color: var(--line-2);
}

/* ============================================================
   FORMCARD — subtle elevation for settings panels.
   ============================================================ */
.fd-formcard {
  box-shadow: var(--shadow-1);
}

/* ============================================================
   EMPTY STATES — illustrated with icon + headline + CTA.
   ============================================================ */
.fd-q-empty {
  text-align: center;
  padding: 40px 24px !important;
}
.fd-empty-icon { font-size: 40px; opacity: .35; margin-bottom: 14px; filter: grayscale(.5); }
.fd-empty-head { font-family: var(--disp); font-size: var(--fs-h2); font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.fd-empty-body { font-size: var(--fs-body); color: var(--ink-mut); line-height: 1.55; max-width: 440px; margin: 0 auto; }
.fd-empty-cta { margin-top: 18px; }

/* ============================================================
   GRADIENT TEXT — subtle richness on hero KPI numbers.
   ============================================================ */
.fd-grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ============================================================
   CARD STAGGER ENTRANCE — lists feel alive on page load.
   ============================================================ */
@keyframes fd-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fd-kpis > .fd-kpi,
.fd-channels > .fd-channel,
.fd-qlist > .fd-qcard,
.fd-feedback-list > .fd-feedback-card {
  animation: fd-card-in .35s var(--ease-out) backwards;
}
.fd-kpis > .fd-kpi:nth-child(1) { animation-delay: .02s; }
.fd-kpis > .fd-kpi:nth-child(2) { animation-delay: .06s; }
.fd-kpis > .fd-kpi:nth-child(3) { animation-delay: .10s; }
.fd-kpis > .fd-kpi:nth-child(4) { animation-delay: .14s; }
.fd-kpis > .fd-kpi:nth-child(5) { animation-delay: .18s; }
.fd-kpis > .fd-kpi:nth-child(6) { animation-delay: .22s; }
.fd-channels > .fd-channel:nth-child(1) { animation-delay: .03s; }
.fd-channels > .fd-channel:nth-child(2) { animation-delay: .08s; }
.fd-channels > .fd-channel:nth-child(3) { animation-delay: .13s; }
.fd-channels > .fd-channel:nth-child(4) { animation-delay: .18s; }
.fd-channels > .fd-channel:nth-child(5) { animation-delay: .23s; }
.fd-channels > .fd-channel:nth-child(6) { animation-delay: .28s; }
.fd-qlist > .fd-qcard:nth-child(1) { animation-delay: .04s; }
.fd-qlist > .fd-qcard:nth-child(2) { animation-delay: .09s; }
.fd-qlist > .fd-qcard:nth-child(3) { animation-delay: .14s; }
.fd-qlist > .fd-qcard:nth-child(4) { animation-delay: .19s; }
.fd-qlist > .fd-qcard:nth-child(5) { animation-delay: .24s; }
.fd-feedback-list > .fd-feedback-card:nth-child(1) { animation-delay: .04s; }
.fd-feedback-list > .fd-feedback-card:nth-child(2) { animation-delay: .09s; }
.fd-feedback-list > .fd-feedback-card:nth-child(3) { animation-delay: .14s; }
.fd-feedback-list > .fd-feedback-card:nth-child(4) { animation-delay: .19s; }

/* ============================================================
   CHART UPGRADES — gradient area fills + line draw-in.
   ============================================================ */
@keyframes fd-chart-draw {
  0%   { stroke-dashoffset: 2400; opacity: 0; }
  10%  { opacity: 1; }
  100% { stroke-dashoffset: 0; }
}
.fd-chart-line {
  stroke-dasharray: 2400;
  animation: fd-chart-draw 1.4s var(--ease-out) forwards;
}
/* After animation completes, clear dasharray so curves render cleanly */
.fd-chart-line.animation-done { stroke-dasharray: none; animation: none; }

/* Fade area fills in after lines draw */
@keyframes fd-chart-area-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fd-chart-area {
  opacity: 0;
  animation: fd-chart-area-fade .8s .6s var(--ease-out) forwards;
}

/* ============================================================
   GLOBAL TOOLTIP — data-tip attribute driven.
   ============================================================ */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%) scale(.9);
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line-2);
  padding: 4px 10px; border-radius: var(--radius-xs);
  font-size: 11.5px; font-family: var(--mono); white-space: nowrap;
  opacity: 0; pointer-events: none; z-index: 8000;
  transition: opacity .15s, transform .15s;
  box-shadow: var(--shadow-2);
}
[data-tip]:hover::after {
  opacity: 1; transform: translateX(-50%) scale(1);
}

/* ============================================================
   MOBILE NAV SCRIM — click-away to close drawer.
   ============================================================ */
.fd-nav-scrim {
  display: none; position: fixed; inset: 0;
  /* Above the sticky HUD (z-index 100) but BELOW the drawer (.fd-nav: 105)
     and hamburger (.fd-menu-btn: 110) — at 998 the scrim covered the drawer
     itself, blocking nav taps. Chat (999/1000) stays above. */
  z-index: 104;
  background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .2s;
}
/* The scrim is a SIBLING before .fd-shell in the DOM, so we key off body.nav-open
   (toggled alongside .fd-shell.nav-open by the menu button + dashboard.js). */
body.nav-open .fd-nav-scrim {
  display: block; opacity: 1;
}
@media (min-width: 821px) { .fd-nav-scrim { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  .fd-kpis > *, .fd-channels > *, .fd-qlist > *, .fd-feedback-list > * { animation: none !important; }
  .fd-chart-line { animation: none !important; stroke-dasharray: none !important; }
}

/* ============================================================
   COMMAND PALETTE (Cmd+K) — fuzzy search overlay.
   ============================================================ */
.fd-cmdk-scrim {
  display: none; position: fixed; inset: 0; z-index: 9500;
  background: rgba(6,11,18,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.fd-cmdk-scrim.open { display: flex; animation: fd-fade-in .15s ease-out; }
.fd-cmdk {
  width: 100%; max-width: 560px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: fd-cmdk-in .2s var(--ease-out);
}
@keyframes fd-cmdk-in {
  from { transform: translateY(-12px) scale(.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes fd-fade-in { from { opacity: 0; } to { opacity: 1; } }
.fd-cmdk-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.fd-cmdk-icon { color: var(--ink-dim); flex-shrink: 0; }
.fd-cmdk-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 16px; font-family: var(--body);
}
.fd-cmdk-input::placeholder { color: var(--ink-dim); }
.fd-cmdk-kbd {
  font-family: var(--mono); font-size: 10px; color: var(--ink-dim);
  border: 1px solid var(--line-2); border-radius: var(--radius-xs);
  padding: 2px 6px; white-space: nowrap;
}
.fd-cmdk-list { max-height: 400px; overflow-y: auto; padding: 8px; }
.fd-cmdk-group {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-dim);
  padding: 10px 12px 6px;
}
.fd-cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--ink-mut); font-size: 14px;
  transition: background .1s, color .1s;
}
.fd-cmdk-item:hover, .fd-cmdk-item.selected {
  background: var(--panel-2); color: var(--ink);
}
.fd-cmdk-item.selected { box-shadow: inset 2px 0 0 var(--brand); }
.fd-cmdk-item-icon { color: var(--ink-dim); flex-shrink: 0; transition: color .1s; }
.fd-cmdk-item.selected .fd-cmdk-item-icon { color: var(--brand); }
.fd-cmdk-empty {
  padding: 32px 20px; text-align: center; color: var(--ink-dim); font-size: 13px;
}
.fd-cmdk-foot {
  display: flex; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-dim);
}
.fd-cmdk-foot span { display: flex; align-items: center; gap: 4px; }
.fd-cmdk-foot kbd {
  font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px;
}

/* Cmd+K trigger button in the sidebar */
.fd-cmdk-trigger {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 12px 12px; padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink-dim);
  font-size: 12.5px; cursor: pointer; width: calc(100% - 24px);
  transition: border-color .15s, color .15s, background .15s;
}
.fd-cmdk-trigger:hover { border-color: var(--line-2); color: var(--ink-mut); background: var(--panel); }
.fd-cmdk-trigger span { flex: 1; text-align: left; }
.fd-cmdk-trigger kbd {
  font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px;
}

/* ============================================================
   RESPONSIVE & TOUCH — mobile collapses, iOS fixes, touch a11y.
   ============================================================ */

/* Hide keyboard-shortcut hints on touch devices */
@media (pointer: coarse) {
  .fd-cmdk-foot { display: none; }
  .fd-cmdk-trigger kbd { display: none; }
}

/* Prevent iOS auto-zoom: inputs must be ≥16px on mobile */
@media (max-width: 820px) {
  .fd-input, select.fd-input, textarea.fd-input { font-size: 16px; }
}

/* Form grids collapse to single column on mobile */
@media (max-width: 820px) {
  .fd-grid2, .fd-grid3 { grid-template-columns: 1fr; }
  .fd-grid2 .fd-f, .fd-grid3 .fd-f { margin-bottom: 12px; }
}

/* Feedback/recommendation card: action column wraps below on mobile */
@media (max-width: 820px) {
  .fd-feedback-card { grid-template-columns: 1fr; gap: 14px; }
  .fd-feedback-side { display: flex; justify-content: flex-start; }
  .fd-feedback-actions { flex-direction: row; justify-content: flex-start; flex-wrap: wrap; }
}

/* Modal metadata grid collapses on mobile */
@media (max-width: 600px) {
  .fd-modal-grid { grid-template-columns: 1fr; }
  .fd-modal-head, .fd-modal-body, .fd-modal-foot { padding-left: 16px; padding-right: 16px; }
}

/* Quality mini stats wrap on narrow screens */
@media (max-width: 600px) {
  .fd-quality-mini { flex-wrap: wrap; }
  .fd-quality-stat { min-width: calc(50% - 8px); flex: 1; }
}

/* Decorative hover lifts only on devices that truly hover (avoid sticky-hover on touch) */
@media (hover: hover) {
  .fd-channel:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), var(--shadow-glow); }
  .fd-qcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
  .fd-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
  .fd-feedback-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
  .fd-quality-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
  .fd-gsc-qchip:hover { transform: translateY(-1px); }
  #fdChatToggle:hover { transform: scale(1.08); }
}
/* On touch devices, neutralize the transforms so taps don't leave stuck lifts */
@media (hover: none) {
  .fd-channel:hover, .fd-qcard:hover, .fd-kpi:hover, .fd-feedback-card:hover,
  .fd-quality-stat:hover, .fd-gsc-qchip:hover, #fdChatToggle:hover { transform: none; }
}

/* Very narrow phones (360–414px) — shrink stat sizes, reduce padding */
@media (max-width: 480px) {
  .fd-content { padding: 16px; }
  .fd-greet { padding: 20px 16px 4px; }
  .fd-greet-text { font-size: 17px; }
  .fd-hud-title { min-width: 0; padding: 14px 16px; }
  .fd-hud-title h1 { font-size: 20px; }
  .fd-stat { padding: 10px 14px; }
  .fd-stat-num { font-size: 22px; }
  .fd-stat-lbl { font-size: 9px; }
  .fd-quality-stat { min-width: calc(100% - 0px); flex: 1 1 100%; }
  .fd-feedback-card { padding: 16px; }
  .fd-kpi { padding: 16px; }
  .fd-kpi-num { font-size: 22px; }
  .fd-sec-head h2 { font-size: 15px; }
  .fd-modal-head, .fd-modal-body, .fd-modal-foot { padding-left: 14px; padding-right: 14px; }
  .fd-budget { margin: 0 0 12px; padding: 12px 14px; }
}

/* ============================================================
   SKIP LINK — visually hidden, visible on focus (keyboard a11y).
   ============================================================ */
.fd-skip-link {
  position: absolute; top: -100px; left: 16px; z-index: 99999;
  background: var(--brand); color: var(--fg-brand);
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: top .15s var(--ease-out);
}
.fd-skip-link:focus { top: 12px; }

/* ============================================================
   PRINT STYLES — usable hardcopy for reports and audit logs.
   ============================================================ */
@media print {
  .fd-nav, .fd-hud, .fd-menu-btn, #fdChatToggle, .fd-toast-wrap,
  .fd-cmdk-scrim, .fd-nav-scrim, .fd-cmdk-trigger { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .fd-shell { display: block; }
  .fd-main { padding: 0; }
  .fd-panel, .fd-formcard, .fd-channel, .fd-feedback-card {
    background: #fff !important; border: 1px solid #ccc !important;
    box-shadow: none !important; page-break-inside: avoid;
  }
  .fd-table thead th { background: #eee !important; }
  .fd-chart-svg { height: 120px; }
}

/* ═══ UI polish 2026-07-17 (overflow, toast, run page, chart) ═══ */

/* Screen-reader-only utility (for chart data table + labels) */
.fd-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Long unbroken strings (review URLs, API errors, titles) must not overflow cards */
.fd-feedback-desc, .fd-feedback-notes, .fd-feedback-rejected, .fd-feedback-task,
.fd-feedback-comment, .fd-qtitle, .fd-alert-title, .fd-run-output { overflow-wrap: anywhere; }
/* A tracked-query chip should wrap rather than shove its row past the container */
.fd-qbadges .fd-badge.ghost, .fd-badge.fd-badge-wrap { white-space: normal; }

/* Flash toast: clamp a very long message (e.g. a dumped artisan error) */
.fd-toast-body { max-height: 40vh; overflow-y: auto; overflow-wrap: anywhere; }

/* Run page — one shared site selector + grouped actions */
.fd-run-site { max-width: 340px; margin-bottom: 6px; }
.fd-run-site label { display: block; font-size: 11.5px; color: var(--ink-mut); margin-bottom: 5px; }
.fd-run-group { border-top: 1px solid var(--line-soft, rgba(255,255,255,.05)); margin-top: 14px; padding-top: 12px; }
.fd-run-group:first-of-type { border-top: none; margin-top: 6px; padding-top: 0; }
.fd-run-group-h { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 10px; }

/* GSC chart — tokenize the four series colors (single source of truth) */
:root { --chart-clicks: #4285F4; --chart-impr: #A142F4; --chart-ctr: #F9AB00; --chart-pos: #34A853; }
.fd-chart-dot.c-clicks { background: var(--chart-clicks); }
.fd-chart-dot.c-impr   { background: var(--chart-impr); }
.fd-chart-dot.c-ctr    { background: var(--chart-ctr); }
.fd-chart-dot.c-pos    { background: var(--chart-pos); }
.fd-chart-line.c-clicks { stroke: var(--chart-clicks); }
.fd-chart-line.c-impr   { stroke: var(--chart-impr); }
.fd-chart-line.c-ctr    { stroke: var(--chart-ctr); }
.fd-chart-line.c-pos    { stroke: var(--chart-pos); }
.fd-chart-pt.c-clicks { fill: var(--chart-clicks); }
.fd-chart-pt.c-impr   { fill: var(--chart-impr); }
.fd-chart-pt.c-ctr    { fill: var(--chart-ctr); }
.fd-chart-pt.c-pos    { fill: var(--chart-pos); }
/* Always-on data dots ovalize under the chart's non-uniform scale and clutter
   dense ranges — hide them, reveal softly on hover for point inspection. */
.fd-chart-pt { opacity: 0; transition: opacity .15s var(--ease-out); }
/* :not(.is-hidden) — otherwise this rule out-specifies .fd-chart-pt.is-hidden
   and hidden (inactive-metric) dots reappear on hover. */
.fd-chart:hover .fd-chart-pt:not(.is-hidden) { opacity: .55; }

@media (max-width: 820px) {
  .fd-run-row { flex-wrap: wrap; align-items: stretch; }
  .fd-run-row .fd-run-opt, .fd-run-row .fd-abtn { width: 100%; }
  .fd-run-site { max-width: none; }
}
