/* Vibra board. Warm grey, one green accent, dark by default and light where the browser
   asks for it; layout and interactions follow Jira's board and issue view so operators keep
   their muscle memory. Every colour is a token on :root, redefined once for light. */

:root {
  color-scheme: dark;

  /* Surfaces: the column is recessed below the page and the card lifted above it, so a
     card reads as sitting in its column (Jira's board model). */
  --bg: #2C292A;
  --bg-top: #211E1F;
  --bg-column: #242122;
  --bg-secondary: #353233;
  --panel-solid: #353233;
  --card: #3A3637;
  --card-hover: #403B3C;
  --scrim: rgba(20, 18, 19, 0.66);

  /* Text. Solid values so contrast is measurable: --muted is >= 4.8:1 on every surface
     above, including a hovered card and a field's inset ground. */
  --ink: #F3F1F0;
  --ink-secondary: #D3CECC;
  --muted: #B2ACAA;

  /* Semantic hues: the saturated value fills and edges, the -ink value carries text. */
  --accent: #22B34A;
  --accent-bright: #51cd85;
  --accent-ink: #79d99f;
  /* The ink on an --accent fill, 6.8:1 on it. */
  --on-accent: #141213;
  /* The running step of a leg's plan, distinct from the done ones before it. */
  --accent-current: var(--accent-bright);
  --warning: #F97316;
  --warning-ink: #fb923c;
  --error: #dc2626;
  --error-ink: #fc8e8e;

  /* Tints mix into --bg so each -ink text lands on the same contrast on any surface. */
  --tint-accent: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --tint-accent-hover: color-mix(in srgb, var(--accent) 20%, var(--bg));
  --tint-warning: color-mix(in srgb, var(--warning) 12%, var(--bg));
  --tint-error: color-mix(in srgb, var(--error) 12%, var(--bg));
  --tint-error-hover: color-mix(in srgb, var(--error) 20%, var(--bg));
  --edge-accent: color-mix(in srgb, var(--accent) 40%, transparent);
  --edge-warning: color-mix(in srgb, var(--warning) 40%, transparent);
  --edge-error: color-mix(in srgb, var(--error) 45%, transparent);

  --border: rgba(255,255,255,0.14);
  --divider: rgba(255,255,255,0.09);
  --border-focus: rgba(34, 179, 74, 0.6);

  /* A stalled run's bar: 3:1 against its surface, so grey never reads as a dim green. */
  --run-stalled: color-mix(in srgb, var(--ink) 62%, var(--bg));
  /* The meter's passed ticks, held to 3:1 against the card. */
  --meter-ink: rgba(255,255,255,0.40);

  --wash-1: rgba(255,255,255,0.03);
  --wash-2: rgba(255,255,255,0.05);
  --fill-inset: rgba(255,255,255,0.05);
  --wash-hover: rgba(255,255,255,0.07);
  --scrollbar-thumb: rgba(255,255,255,0.2);
  --nav-active: #E5E7E1;
  /* The mark is light letters on transparent; light mode turns them dark. */
  --logo-filter: none;
  /* The native date picker's glyph is dark; dark mode turns it light. */
  --picker-filter: invert(1);
  /* What an avatar's and a type chip's text mixes toward, and by how much of its hue. */
  --chip-ink-base: #fff;
  --chip-ink-pct: 55%;
  --avatar-ink-pct: 45%;

  --shadow-card: 0 1px 1px rgba(0,0,0,0.25), 0 0 1px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow: 0 12px 40px rgba(0,0,0,0.45);

  --gradient-primary: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
  --sweep: rgba(255,255,255,0.45);

  --space-2: 2px;  --space-4: 4px;  --space-6: 6px;  --space-8: 8px;
  --space-10: 10px; --space-12: 12px; --space-16: 16px; --space-20: 20px;
  --space-24: 24px; --space-32: 32px; --space-48: 48px;

  /* What you operate is a pill, what holds content is a rectangle. */
  --radius-modal: 12px;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-button: 999px;
  --radius-mark: 4px;
  --radius-pill: 999px;

  /* Type: five steps, two weights, nothing under 12px. */
  --fs-display: 32px;   /* the login wordmark */
  --fs-title: 20px;     /* the ticket's summary, a modal's title */
  --fs-heading: 16px;   /* section headings, the board title */
  --fs-body: 14px;      /* prose, fields, controls, card summary */
  --fs-small: 12px;     /* keys, meta, pills, column counts */

  /* Contained, so a wide screen grows the margin rather than the columns. */
  --board-max: 1600px;
  --col-min-h: 180px;
  --col-inset: var(--space-8);

  /* ONE CARD HEIGHT on every board and in every column: summary, stage, one label line and
     the foot, reserved whether or not a card fills them. */
  --card-row-h: 24px;
  --card-id-line: 18px;          /* the campaign id's one line on a card; its title has it whole */
  --card-id-h: var(--card-id-line);
  --card-stage-h: 30px;
  --card-label-h: 20px;
  --card-labels-h: var(--card-label-h);

  --topbar-h: 56px;
  --ctl-h: 32px;

  --listbox-row-h: 30px;
  --listbox-rows: 16;

  --z-header: 300; --z-overlays: 400; --z-popover: 450; --z-toasts: 500; --z-splash: 600;

  /* Windows-native first: ClearType-hinted on the operators' desktops, no download. */
  --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto,
             "Helvetica Neue", Arial, sans-serif;
  /* Only for what people paste: campaign ids, paths, folder names, URLs, raw JSON. */
  --font-mono: "Cascadia Mono", Consolas, "JetBrains Mono", monospace;
}

/* The light palette: same hue per meaning, text and meaningful marks held to 4.5:1 and 3:1
   on every surface. Only tokens are redefined here; a rule never branches on the scheme. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #F5F3F2;
    --bg-top: #FFFFFF;
    --bg-column: #E9E6E4;
    --bg-secondary: #FFFFFF;
    --panel-solid: #FFFFFF;
    --card: #FFFFFF;
    --card-hover: #F8F6F5;
    --scrim: rgba(30, 27, 28, 0.45);

    --ink: #1E1B1C;
    --ink-secondary: #433D3C;
    --muted: #675F5D;

    --accent: #15803D;
    --accent-bright: #116B30;
    --accent-current: #3DBE6A;
    --accent-ink: #14632F;
    --on-accent: #FFFFFF;
    --warning: #D4560B;
    --warning-ink: #A8420A;
    --error: #C62828;
    --error-ink: #9E1A1A;

    --border: rgba(30,27,28,0.20);
    --divider: rgba(30,27,28,0.12);
    --border-focus: rgba(21, 128, 61, 0.7);

    --meter-ink: rgba(30,27,28,0.55);

    --wash-1: rgba(30,27,28,0.035);
    --wash-2: rgba(30,27,28,0.05);
    --fill-inset: rgba(30,27,28,0.045);
    --wash-hover: rgba(30,27,28,0.07);
    --scrollbar-thumb: rgba(30,27,28,0.3);
    --nav-active: #2A2627;
    --logo-filter: invert(1) hue-rotate(180deg);
    --picker-filter: none;
    --chip-ink-base: #000;
    --chip-ink-pct: 45%;
    --avatar-ink-pct: 45%;
    --sweep: rgba(255,255,255,0.55);

    /* A white card on the column is 1.2:1, so the hairline ring is what draws it. */
    --shadow-card: 0 1px 2px rgba(40,30,30,0.14), 0 0 0 1px rgba(40,30,30,0.12);
    --shadow-md: 0 4px 12px rgba(40,30,30,0.16);
    --shadow: 0 12px 40px rgba(40,30,30,0.24);
  }
}

* { box-sizing: border-box; }

/* author display rules must never resurrect [hidden] elements */
[hidden] { display: none !important; }

html { scrollbar-gutter: stable both-edges; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  -webkit-font-smoothing: auto;
}

/* The pasteable face. Doubled so a component's `font` shorthand cannot win on order. */
.mono.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}
.num { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* ---------------------------------------------------------------- splash + login */

.splash {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: var(--z-splash);
  transition: opacity .35s ease, visibility .35s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash-card {
  width: min(360px, calc(100vw - 2 * var(--space-16)));
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-modal);
  padding: var(--space-32);
  text-align: center;
  box-shadow: var(--shadow);
}
.splash-logo { height: 40px; display: block; margin: 0 auto var(--space-12); filter: var(--logo-filter); }
.splash-title {
  margin: 0;
  font: 600 var(--fs-display)/1.1 var(--font-ui);
  letter-spacing: 4px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.splash-sub {
  margin-top: var(--space-6);
  font: 400 var(--fs-small)/1.4 var(--font-ui);
  color: var(--muted);
}

.login-view { z-index: calc(var(--z-splash) - 10); }
.login-form {
  display: flex; flex-direction: column; gap: var(--space-12);
  margin-top: var(--space-24);
  text-align: left;
}
.login-field { display: flex; flex-direction: column; gap: var(--space-4); }
.login-submit { margin-top: var(--space-4); width: 100%; }
.login-note {
  margin: var(--space-16) 0 0;
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--warning-ink);
}
.login-error {
  margin: 0;
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--error-ink);
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0;
  z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--space-12);
  height: var(--topbar-h);
  padding: 0 var(--space-16);
  /* the page's own ground: the both-edges scrollbar gutter shows it beside the bar */
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}
.brand { display: flex; align-items: center; gap: var(--space-8); flex: none; }
.logo { height: 26px; display: block; filter: var(--logo-filter); }
.app-title { font: 600 var(--fs-heading)/1 var(--font-ui); color: var(--ink); }

/* The board switcher: Jira's project picker, flattened to its three peers. */
.topnav {
  display: flex; align-items: center; gap: var(--space-4);
  margin-left: var(--space-8);
  min-width: 0;
}
.navbtn {
  display: inline-flex; align-items: center; gap: var(--space-6);
  flex: none; height: var(--ctl-h);
  padding: 0 var(--space-12);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  color: var(--ink-secondary);
  font: 600 var(--fs-body)/1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.navbtn:hover { background: var(--wash-hover); color: var(--ink); }
.navbtn.active { background: var(--nav-active); color: var(--bg); }
.navbtn.active:hover { background: var(--nav-active); }
.topbar-spacer { flex: 1; min-width: var(--space-8); }
.topbar-actions { display: flex; align-items: center; gap: var(--space-4); flex: none; }

.session { display: flex; align-items: center; flex: none; position: relative; margin-left: var(--space-4); }
.session-name {
  font: 400 var(--fs-body)/1.3 var(--font-ui); color: var(--ink);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.identity-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--ctl-h); height: var(--ctl-h); padding: 0;
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius-button);
}
.identity-trigger:hover { background: var(--wash-hover); }
.identity-menu {
  position: absolute; top: calc(100% + var(--space-8)); right: 0;
  z-index: var(--z-popover);
  min-width: 240px;
  display: flex; flex-direction: column; gap: var(--space-12);
  padding: var(--space-12);
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
}
.identity-menu-who { display: flex; align-items: center; gap: var(--space-10); min-width: 0; }
.identity-menu-text { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); min-width: 0; }
.identity-menu-item {
  display: flex; align-items: center;
  height: var(--ctl-h); padding: 0 var(--space-10);
  font: 600 var(--fs-body)/1 var(--font-ui); color: var(--ink-secondary);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-control);
  cursor: pointer;
}
.identity-menu-item:hover { background: var(--wash-hover); color: var(--ink); }

