/* Brand v1.2 (App-Wide Spec): Aubergine & Persimmon, with a little funk. */
:root {
  /* Brand tokens */
  --aubergine: #4B2142; --persimmon: #E0573C; --zest: #D7F25C; --sunny: #FFC23D; --lilac: #CDB8FF;
  --ink: #2A1A2E; --muted: #6B5868; --mist: #EFE7EE; --page: #FAF7F9; --line: #DCCFDA; --panel: #FFFFFF;
  /* Supporting shades, chosen to keep text at 4.5:1 or better */
  --persimmon-text: #B8432D;  /* Persimmon for small text on white (5.4:1) */
  --persimmon-tint: #F9DCD4;  /* behind urgent chips and alerts, with Ink text */
  --sunny-tint: #FFF0C7;      /* behind "needs review" */
  --lilac-tint: #EEE6FF;      /* behind low-priority notes */
  --radius: 20px; --radius-sm: 12px;
  --shadow: 4px 4px 0 var(--mist);
  --head: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--body); }
:focus-visible { outline: 3px solid var(--aubergine); outline-offset: 2px; }

/* Nav bar */
.top { display: flex; align-items: center; gap: 28px; padding: 14px 32px; background: var(--aubergine); color: #fff;
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 11px; background: #5C2A52; border: 2px solid var(--ink);
  transform: rotate(-5deg); display: grid; place-items: center; flex: none; }
.logo svg { width: 32px; height: 32px; }
.brand .title { font: 800 24px/1 var(--head); letter-spacing: -.01em; color: #fff; }
.state-pill { background: #D7F25C; color: #2A1A2E; font: 800 12px/1 var(--body, Figtree, sans-serif); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
nav { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: center; }
nav button { background: none; border: 0; min-height: 44px; padding: 0 18px; border-radius: 99px; color: #fff;
  font: 700 15px var(--body); cursor: pointer; }
nav button:hover { background: rgba(255,255,255,.1); }
nav button.on { background: var(--zest); color: var(--ink); }
.menu { position: relative; }
.userchip { display: flex; align-items: center; gap: 10px; background: none; border: 0; min-height: 44px; padding: 0;
  color: #fff; font: inherit; cursor: pointer; text-align: right; }
.userchip .who { display: flex; flex-direction: column; line-height: 1.2; }
.userchip .who b { font-weight: 800; }
.userchip .who span { font-size: 13px; opacity: .9; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--lilac); color: var(--ink); display: grid;
  place-items: center; font: 800 14px var(--body); flex: none; }
.dropdown { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; min-width: 200px; display: flex; flex-direction: column;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px;
  box-shadow: var(--shadow); }
.dropdown.right { left: auto; right: 0; }
.dropdown[hidden] { display: none; }
.dropdown button { text-align: left; background: none; border: 0; min-height: 44px; padding: 0 12px; border-radius: 10px;
  font: 600 14px var(--body); color: var(--ink); cursor: pointer; }
.dropdown button:hover { background: var(--mist); }

/* Field section bar */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; padding: 10px 32px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 72px; z-index: 4; }
.subnav[hidden] { display: none; }
.subnav button { background: none; border: 2px solid transparent; min-height: 40px; padding: 0 14px; border-radius: 99px;
  color: var(--ink); font: 600 14px var(--body); cursor: pointer; }
.subnav button:hover { background: var(--mist); }
.subnav button.on { border-color: var(--ink); background: var(--panel); font-weight: 800; }

/* Page */
main { max-width: 1240px; margin: 0 auto; padding: 32px 32px 48px; }
.kicker { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
h2 { font: 800 34px/1.1 var(--head); letter-spacing: -.02em; margin: 0 0 6px; }
h3 { font: 800 19px/1.2 var(--head); margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 20px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
details.setup summary { cursor: pointer; list-style: revert; }
details.setup summary h3 { margin: 0; }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.req:has(.missing)::after { content: "Required"; color: var(--ink); background: var(--sunny-tint); border-radius: 99px;
  padding: 0 8px; font-size: 11px; font-weight: 700; align-self: flex-start; }
input, select, textarea { font: 15px var(--body); color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; min-height: 40px; }
input:focus, select:focus { border-color: var(--aubergine); }
input[type=number] { width: 110px; }
input.missing, select.missing { border-color: var(--sunny); background: var(--sunny-tint); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--aubergine); }

/* Buttons: pills with a 2 px Ink outline; the main action gets a 3 px Ink offset shadow */
button.btn, button.ghost, a.ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 20px; border: 2px solid var(--ink); border-radius: 99px; background: var(--panel); color: var(--ink);
  font: 800 14px var(--body); cursor: pointer; text-decoration: none; }
button.btn { box-shadow: 3px 3px 0 var(--ink); }
button.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button.ghost:hover, a.ghost:hover, button.btn:hover { background: var(--mist); }
button.link { border: 0; background: none; color: var(--persimmon-text); cursor: pointer; font: 700 14px var(--body);
  padding: 4px; min-height: 32px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--mist); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-bottom-color: var(--line); }
