/* ── Reparto: the planner ────────────────────────────────────
 * Tokens come from CDN base.css and the :root block in style.css. This file
 * only lays out the tool. Status colour always travels with an icon and a
 * word (see render-board.js status()), so no state is colour alone.
 */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* White on teal-500 is 2.5:1; ink on teal clears 7:1. */
.btn--primary, .btn--primary:hover { color: #042f2c; }

.plan {
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ── The formula ───────────────────────────────────────────── */
.calc {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6) var(--space-6);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.calc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4); }
.calc-title {
  font-size: var(--text-sm); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
}
.calc-lead { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
.calc-lead strong { color: var(--accent-bright); }

.calc-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3) var(--space-2);
}
.term {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 76px; padding: var(--space-2) var(--space-2) 0;
  text-align: center;
}
.term-val { min-height: 44px; display: flex; align-items: center; }
.term-num, .term-select {
  font-size: 1.75rem; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.term-select {
  appearance: none; -webkit-appearance: none;
  font-family: inherit;
  background: transparent;
  border: 0;
  border-bottom: 2px dashed var(--border-strong);
  border-radius: 0;
  padding: 0 4px;
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  transition: border-color var(--dur);
}
.term-select:hover, .term-select:focus-visible { border-bottom-color: var(--accent-bright); }
.term-select option { background: var(--surface-solid); color: var(--text-primary); font-size: var(--text-base); }
.term-lbl { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.term-sub {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  margin-top: var(--space-1);
}
.term-sub .term-select, .mini .term-select {
  font-size: var(--text-xs); font-weight: 600; border-bottom-width: 1px; padding: 2px 2px;
}
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.op {
  align-self: flex-start;
  padding-top: calc(var(--space-2) + 6px);
  font-size: 1.35rem; color: var(--text-muted); font-weight: 300;
}
.term--result .term-num { color: var(--text-secondary); }
.term--final {
  padding: var(--space-2) var(--space-4) var(--space-2);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.term--final .term-num { color: var(--accent-bright); font-size: 2.1rem; }
.term--final .term-lbl { color: var(--text-secondary); }

/* ── Calendar row ──────────────────────────────────────────── */
.term-note { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.cal {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.cal-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); }
.cal-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.field--date { width: auto; min-width: 150px; color-scheme: dark; font-variant-numeric: tabular-nums; }
.field--country { width: 220px; }
.cal-field--countries { flex: 1 1 420px; }
.country-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.country-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 2px; }
.country-default { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.chip-btn--on {
  padding-right: 2px; cursor: default;
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.day-cc {
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  color: var(--info); padding-right: 2px;
}
.cal-range { font-size: var(--text-sm); color: var(--text-secondary); padding-bottom: 8px; }
.cal-range strong { color: var(--text-primary); font-weight: 600; }
.sprint-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.sprint-strip li {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 4px;
  font-size: var(--text-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums;
  background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: 999px;
}
.sprint-n {
  display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 4px;
  font-size: 10px; font-weight: 800; color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 16%, transparent); border-radius: 999px;
}
.cal-days { display: flex; flex-direction: column; gap: 8px; }
.cal-days-head { font-size: var(--text-xs); color: var(--text-muted); }
.day-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.day-chips:empty { display: none; }
.day-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 26px; padding: 0 4px 0 10px;
  font-size: var(--text-xs); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 999px;
}
.day-chip--holiday { padding-right: 10px; border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.day-chip--team { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.day-chip--muted { opacity: .6; border-style: dashed; }
.day-date { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.day-x {
  display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0;
  color: var(--text-muted); background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.day-x:hover { color: var(--text-primary); background: rgba(255, 255, 255, .1); }
.day-add { display: flex; flex-wrap: wrap; gap: 6px; }
.day-add .field:not(.field--date) { width: 200px; }

/* Vacations in the person editor */
.vac { border: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vac-list { list-style: none; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.vac-list:empty { display: none; }
.vac-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vac-row .field.field--date { min-width: 0; width: 150px; }
.vac-to { font-size: var(--text-xs); color: var(--text-muted); }
.vac-days { font-size: var(--text-xs); color: var(--text-secondary); min-width: 96px; font-variant-numeric: tabular-nums; }

/* The formula wraps between pairs, never after an operator */
.chain-pair { display: flex; align-items: flex-start; gap: var(--space-2); }

/* The calendar folds to one line; <details> gives the toggle and its keyboard for free */
.cal { padding-top: var(--space-3); }
.cal-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  cursor: pointer; list-style: none;
  font-size: var(--text-sm); color: var(--text-secondary);
}
.cal-summary::-webkit-details-marker { display: none; }
.cal-summary::before {
  content: ''; align-self: center; width: 7px; height: 7px; margin-right: 2px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg); transition: transform var(--dur) var(--ease-out);
}
.cal[open] > .cal-summary::before { transform: rotate(45deg); }
.cal-summary-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.cal[open] > .cal-summary { margin-bottom: var(--space-3); }
.cal:not([open]) { gap: 0; }

/* One-line flag summary above the board, where the panel is not beside it */
.flag-bar {
  display: none;
  position: sticky; top: 64px; z-index: 5;
  align-items: center; gap: 6px 12px; flex-wrap: wrap;
  padding: 8px 12px;
  font-size: var(--text-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(2, 6, 23, .45);
}
.fb-count { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.fb-count--error { color: var(--err); }
.fb-count--warn { color: var(--warn); }
.fb-count--ok { color: var(--ok); }
.fb-top { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; flex: 1; min-width: 0; }
.fb-top .flag-text { font-size: var(--text-sm); }
.fb-all { font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.fb-all:hover { color: var(--text-primary); }

/* ── Chips (presets, toggles, filters) ─────────────────────── */
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 10px;
  font: inherit; font-size: var(--text-xs); font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur);
}
.chip-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-primary); }
.chip-btn[aria-pressed="true"] {
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.chip-btn:disabled { opacity: .45; cursor: default; }
.chip-n { font-variant-numeric: tabular-nums; opacity: .8; }

/* ── Totals ────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.tile {
  display: flex; flex-direction: column; gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tile-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.tile-value { display: flex; align-items: baseline; gap: 6px; }
.tile-num { font-size: 1.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-unit { font-size: var(--text-sm); color: var(--text-muted); }
.tile-sub { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.45; }
.tile-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.tile-meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.tile--error { border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.tile--error .tile-num { color: var(--err); }
.tile--ok .tile-num { color: var(--ok); }
.warn-text { color: var(--warn); }
.error-text { color: var(--err); }

/* ── Workspace: roster | board | flags ─────────────────────── */
.workspace, .workspace-main {
  display: grid;
  gap: var(--space-6);
  align-items: start;
}
.workspace { grid-template-columns: minmax(0, 1fr) 320px; }
.workspace-main { grid-template-columns: 300px minmax(0, 1fr); }
.workspace > *, .workspace-main > * { min-width: 0; }

.roster, .flags {
  position: sticky; top: 68px;
  max-height: calc(100dvh - 144px);   /* clears the beacon and back-to-top in the corners */
  overflow: auto;
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  scrollbar-width: thin;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.panel-title { font-size: var(--text-sm); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.panel-count { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.panel-tip { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.55; }

.roster-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.roster-empty { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.5; padding: var(--space-2) 0; }
.roster.drop-target { box-shadow: inset 0 0 0 2px var(--err); }

.person {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 12px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: border-color var(--dur), background-color var(--dur);
}
.person:hover { border-color: var(--border-strong); }
.person:active { cursor: grabbing; }
.person--open { border-style: dashed; }
.person-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.person-name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-role { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-cap { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; font-variant-numeric: tabular-nums; }
.person-cap b { font-size: var(--text-base); }
.person-cap small { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.person--over .person-cap b, .person--over .person-cap small { color: var(--err); }
.person--full .person-cap b { color: var(--text-muted); }
.cap-bar { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.cap-bar i { display: block; height: 100%; background: var(--accent); }
.person--over .cap-bar i { background: var(--err); }
.tag {
  display: inline-block; flex-shrink: 0; margin-right: 5px; padding: 0 4px; line-height: 1.35;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); border-radius: 3px;
  vertical-align: 1px;
}

.face {
  width: 32px; height: 32px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--face);
}
.face--sm { width: 22px; height: 22px; font-size: 9px; }
.face--open { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.person-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.person-line .fbadge { height: 17px; padding: 0 5px; font-size: 10px; flex-shrink: 0; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  color: var(--text-muted); background: transparent;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--dur), background-color var(--dur);
}
.icon-btn:hover { color: var(--text-primary); background: var(--surface-2); }

.field {
  min-height: 36px; padding: 0 10px; width: 100%;
  font: inherit; font-size: var(--text-sm); color: var(--text-primary);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.field { border-color: color-mix(in srgb, var(--text-muted) 70%, transparent); }  /* 3:1 against the surface */
.field::placeholder { color: var(--text-muted); opacity: 1; }
.field:focus { outline: none; border-color: var(--accent-bright); }
.field.field--date { width: auto; min-width: 150px; }
.field.field--country { width: 220px; }
.field.field--num { width: 64px; }
.field--num { width: 64px; text-align: center; font-variant-numeric: tabular-nums; padding: 0 4px; }
select.field option { background: var(--surface-solid); }
.roster-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }

/* ── Board ─────────────────────────────────────────────────── */
.board { display: flex; flex-direction: column; gap: var(--space-4); }
.board-head { display: flex; align-items: center; gap: var(--space-3); }
.plan-title {
  flex: 1; min-width: 0;
  font: inherit; font-size: var(--text-xl); font-weight: 700; color: var(--text-primary);
  background: transparent; border: 0; border-bottom: 1px solid transparent; padding: 4px 0;
}
.plan-title:hover { border-bottom-color: var(--border); }
.plan-title:focus { outline: none; border-bottom-color: var(--accent-bright); }

.carry-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: var(--radius);
}

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }

.deliv {
  display: flex; flex-direction: column; gap: 10px;
  padding: var(--space-3) var(--space-4) var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
}
.deliv:hover { border-color: var(--border-strong); }
.deliv-head { display: flex; align-items: center; gap: 6px; }
.deliv-name {
  flex: 1; min-width: 0;
  font: inherit; font-size: var(--text-base); font-weight: 600; color: var(--text-primary);
  background: transparent; border: 0; border-bottom: 1px solid transparent; padding: 3px 0;
  text-overflow: ellipsis;
}
.deliv-name::placeholder { color: var(--text-muted); font-weight: 400; font-style: italic; }
.deliv-name:hover { border-bottom-color: var(--border); }
.deliv-name:focus { outline: none; border-bottom-color: var(--accent-bright); }

.est {
  display: inline-flex; align-items: baseline; gap: 3px;
  min-height: 34px; padding: 0 10px;
  font: inherit; color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--dur);
}
.est:hover { border-color: var(--accent-bright); }
.est-num { font-size: var(--text-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.est-unit { font-size: 10px; color: var(--text-muted); }
.est--missing { border-style: dashed; border-color: var(--warn); }
.est--missing .est-num { color: var(--warn); }

.deliv-meter { display: flex; gap: 2px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.deliv-meter i { display: block; height: 100%; }
.m-got { background: var(--accent); border-radius: 3px 0 0 3px; }
.deliv--ok .m-got { border-radius: 3px; }
.m-over { background: var(--err); border-radius: 0 3px 3px 0; }
.deliv-meter--unsized { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, transparent 4px 8px); }

.deliv-status { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--st); }
.status-icon {
  display: inline-grid; place-items: center; width: 16px; height: 16px;
  border-radius: 50%; font-size: 10px; font-weight: 800; line-height: 1;
  color: var(--surface-solid); background: var(--st);
}
.status--ok { --st: var(--ok); }
.status--short, .status--empty { --st: var(--err); }
.status--over, .status--unsized { --st: var(--warn); }

.shares { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.share {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 3px 3px 4px;
  font-size: var(--text-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.share:hover { border-color: var(--border-strong); }
.share--open { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.share--over .share-pts { color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, transparent); }
.share-name { max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.share-pts {
  min-width: 28px; height: 22px; padding: 0 6px;
  font: inherit; font-size: var(--text-xs); font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text-primary); background: rgba(255, 255, 255, .08);
  border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer;
}
.share-pts:hover { border-color: var(--accent-bright); }
.share-pts { display: inline-flex; align-items: baseline; gap: 4px; }
.share-pct { font-size: 10px; font-weight: 600; color: var(--text-muted); }

/* How one person's time is split (person editor) */
.dist { border: 0; display: flex; flex-direction: column; gap: 8px; }
.dist-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dist-list:empty { display: none; }
.dist-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto 64px auto; align-items: center; gap: 6px; }
.dist-name { font-size: var(--text-sm); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-row .field.field--num { width: 72px; }
.dist-unit { font-size: var(--text-xs); color: var(--text-muted); }
.dist-pts { font-size: var(--text-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; text-align: right; }
.dist-total { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.dist-meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.dist-meter i { display: block; height: 100%; background: var(--accent); }
.dist-empty { color: var(--text-muted); }
.dist-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dist-actions .field { width: auto; min-width: 200px; }
.share-x {
  display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0;
  color: var(--text-muted); background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.share-x:hover { color: var(--text-primary); background: rgba(255, 255, 255, .1); }

.drop-hint {
  padding: var(--space-3); text-align: center;
  font-size: var(--text-xs); color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
}
.drop-btn {
  min-height: 36px; padding: 0 var(--space-3);
  font: inherit; font-size: var(--text-xs); font-weight: 700; color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: var(--radius-sm); cursor: pointer;
}
.drop-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.deliv-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  margin-top: auto; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.deliv-foot .icon-btn { width: 26px; height: 26px; }

.deliv-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 150px;
  font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--dur), border-color var(--dur);
}
.deliv-add:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.deliv-add span { font-size: 1.4rem; font-weight: 300; }

/* Drag states */
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
body.is-dragging .deliv { border-style: dashed; }
.is-drag-source { opacity: .4; }
.drop-target.deliv, .deliv.drop-target {
  border-style: solid;
  border-color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: 0 0 0 1px var(--accent-bright);
}
.is-carried { border-color: var(--accent-bright); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.deliv.is-target { cursor: copy; }
.drag-ghost {
  position: fixed; z-index: var(--z-toast); pointer-events: none;
  display: grid; justify-items: center; gap: 3px;
  transform: translate(-50%, -50%) scale(1.1);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .6));
}
.drag-ghost .face { width: 40px; height: 40px; font-size: 14px; box-shadow: 0 0 0 2px #fff; }
.ghost-hint {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #042f2c; background: var(--accent-bright); border-radius: 3px; padding: 1px 5px;
}
.ghost-hint:empty { display: none; }

/* Flag -> target pulse */
@keyframes flagged {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-bright) 55%, transparent); }
}
.is-focus { animation: flagged 1.1s var(--ease-out) 2; border-color: var(--accent-bright); }

/* Flag badges on cards and people */
.fbadge {
  display: inline-flex; align-items: center; gap: 2px;
  height: 20px; padding: 0 6px;
  font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums;
  border-radius: 999px; white-space: nowrap;
}
.fbadge--error { color: var(--err); background: color-mix(in srgb, var(--err) 14%, transparent); }
.fbadge--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

/* ── Flags panel ───────────────────────────────────────────── */
.flag-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.flag {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px;
  padding: 10px 10px 10px 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--flag, var(--border)) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--flag, var(--border)) 35%, transparent);
}
.flag--error { --flag: var(--err); }
.flag--warn { --flag: var(--warn); }
.flag--info { --flag: var(--info); }
.flag-icon {
  display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px;
  border-radius: 50%; font-size: 12px; font-weight: 800;
  color: var(--surface-solid); background: var(--flag);
}
.flag-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.flag-text {
  padding: 0; text-align: left;
  font: inherit; font-size: var(--text-sm); line-height: 1.45; color: var(--text-primary);
  background: none; border: 0;
}
button.flag-text { cursor: pointer; }
button.flag-text:hover { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.flag-meta { font-size: 11px; color: var(--text-muted); }
.flag-fix {
  padding: 0; font: inherit; font-weight: 700; color: var(--accent-bright);
  background: none; border: 0; cursor: pointer;
}
.flag-fix:hover { text-decoration: underline; text-underline-offset: 3px; }
.flag-empty { font-size: var(--text-sm); color: var(--ok); line-height: 1.5; padding: var(--space-2) 0; }
.flag-more {
  align-self: flex-start; padding: 0;
  font: inherit; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted);
  background: none; border: 0; cursor: pointer;
}
.flag-more:hover { color: var(--text-primary); }

/* ── Popover ───────────────────────────────────────────────── */
.pop {
  position: fixed; z-index: var(--z-pop);
  width: min(360px, calc(100vw - 16px));
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
}
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.pop-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scale { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.scale-btn {
  min-height: 38px; padding: 0 6px;
  font: inherit; font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.scale-btn:hover { border-color: var(--accent-bright); }
.scale-btn[aria-pressed="true"] { color: #042f2c; background: var(--accent-bright); border-color: var(--accent-bright); }
.scale-btn--suggest { min-height: 30px; min-width: 42px; color: var(--accent-bright); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.pop-calc { display: flex; flex-direction: column; gap: 8px; padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.pop-label { font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); }
.pop-row { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; }
.pop-row--wrap { flex-wrap: wrap; }
.pop-row .field.field--num { width: 50px; min-height: 30px; }
.pop-row output { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-variant-numeric: tabular-nums; }
.pop-note { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }

/* ── Export dialog ─────────────────────────────────────────── */
.export-dialog { width: min(100%, 960px); }
.export-body { display: flex; flex-direction: column; gap: var(--space-3); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; align-self: flex-start;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
.seg-btn {
  min-height: 34px; padding: 0 14px;
  font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary);
  background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn[aria-checked="true"] { color: #042f2c; background: var(--accent-bright); }
.export-hint { font-size: var(--text-sm); color: var(--text-secondary); }
.export-preview { overflow: auto; max-height: 340px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.xtable { border-collapse: collapse; width: max-content; min-width: 100%; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.xtable th, .xtable td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.xtable th { position: sticky; top: 0; background: var(--surface-solid); color: var(--text-muted); font-weight: 700; }
.xtable td { color: var(--text-secondary); }
.xtable .num { text-align: right; }
.xtable-foot { padding: 8px 10px; font-size: var(--text-xs); color: var(--text-muted); }
.export-actions { justify-content: flex-start; }
.panel-link {
  margin-left: auto; padding: 0;
  font: inherit; font-size: var(--text-xs); font-weight: 700; color: var(--accent-bright);
  background: none; border: 0; cursor: pointer;
}
.panel-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.flags .panel-head .panel-count { margin-left: 0; }

/* ── Person editor and help ────────────────────────────────── */
.person-form { display: flex; flex-direction: column; gap: var(--space-4); }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-note { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; font-variant-numeric: tabular-nums; }
.form-note strong { font-size: var(--text-lg); color: var(--text-primary); }
.btn--quiet-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.btn--quiet-danger:hover { color: #fff; background: color-mix(in srgb, var(--err) 25%, transparent); }
.modal__left { margin-right: auto; }
.help p { margin-bottom: var(--space-3); }
.help h3 { font-size: var(--text-sm); margin: var(--space-4) 0 var(--space-2); color: var(--text-primary); }
.keys { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px;
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 4px; text-align: center;
}

/* ── Narrower screens ──────────────────────────────────────── */
@media (max-width: 1280px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .flags { position: static; max-height: none; scroll-margin-top: 72px; }
  .flag-bar { display: flex; }
}
/* Fingers: every small control gets at least a 32px target */
@media (pointer: coarse) {
  .share-pts { min-width: 36px; height: 32px; }
  .share-x, .day-x { width: 32px; height: 32px; }
  .icon-btn, .deliv-foot .icon-btn { width: 36px; height: 36px; }
  .share { padding: 4px 4px 4px 6px; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .plan { padding: var(--space-4); gap: var(--space-4); }
  .workspace-main { grid-template-columns: minmax(0, 1fr); }
  .roster { position: static; max-height: none; }
  .calc { padding: var(--space-3); }
  .term { min-width: 64px; }
  .term-num, .term-select { font-size: 1.4rem; }
  .term--final .term-num { font-size: 1.7rem; }
  .op { font-size: 1.1rem; }
}
@media (max-width: 520px) {
  .field.field--country, .field.field--date, .day-add .field:not(.field--date) { width: 100%; }
  .cal-field { flex: 1 1 100%; }
}
@media (max-width: 420px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .roster-add { grid-template-columns: 1fr 1fr; }
  .roster-add .btn { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .is-focus { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 55%, transparent); }
}