/* ---------------------------------------------------------------- board header + filters */

.board-head {
  position: relative; z-index: 1;
  width: min(calc(100% - 2 * var(--space-24)), var(--board-max));
  margin: var(--space-20) auto 0;
  display: flex; flex-direction: column; gap: var(--space-12);
}
.board-title { margin: 0; font: 600 var(--fs-title)/1.2 var(--font-ui); color: var(--ink); }
.board-filters { display: flex; align-items: center; gap: var(--space-12); flex-wrap: wrap; }
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap svg { position: absolute; left: var(--space-10); color: var(--muted); pointer-events: none; }
.search {
  height: var(--ctl-h);
  width: 220px;
  padding: 0 var(--space-12) 0 var(--space-32);
  font: 400 var(--fs-body)/1 var(--font-ui);
  color: var(--ink);
  background: var(--fill-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
}
.search::placeholder { color: var(--muted); }
.search:focus { border-color: var(--border-focus); }

/* The assignee row: overlapping avatars, each a toggle, as on a Jira board. */
.avatar-filter { display: flex; align-items: center; padding-left: var(--space-6); }
.avatar-toggle {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  margin-left: -6px;
  background: var(--bg); border: 2px solid var(--bg); border-radius: 50%;
  cursor: pointer;
}
.avatar-toggle .avatar { width: 28px; height: 28px; }
.avatar-toggle[aria-pressed="true"] { border-color: var(--accent-bright); z-index: 1; }
.avatar-toggle:hover { z-index: 2; }
.avatar-more {
  margin-left: var(--space-6);
  font: 400 var(--fs-small)/1 var(--font-ui); color: var(--muted);
}
.filter-toggle {
  display: inline-flex; align-items: center;
  height: var(--ctl-h); padding: 0 var(--space-12);
  font: 400 var(--fs-body)/1 var(--font-ui);
  color: var(--ink-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  cursor: pointer;
}
.filter-toggle:hover { background: var(--wash-hover); color: var(--ink); }
.filter-toggle[aria-pressed="true"] {
  background: var(--tint-accent); color: var(--accent-ink); border-color: var(--edge-accent);
}
.filter-clear { color: var(--muted); }

/* ---------------------------------------------------------------- issue list */

.board-head-top { display: flex; align-items: center; gap: var(--space-24); flex-wrap: wrap; }
.view-switch { display: flex; gap: var(--space-4); }
.issue-filters .select-wrap { flex: none; width: 170px; }

/* The whole board as rows: the board's own faces, a plain table, sorted by its headers. */
.issues {
  position: relative; z-index: 1;
  width: min(calc(100% - 2 * var(--space-24)), var(--board-max));
  margin: var(--space-16) auto var(--space-48);
  background: var(--bg-column); border-radius: var(--radius-card);
  padding: var(--space-8) var(--space-12) var(--space-12);
}
.issue-scroll { overflow-x: auto; }
.issue-table {
  width: 100%; border-collapse: collapse; font: 400 var(--fs-body)/1.35 var(--font-ui);
  color: var(--ink);
}
.issue-table th, .issue-table td {
  padding: var(--space-8) var(--space-10); text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--divider);
}
.issue-table thead th { padding: 0; white-space: nowrap; }
.issue-sort {
  display: flex; align-items: center; gap: var(--space-6); width: 100%;
  height: 34px; padding: 0 var(--space-10);
  font: 600 var(--fs-small)/1 var(--font-ui); color: var(--muted);
  background: none; border: none; cursor: pointer; text-align: left;
}
.issue-sort:hover { color: var(--ink); background: var(--wash-1); }
.issue-table th[aria-sort] .issue-sort { color: var(--ink); }
.issue-arrow { width: 8px; color: var(--accent-ink); }
.issue-row { cursor: pointer; }
.issue-row:hover, .issue-row:focus-visible { background: var(--card-hover); }
.issue-row td { font-size: var(--fs-body); }
.issue-row .issue-id { overflow-wrap: anywhere; }
.issue-row .issue-key { white-space: nowrap; font-weight: 600; }
.issue-row .issue-assignee { display: flex; align-items: center; gap: var(--space-6); }
.issue-row .overdue { color: var(--error-ink); }
.issue-row .issue-when { white-space: nowrap; color: var(--ink-secondary); }
.issue-row .issue-none { color: var(--muted); }
.issue-empty { margin: var(--space-24) 0; text-align: center; color: var(--muted); }
.issue-pager {
  display: flex; align-items: center; gap: var(--space-12);
  padding-top: var(--space-12); font: 400 var(--fs-small)/1 var(--font-ui); color: var(--ink-secondary);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-6);
  height: var(--ctl-h);
  padding: 0 var(--space-16);
  font: 600 var(--fs-body)/1 var(--font-ui);
  border: none; cursor: pointer;
  border-radius: var(--radius-button);
  transition: background .12s ease;
  flex: none;
  white-space: nowrap;
}
/* --on-accent: dark ink on the dark scheme's green fill (white there is 2.76:1), white on light's. */
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-bright); }
.btn.ghost {
  background: transparent; color: var(--ink-secondary);
  border: 1px solid var(--border);
}
.btn.ghost:hover { background: var(--wash-hover); color: var(--ink); }
/* The top bar's quiet actions: text buttons, Jira's "Create/Apps" row without the chrome. */
.btn.bar { background: transparent; color: var(--ink-secondary); padding: 0 var(--space-10); font-weight: 400; }
.btn.bar:hover { background: var(--wash-hover); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary:disabled:hover { background: var(--accent); }
.btn.ghost:disabled:hover { background: transparent; }

.btn-compact {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-4);
  font: 600 var(--fs-small)/1 var(--font-ui);
  height: 28px; padding: 0 var(--space-12);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: background .12s ease;
  flex: none;
}
.btn-compact.danger {
  background: var(--tint-error); color: var(--error-ink);
  border: 1px solid var(--edge-error);
}
.btn-compact.danger:hover { background: var(--tint-error-hover); }
.btn-compact.accent {
  background: var(--accent); color: var(--on-accent);
  border: 1px solid var(--accent);
}
.btn-compact.accent:hover { background: var(--accent-bright); }
.btn-compact.ghost {
  background: transparent; color: var(--ink-secondary);
  border: 1px solid var(--border);
}
.btn-compact.ghost:hover { background: var(--wash-hover); color: var(--ink); }
.btn-compact:disabled { opacity: .45; cursor: default; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  color: var(--muted);
  width: var(--ctl-h); height: var(--ctl-h);
  border-radius: var(--radius-button);
  cursor: pointer; flex: none; padding: 0;
  transition: background .12s ease, color .12s ease;
}
.iconbtn svg { flex: none; }
.svg-sprite { position: absolute; width: 0; height: 0; }
.iconbtn:hover { background: var(--wash-hover); color: var(--ink); }
.iconbtn.sm { width: 28px; height: 28px; }
.iconbtn.xs { width: 22px; height: 22px; }
.iconbtn:disabled { opacity: .35; cursor: default; }
.iconbtn:disabled:hover { background: transparent; color: var(--muted); }

/* ---------------------------------------------------------------- the field system
   One box for every field; a field chooses only its face, via `.mono`. */

.field-control {
  height: var(--ctl-h);
  width: 100%;
  padding: 0 var(--space-10);
  /* 1.45, not tighter: a mono underscore sits below the baseline and a tight box hides it */
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--ink);
  background: var(--fill-inset);
  border: 1px solid var(--divider);
  border-radius: var(--radius-control);
  transition: border-color .12s ease, background .12s ease;
}
.field-control:hover { border-color: var(--border); }
textarea.field-control {
  height: auto;
  min-height: calc(2 * var(--ctl-h));
  padding: var(--space-8) var(--space-10);
  line-height: 1.5;
  resize: vertical;
}
.field-control:focus { border-color: var(--border-focus); background: var(--wash-hover); }
.field-control::placeholder { color: var(--muted); opacity: 1; }
/* a placeholder is an instruction, not a value: the UI face even in a mono field */
.field-control.mono::placeholder { font: 400 var(--fs-body)/1.2 var(--font-ui); }
.field-control:disabled { opacity: .6; cursor: default; }
.field-control:invalid:not(:placeholder-shown) { border-color: var(--edge-error); }
.field-control option { background: var(--panel-solid); color: var(--ink); }
/* The inert member: the field's box without what says "you may type here". */
.field-static {
  display: flex; align-items: center;
  min-height: var(--ctl-h);
  min-width: 0;
  padding: var(--space-6) var(--space-10);
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius-control);
  cursor: default;
  overflow: hidden;
}
select.field-control {
  cursor: pointer;
  appearance: none;
  padding-right: var(--space-32);
  text-overflow: ellipsis;
}
.select-wrap { position: relative; display: flex; flex: 1; min-width: 0; }
.select-wrap::after {
  content: "";
  position: absolute; right: var(--space-12); top: 50%;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.select-wrap:focus-within::after, .select-wrap:hover::after {
  border-right-color: var(--ink); border-bottom-color: var(--ink);
}
/* The date field keeps the platform calendar; only its inner shells are aligned. */
input[type="date"].field-control { padding-right: var(--space-6); }
input[type="date"].field-control::-webkit-datetime-edit,
input[type="date"].field-control::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type="date"].field-control::-webkit-datetime-edit-text { color: var(--muted); }
input[type="date"].field-control.empty::-webkit-datetime-edit { color: var(--muted); }
input[type="date"].field-control::-webkit-calendar-picker-indicator {
  filter: var(--picker-filter);
  opacity: .6;
  cursor: pointer;
}
input[type="date"].field-control::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.hint { font: 400 var(--fs-small)/1.5 var(--font-ui); color: var(--muted); }
p.hint { margin: 0; }
.field-help { font: 400 var(--fs-small)/1.45 var(--font-ui); color: var(--muted); margin: 0; }
.empty-note {
  padding: var(--space-12);
  border: 1px dashed var(--divider);
  border-radius: var(--radius-control);
  text-align: center;
}

/* ---------------------------------------------------------------- board */

/* Five equal columns: a card is one object whatever column it sits in. */
.board {
  position: relative; z-index: 1;
  display: flex;
  gap: var(--space-8);
  align-items: stretch;
  width: min(calc(100% - 2 * var(--space-24)), var(--board-max));
  margin: var(--space-16) auto var(--space-16);
  /* The window below the board's top (app.js fitColumns), less a column head and the margin. */
  --col-body-max: max(var(--col-min-h), calc(100dvh - var(--board-top, 240px) - 64px));
}