td.n, th.n { text-align: right; }
td input { padding: 5px 8px; min-height: 36px; }
td input:not([type]), .row label input:not([type]) { min-width: 200px; }
td input[type=number] { width: 96px; text-align: right; }

/* Stat boxes (inside pages) */
.stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { flex: 1 1 170px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; }
.stat .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font: 800 30px/1.15 var(--head); font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.stat .d { font-size: 13px; color: var(--muted); }
.stat.hl { background: var(--aubergine); border-color: var(--aubergine); color: #fff; box-shadow: 4px 4px 0 var(--lilac); }
.stat.hl .k { color: var(--zest); }
.stat.hl .d { color: #fff; opacity: .9; }

/* Tiles (App-Wide Spec: bold headline, supporting lines, "Updated" that flips) */
.tiles { margin-top: 12px; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; min-height: 200px; }
.tile .face { display: flex; flex-direction: column; gap: 4px; height: 100%; }
.tile .back, .tile.flipped .front { display: none; }
.tile.flipped .back { display: flex; }
.tile .tt { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.tile .th { font: 800 40px/1.1 var(--head); letter-spacing: -.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.tile .th.long { font-size: 26px; }
.tile .tl { font-size: 15px; }
.tile .tlist { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; font-size: 14px; }
.tile .tu { margin-top: auto; padding: 14px 0 0; font: 600 12px var(--body); color: var(--muted); background: none; border: 0;
  text-align: left; cursor: pointer; min-height: 0; }
.tile button.tu:hover { text-decoration: underline; }
.tile.waiting .th { color: var(--muted); }
.tile.primary { background: var(--aubergine); border-color: var(--aubergine); color: #fff; box-shadow: 4px 4px 0 var(--lilac); }
.tile.primary .tt { color: var(--zest); }
.tile.primary .tl:first-of-type { font-weight: 800; font-size: 17px; }
.tile.primary .tu { color: #fff; opacity: .85; }

/* Status chips: always a word, never color alone */
.pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px;
  background: var(--mist); color: var(--ink); white-space: nowrap; }
.pill.ok { background: var(--zest); }
.pill.warn { background: var(--sunny); margin: 0; padding: 2px 10px; border-radius: 99px; position: static; }
.pill.warn::before { display: none; }
.pill.urgent { background: var(--persimmon-tint); }

/* Notices */
.warn { background: var(--sunny-tint); color: var(--ink); border-radius: var(--radius-sm); padding: 12px 14px 12px 34px;
  margin: 8px 0; position: relative; }
.warn::before { content: ""; position: absolute; left: 14px; top: 19px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sunny); }
.warn.urgent { background: var(--persimmon-tint); }
.warn.urgent::before { background: var(--persimmon); }
.muted { color: var(--muted); }
.pos { color: var(--aubergine); font-weight: 700; } .neg { color: var(--persimmon-text); font-weight: 700; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Sign-in, dialogs, toast */
form.auth { max-width: 420px; margin: 64px auto; display: flex; flex-direction: column; gap: 12px; }
dialog.card { max-width: 420px; width: 90%; color: var(--ink); }
dialog::backdrop { background: rgba(42,26,46,.45); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 99px; font-weight: 700; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: .95; }

@media (max-width: 760px) {
  .top { padding: 10px 16px; gap: 10px; }
  nav { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .userchip .who { display: none; }
  #user { margin-left: auto; }
  .subnav { position: static; padding: 8px 16px; justify-content: flex-start; }
  main { padding: 20px 16px 40px; }
  h2 { font-size: 28px; }
  .tile .th { font-size: 34px; }
}

/* Roles: one person can hold several (App-Wide Spec v1.5) */
.rolepick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; padding: 6px 0; }
.rolepick label { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink); min-height: 32px; }
details.roles summary { cursor: pointer; white-space: normal; min-width: 160px; }
details.roles[open] { min-width: 380px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); flex-basis: 100%; }

/* Tasks (Tasks Module Spec v1.2) */
#user { display: flex; align-items: center; gap: 14px; }
.taskbtn { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 99px;
  border: 2px solid rgba(255,255,255,.35); background: none; color: #fff; font: 700 14px var(--body); cursor: pointer; }
.taskbtn:hover { background: rgba(255,255,255,.1); }
.taskbtn .tb-icon { font-weight: 800; }
.taskbtn .badge { background: var(--zest); color: var(--ink); border-radius: 99px; padding: 0 8px; font-size: 12px; font-weight: 800; line-height: 20px; }
.taskbtn .dot { position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--persimmon); border: 2px solid var(--aubergine); }
.tasks-panel { width: 400px; max-width: calc(100vw - 32px); max-height: 70vh; overflow: auto; padding: 10px; gap: 6px; }
.tp-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; }
.tp-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 6px; }
.tp-filters select { font-size: 13px; min-height: 32px; padding: 2px 6px; }
.tp-group { font: 800 12px var(--body); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 6px 4px; }
.tp-group.late { color: var(--persimmon-text); }
.tp-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px; border-radius: 10px; }
.tp-item:hover { background: var(--mist); }
.tp-item input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.dropdown .tp-title, .tp-title { background: none; border: 0; padding: 0; min-height: 0; text-align: left; font: 600 14px var(--body); color: var(--ink); cursor: pointer; }
.tp-title:hover { text-decoration: underline; }
dialog.card.wide { max-width: 640px; }
.task-details { margin: 0 0 12px; padding-left: 20px; }
.task-details li { margin: 4px 0; }
.comment { padding: 8px 0; border-top: 1px solid var(--line); }
.note { background: var(--mist); border-radius: 12px; padding: 10px 14px; margin-top: 0; }
a.btnlike { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 99px; text-decoration: none; color: var(--ink); }
@media (max-width: 700px) { .taskbtn .tb-label { display: none; } }