.column {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--col-min-h);
  background: var(--bg-column);
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  display: flex; flex-direction: column;
}
/* Loud only when occupied: an always-red empty column trains the eye to ignore it. */
.column.station-failstate.occupied { border-color: var(--edge-error); }
.column.station-failstate.occupied .col-head h2 { color: var(--error-ink); }
.column.station-failstate.occupied .count { color: var(--error-ink); }

.col-head {
  display: flex; align-items: center; gap: var(--space-8);
  min-height: 44px;
  padding: var(--space-6) var(--space-8) var(--space-2) var(--space-12);
}
.col-head h2 {
  margin: 0;
  font: 600 var(--fs-body)/1.2 var(--font-ui);
  color: var(--ink-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.count {
  font: 400 var(--fs-small)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex: none;
}
.col-head .col-add { margin-left: auto; }

.col-body {
  flex: 1;
  /* One token for the gap and the inset; the sides come from the reserved gutter. */
  display: flex; flex-direction: column; gap: var(--col-inset);
  padding: var(--col-inset) 0;
  max-height: var(--col-body-max);
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
.col-empty {
  margin: var(--space-24) auto;
  font: 400 var(--fs-small)/1.5 var(--font-ui);
  color: var(--muted);
  text-align: center;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-10) var(--space-12);
  /* Declared on the card, not :root, so a scoped --card-labels-h can still reach it. */
  --card-h: calc(2px + 2 * var(--space-10) + var(--card-row-h) + var(--card-id-h)
                 + var(--space-6) + var(--card-stage-h)
                 + var(--space-6) + var(--card-labels-h) + var(--space-6)
                 + var(--card-run-h));
  --card-run-h: 0px;
  height: var(--card-h);
  flex: none;
  display: flex; flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.card:hover { background: var(--card-hover); }
.card:focus-visible { outline-offset: 1px; }

/* Row 1 — the summary: the place a human recognises, then urgency and due date. */
.card-top {
  display: flex; align-items: center; gap: var(--space-6);
  min-width: 0; height: var(--card-row-h); flex: none;
}
.card-top-spacer { flex: 1; }
.card-top-id { display: block; height: var(--card-id-h); }
/* The flags float right INSIDE the clamped id, so line 2 keeps the card's full width. */
/* The id gives way to the flags: it is cut, never pushed onto a second line. */
.card-id { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-id wbr { display: none; }  /* Chromium still breaks a nowrap line at <wbr> */
.card-flags {
  order: 1; flex: none; height: var(--card-id-line); margin-left: var(--space-4);
  display: flex; align-items: center; gap: var(--space-4);
}
.card-flags .pill.due { padding-inline: var(--space-2); }
/* Two lines at most, breaking after the id's underscores (<wbr>); the ellipsis only comes
   for an id too long for two lines, and the full id is then in the title. */
.card-summary {
  display: flex; align-items: center; gap: var(--space-4);
  min-width: 0; overflow: hidden;
  font: 600 var(--fs-body)/var(--card-id-line) var(--font-ui);
  color: var(--ink);
}
.id-stamp { color: var(--muted); font-size: var(--fs-small); font-weight: 400; white-space: nowrap; }
.prio { display: inline-flex; align-items: center; flex: none; }
.gcp-open {
  display: flex; align-items: center;
  min-height: var(--ctl-h);
  padding: var(--space-6) var(--space-10);
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--accent-ink);
}

/* THE LIFECYCLE METER: which stage, and how far through the run that is. */
.card-stage {
  display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-4);
  height: var(--card-stage-h); flex: none; margin-top: var(--space-6);
}
.stage-meter { display: flex; gap: var(--space-2); align-items: flex-end; height: 8px; flex: none; }
/* The run bar: only a card with a live or unfinished run grows by it. */
.card.has-run { --card-run-h: calc(var(--space-6) + 14px); }
.card-run {
  display: flex; align-items: center; gap: var(--space-6);
  height: 14px; flex: none; margin-top: var(--space-6); min-width: 0;
}
.card-run .run-plan, .card-run .cl-bar { flex: 1 1 0; min-width: 0; height: 4px; }
.card-run .run-plan { gap: 1px; }
.card-run .cl-bar-fill::after { content: none; }
.card-run-text {
  flex: none; font: 400 var(--fs-small)/1 var(--font-ui); color: var(--ink-secondary);
  white-space: nowrap;
}
/* A failed end needs a person as much as a stall does: the same ink (the words say which). */
.card-run.run-dead .card-run-text, .card-run.run-failed .card-run-text { color: var(--warning-ink); }
.tick {
  flex: 1 1 0; min-width: 0;
  height: 3px;
  border-radius: 1px;
  background: var(--wash-hover);
}
.tick.on { background: var(--meter-ink); }
.tick.now { height: 8px; border-radius: var(--radius-mark); background: var(--ink-secondary); }
.station-todo .tick.now { background: var(--warning); }
.station-done .tick.now { background: var(--accent); }
.station-archived .tick.now { background: var(--meter-ink); }
.stage-name {
  font: 600 var(--fs-body)/1.25 var(--font-ui);
  color: var(--ink-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card.station-failstate .stage-name { color: var(--error-ink); }
.station-failstate .tick.now { background: var(--error); }
.stage-from { font-weight: 400; color: var(--ink-secondary); }


/* Row 3 — the flags, ONE reserved line; what does not fit collapses into a +N pill
   (app.js fitCardLabels), so a flag is never silently cut off. */
.card-labels {
  display: flex; flex-wrap: wrap; align-content: flex-start;
  gap: var(--space-4);
  height: var(--card-labels-h); flex: none;
  margin-top: var(--space-6);
  overflow: hidden;
}
.card-labels .label-pill {
  display: block;
  /* An inset shadow outlines the flag at zero layout width. */
  border: none;
  box-shadow: inset 0 0 0 1px var(--border);
  letter-spacing: 0;
  padding: 0 var(--space-6);
  height: var(--card-label-h); line-height: var(--card-label-h);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The warning leads the row and is filled: it is a report, the others are instructions. */
.card-labels .label-pill[data-label="PROBLEM"] {
  order: -1;
  background: color-mix(in srgb, var(--error) 26%, var(--bg));
  color: var(--error-ink);
  box-shadow: inset 0 0 0 1px var(--edge-error);
}
.card-labels .label-more { color: var(--ink-secondary); }

/* Row 4 — Jira's issue foot: type, key, then the assignee pinned right. */
.card-foot {
  display: flex; flex-wrap: nowrap; align-items: center; gap: var(--space-6);
  margin-top: auto;
  height: var(--card-row-h); flex: none;
  min-width: 0;
}

.pill {
  display: inline-flex; align-items: center; gap: var(--space-4);
  font: 600 var(--fs-small)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-8);
  border: 1px solid var(--divider);
  color: var(--ink-secondary);
  background: var(--wash-2);
  white-space: nowrap;
}
.pill.due { padding: var(--space-2) var(--space-6); border-color: transparent; background: transparent; color: var(--muted); font-weight: 400; }
.pill.due.overdue {
  color: var(--error-ink); border-color: var(--edge-error); background: var(--tint-error); font-weight: 600;
}
.pill.problem-pill {
  color: var(--error-ink); border-color: var(--edge-error); background: var(--tint-error);
}
.label-pill { font: 600 var(--fs-small)/1 var(--font-ui); }
/* The one place a control label is named, and it is presentation. */
.pill.label-pill[data-label="PROBLEM"] {
  color: var(--error-ink); border-color: var(--edge-error); background: var(--tint-error);
}

/* Survey type (UAV / IAB / PIX / NAV), hued from its own value in app.js. */
.type-chip {
  display: inline-flex; align-items: center; flex: none;
  font: 600 var(--fs-small)/1 var(--font-ui);
  border-radius: var(--radius-mark);
  padding: 3px var(--space-4);
  color: color-mix(in srgb, var(--tc) var(--chip-ink-pct), var(--chip-ink-base));
  background: color-mix(in srgb, var(--tc) 22%, var(--bg));
}

.avatar {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--av) 30%, var(--bg));
  color: color-mix(in srgb, var(--av) var(--avatar-ink-pct), var(--chip-ink-base));
  font: 600 var(--fs-small)/1 var(--font-ui);
  user-select: none;
}
.avatar.sm { width: 24px; height: 24px; }
.avatar.system {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.avatar.empty {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
}

/* ---------------------------------------------------------------- modal */

.overlay {
  position: fixed; inset: 0;
  z-index: var(--z-overlays);
  background: var(--scrim);
  display: grid; place-items: center;
  padding: var(--space-24);
}
.overlay[hidden] { display: none; }

.modal {
  width: min(1180px, 100%);
  max-height: calc(100vh - 2 * var(--space-24));
  display: flex; flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow);
}
.modal-md { width: min(760px, 100%); }
/* min-width: the overlay's auto grid track would otherwise grow to the rows' min-content. */
.modal.modal-fleet { width: min(1120px, 100%); min-width: 0; }

.modal-head {
  display: flex; align-items: center; gap: var(--space-8);
  min-height: 52px;
  padding: var(--space-8) var(--space-12) var(--space-8) var(--space-24);
  border-bottom: 1px solid var(--divider);
  flex: none;
}
.modal-title { margin: 0; font: 600 var(--fs-title)/1.2 var(--font-ui); color: var(--ink); }
.crumb { font: 400 var(--fs-small)/1.3 var(--font-ui); color: var(--muted); }
.modal-head-spacer { flex: 1; }

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--space-32);
  padding: var(--space-20) var(--space-24) var(--space-24);
  overflow-y: auto;
}
.modal-md .modal-body { display: flex; flex-direction: column; gap: var(--space-16); }
/* The ticket's aside comes first in the DOM (stage before evidence) and sits on the right. */
.modal-main { min-width: 0; display: flex; flex-direction: column; gap: var(--space-24); grid-column: 1; grid-row: 1; }
.modal-side {
  min-width: 0;
  display: flex; flex-direction: column; gap: var(--space-20);
  grid-column: 2; grid-row: 1;
}

/* The ticket head: breadcrumb (board / key) with a copy control, then the summary. */
.ticket-head { min-height: 48px; border-bottom: none; padding-bottom: 0; }
.ticket-crumbs { display: flex; align-items: center; gap: var(--space-6); min-width: 0; }
.ticket-heading {
  display: flex; align-items: center; gap: var(--space-10);
  padding: var(--space-4) var(--space-24) var(--space-12);
}
.ticket-title:focus { outline: none; }
.ticket-title:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; border-radius: var(--radius-mark); }
.tab-panel { display: flex; flex-direction: column; gap: var(--space-16); padding-top: var(--space-6); }
.ticket-title { margin: 0; font: 600 var(--fs-title)/1.25 var(--font-ui); color: var(--ink); overflow-wrap: anywhere; }
.ticket-title .id-stamp, .cfg-stat-v .id-stamp { font-size: inherit; }
.ticket-sub { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-8); margin-top: var(--space-6); }

/* SECTION HEADING — sentence case, one step above body. */
.m-label {
  display: block;
  margin: 0;
  font: 600 var(--fs-heading)/1.3 var(--font-ui);
  color: var(--ink);
}
.m-label.sub { font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink-secondary); }

.m-section { display: flex; flex-direction: column; gap: var(--space-10); }
.m-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); }
.m-section-head .m-label { flex: none; }

/* Sections parted by a hairline in both columns; wider above it than below. */
.modal-main > .m-section + .m-section,
.modal-side > .m-section + .m-section {
  border-top: 1px solid var(--divider);
  padding-top: var(--space-12);
}
/* ...except after a section that is only hidden: the first SHOWN one takes no rule. */
.modal-main > .m-section[hidden]:first-child + .m-section {
  border-top: none; padding-top: 0;
}

/* A heading that is also the control that opens its block (config groups). */
.m-disclosure {
  display: inline-flex; align-items: center; gap: var(--space-8);
  margin: 0; padding: 0;
  background: none; border: 0; cursor: pointer;
  color: inherit; text-align: left;
}
.m-caret {
  width: 10px; height: 10px; flex: none;
  color: var(--muted);
  transform: rotate(90deg);
  transition: transform .16s ease;
}
.m-disclosure[aria-expanded="false"] .m-caret { transform: none; }
.m-disclosure:hover .m-caret { color: var(--ink); }

.cl-badges { display: inline-flex; align-items: center; gap: var(--space-6); }
.progress-pill {
  font: 400 var(--fs-small)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
  background: var(--wash-2);
  border: 1px solid var(--divider);
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-8);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- details */

.detail-rows { display: flex; flex-direction: column; gap: var(--space-12); }
.detail-row { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.detail-k {
  font: 400 var(--fs-small)/1.3 var(--font-ui);
  color: var(--muted);
}
.detail-row.inline {
  flex-direction: row; align-items: baseline; gap: var(--space-8);
}
.detail-row.inline .detail-k { flex: none; }
.detail-row.inline .detail-v {
  min-width: 0; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-v {
  display: inline-flex; align-items: center; gap: var(--space-6);
  font: 400 var(--fs-body)/1.35 var(--font-ui);
  color: var(--ink);
}

/* THE DETAILS PANEL — Jira's right-hand field list: one key column, one value column. */
.details-panel {
  border: 1px solid var(--divider);
  border-radius: var(--radius-card);
}
.details-panel > .m-label {
  padding: var(--space-10) var(--space-16);
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-body);
}
.ticket-paths {
  display: flex; flex-direction: column; gap: var(--space-8);
  padding: var(--space-12) var(--space-16) var(--space-16);
}
.ticket-paths .detail-row.inline { align-items: flex-start; }
.ticket-paths .detail-k { flex: none; width: 112px; align-self: center; font-size: var(--fs-body); }
.ticket-paths .detail-row.stack > .detail-k { align-self: flex-start; padding-top: 7px; }
/* A path takes the panel's whole width under its key: a UNC path plus an id does not fit
   the value column, and a break inside the id is the one that misreads. */
.ticket-paths .detail-row.path-row { flex-wrap: wrap; row-gap: var(--space-4); }
.ticket-paths .detail-row.path-row > .detail-k { flex-basis: 100%; padding-top: 0; }
.ticket-paths .field-control, .ticket-paths .field-static { flex: 1; min-width: 0; }
.ticket-paths .select-wrap { flex: 1; }
.ticket-paths .iconbtn.sm { flex: none; align-self: center; }
/* The copy control sits inside the path box at its right edge, on the first line; the
   box reserves its width so a wrapped path never runs under it. */
.path-field { position: relative; flex: 1; min-width: 0; display: flex; }
.path-field > .path-value { padding-right: calc(28px + var(--space-6)); }
.ticket-paths .path-field > .iconbtn.sm { position: absolute; top: 2px; right: 2px; }
/* The ticket's files lead the DOM so focus order matches every layout: left column top
   beside the stage control when wide, first of the single column when narrow. */
#overlay .modal-body {
  grid-template-areas: "files side" "main side";
  grid-template-rows: auto 1fr;
  row-gap: var(--space-12);
}
#overlay .ticket-files { grid-area: files; }
#overlay .modal-side { grid-area: side; }
#overlay .modal-main { grid-area: main; }
/* flush with the column: its keys share the left edge of the headings below */
.ticket-files { padding-inline: 0; padding-bottom: var(--space-24); border-bottom: 1px solid var(--divider); }
.ticket-files .detail-row.path-row { flex-wrap: nowrap; }
.ticket-files .detail-row.path-row > .detail-k { flex-basis: auto; padding-top: 0; }
/* an absent value reads like a placeholder: muted, in the UI face (`mono` is dropped) */
.field-static.empty { color: var(--muted); }
.detail-value { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-6); min-height: var(--ctl-h); }
/* A path is never ellipsed where it can be read whole: it wraps, because half a path still
   looks like a real one and gets pasted. */
.detail-row.inline .path-value {
  white-space: normal; overflow-wrap: anywhere; overflow: visible;
  text-overflow: clip;
  flex: 1;
  font-size: var(--fs-small);
  line-height: 1.5;
}
.due-row { display: flex; align-items: center; gap: var(--space-4); flex: 1; min-width: 0; }
.due-row .field-control { flex: 1; }
#mDue.overdue {
  border-color: var(--edge-error); background: var(--tint-error); color: var(--error-ink);
}

/* ---------------------------------------------------------------- the stage control

   A plain field holding the served caps name: same box and height as every
   other field, neutral at every stage. */
.stage-block { display: flex; flex-direction: column; gap: var(--space-10); }
.stage-row { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
.stage-field { display: flex; align-items: center; gap: var(--space-6); flex: 1; min-width: 0; }
.stage-field .field-control { flex: 1; min-width: 0; }
.assignee-field { display: flex; flex: 1; min-width: 0; }
.stage-field .listbox-option, .assignee-field .listbox-option {
  position: relative; padding-left: calc(var(--space-8) + 2ch);
}
/* The current-stage glyph sits in the gutter, so the names stay in one column. */
.stage-field [role="option"][aria-selected="true"]::before,
.assignee-field [role="option"][aria-selected="true"]::before {
  position: absolute; left: var(--space-8);
}
/* Nothing to choose: no chevron, so the field reads as a value, not a control. */
.stage-field .listbox-trigger:disabled::after,
.assignee-field .listbox-trigger:disabled::after { display: none; }
/* the email beside a display name: one line, so every row keeps the listbox row height */
.assignee-email { margin-left: var(--space-8); color: var(--muted); }

.ticket-meter .stage-meter.lg { height: 12px; gap: var(--space-4); }
.ticket-meter .tick.on, .ticket-meter .tick { height: 4px; border-radius: 2px; }
.ticket-meter .tick.now { height: 12px; border-radius: var(--radius-mark); }
.ticket-meter:empty { display: none; }

/* ---------------------------------------------------------------- the listbox
   A custom combobox, because a native select's option list cannot be styled. */
.listbox { position: relative; flex: 1; min-width: 0; }
.listbox-trigger {
  display: flex; align-items: center;
  text-align: left; cursor: pointer;
  padding-right: var(--space-32);
}
.listbox-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listbox-value.placeholder { color: var(--muted); }
.listbox-trigger::after {
  content: "";
  position: absolute; right: var(--space-12); top: 50%;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.listbox-trigger[aria-expanded="true"]::after { margin-top: -1px; transform: rotate(-135deg); }

/* FIXED, because the modal body scrolls and would clip it; app.js places it. */
.listbox-list {
  position: fixed;
  z-index: var(--z-popover);
  /* whole rows only; the 2px is the two borders */
  max-height: calc(var(--listbox-rows) * var(--listbox-row-h) + 2px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 0 var(--space-4);
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  /* opacity only: a transform would skew the position app.js measures */
  animation: listbox-in .12s ease;
}
@keyframes listbox-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.listbox-option {
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-mark);
  font: 400 var(--fs-body)/18px var(--font-ui);
  height: var(--listbox-row-h);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* where the campaign is: a glyph; where the keyboard is: a fill and a ring */
.listbox-option[aria-selected="true"]::before { content: "› "; color: var(--accent-ink); }
@media (hover: hover) {
  .listbox-option:hover { background: var(--wash-1); }
}
.listbox-option.active {
  background: var(--wash-hover);
  box-shadow: inset 0 0 0 1px var(--edge-accent);
}
/* Not this caller's to take: drawn and reachable, struck through, never dropped. */
.listbox-option.off {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--edge-warning);
  cursor: not-allowed;
}
.listbox-option.off.active { background: var(--wash-hover); box-shadow: none; }
@media (hover: hover) {
  .listbox-option.off:hover {
    background: none;
    text-decoration-color: var(--warning-ink);
  }
}

/* ---------------------------------------------------------------- checklist */

.cl-bar {
  display: flex;
  height: 4px; border-radius: var(--radius-pill);
  background: var(--wash-hover);
  overflow: hidden;
}
.cl-bar-fill {
  height: 100%; width: 0;
  background: var(--gradient-primary);
  transition: width .3s ease;
}
.cl-bar-problem {
  height: 100%; width: 0;
  background: var(--error);
  transition: width .3s ease;
}

/* ---------------------------------------------------------------- the automated run
   Reuses the checklist bar; only the three states live here. */

/* MOVING means a claim still stands behind the sample. */
.run-live .cl-bar-fill { position: relative; overflow: hidden; }
.run-live .cl-bar-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%, var(--sweep) 50%, transparent 100%);
  animation: run-sweep 1.6s linear infinite;
}
@keyframes run-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .run-live .cl-bar-fill::after { animation: none; }
}
/* STALLED snaps and stays: an eased width would read as progress. */
.run-dead .cl-bar-fill { background: var(--run-stalled); transition: none; }