/* Universes */
.tagline { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.universe-dialog { max-width: 820px; }
.universe-dialog .table-wrap { max-height: 320px; overflow: auto; }

/* Field v1.5: Analysis, show the math, help text, setup steps */
.math { background: var(--mist); border-left: 4px solid var(--aubergine); border-radius: 8px; padding: 10px 14px; margin: 10px 0 16px; font-size: 14px; }
details.help { margin-top: 10px; }
details.help summary { cursor: pointer; font-weight: 700; color: var(--aubergine); }
details.help p { white-space: pre-line; color: var(--muted); }
.segmented { display: inline-flex; gap: 4px; background: var(--mist); border-radius: 99px; padding: 4px; margin: 4px 0 16px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; border-radius: 99px; min-height: 40px; padding: 0 16px; font: 700 14px var(--body); color: var(--ink); cursor: pointer; }
.segmented button.on { background: var(--aubergine); color: #fff; }
ol.steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
ol.steps button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--panel);
  border-radius: 14px; min-height: 52px; padding: 8px 12px; font: 600 14px var(--body); color: var(--ink); cursor: pointer; }
ol.steps button.on { border: 2px solid var(--aubergine); }
ol.steps button:disabled { opacity: .5; cursor: not-allowed; }
ol.steps .sn { width: 28px; height: 28px; border-radius: 50%; background: var(--aubergine); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
ol.steps .pill { margin-left: auto; }
.embedded > div > .row:first-child h2 { font-size: 20px; }
.empty.disabled { opacity: .6; }
.pill.flag { background: none; border: 2px solid var(--persimmon-text); color: var(--ink); }
.chart { margin: 8px 0 18px; }
.tlink { color: var(--aubergine); padding: 0; text-align: left; margin-top: 6px; }

/* Delegation of authority log */
.dl-grid th.dl-code { text-align: center; min-width: 54px; vertical-align: bottom; }
.dl-grid .dl-name { font: 500 11px var(--body); color: var(--muted); text-transform: none; letter-spacing: 0; white-space: normal; max-width: 110px; margin: 2px auto 0; }
.dl-grid td.dl-cell { text-align: center; }
.dl-grid td.dl-cell input { width: 20px; height: 20px; }
.dl-grid td.changed { background: var(--sunny-tint, #FFF1CC); }
.dl-grid th.dl-person { text-align: left; min-width: 180px; position: sticky; left: 0; background: var(--panel); text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); font-weight: 500; }
.dl-warn { display: inline-block; margin-left: 4px; color: var(--persimmon-text); font-weight: 800; }

/* Practice campaign (App-Wide v1.7): a different accent on every screen so it can't be mistaken for the live campaign */
.practice-banner[hidden] { display: none; }
.practice-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; background: var(--lilac);
  color: var(--ink); border-bottom: 3px dashed var(--aubergine); font-size: 15px; }
.practice-banner b::before { content: "⚑ "; }
.practice-banner label { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.practice-banner .ghost { min-height: 36px; background: #fff; }
body.in-practice header.top { box-shadow: inset 0 -6px 0 var(--lilac); }

/* TN CAMP entry list */
.camp-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.camp-item.done { opacity: .65; }
.camp-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; margin-top: 8px; }
.camp-f { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.camp-f .k { color: var(--muted); font-size: 12px; width: 96px; flex: none; }
.camp-f .v { flex: 1; font-weight: 600; }
button.copy { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 2px 10px; min-height: 30px; font: 600 12px var(--body); color: var(--aubergine); cursor: pointer; }
.progress { height: 10px; background: var(--mist); border-radius: 99px; overflow: hidden; margin: 6px 0 12px; }
.progress span { display: block; height: 100%; background: var(--aubergine); }
.badge-count { background: var(--zest); color: var(--ink); border-radius: 99px; padding: 0 7px; margin-left: 6px; font-size: 12px; font-weight: 800; }

/* Field v1.6: the stage banner */
.stage-banner{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;background:var(--surface,#fff);border:1px solid #DCCFDA;border-left:4px solid #4B2142;border-radius:10px;padding:10px 14px;margin:0 0 16px}
.stage-banner p{margin:0;flex:1 1 320px}
.stage-steps{display:flex;gap:4px;list-style:none;margin:0;padding:0;font-size:13px;font-weight:700}
.stage-steps li{padding:3px 10px;border-radius:999px;background:#EFE7EE;color:#6B5868}
.stage-steps li.on{background:#4B2142;color:#fff}
a.btn-link{display:inline-flex;align-items:center;min-height:44px;padding:0 16px;border:2px solid var(--ink);border-radius:999px;color:var(--ink);text-decoration:none;font-weight:700;align-self:flex-end}
.quicklog{min-height:36px;border-color:#fff;color:#fff;background:transparent;margin-right:8px}
.board{display:grid;grid-template-columns:repeat(4,minmax(200px,1fr));gap:12px;overflow-x:auto;margin:12px 0}
.board-col{background:#F6F1F5;border-radius:10px;padding:10px;min-width:200px}
.board-col h3{margin:0 0 8px;font-size:15px}
.orgchart, .orgchart ul{list-style:none;padding-left:18px;border-left:2px solid #DCCFDA;margin:4px 0}
.orgchart li{margin:6px 0}
.checklist{list-style:none;padding:0}
.checklist li{margin:8px 0}

/* Briefing sheets and scripts print as one clean page */
@media print {
  header, #tabs, #user, #subnav, .practice-banner, #campaign-line, #toast, .no-print { display: none !important; }
  .print-footer { display: flex !important; }
  body, main { background: #fff; }
  main { padding: 0; max-width: none; }
  .brief-sheet h2 { margin-top: 0; }
}

/* Do next card and Alerts panel (App-Wide v1.7) */
.donext { border-width: 2px; }
.donext-list { list-style: none; margin: 0; padding: 0; }
.donext-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line, #DCCFDA); }
.donext-list li:first-child { border-top: 0; }
.donext-text { flex: 1 1 auto; min-width: 0; }
.donext-list button { min-height: 44px; min-width: 64px; }

/* Training v1.1: the lesson coach box and the help menu */
.coach { position: fixed; right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); z-index: 50; background: #fff; border: 2px solid var(--ink, #2A1A2E);
  border-radius: 20px; box-shadow: 4px 4px 0 var(--lilac, #CDB8FF); padding: 14px 16px; }
.coach.top { top: 76px; bottom: auto; }
.coach h3 { margin: 4px 0; }
.coach-kicker { font-size: 12px; font-weight: 700; color: var(--muted, #6B5868); text-transform: uppercase; letter-spacing: .04em; }
.coach-goal { margin: 4px 0; font-weight: 700; }
.coach-text { margin: 6px 0 10px; font-size: 16px; }
.coach button { min-height: 44px; }
.coach-target { outline: 3px solid #B8442E !important; outline-offset: 3px; border-radius: 8px; }
@media (max-width: 600px) {
  .coach { left: 8px; right: 8px; bottom: 8px; width: auto; padding: 10px 12px; border-radius: 16px; }
  .coach.top { top: 8px; }
  .coach-goal { display: none; }
  .coach-text { font-size: 15px; margin: 4px 0 8px; }
  .coach .row { flex-wrap: nowrap; }
  .coach .ghost, .coach .link { min-height: 40px; padding: 0 10px; font-size: 14px; }
}
@media print { .coach { display: none !important; } }
.help-wrap .dropdown { top: 44px; }
.help-btn { min-width: 40px; min-height: 40px; border-radius: 999px; font-weight: 800; margin-right: 6px; }

.print-footer { display: none; align-items: center; gap: 6px; margin: 28px 0 0; font: 600 11px var(--body); color: var(--muted, #6B5868); }

h1.greeting { font: 800 34px/1.1 var(--head); letter-spacing: -.02em; margin: 0 0 6px; }
@media (max-width: 600px) { h1.greeting { font-size: 28px; } }

/* Calm by default (App-Wide v1.8): summary cards, side panel details, short lists, light tables, ? help, steps */
.calm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.calm-card { text-align: left; background: #fff; border: 1px solid var(--line, #DCCFDA); border-radius: 20px; box-shadow: 4px 4px 0 var(--mist, #EFE7EE);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font: inherit; color: inherit; }
button.calm-card { cursor: pointer; }
.calm-card.on { border: 2px solid var(--ink, #2A1A2E); box-shadow: 3px 3px 0 var(--ink, #2A1A2E); }
.cc-label { font-size: 13px; font-weight: 700; color: var(--muted, #6B5868); }
.cc-value { font: 800 30px/1.1 var(--head); font-variant-numeric: tabular-nums; }
.cc-line { font-size: 14px; color: var(--muted, #6B5868); }
.calm-card .pill { align-self: flex-start; }
.more-wrap { position: relative; display: inline-block; }
.more-wrap .dropdown { position: absolute; z-index: 20; top: 46px; left: 0; min-width: 220px; }
.show-all { color: var(--aubergine, #4B2142); font-weight: 700; }
tr.row-open { cursor: pointer; }
tr.row-open:hover, tr.row-open:focus { background: var(--mist, #EFE7EE); outline: none; }
.help-wrap-inline { position: relative; display: inline-block; margin-left: 6px; vertical-align: middle; }
.help-q { width: 26px; height: 26px; min-height: 26px; border-radius: 999px; border: 2px solid var(--ink, #2A1A2E); background: #fff; font-weight: 800; padding: 0; line-height: 1; }
.help-tip { position: absolute; z-index: 30; top: 32px; left: -8px; width: min(320px, 80vw); background: #fff; border: 1px solid var(--line, #DCCFDA); border-radius: 12px;
  box-shadow: 4px 4px 0 var(--mist, #EFE7EE); padding: 10px 12px; font-size: 14px; font-weight: 400; color: var(--ink, #2A1A2E); }
dialog.detail-panel { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100vh; max-height: 100vh; width: min(520px, 100vw); max-width: 100vw;
  border: 0; border-left: 2px solid var(--ink, #2A1A2E); padding: 18px 20px 28px; background: #fff; overflow-y: auto; }
dialog.detail-panel::backdrop { background: rgba(42, 26, 46, .35); }
.dp-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.dp-head h2 { font-size: 26px; margin: 0; }
.dp-close { align-self: flex-start; }
.dp-summary { margin: 4px 0 12px; }
.dp-body { margin-top: 12px; }
@media (max-width: 600px) { dialog.detail-panel { width: 100vw; border-left: 0; padding: 14px 16px 24px; } }
.sf-progress { height: 8px; border-radius: 999px; background: var(--mist, #EFE7EE); overflow: hidden; }
.sf-bar { height: 100%; background: var(--aubergine, #4B2142); }
.tile .tmore { font-size: 13px; }
.tile .face > .pill { align-self: flex-start; margin: 2px 0 4px; }
.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; }
.file-btn { cursor: pointer; display: inline-flex; align-items: center; }
.file-btn:focus-within { outline: 3px solid var(--aubergine, #4B2142); outline-offset: 2px; }
details.add-form > summary, details.filters > summary { cursor: pointer; font-weight: 700; color: var(--aubergine, #4B2142); min-height: 36px; display: flex; align-items: center; }

/* Payouts: gross, net and fee fit a phone without scrolling */
.payouts td:first-child { white-space: normal; min-width: 84px; }
.payouts td:first-child .pill { white-space: normal; }
@media (max-width: 480px) { .payouts th, .payouts td { padding: 8px 5px; font-size: 14px; } .payouts .pill { font-size: 11px; } }

/* Candidate v1.1 */
.cand-approval.urgent { border-left: 4px solid var(--danger, #B3261E); }
.cand-timer { font: 800 64px/1.1 var(--display, inherit); text-align: center; margin: 18px 0; font-variant-numeric: tabular-nums; }
.cand-goto { display: flex; flex-wrap: wrap; gap: 8px; }
.cand-bar { display: none; }
@media (max-width: 700px) {
  /* Phones: the menus scroll sideways in one row instead of wrapping onto several */
  nav#tabs, .subnav { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  nav#tabs::-webkit-scrollbar, .subnav::-webkit-scrollbar { display: none; }
  nav#tabs button, .subnav button { flex: 0 0 auto; }
  /* The candidate gets a bottom bar instead of the top menus */
  body.cand-mode nav#tabs, body.cand-mode #subnav { display: none !important; }
  body.cand-mode { padding-bottom: 76px; }
  .cand-bar { display: flex; flex-wrap: nowrap; gap: 2px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--aubergine, #4B2142);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .cand-bar button { flex: 1 1 0; min-width: 0; padding: 0 2px; background: none; border: 0; color: #fff; min-height: 52px; border-radius: 12px;
    font-weight: 700; font-size: 12px; line-height: 1.15; white-space: normal; }
  .cand-bar button.on { background: var(--zest, #D7F25B); color: var(--ink, #2A1A2E); }
}
@media print { .cand-bar { display: none !important; } }

/* Field v2.1: board cluster rows, % bars, the cluster panel */
.pbar { flex: 1 1 80px; height: 10px; background: var(--mist); border-radius: 99px; overflow: hidden; }
.pbar span { display: block; height: 100%; background: var(--aubergine); border-radius: 99px; }
.cl-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--panel, #fff);
  border: 1px solid var(--line, #EFE7EE); border-radius: 14px; padding: 12px 16px; margin-bottom: 8px; min-height: 52px; }
button.cl-row { cursor: pointer; }
button.cl-row:hover, button.cl-row:focus-visible { border-color: var(--ink); }
.cl-rank { width: 26px; font-weight: 800; color: var(--muted); }
.cl-name { flex: 2 1 180px; font-weight: 800; }
.cl-voters { flex: 0 0 110px; color: var(--muted); font-size: 14px; }
.cl-bar { flex: 1 1 160px; display: flex; align-items: center; gap: 8px; }
.cl-bar b { min-width: 40px; text-align: right; font-size: 14px; }
.cl-go { color: var(--muted); font-size: 20px; }
.pc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 0; border-bottom: 1px solid var(--line, #EFE7EE); }
.pc-row select { max-width: 160px; }
.dp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; }
.field-universe { font-size: 13px; }
.field-universe select { min-height: 36px; font-size: 14px; }
@media (max-width: 700px) {
  .cl-row { flex-wrap: wrap; gap: 8px 12px; }
  .cl-voters { flex: 1 1 auto; }
  .cl-bar { flex-basis: 100%; order: 5; }
  .dp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pc-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 10px; }
.list-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--panel, #fff);
  border: 1px solid var(--line, #EFE7EE); border-radius: 14px; padding: 12px 16px; margin-bottom: 8px; min-height: 52px; cursor: pointer; }
.list-row:hover, .list-row:focus-visible { border-color: var(--ink); }
.lr-turf { flex: 0 0 70px; } .lr-who { flex: 1 1 140px; } .lr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lr-days { flex: 0 0 120px; text-align: right; color: var(--muted); font-weight: 700; font-size: 14px; }
.results-form { display: flex; flex-direction: column; gap: 8px; }
.results-form .rf-num input { max-width: 160px; }
@media (max-width: 700px) {
  .list-row { flex-wrap: wrap; gap: 6px 10px; }
  .lr-days { flex: 1 1 auto; text-align: left; }
  .results-form .rf-num input { max-width: none; font-size: 18px; min-height: 48px; }
}
.setup-nav { margin: 10px 0 14px; }
details.fold > summary { cursor: pointer; }
.wk-channel { border-bottom: 1px solid var(--line, #EFE7EE); padding: 8px 0; }
.wk-channel > summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { border: 1px solid var(--line, #EFE7EE); border-radius: 12px; padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
.week-day.today { border: 2px solid var(--ink); background: var(--mist, #F7F1F6); }
.wd-head { font-weight: 800; font-size: 13px; }
.shift-chip { text-align: left; font: inherit; font-size: 13px; color: inherit; background: var(--panel, #fff); border: 1px solid var(--line, #DCCFDA); border-left: 4px solid var(--aubergine);
  border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.shift-chip.phones { border-left-color: var(--persimmon, #B8442E); }
@media (max-width: 900px) { .week-grid { grid-template-columns: 1fr; } .week-day { min-height: 0; } }


/* App-Wide v1.9: Basic or Advanced at the end of a module's menu, and the "Add more detail" links */
#subnav .level-label { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; min-height: 0;
  border: 1px solid var(--aubergine); color: var(--aubergine); background: transparent; }
#subnav .level-label.basic { border-style: dashed; }
.link.more-detail { color: var(--aubergine); font-size: 13px; }
.link.more-detail::before { content: "+ "; }

/* Field v2.2: Basic Field (setup, Doors, Progress), the Default tag, step chips and the doors chart */
.pill.default-tag { margin-left: 6px; border: 1px dashed var(--aubergine); color: var(--aubergine); background: transparent; font-size: 11px; }
.default-note { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; }
.fb-setup { max-width: 720px; margin: 0 auto; }
.fb-q h3 { display: flex; gap: 10px; align-items: flex-start; margin-top: 0; }
.fb-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--zest); border: 1.5px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.fb-note { background: var(--mist); border-radius: 10px; padding: 10px 14px; margin-top: 10px; }
.fb-big { font-size: 22px; }
.fb-group { margin: 14px 0; }
.fb-row { display: grid; grid-template-columns: 160px 1fr auto auto auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; margin-top: 6px; cursor: pointer; }
.fb-done { display: grid; gap: 8px; }
.fb-num { flex-direction: row; justify-content: space-between; align-items: center; }
.fb-num input { width: 90px; text-align: right; }
.fb-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.fb-card .cc-value { font-size: 34px; font-weight: 800; }
.fb-day { background: var(--aubergine); color: #fff; }
.fb-day .cc-label { color: var(--zest); }
.fb-bar { height: 8px; border-radius: 999px; background: var(--mist); margin: 8px 0 6px; overflow: hidden; }
.fb-bar > div { height: 100%; background: var(--aubergine); }
.fb-more { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 16px; margin-top: 16px; }
@media (max-width: 640px) { .fb-row { grid-template-columns: 1fr auto; } }
.step-chips ol { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; list-style: none; padding: 0; margin: 0; }
.step-chips li { border-top: 5px solid var(--mist); }
.step-chips li.done { border-top-color: var(--lilac); }
.step-chips li.on { border-top-color: var(--aubergine); }
.step-chips button { background: none; border: 0; padding: 6px 0 0; font-size: 12px; text-align: left; color: var(--muted); min-height: 0; cursor: pointer; }
.step-chips li.on button { color: var(--ink); font-weight: 800; }
@media (max-width: 640px) { .step-chips ol { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } }
.doors-chart .chart-svg svg { width: 100%; max-height: 220px; }
.doors-chart .bar { fill: var(--aubergine); }
.doors-chart .goal { stroke: var(--persimmon); stroke-width: 3; }
.doors-chart text { font-size: 11px; text-anchor: middle; font-family: inherit; }
.doors-chart .bar-v { fill: #fff; font-weight: 700; }
.doors-chart .bar-o, .doors-chart .axis { fill: var(--muted); }

/* App-Wide v1.10: operator tabs that hold several sections */
.op-section + .op-section { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); }

/* County Party Mode v1.2: the shared calendar's month view and printable district reports */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 12px 0; }
.cal-dow { font-size: 12px; color: var(--muted, #666); text-align: center; }
.cal-day { min-height: 84px; border: 1px solid var(--line, #ddd); border-radius: 6px; padding: 4px; background: var(--card, #fff); overflow: hidden; }
.cal-day.today { border-color: var(--aubergine, #5b2a5c); }
.cal-num { font-size: 12px; font-weight: 600; }
.cal-ev { display: block; width: 100%; text-align: left; font-size: 12px; padding: 2px 4px; margin-top: 2px; min-height: 0; border: 0; border-radius: 4px;
  background: var(--soft, #f1e9f1); color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
@media (max-width: 640px) { .cal-day { min-height: 56px; } .cal-ev { font-size: 11px; } }
@media print { header, nav, .no-print, #tabs, .tabs { display: none !important; } .district-report { padding: 0; } }