.run-pill { font: 600 var(--fs-small)/1 var(--font-ui); }
.run-live .run-pill {
  color: var(--accent-ink); border-color: var(--edge-accent); background: var(--tint-accent);
}
.run-dead .run-pill {
  color: var(--warning-ink); border-color: var(--edge-warning); background: var(--tint-warning);
}
.run-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-8); }
.run-when { display: inline-flex; align-items: baseline; gap: var(--space-4); }
/* ENDED is not stalled: nothing is lost, the queue decided — the pill names what it did. */
.run-ended .cl-bar-fill { background: var(--run-stalled); transition: none; }
.run-ended .run-pill {
  color: var(--ink-secondary); border-color: var(--divider); background: var(--wash-hover);
}
/* No % reported yet: a short sliding block, so "unknown" never reads as 0%. */
.run-indet .cl-bar-fill { width: 30% !important; animation: run-indet 1.4s ease-in-out infinite alternate; }
@keyframes run-indet { from { margin-left: 0; } to { margin-left: 70%; } }
@media (prefers-reduced-motion: reduce) {
  .run-indet .cl-bar-fill { animation: none; margin-left: 35%; }
}
.run-step-line {
  display: flex; align-items: baseline; gap: var(--space-8); min-width: 0; margin: 0;
  font: 400 var(--fs-body)/1.3 var(--font-ui); color: var(--ink);
}
.run-step-line .num { color: var(--ink-secondary); flex: none; }
.run-step-line .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The leg's plan: one equal segment per step, its state in shape and words, not hue alone. */
.run-plan {
  display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; height: 8px;
}
.run-seg { flex: 1 1 0; min-width: 3px; border-radius: 2px; background: var(--wash-hover); }
.run-seg.seg-done { background: var(--accent); }
.run-seg.seg-current { background: var(--accent-current); box-shadow: 0 0 0 1px var(--accent-ink); }
.run-seg.seg-stalled { background: var(--run-stalled); }
.run-seg.seg-stopped { background: var(--error); box-shadow: 0 0 0 1px var(--error-ink); }
.run-seg.seg-pending { box-shadow: inset 0 0 0 1px var(--divider); }
/* The step timings: a plain table in the run panel's faces; state in words, not hue alone. */
.run-steps {
  width: 100%; border-collapse: collapse; font: 400 var(--fs-small)/1.4 var(--font-ui);
  color: var(--ink);
}
.run-steps th, .run-steps td {
  padding: var(--space-4) var(--space-6); text-align: left; border-bottom: 1px solid var(--divider);
}
.run-steps thead th { font-weight: 600; color: var(--muted); }
.run-steps .num { text-align: right; white-space: nowrap; }
.run-steps td.mono { overflow-wrap: anywhere; }
.run-steps tfoot th, .run-steps tfoot td { font-weight: 600; border-bottom: 0; }
.run-steps .step-running .step-state { color: var(--accent-ink); font-weight: 600; }
.run-steps .step-held .step-state { color: var(--ink-secondary); }
.run-steps .step-failed .step-state { color: var(--error-ink); font-weight: 600; }
.run-steps .step-abandoned td { color: var(--muted); }
/* One run per stage, stacked: a gap before each next stage's heading. */
#mStepsRuns > * + .m-section-head { margin-top: var(--space-16); }
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.cl-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-4);
}
.cl-item {
  display: flex; align-items: center; gap: var(--space-10);
  padding: var(--space-8) var(--space-10);
  border: 1px solid var(--divider);
  border-radius: var(--radius-control);
}
.cl-item:hover { background: var(--wash-1); }
.cl-check {
  display: grid; place-items: center;
  width: 20px; height: 20px; flex: none;
  border: 1.5px solid var(--muted);
  border-radius: var(--radius-mark);
  background: transparent;
  color: var(--on-accent);
  cursor: pointer;
  padding: 0;
}
.cl-item.state-done .cl-check { background: var(--accent); border-color: var(--accent); }
.cl-item.state-problem .cl-check { border-color: var(--edge-error); }
.cl-text {
  flex: 1;
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--ink);
  overflow-wrap: anywhere;
}
/* Muted only: a strike-through is what a REMOVED item looks like. */
.cl-item.state-done .cl-text { color: var(--muted); }
.cl-item.state-problem { border-color: var(--edge-error); background: var(--tint-error); }
.cl-item.state-problem .cl-text { color: var(--error-ink); }
.cl-flag {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  background: none; border: none;
  border-radius: var(--radius-mark);
  color: var(--muted);
  opacity: .55;
  cursor: pointer;
  padding: 0;
}
.cl-item:hover .cl-flag, .cl-flag:focus-visible { opacity: 1; }
.cl-flag:hover { color: var(--warning-ink) !important; background: var(--tint-warning); }
.cl-flag.on, .cl-item:hover .cl-flag.on { color: var(--error-ink); opacity: 1; }
.cl-flag.on:hover { color: var(--error-ink) !important; background: var(--tint-error-hover); }
.cl-text strong { font-weight: 600; }
.cl-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.cl-tag {
  display: inline-block; margin-left: var(--space-4); padding: 0 var(--space-4);
  border: 1px solid var(--divider); border-radius: var(--radius-mark);
  font: 400 11px/1.5 var(--font-ui); color: var(--muted); vertical-align: 1px;
}
.cl-edit, .cl-remove {
  display: grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  background: none; border: none; border-radius: var(--radius-mark);
  color: var(--muted); opacity: .55; cursor: pointer; padding: 0;
}
.cl-item:hover .cl-edit, .cl-item:hover .cl-remove,
.cl-edit:focus-visible, .cl-remove:focus-visible { opacity: 1; }
.cl-edit:hover { color: var(--ink); background: var(--wash-hover); }
.cl-remove:hover { color: var(--error-ink); background: var(--tint-error); }
.cl-rename { width: 100%; }
.cl-add { display: flex; align-items: center; gap: var(--space-6); margin-top: var(--space-8); }
.cl-add .field-control { flex: 1; }
.cl-check:disabled, .cl-flag:disabled { cursor: not-allowed; opacity: .5; }
.cl-flag:disabled:hover { color: var(--muted) !important; background: none; }
.cl-why {
  display: block;
  margin-top: var(--space-2);
  font: 400 var(--fs-small)/1.4 var(--font-ui);
  color: var(--muted);
}

/* ---------------------------------------------------------------- activity
   Jira's Activity block: Comments and History as tabs over one panel. */

.tabs { display: flex; gap: var(--space-4); border-bottom: 1px solid var(--divider); }
.tab {
  position: relative;
  height: 34px; padding: 0 var(--space-12);
  background: none; border: none;
  font: 600 var(--fs-body)/1 var(--font-ui);
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-control) var(--radius-control) 0 0;
}
.tab:hover { color: var(--ink); background: var(--wash-1); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--space-8); right: var(--space-8); bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--accent-bright);
}
/* the first tab's text sits on the section's left edge, its indicator under the text */
.tabs > .tab:first-child { padding-left: 0; }
.tabs > .tab:first-child:hover { background: none; }
.tabs > .tab:first-child[aria-selected="true"]::after { left: 0; }

.comment-form { display: flex; gap: var(--space-10); align-items: flex-start; }
.comment-compose { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
/* The submit trails the field it submits, flush with its right edge — `.cl-add`'s shape,
   wrapped onto its own row only because a comment body is a textarea and not one line. */
.comment-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-12); }

.comment-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-16);
}
/* An empty list is still a flex item of the panel, so without this its 16px gap would
   hold a band of nothing open under the composer. */
.comment-list:empty { display: none; }
.comment-item { display: flex; gap: var(--space-10); }
.comment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.comment-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-8);
  font: 400 var(--fs-small)/1.3 var(--font-ui);
  color: var(--muted);
}
.comment-who { font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink); }
.comment-body {
  font: 400 var(--fs-body)/1.5 var(--font-ui);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------- the trail */

.admin-badge {
  font: 600 var(--fs-small)/1 var(--font-ui);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-mark);
  color: var(--warning-ink); background: var(--tint-warning);
  border: 1px solid var(--edge-warning);
}

.hist-list { list-style: none; margin: 0; padding: 0;
             display: flex; flex-direction: column; gap: var(--space-4); }
.hist-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-10);
  align-items: baseline;
  padding: var(--space-8) var(--space-10);
  border-bottom: 1px solid var(--divider);
  font: 400 var(--fs-small)/1.4 var(--font-ui);
  color: var(--ink-secondary);
}
.hist-line { display: flex; align-items: baseline; gap: var(--space-8); min-width: 0; }
.hist-who { font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink); }
.hist-move { grid-column: 1 / -1; font: 400 var(--fs-body)/1.4 var(--font-ui); color: var(--ink); }
.hist-trigger { color: var(--muted); }
.hist-when { color: var(--muted); white-space: nowrap; }
/* The reason spans the row: truncating the one field that explains a move defeats recording it. */
.hist-reason {
  grid-column: 1 / -1;
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--ink-secondary);
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed; right: var(--space-16); bottom: var(--space-16);
  z-index: var(--z-toasts);
  display: flex; flex-direction: column; gap: var(--space-6);
}
.toast {
  display: flex; align-items: center; gap: var(--space-8);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-md);
  padding: var(--space-10) var(--space-16);
  font: 400 var(--fs-body)/1.45 var(--font-ui);
  color: var(--ink);
  max-width: 420px;
}
.toast.error { border-left-color: var(--error-ink); }
.toast.gone { opacity: 0; transition: opacity .3s; }

/* ---------------------------------------------------------------- labels (ticket) */

.label-row { display: flex; flex-wrap: wrap; gap: var(--space-6); flex: 1; min-width: 0; padding: var(--space-4) 0; }
.label-chip {
  font: 400 var(--fs-small)/1 var(--font-ui);
  border-radius: var(--radius-pill);
  padding: var(--space-6) var(--space-10);
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-secondary);
}
.label-chip:hover { color: var(--ink); background: var(--wash-hover); }
.label-chip.on {
  color: var(--accent-ink);
  border-color: var(--edge-accent);
  background: var(--tint-accent);
  font-weight: 600;
}
.label-chip.on[data-label="PROBLEM"] {
  color: var(--error-ink);
  border-color: var(--edge-error);
  background: color-mix(in srgb, var(--error) 26%, var(--bg));
}
/* ARMED: setting this one would move the campaign (the server's `fires_from`). */
.label-chip.arms {
  color: var(--warning-ink);
  border-color: var(--edge-warning);
  background: var(--tint-warning);
}

/* -------------------------------------------------- planned flights
   A planned flight is not a campaign, so it is drawn as a different object, dashed and with
   no stage, in a column of its own that leads the lifecycle's. */

.column.planning { border: 1px solid var(--border); }
.request-card {
  display: flex; flex-direction: column; gap: var(--space-6);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-10) var(--space-12);
  cursor: pointer;
  min-width: 0;
}
.request-card:hover { border-color: var(--border-focus); background: var(--wash-2); }
.request-card.refused { border-color: var(--edge-error); border-style: solid; }
.request-date { font: 600 var(--fs-body)/1.2 var(--font-ui); color: var(--ink); }
.request-project {
  font: 600 var(--fs-body)/1.3 var(--font-ui);
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.request-line { display: flex; align-items: center; gap: var(--space-6); min-width: 0; }
.request-folder {
  font-size: var(--fs-small);
  color: var(--ink-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill.request-pill { font: 600 var(--fs-small)/1 var(--font-ui); }
.pill.request-pill.failed { color: var(--error-ink); border-color: var(--edge-error); background: var(--tint-error); }
.request-error {
  font: 400 var(--fs-small)/1.3 var(--font-ui);
  color: var(--error-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.request-count {
  display: inline-flex; align-items: center; gap: var(--space-4);
  font: 400 var(--fs-small)/1 var(--font-ui);
  color: var(--muted);
}

/* A trigramme is three capitals; the narrow mono field says so before anything is typed. */
.field-control.trigramme {
  width: 7ch; box-sizing: content-box;
  text-transform: uppercase; letter-spacing: .08em;
}
.field-help.field-error { color: var(--error-ink); }

.req-form { display: flex; flex-direction: column; gap: var(--space-16); }
.req-field { display: flex; flex-direction: column; gap: var(--space-6); }
.req-field > .m-label { font-size: var(--fs-body); }
.req-actions { display: flex; align-items: center; gap: var(--space-8); }
.req-meta { margin-top: var(--space-24); }
.req-error {
  font: 400 var(--fs-body)/1.5 var(--font-ui);
  color: var(--error-ink);
  border: 1px solid var(--edge-error);
  background: var(--tint-error);
  border-radius: var(--radius-control);
  padding: var(--space-8) var(--space-10);
  margin: 0 0 var(--space-12);
}

/* ------------------------------------------------- fleet health */

.fl-head-title { display: flex; align-items: baseline; gap: var(--space-8); min-width: 0; }
.fl-caption { font: 400 var(--fs-small)/1.3 var(--font-ui); color: var(--muted); white-space: nowrap; }
.m-label.fl-alarm, .hint.fl-alarm, .fl-status-bad { color: var(--error-ink); }
.m-label.fl-warn, .fl-warn-text, .detail-row.fl-warn .detail-v { color: var(--warning-ink); }
.detail-row.fl-alarm .detail-v { color: var(--error-ink); }
.fl-status-ok { color: var(--accent-ink); }
.fl-status-done { color: var(--muted); }

/* State is a dot AND a word everywhere; a dot alone would be colour-only. `none` is neutral
   on purpose: an unmeasured row is never green. */
.fl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.fl-dot-ok { background: var(--accent-ink); }
.fl-dot-warn { background: var(--warning-ink); }
.fl-dot-bad { background: var(--error-ink); }
.fl-dot-none { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.fl-beat { font: 400 var(--fs-small)/1.3 var(--font-ui); font-variant-numeric: tabular-nums;
  white-space: nowrap; color: var(--ink-secondary); }
.fl-beat-ok { color: var(--accent-ink); }
.fl-beat-warn { color: var(--warning-ink); }
.fl-beat-bad { color: var(--error-ink); font-weight: 600; }
.fl-beat-none { color: var(--muted); }

.fl-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-6); }
.fl-board { gap: var(--space-6); }
.fl-board-reason { font-weight: 400; margin-left: var(--space-4); overflow-wrap: anywhere;
  white-space: normal; }

.fl-machines {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-12);
}
.fl-note { grid-column: 1 / -1; }
.fl-machine {
  display: flex; flex-direction: column; gap: var(--space-10); min-width: 0;
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--divider); border-radius: var(--radius-control);
  background: var(--wash-1);
}
.fl-machine.fl-state-bad { border-color: var(--edge-error); }
.fl-machine-head { display: flex; align-items: center; gap: var(--space-8); min-width: 0; }
.fl-machine-name {
  margin: 0; flex: 1; min-width: 0;
  font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-roles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fl-machine-name:not(.mono) { white-space: normal; }
.fl-role {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-6) var(--space-12); padding: var(--space-6) 0;
  border-top: 1px solid var(--divider);
}
.fl-role:first-child { border-top: 0; }
.fl-slotsets { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-12); min-width: 0; }
.fl-slotset { display: inline-flex; align-items: center; gap: var(--space-6); }
.fl-worker {
  color: var(--ink-secondary); font-size: var(--fs-small); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-slot-name { font: 400 var(--fs-small)/1 var(--font-ui); color: var(--ink-secondary); }
.fl-slots { display: inline-flex; align-items: center; gap: var(--space-4); }
/* One square per slot: outlined while idle, filled with the accent while busy. */
.fl-slot {
  width: 12px; height: 12px; border-radius: var(--radius-mark); flex: none;
  border: 1px solid var(--muted); background: transparent;
}
.fl-slot.is-busy { border-color: var(--accent-ink); background: var(--accent); }
.fl-slots-text { font: 400 var(--fs-small)/1 var(--font-ui); color: var(--muted); }
.fl-paused { flex: 1 0 100%; font: 400 var(--fs-small)/1.3 var(--font-ui); color: var(--warning-ink); }
.fl-caps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.pill.fl-cap { font-weight: 400; background: none; color: var(--muted); }
.fl-role .fl-caps { flex: 1 0 100%; }
.fl-res {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-4) var(--space-12); margin: 0; font: 400 var(--fs-small)/1.3 var(--font-ui);
}
.fl-res > div { display: flex; justify-content: space-between; gap: var(--space-8); }
.fl-res dt { color: var(--muted); }
.fl-res dd { margin: 0; color: var(--ink); text-align: right; white-space: nowrap; }
.fl-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4) var(--space-12);
  margin-top: auto; padding-top: var(--space-8); border-top: 1px solid var(--divider);
}

.fl-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-12); }
.fl-stat { padding: var(--space-10) var(--space-12); }
.fl-stat.is-warn { border-color: var(--edge-warning); background: var(--tint-warning); }
.fl-stat.is-warn .cfg-stat-v, .fl-stat.is-warn .cfg-stat-sub { color: var(--warning-ink); }
.fl-stat.is-error { border-color: var(--edge-error); background: var(--tint-error); }
.fl-stat.is-error .cfg-stat-v, .fl-stat.is-error .cfg-stat-sub { color: var(--error-ink); }

.fl-notes { gap: var(--space-6); }
.fl-notes .detail-v { font: 400 var(--fs-small)/1.3 var(--font-ui); }
#flStoppedBlock, #flStuckBlock { margin-top: var(--space-8); }
#flStoppedBlock .m-label, #flStuckBlock .m-label { margin-bottom: var(--space-4); }

/* Fixed layout: the headers align with their rows and a long error truncates in its own
   column instead of widening the table. */
.fl-table { table-layout: fixed; }
.fl-table td, .fl-table th { vertical-align: middle; overflow-wrap: anywhere; }
.fl-table-runs th:nth-child(1) { width: 28%; }
.fl-table-runs th:nth-child(2) { width: 14%; }
.fl-table-runs th:nth-child(4) { width: 9%; }
.fl-table-runs th:nth-child(5) { width: 17%; }
.fl-table-runs th:nth-child(6) { width: 15%; }
.fl-table-stuck th:nth-child(1) { width: 18%; }
.fl-table-stuck th:nth-child(2) { width: 28%; }
.fl-table-stuck th:nth-child(4) { width: 14%; }
.fl-table-stuck th:nth-child(5) { width: 16%; }
.fl-table-stopped th:nth-child(1) { width: 40%; }
.fl-table-stopped th:nth-child(3) { width: 12%; }
.fl-run-past td:not(.fl-status) { color: var(--muted); }
.fl-error { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.fl-confirm-row td { padding-top: 0; }
.fl-confirm-row .fl-restart { width: 100%; }

.fl-restart { display: inline-flex; flex-wrap: wrap; align-items: center; }
.fl-restart-confirm,
.fl-stuck-actions { gap: var(--space-6); }
.fl-restart-reason {
  height: 28px; flex: 1 1 12em; min-width: 0; max-width: 24em;
  font: 400 var(--fs-small)/1 var(--font-ui);
}
.fl-restart-flagged,
.fl-restart-ambiguous {
  font: 400 var(--fs-small)/1.3 var(--font-ui); color: var(--muted);
}

@media (max-width: 900px) {
  .fl-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .fl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fl-machines { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------- config admin */

.cfg-toolbar { margin-bottom: var(--space-4); }
.cfg-search { width: 100%; }
.cfg-group-label { font: 400 var(--fs-small)/1.2 var(--font-ui); color: var(--muted); }
.cfg-group-toggle { display: inline-flex; gap: var(--space-4); }
.btn-compact.active {
  background: var(--nav-active); color: var(--bg); border-color: transparent;
}
.cfg-row {
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-10);
  border: 1px solid var(--divider);
  border-radius: var(--radius-control);
  background: var(--wash-1);
  cursor: pointer;
  margin-bottom: var(--space-4);
}
.cfg-row:hover { background: var(--wash-hover); }
.cfg-row.batch-row { display: grid; grid-template-columns: 0.6fr 0.6fr 1fr 1.2fr 0.9fr; }
.cfg-row.users-row { display: grid; grid-template-columns: 1.6fr 1.2fr 0.6fr 0.7fr 0.8fr; }
.cfg-row.batch-child-row { display: grid; grid-template-columns: 1.1fr 0.6fr 1.7fr 0.8fr 0.9fr; }
/* The id wraps after its underscores rather than clipping (<wbr> from idHtml). */
.cfg-row .cfg-cell.cfg-cell-wrap { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.cfg-row.flight-row { display: grid; grid-template-columns: 24px 1.2fr 0.9fr 1.3fr 0.5fr 0.9fr; }
.cfg-row.flight-result-row { display: grid; grid-template-columns: 1fr 2fr; cursor: default; }
.cfg-row.flight-row.current { border-color: var(--edge-accent); background: var(--wash-hover); }
.cfg-row.flight-row.refused .cfg-cell-id { color: var(--muted); }
.cfg-row.cfg-row-head {
  background: none; border: none; cursor: default; margin-bottom: var(--space-2);
  color: var(--muted);
  font: 400 var(--fs-small)/1.2 var(--font-ui);
}
.cfg-row .cfg-cell-id {
  font: 600 var(--fs-body)/1.3 var(--font-ui);
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cfg-row .cfg-cell {
  font: 400 var(--fs-body)/1.3 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cfg-row .cfg-cell.mono { font-size: var(--fs-small); }
.cfg-row .pill { justify-self: end; }
.cfg-row mark {
  background: var(--tint-accent); color: var(--accent-ink);
  border-radius: var(--radius-mark); padding: 0 1px;
}
.cfg-row.cfg-empty {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-10);
  border-style: dashed; background: none; cursor: default;
}
/* A group's colour is hashed from its key, so shared offers read at a glance. */
.cfg-group {
  border-left: 3px solid var(--spine, var(--border));
  padding-left: var(--space-12);
  margin: var(--space-10) 0;
}
.cfg-group:first-child { margin-top: 0; }
.cfg-group-head {
  display: inline-flex; align-items: center; gap: var(--space-8);
  padding: var(--space-4) 0; margin-bottom: var(--space-6);
}
.cfg-group-name { font: 600 var(--fs-body)/1.2 var(--font-ui); color: var(--ink); }
.cfg-spine-chip {
  width: 10px; height: 10px; flex: none;
  border-radius: 50%;
  background: var(--spine, var(--border));
}
.cfg-row-ord {
  flex: none; width: 20px; align-self: center; text-align: right;
  color: var(--muted);
  font: 400 var(--fs-small)/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-16);
}
.cfg-grid .detail-row.wide { grid-column: 1 / -1; }
#fpDetail > .m-label.sub { margin: var(--space-16) 0 var(--space-8); }
.cfg-grid .detail-row > .mono, .cfg-grid .detail-row > .fact { overflow-wrap: anywhere; }
.batch-project-field { display: flex; gap: var(--space-8); align-items: flex-start; }
.batch-counts { display: flex; flex-wrap: wrap; gap: var(--space-8); }
/* ---- config project/offer editor: field grid, option row, list editors.
   Every field cell is label-above / one control row, so a row's controls share one line. */
#cfgProjectFields .cfg-grid, #cfgOfferFields .cfg-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-16);
}
#cfgProjectFields .cfg-grid .detail-row.span2 { grid-column: span 2; }
#cfgProjectFields > .m-section + .m-section, #cfgOfferFields > .m-section + .m-section {
  margin-top: var(--space-24); padding-top: var(--space-20);
  border-top: 1px solid var(--divider);
}
#cfgDetailView .field-control::placeholder { font-style: italic; }
.cfg-check {
  display: flex; align-items: center; gap: var(--space-8);
  height: var(--ctl-h); min-width: 0;
  font: 400 var(--fs-body)/1.3 var(--font-ui); color: var(--ink);
  cursor: pointer;
}
.cfg-check > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-check input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; margin: 0; }
/* the actions track is fixed so the header's empty last cell is as wide as a row's three buttons */
.cfg-list { --cfg-actions-w: calc(3 * 30px + 2 * var(--space-2)); }
.cfg-list-head, .cfg-list-row {
  display: grid; grid-template-columns: var(--cfg-list-cols);
  column-gap: var(--space-8); align-items: center;
}
.cfg-list-head { margin-bottom: var(--space-6); }
/* text starts where an input's text does: its 1px border plus its padding */
.cfg-list-head-cell {
  padding-left: calc(var(--space-10) + 1px);
  font: 400 var(--fs-small)/1.4 var(--font-ui); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cfg-list > .detail-rows { gap: var(--space-8); }
.cfg-list .select-wrap { min-width: 0; }
.cfg-cell-field { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.cfg-cell-k { display: none; font: 400 var(--fs-small)/1.3 var(--font-ui); color: var(--muted); }
.cfg-row-actions { display: inline-flex; align-items: center; gap: var(--space-2); }
.cfg-row-actions .iconbtn { width: 30px; height: var(--ctl-h); }
.cfg-row-actions .iconbtn:disabled { opacity: 1; color: var(--border); }
.cfg-list > .hint { margin: 0; }
.cfg-list > .cfg-list-add { display: flex; width: fit-content; margin-top: var(--space-12); }

@media (max-width: 900px) {
  #cfgProjectFields .cfg-grid, #cfgOfferFields .cfg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #cfgProjectFields .cfg-grid, #cfgOfferFields .cfg-grid { grid-template-columns: minmax(0, 1fr); }
  #cfgProjectFields .cfg-grid .detail-row.span2 { grid-column: 1 / -1; }
  /* rows stack: first field beside the actions, every further field on its own line */
  .cfg-list-head { display: none; }
  .cfg-list-row {
    grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--space-6);
    padding-bottom: var(--space-8); border-bottom: 1px solid var(--divider);
  }
  .cfg-list-row > * { grid-column: 1 / -1; }
  /* :where() keeps these at the specificity of the placements below, which must win */
  :where(.cfg-list.numbered) .cfg-list-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  :where(.cfg-list.numbered) .cfg-list-row > * { grid-column: 2 / -1; }
  .cfg-list-row > .cfg-row-ord { grid-column: 1; grid-row: 1; }
  .cfg-list-row > :first-child:not(.cfg-row-ord) { grid-column: 1; grid-row: 1; }
  .cfg-list-row > .cfg-row-ord + * { grid-column: 2; grid-row: 1; }
  .cfg-list-row > .cfg-row-actions { grid-column: -2; grid-row: 1; align-self: end; }
  .cfg-list-row > .cfg-row-ord { align-self: end; line-height: var(--ctl-h); }
  .cfg-cell-k { display: block; }
}
.cfg-copy-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8);
  margin-top: var(--space-8);
}
.cfg-copy-note { flex-basis: 100%; margin: 0; }
.cfg-copy-form .field-control { flex: 1; min-width: 0; }
.cfg-action-bar {
  display: flex; align-items: center; gap: var(--space-10);
  padding-top: var(--space-12);
  border-top: 1px solid var(--divider);
}
.cfg-action-bar-spacer { flex: 1; }
.cfg-dirty-pill {
  font: 600 var(--fs-small)/1 var(--font-ui);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-pill);
  color: var(--warning-ink); background: var(--tint-warning);
  border: 1px solid var(--edge-warning);
}

@media (max-width: 700px) {
  .cfg-row.batch-row { grid-template-columns: 0.6fr 1fr 1.2fr; }
  .cfg-row.batch-row > :nth-child(2), .cfg-row.batch-row > :nth-child(5) { display: none; }
  .cfg-row.users-row { grid-template-columns: 1.6fr 1fr 0.7fr; }
  .cfg-row.users-row > :nth-child(2), .cfg-row.users-row > :nth-child(5) { display: none; }
  .cfg-row.batch-child-row { grid-template-columns: 1.2fr 0.7fr 0.9fr; }
  .cfg-row.batch-child-row > :nth-child(3), .cfg-row.batch-child-row > :nth-child(5) { display: none; }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .board, .board-head, .issues { width: calc(100% - 2 * var(--space-16)); }
  .board { flex-wrap: wrap; --col-body-max: min(760px, 70vh); }
  .column { flex: 0 1 calc(50% - var(--space-4)); }
}
@media (max-width: 1100px) {
  .modal-body { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-24); }
}
@media (max-width: 980px) {
  .topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding: var(--space-8) var(--space-16); }
  .topnav { order: 10; width: 100%; margin-left: 0; }
  .modal-body { display: flex; flex-direction: column; }
  #overlay .modal-body {
    display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "files" "side" "main"; grid-template-rows: none;
    row-gap: var(--space-24);
  }
}

/* FLIGHT PLANNING: the config row idiom plus a pick box per row. */
.fp-toolbar { display: flex; gap: var(--space-8); align-items: center; }
.fp-toolbar .cfg-search { flex: 1; width: auto; }
.fp-filter { flex: 0 0 160px; }
.flight-row input[type="checkbox"], .cfg-row-head input[type="checkbox"] {
  accent-color: var(--accent); margin: 0; cursor: pointer; width: 16px; height: 16px;
}
.flight-row input[type="checkbox"]:disabled { cursor: not-allowed; }
.fp-why {
  display: block;
  font: 400 var(--fs-small)/1.4 var(--font-ui);
  color: var(--muted);
  white-space: normal;
}
.fp-ok { color: var(--accent-ink); }
.fp-refused { color: var(--error-ink); }
/* ---- config page: the list beside the open record, and the project dashboard.
   The panes switch on their own width, not the viewport: the config modal is fixed-width,
   so a viewport breakpoint would leave a half-width detail pane cramped. */
.cfg-panes { container: cfg-panes / inline-size; }
#cfgDetailView { container: cfg-detail / inline-size; min-width: 0; }
.cfg-placeholder {
  font: 400 var(--fs-body)/1.5 var(--font-ui);
  color: var(--muted);
  text-align: center;
  padding: var(--space-32) var(--space-24);
  border: 1px dashed var(--divider);
  border-radius: var(--radius-card);
}
.cfg-row.is-selected { border-color: var(--edge-accent); background: var(--wash-hover); }
.cfg-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-12);
  margin-bottom: var(--space-20);
}
.cfg-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--divider);
  border-radius: var(--radius-control);
  background: var(--wash-1);
}
.cfg-stat-k { font: 400 var(--fs-small)/1.2 var(--font-ui); color: var(--muted); }
.cfg-stat-v {
  font: 600 var(--fs-title)/1.2 var(--font-ui);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
/* The face comes from .mono.mono; body size keeps a campaign id from wrapping in its tile. */
.cfg-stat-v.mono { font-size: var(--fs-body); }
.cfg-stat-sub { font: 400 var(--fs-small)/1.4 var(--font-ui); color: var(--muted); overflow-wrap: anywhere; }
.cfg-stat-sub:empty { display: none; }

/* The modal keeps one height and each pane scrolls on its own, so the list stays in view
   beside a long record and the record's Save stays in reach. */
.modal.modal-cfg { height: calc(100vh - 2 * var(--space-24)); }
.modal-cfg .modal-body { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 0; }
.modal-cfg .modal-main, .cfg-panes { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cfg-split {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  gap: var(--space-24);
}
.cfg-list-pane, #cfgDetailView { min-height: 0; overflow-y: auto; }
.cfg-placeholder { align-self: start; }

.cfg-list-top {
  position: sticky; top: 0; z-index: 1;
  display: flex; flex-direction: column; gap: var(--space-10);
  padding-bottom: var(--space-12);
  background: var(--panel-solid);
}
.cfg-tabbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-8); }
.cfg-tabs { display: inline-flex; gap: var(--space-4); }
.cfg-tab[aria-selected="true"], .cfg-tab[aria-selected="true"]:hover {
  background: var(--nav-active); color: var(--bg);
}
.cfg-tab[aria-selected="true"] .progress-pill { color: inherit; background: none; border-color: currentColor; }
.cfg-list-tools {
  display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap;
  margin-bottom: var(--space-12);
}
.cfg-list-section { padding-bottom: var(--space-24); }

/* A record row: the id and its version on top, the facts the group does not already name under it. */
.cfg-row.cfg-rec {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  row-gap: var(--space-2); column-gap: var(--space-8);
}
.cfg-rec-id {
  font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink);
  overflow-wrap: anywhere;
}
.cfg-rec-meta {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; column-gap: var(--space-12); row-gap: var(--space-2);
  font: 400 var(--fs-small)/1.4 var(--font-ui); color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.cfg-rec-meta > * { overflow-wrap: anywhere; min-width: 0; }

.cfg-detail-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-10);
  padding-bottom: var(--space-12); margin-bottom: var(--space-16);
  border-bottom: 1px solid var(--divider);
  background: var(--panel-solid);
}
.cfg-detail-title {
  flex: 1 1 12rem; min-width: 0; margin: 0;
  font: 600 var(--fs-heading)/1.3 var(--font-ui); color: var(--ink);
  overflow-wrap: anywhere;
}
.cfg-detail-head + .cfg-copy-form { margin: 0 0 var(--space-16); }
#cfgDetailView .cfg-action-bar {
  position: sticky; bottom: 0; z-index: 1;
  flex-wrap: wrap; justify-content: flex-end;
  margin-top: var(--space-24);
  padding: var(--space-12) 0 var(--space-16);
  background: var(--panel-solid);
}

@container cfg-panes (min-width: 720px) {
  .cfg-split { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
  .cfg-list-pane { padding-right: var(--space-16); border-right: 1px solid var(--divider); }
  .cfg-back-narrow { display: none; }
}
@container cfg-panes (max-width: 719px) {
  .cfg-split.cfg-has-detail > #cfgListView { display: none; }
  .cfg-placeholder { display: none; }
}
@container cfg-detail (max-width: 760px) {
  #cfgProjectFields .cfg-grid, #cfgOfferFields .cfg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container cfg-detail (max-width: 520px) {
  #cfgProjectFields .cfg-grid, #cfgOfferFields .cfg-grid { grid-template-columns: minmax(0, 1fr); }
  #cfgProjectFields .cfg-grid .detail-row.span2 { grid-column: 1 / -1; }
  .cfg-stat-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- planning boards
   Dedicated classes: the campaign `.card` has a fixed height built from rows
   a planning card does not have. */

.board.classical { flex-direction: column; gap: var(--space-12); }
.cb-head { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
.cb-lane { display: flex; gap: var(--space-8); align-items: flex-start; overflow-x: auto; }
.cb-column { flex: 1 0 240px; max-width: 360px; min-height: 0; }
.cb-tag {
  font: 400 var(--fs-small)/1 var(--font-ui); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-6); flex: none;
}
.cb-card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-10) var(--space-12);
  margin: 0 var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-6);
}
.cb-card:hover { background: var(--card-hover); }
.cb-card-title { margin: 0; font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink); overflow-wrap: anywhere; }
.cb-card-text {
  margin: 0; font: 400 var(--fs-small)/1.5 var(--font-ui); color: var(--ink-secondary);
  white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.cb-card-meta { margin: 0; font: 400 var(--fs-small)/1 var(--font-ui); color: var(--muted); }
.cb-card-bar, .cb-dialog-bar { display: flex; align-items: center; gap: var(--space-8); }
.cb-dialog-bar { margin-top: var(--space-8); }
.cb-bar-spacer { flex: 1; }
.cb-empty { margin: var(--space-48) auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-12); }
.cb-empty-title { margin: 0; font: 600 var(--fs-title)/1.2 var(--font-ui); color: var(--ink); }
.cb-check { display: flex; align-items: center; gap: var(--space-8); font: 400 var(--fs-body)/1.3 var(--font-ui); color: var(--ink); }
.modal-cb { width: min(520px, 100%); }
.modal-cb .modal-body { display: block; }
.navbtn.cb-add { color: var(--muted); }

/* ---- flight planning, rhythm tab. Windows, not days; every colour is a token above.
   Layout switches on the pane's own width, not the viewport (the modal is fixed-width). */
.modal.fp-wide { width: min(1240px, 100%); }
.fp-tabs { padding: 0 var(--space-24); flex: none; }
.fp-rhythm { container: fp-rh / inline-size; gap: var(--space-20); }
.fp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fp-kpis .cfg-stat-v { font: 600 var(--fs-display)/1.1 var(--font-ui); }
.fp-rh-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--space-16); }
.fp-card {
  display: flex; flex-direction: column; gap: var(--space-10); min-width: 0;
  padding: var(--space-16);
  background: var(--card); border: 1px solid var(--divider); border-radius: var(--radius-card);
}
.fp-card-head { display: flex; align-items: center; gap: var(--space-8); }
.fp-card-head .m-label { flex: none; }
.fp-due-spacer { flex: 1; }
.fp-type { flex: 0 0 140px; }
.fp-empty { padding: var(--space-8) 0; }

.fp-due-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.fp-due-row {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center;
  gap: var(--space-12); padding: var(--space-8) 0;
  border-top: 1px solid var(--divider);
}
.fp-due-row:first-child { border-top: none; }
.fp-due-row.is-settled .fp-site-label { color: var(--muted); }
.fp-due-row input[type="checkbox"], .fp-toggle input { accent-color: var(--accent); margin: 0; width: 16px; height: 16px; cursor: pointer; }
.fp-due-row input:disabled, .fp-toggle input:disabled { cursor: not-allowed; }
.fp-due-text { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.fp-site-label {
  font: 600 var(--fs-body)/1.3 var(--font-ui); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fp-site-sub { font: 400 var(--fs-small)/1.4 var(--font-ui); color: var(--muted); overflow-wrap: anywhere; }
.fp-answer { font: 400 var(--fs-small)/1.4 var(--font-ui); text-align: right; overflow-wrap: anywhere; }
.fp-due-foot { display: flex; align-items: center; gap: var(--space-8); padding-top: var(--space-8); border-top: 1px solid var(--divider); }
.fp-toggle { display: inline-flex; align-items: center; gap: var(--space-8); font: 400 var(--fs-body)/1 var(--font-ui); color: var(--ink-secondary); cursor: pointer; }
.fp-confirm {
  display: flex; flex-direction: column; gap: var(--space-10);
  padding: var(--space-12); border: 1px solid var(--edge-accent); border-radius: var(--radius-control);
  background: var(--tint-accent);
}
.fp-confirm p { margin: 0; font: 400 var(--fs-body)/1.5 var(--font-ui); color: var(--ink); overflow-wrap: anywhere; }
.fp-confirm-act { display: flex; justify-content: flex-end; gap: var(--space-8); }

.fp-pill {
  display: inline-block; white-space: nowrap;
  font: 400 var(--fs-small)/1 var(--font-ui); color: var(--ink-secondary);
  padding: var(--space-4) var(--space-8); border-radius: var(--radius-pill);
  border: 1px solid var(--divider); background: var(--wash-2);
}
.fp-pill:empty { display: none; }
.fp-pill.is-due { color: var(--warning-ink); border-color: var(--edge-warning); background: var(--tint-warning); }
.fp-pill.is-unconfirmed { color: var(--accent-ink); border-color: var(--edge-accent); background: var(--tint-accent); }
.fp-pill.is-overdue { color: var(--error-ink); border-color: var(--edge-error); background: var(--tint-error); }

/* The load chart: bars are plain SVG, labels are HTML so they stay 12px at any width. */
.fp-chart { padding-left: 28px; flex: 1; display: flex; flex-direction: column; }
.fp-plot { position: relative; flex: 1; min-height: 140px; }
.fp-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.fp-yl {
  position: absolute; right: calc(100% + 6px); transform: translateY(-50%);
  font: 400 var(--fs-small)/1 var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums;
}
.fp-yl:first-child { transform: none; }
.fp-xaxis { position: relative; height: 20px; border-top: 1px solid var(--border); }
.fp-xl {
  position: absolute; top: var(--space-4); transform: translateX(-50%);
  font: 400 var(--fs-small)/1 var(--font-ui); color: var(--muted);
}
.fp-grid { stroke: var(--divider); stroke-width: 1; vector-effect: non-scaling-stroke; }
.fp-zone { fill: var(--wash-2); }
.fp-bar { fill: var(--accent); }
.fp-bar-fc {
  fill: var(--tint-accent); stroke: var(--accent-ink); stroke-width: 1.5;
  stroke-dasharray: 3 2; vector-effect: non-scaling-stroke;
}
.fp-bar-hit { fill: transparent; }
.fp-bar-hit:hover { fill: var(--wash-hover); }
.fp-legend { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-16); font: 400 var(--fs-small)/1.4 var(--font-ui); color: var(--muted); }
.fp-legend span { display: inline-flex; align-items: center; gap: var(--space-6); }
.fp-sw { width: 12px; height: 12px; border-radius: 2px; background: var(--accent); }
.fp-sw.is-fc { background: var(--tint-accent); border: 1.5px dashed var(--accent-ink); }

/* One row per site: name, window state, 12-month strip, gap bars, ticket button. */
.fp-sites { display: flex; flex-direction: column; }
.fp-sites-scroll { max-height: 320px; overflow-y: auto; }
.fp-sites-head { flex-wrap: wrap; }
.fp-site-tools { display: inline-flex; align-items: center; gap: var(--space-16); }
.fp-site-search { width: 200px; }
.fp-site {
  display: grid; align-items: center; gap: var(--space-12);
  grid-template-columns: minmax(150px, 1fr) minmax(210px, 1.2fr) minmax(170px, 1.4fr) 110px 120px;
  padding: var(--space-8) var(--space-4); border-top: 1px solid var(--divider);
}
.fp-site:hover { background: var(--wash-1); }
.fp-site-head {
  border-top: none; padding-block: var(--space-4);
  font: 400 var(--fs-small)/1.2 var(--font-ui); color: var(--muted);
}
.fp-site-head:hover { background: none; }
.fp-site.is-inactive .fp-site-label { color: var(--muted); }
.fp-site-name, .fp-site-status { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); min-width: 0; }
.fp-site-name .fp-site-label { max-width: 100%; }
.fp-site-act { display: flex; justify-content: flex-end; }
.fp-site-act .btn-compact { white-space: nowrap; }

.fp-tl { display: block; width: 100%; height: 28px; }
.fp-tl-grid { stroke: var(--divider); stroke-width: 1; vector-effect: non-scaling-stroke; }
.fp-tl-now { stroke: var(--ink-secondary); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.fp-tl-win { fill: var(--tint-warning); stroke: var(--edge-warning); stroke-width: 1; vector-effect: non-scaling-stroke; }
.fp-tl-win.is-overdue { fill: var(--tint-error); stroke: var(--edge-error); }
.fp-tl-tick { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }

.fp-adh { display: inline-flex; align-items: center; gap: var(--space-8); }
.fp-adh svg { flex: none; }
.fp-adh-band { fill: var(--wash-hover); }
.fp-adh-target { stroke: var(--ink-secondary); stroke-width: 1; stroke-dasharray: 2 2; }
.fp-adh-bar { fill: var(--accent); }
.fp-adh-bar.is-late { fill: var(--warning); }
/* An inferred or changed rhythm under a site's status: the line, then its buttons. */
.fp-rh-line { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); }
.fp-rh-act { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.fp-rh-act .btn-compact { white-space: nowrap; }
.fp-rh-differs { color: var(--warning-ink); }

/* The flight rhythm form: the Change dialog and the project editor's section. */
.rf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-12) var(--space-16); }
.rf-grid .detail-row[hidden] { display: none; }
.rf-actions { display: flex; justify-content: flex-end; margin-top: var(--space-12); }
#cfgPRhythm > .hint { margin: 0 0 var(--space-12); }
@media (max-width: 560px) { .rf-grid { grid-template-columns: minmax(0, 1fr); } }

.fp-adh-pct { font: 600 var(--fs-small)/1 var(--font-ui); color: var(--ink-secondary); font-variant-numeric: tabular-nums; }

@container fp-rh (max-width: 900px) {
  .fp-rh-top { grid-template-columns: minmax(0, 1fr); }
  .fp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fp-site {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name act" "status status" "tl tl" "adh adh";
    row-gap: var(--space-8);
  }
  .fp-site-name { grid-area: name; }
  .fp-site-act { grid-area: act; }
  .fp-site-status { grid-area: status; }
  .fp-site-tl { grid-area: tl; }
  .fp-site-adh { grid-area: adh; }
  .fp-site-adh:empty { display: none; }
  .fp-site-head { display: none; }
}
@container fp-rh (max-width: 520px) {
  .fp-due-row { grid-template-columns: 16px minmax(0, 1fr); align-items: start; }
  .fp-due-row > :nth-child(3) { grid-column: 2; justify-self: start; text-align: left; }
  .fp-answer { text-align: left; }
  .fp-site-search { width: 100%; }
  .fp-site-tools { width: 100%; flex-wrap: wrap; }
}
