/* ---------- tokens ---------- */
:root {
  --paper: #F6F7F5;
  --panel: #FFFFFF;
  --ink: #16202A;
  --ink-2: #4A5561;
  --ink-3: #8A949E;
  --rule: #D5DAD9;
  --rule-soft: #E9ECEB;

  --day: #F5C542;
  --day-soft: #FBEBB3;
  --night: #2C3E66;
  --night-soft: #D9DFEE;
  --off: #E4E7E6;

  --gap: #C8402B;
  --gap-soft: #FBE4DF;
  /* Overtime marker, deepening with the length of the run: 15+, 21+, 28+
     straight days. See OT_TIERS in app.js. */
  --ot-1: #F5C542;
  --ot-2: #E0761B;
  --ot-3: #C8402B;
  --ok: #2E7D4F;
  --warn: #B26A00;
  --warn-soft: #FFF1D6;
  /* Training: green, and its own colour so a trainee on a pad is never
     mistaken for an overtime or open-slot warning. See the Training tab. */
  --trn: #2E7D4F;
  --trn-soft: #DCF0E3;
  --trn-line: #A9D6BC;

  --crew-blue: #2F6FE0;
  --crew-grey: #6E7781;
  --crew-white: #FFFFFF;

  --accent: #1F5A96;
  --accent-ink: #FFFFFF;

  --col-w: 132px;
  --label-w: 200px;
  --radius: 4px;
  --font: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 var(--font);
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
/* Something was deleted — used for the removed list in a Monday job sync. */
.removed { font-size: 12.5px; color: var(--gap); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; }
.brand-name { font-weight: 600; font-size: 15px; white-space: nowrap; }
.tabs { display: flex; gap: 2px; margin-left: 8px; }
.tab {
  background: none; border: 0; padding: 18px 12px 16px;
  color: var(--ink-2); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.range { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.range input[type=date] {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 5px 8px; background: var(--panel);
}
.range-sep { color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--rule); background: var(--panel);
  border-radius: var(--radius); padding: 6px 12px; line-height: 1.2;
}
.btn:hover { border-color: var(--ink-3); }
a.btn { color: var(--ink); text-decoration: none; display: inline-block; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--gap); border-color: #E7B5AC; }
.btn.danger:hover { background: var(--gap-soft); }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
/* A switched-off button reads as scenery, not as something to press: flat,
   greyed, no hover, and the cursor says so before the click does. */
.btn:disabled, .btn:disabled:hover {
  background: var(--paper); border-color: var(--rule); color: var(--ink-3);
  cursor: not-allowed; filter: none; opacity: 0.6;
}
.btn-icon {
  border: 1px solid var(--rule); background: var(--panel); border-radius: var(--radius);
  width: 30px; height: 30px; font-size: 18px; line-height: 1; padding: 0;
}
.btn-icon:hover { border-color: var(--ink-3); }

/* ---------- layout ---------- */
#main { padding: 20px; }
.view-head {
  display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.view-head .spacer { flex: 1; }
.summary { display: flex; gap: 18px; color: var(--ink-2); }
.summary b { color: var(--ink); font-weight: 600; }
.summary .gapcount b { color: var(--gap); }

/* ---------- schedule grid ---------- */
.gridwrap {
  overflow: auto; background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--radius);
  max-height: calc(100vh - 140px);
}
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft); }
.grid th { position: sticky; z-index: 3; background: var(--panel); font-weight: 500; text-align: left; }
.grid .labelcol {
  position: sticky; left: 0; z-index: 2; background: var(--panel);
  min-width: var(--label-w); max-width: var(--label-w);
  border-right: 1px solid var(--rule);
}
.grid thead .labelcol { z-index: 4; }
.grid th.daycol, .grid td.daycol { min-width: var(--col-w); max-width: var(--col-w); }
.grid td.daycol { vertical-align: top; padding: 0; }

/* rotation ribbon rows live inside thead; each row gets its own sticky offset */
.grid thead tr:nth-child(1) th { top: 0; }
.grid thead tr:nth-child(2) th { top: 22px; }
.grid thead tr:nth-child(3) th { top: 44px; }
.grid thead tr.dates th { top: 66px; }
/* rotation ribbon rows live inside thead */
.grid tr.ribbon th { padding: 0; height: 22px; border-bottom: 0; }
.grid tr.ribbon th.labelcol { padding: 0 12px; font-size: 12px; color: var(--ink-2); }
.grid tr.ribbon:first-child th { padding-top: 0; }
.stripe { height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.stripe.D { background: var(--day); color: var(--ink); }
.stripe.N { background: var(--night); color: #fff; }
.stripe.OFF { background: var(--off); color: var(--ink-3); }
.stripe.first { border-left: 2px solid var(--panel); }
.crewdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.18); }
.crewdot.Blue { background: var(--crew-blue); }
.crewdot.Grey { background: var(--crew-grey); }
.crewdot.White { background: var(--crew-white); }
.crewdot.Float { background: repeating-linear-gradient(45deg, #fff 0 2px, var(--ink-3) 2px 4px); }

.grid tr.dates th { padding: 8px 10px 6px; border-top: 1px solid var(--rule); }
.grid tr.dates th .dow { color: var(--ink-3); font-size: 12px; }
.grid tr.dates th .dom { font-weight: 600; }
.grid tr.dates th.today { background: #FFFBEA; }
.grid tr.dates th.weekend .dow { color: var(--ink-2); }

.grid tr.jobrow td.labelcol { padding: 10px 12px 4px; }
.grid tr.jobrow .jobname { font-weight: 600; }
.grid tr.jobrow .jobmeta { color: var(--ink-2); font-size: 12px; }
/* A job's free-text note, in one cell spanning the day columns so it has room
   to be read. The cell is as wide as the whole grid; the note inside it is
   sticky, pinned just clear of the label column, so scrolling the weeks
   sideways never carries it off screen. */
.grid tr.jobrow td.notecol {
  padding: 6px 0 8px; border-right: 0; vertical-align: middle;
  background: var(--panel);
}
.jobnotewrap {
  position: sticky; left: calc(var(--label-w) + 10px); z-index: 1;
  width: 540px; max-width: 540px;
}
.grid tr.jobrow .jobnote {
  display: block; width: 100%; padding: 6px 10px;
  border: 1px solid transparent; border-left: 3px solid transparent;
  border-radius: 6px; background: transparent;
  font: inherit; font-size: 12.5px; line-height: 1.4; color: var(--ink-3);
  resize: none; overflow: hidden;
}
.grid tr.jobrow .jobnote::placeholder { color: var(--ink-3); font-style: italic; }
.grid tr.jobrow .jobnote:hover { border-color: var(--rule); }
/* A note with something in it: the one thing on this screen the engine did
   not work out for itself, so it is allowed to shout a little. */
.grid tr.jobrow .jobnote.has-note {
  background: var(--warn-soft); color: var(--ink); font-weight: 500;
  border-color: #EFD9A8; border-left-color: var(--warn);
  box-shadow: 0 1px 3px rgba(22, 32, 42, 0.10);
}
.grid tr.jobrow .jobnote.has-note:hover { border-color: #E3C88A; border-left-color: var(--warn); }
.grid tr.jobrow .jobnote:focus {
  outline: none; background: var(--panel); color: var(--ink);
  border-color: var(--accent); border-left-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 90, 150, 0.14);
}
.grid tr.jobrow .jobnote:disabled { opacity: 0.5; }
.grid tr.shiftrow td.labelcol { padding: 6px 12px 6px 22px; color: var(--ink-2); font-size: 12.5px; }
.grid tr.shiftrow.last td { border-bottom: 1px solid var(--rule); }
.shifttag {
  display: inline-block; min-width: 18px; text-align: center;
  font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 3px; margin-right: 6px;
}
.shifttag.D { background: var(--day); }
.shifttag.N { background: var(--night); color: #fff; }

.cell {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 5px 8px 6px; min-height: 56px; font: inherit; color: inherit;
  border-left: 3px solid transparent;
}
.cell:hover { background: #F2F5F9; }
.cell.N { background: #F7F8FB; }
.cell.N:hover { background: #EEF1F7; }
.cell.has-gap { border-left-color: var(--gap); background: var(--gap-soft); }
/* The shift is staffed, but breaks one of the shift-wide rules: contractors
   only (minLoboPerShift), or nobody on it carrying a company credit card
   (minCardPerShift). */
.cell.has-blockwarn { border-left-color: var(--warn); }
.cell.has-override { border-left-color: var(--accent); }
.cell.inactive { min-height: 56px; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--rule-soft) 6px 7px); cursor: default; }
.slot { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; }
.slot .role { color: var(--ink-3); width: 32px; flex: 0 0 32px; font-size: 11px; }
/* Name on one line, tags under it. min-width:0 lets the name ellipsis inside
   the flex column instead of forcing the slot wider than the cell. */
.slot .slotbody { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.slot .who { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.slot .tags { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 1px; }
/* The row above supplies the spacing, so the inline nudge on .tag would only
   indent the first tag of each line. */
.slot .tags .tag { margin-left: 0; vertical-align: baseline; }
.slot.gap .who { color: var(--gap); font-weight: 600; }
.slot.open .who { color: var(--ink-3); font-style: italic; }
.slot.cross .who::after, .slot.float .who::after { content: " ↗"; color: var(--ink-3); font-size: 11px; }
.slot.float .who { font-style: italic; }
.slot.override .who::before { content: "⚑ "; color: var(--accent); font-size: 11px; }
.slot.warn .who { color: var(--warn); }
.slot.offday .who { color: var(--warn); }
.slot.offday .who::before { content: "● "; font-size: 9px; vertical-align: 1px; }
/* $ beside a name: this person carries a company credit card. Green, because
   unlike the other markers in the grid it is a thing being right rather than a
   thing to fix — and on a shift that needs something bought, it is the name a
   manager is looking for. */
.cardmark { color: var(--ok); font-weight: 700; }
.slot .who .cardmark { font-size: 11.5px; margin-left: 2px; }
.tag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; padding: 0 4px; border-radius: 3px; margin-left: 4px; vertical-align: 1px; flex: 0 0 auto; }
/* Overtime is a single + whose colour says how long the run is. The glyph is
   small, so it gets a little more size and width than the other tags. */
.tag.ot { font-size: 12px; line-height: 1.05; padding: 0 3px; min-width: 13px; text-align: center; }
.tag.ot1 { background: var(--ot-1); color: var(--ink); }
.tag.ot2 { background: var(--ot-2); color: var(--ink); }
.tag.ot3 { background: var(--ot-3); color: #fff; }
.tag.cover { background: var(--warn-soft); color: var(--warn); }
/* Someone working a pad that belongs to a different named crew. */
.tag.offcrew { background: #EDE7F6; color: #5B4A9E; font-weight: 600; }
.slot.offcrew { border-left: 3px solid #7E6BC4; padding-left: 3px; }
/* Trainees: green, on their own row under the pad's shifts. They fill no slot
   and are not available for one — the row says where they are, not what they
   are covering. */
.tag.trn { background: var(--trn-soft); color: var(--trn); min-width: 13px; text-align: center; }
.shifttag.trn { background: var(--trn-soft); color: var(--trn); }
.cell.trainees { background: var(--trn-soft); border-left: 3px solid var(--trn); }
.slot.trainee .who { color: var(--trn); font-weight: 600; }
.slot.trainee .role { color: var(--trn); opacity: .75; }
.grid tr.trainingrow td.labelcol { color: var(--trn); }
/* The clash marker: somebody pinned onto a shift inside their own training.
   Red, because unlike everything else green here it is a mistake to fix. */
.tag.trnclash { background: var(--gap-soft); color: var(--gap); }
.summary .otcount b { color: var(--warn); }
.summary .trncount b { color: var(--trn); }

/* The pinned-over-training notice above the grid. */
.conflicts {
  border: 1px solid #E7B5AC; border-left: 3px solid var(--gap); border-radius: var(--radius);
  background: var(--gap-soft); padding: 10px 14px; margin-bottom: 14px;
}
.conflicthead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.conflictrow {
  display: flex; gap: 12px; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; padding: 6px 0; border-top: 1px solid #EFD0C9; font-size: 13px;
}
.conflictacts { display: flex; gap: 6px; flex: 0 0 auto; }
.conflictacts .btn { background: var(--panel); }

/* ---------- sign-in ---------- */
/* Covers everything: with sign-in on and nobody signed in there is nothing
   behind this worth showing, and the store has not been loaded anyway. */
.signin {
  position: fixed; inset: 0; z-index: 100; background: var(--paper);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.signin-card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 32px 36px; text-align: center; max-width: 380px; width: 100%;
  box-shadow: 0 2px 10px rgba(22, 32, 42, .06);
}
.signin-card h1 { font-size: 20px; margin: 10px 0 4px; }
.signin-card p { margin-bottom: 18px; font-size: 13px; }
.signin-card #gbutton { display: flex; justify-content: center; min-height: 44px; }
.signin-card .error { margin-top: 12px; }

/* Who is signed in, top right. */
.whoami { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.tag.rolepill { background: var(--rule-soft); color: var(--ink-2); margin: 0; padding: 2px 7px; font-size: 10.5px; }
/* A note somebody may read but not write. */
.jobnote.is-readonly { cursor: default; }
.jobnote.is-readonly:hover { border-color: transparent; }
.jobnote.has-note.is-readonly:hover { border-color: #EFD9A8; border-left-color: var(--warn); }
body.readonly .cell[data-date] { cursor: default; }

/* ---------- planner ---------- */
/* One chip per person placed on a pad: who, the rotation they will follow, and
   a way off the pad again. */
.planchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.planchip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--paper); padding: 2px 4px 2px 10px; font-size: 12.5px;
}
.planchip select { font-size: 11px; padding: 1px 4px; border-radius: 999px; }
.planchip .btn-icon { width: 20px; height: 20px; font-size: 14px; border-radius: 999px; }
.card-head select { font-size: 12.5px; }
.pd .tag { margin-left: 0; margin-right: 4px; }
.choice { display: grid; gap: 10px; margin-top: 12px; }
.choice button { text-align: left; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.choice button:hover { border-color: var(--accent); }
.choice button b { display: block; margin-bottom: 2px; }
.choice button span { color: var(--ink-2); font-size: 12.5px; }

/* ---------- people grid ---------- */
.grid tr.crewhead td { padding: 10px 12px 4px; font-weight: 600; background: var(--paper); }
.grid tr.crewhead td.labelcol { background: var(--paper); }
/* The named crews inside a rotation: quieter than the rotation band above. */
.grid tr.teamhead td { padding: 6px 12px 2px; background: var(--paper); }
.grid tr.teamhead td.labelcol { background: var(--paper); font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; padding-left: 20px; }
.grid tr.person td.labelcol { padding: 5px 12px; }
.grid tr.person .pname { font-size: 13px; }
.grid tr.person .ptitle { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd { display: block; height: 100%; min-height: 40px; padding: 5px 8px; font-size: 12px; line-height: 1.3; }
.pd .l1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd .l2 { color: var(--ink-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd.WORK.D { background: var(--day-soft); }
.pd.WORK.N { background: var(--night-soft); }
.pd.SPARE { background: #EAF6EE; color: var(--ok); }
.pd.SPARE .l2 { color: var(--ok); }
.pd.OFF { color: var(--ink-3); }
.pd.TIMEOFF { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--rule-soft) 5px 6px); color: var(--ink-2); }
/* Training reads as its own state, not as a variety of spare or off: they are
   somewhere specific, and not available. */
.pd.TRAINING { background: var(--trn-soft); color: var(--trn); border-left: 3px solid var(--trn); }
.pd.TRAINING .l2 { color: var(--trn); }
.pd.INACTIVE { color: var(--ink-3); }

/* ---------- tables (employees, jobs, time off) ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); }
.list th, .list td { padding: 9px 12px; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: middle; }
.list th { font-weight: 500; color: var(--ink-2); font-size: 12.5px; }
.list tr:last-child td { border-bottom: 0; }
.list tr:hover td { background: #FAFBFA; }
.list .actions { text-align: right; white-space: nowrap; }
.crewpill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 5px; border: 1px solid var(--rule); border-radius: 12px; font-size: 12px; }
.lvl { display: inline-flex; gap: 2px; }
.lvl i { display: inline-block; width: 7px; height: 12px; background: var(--rule-soft); border-radius: 1px; }
.lvl i.on { background: var(--ink-2); }
.inactive-name { color: var(--ink-3); text-decoration: line-through; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11.5px; padding: 1px 7px; border: 1px solid var(--rule); border-radius: 10px; color: var(--ink-2); }
/* Crew coverage: the crew can fill the slot / can fill it but is thin / has
   nobody with the skill at all. */
.chip.ok { color: var(--ok); border-color: #B7D6C3; }
.chip.thin { color: var(--warn); border-color: #E8D3A6; background: var(--warn-soft); }
.chip.none { color: var(--gap); border-color: #E7B5AC; background: var(--gap-soft); }
.nobody { color: var(--gap); }

/* The Crew cell on the jobs table is a button that opens the crew picker. */
.crewbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; line-height: 1.3; text-align: left; }
.crewbtn.is-unset { color: var(--ink-2); border-style: dashed; }

/* ---------- crew picker ---------- */
.crewopts { display: grid; gap: 6px; margin: 12px 0 4px; }
.crewopt {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 9px 11px; border: 1px solid var(--rule); border-radius: var(--radius);
}
.crewopt:hover { border-color: var(--ink-3); }
.crewopt.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.crewopt input { margin-top: 3px; flex: 0 0 auto; }
.crewopt-body { display: grid; gap: 5px; flex: 1; min-width: 0; }
.crewopt-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pullhead { margin: 16px 0 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.pull { display: grid; gap: 8px; }
.pullrow { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: baseline; }
.pullneed { font-size: 12.5px; }
.pullnames { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pullwho { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }

.filterbar { display: flex; gap: 8px; align-items: center; }
.filterbar input, .filterbar select {
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 6px 9px; background: var(--panel);
}

.empty {
  padding: 40px; text-align: center; color: var(--ink-2);
  background: var(--panel); border: 1px dashed var(--rule); border-radius: var(--radius);
}

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 56px; right: 0; bottom: 0; width: 420px; max-width: 100vw;
  background: var(--panel); border-left: 1px solid var(--rule);
  box-shadow: -12px 0 30px rgba(22,32,42,.08); z-index: 30;
  display: flex; flex-direction: column;
}
.drawer-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--rule-soft); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head .spacer { flex: 1; }
.drawer-body { padding: 16px 20px; overflow: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--rule-soft); display: flex; gap: 8px; justify-content: flex-end; }
.slotcard { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.slotcard.gap { border-color: #E7B5AC; background: var(--gap-soft); }
.slotcard h3 { margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.slotcard h3 .min { color: var(--ink-3); font-weight: 400; font-size: 12px; }
.slotcard .current { color: var(--ink-2); font-size: 12.5px; margin-bottom: 8px; }
.slotcard select, .slotcard input {
  width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); padding: 7px 9px; background: var(--panel);
}
.slotcard .row { display: flex; gap: 8px; margin-top: 8px; }
.slotcard .row input { flex: 1; }
/* Marker on a grid cell whose shift has a problem of its own, not a slot's. */
.blockwarn { font-size: 11px; font-weight: 600; color: var(--warn); margin-top: 2px; }
.warnlist { margin: 6px 0 0; padding: 0; list-style: none; color: var(--warn); font-size: 12.5px; }
.warnlist.shiftwarn { margin: 0 0 12px; }
.warnlist li::before { content: "! "; font-weight: 700; }
.pinned { font-size: 12px; color: var(--accent); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(22,32,42,.35); z-index: 40;
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow: auto;
}
.modal { background: var(--panel); border-radius: 6px; width: 640px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--rule-soft); display: flex; align-items: center; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 16px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--rule-soft); display: flex; gap: 8px; }
.modal-foot .spacer { flex: 1; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
.form label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.form input, .form select, .form textarea {
  width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); padding: 7px 9px; background: var(--panel);
}
.form textarea { min-height: 64px; resize: vertical; }
/* A heading inside a form, to group fields that belong together. */
.form .formhead {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-2); border-top: 1px solid var(--rule-soft); padding-top: 12px; margin-top: 2px;
}
.form .check { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.form .check input { width: auto; }
.skillgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.skillgrid label { text-align: center; }
.skillgrid select { text-align: center; }
.needs { display: grid; grid-template-columns: 1.4fr 1.2fr 0.8fr 0.6fr auto; gap: 8px; align-items: end; }
.needs .hdr { font-size: 12px; color: var(--ink-2); }
.shiftcheck { display: flex; gap: 16px; align-items: center; height: 34px; }
.shiftcheck label { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--ink); }
.shiftcheck input { width: auto; }
.error { color: var(--gap); font-size: 12.5px; margin-top: 8px; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: minmax(0, 660px); gap: 20px; }
.btn { white-space: nowrap; }
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; }
.card h3 { margin-bottom: 8px; }
.cycle { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.cycle select, .cycle input, .offsets input, .anchor input {
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 7px 9px; background: var(--panel); width: 100%;
}
.offsets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.offsets label, .anchor label { font-size: 12.5px; color: var(--ink-2); display: block; margin-bottom: 4px; }
.preview { display: grid; grid-template-columns: 60px 1fr; gap: 4px 10px; margin-top: 12px; align-items: center; font-size: 12.5px; }
.preview .bar { display: flex; height: 16px; }
.preview .bar i { flex: 1; }
.preview .bar i.D { background: var(--day); }
.preview .bar i.N { background: var(--night); }
.preview .bar i.OFF { background: var(--off); }
.legend { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 12px; color: var(--ink-2); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.error { background: var(--gap); }

/* Shown when someone else changed the data while a form or the drawer is open,
   so the reload waits until the current edit is finished. */
.stale {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 60;
  background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn);
  padding: 9px 12px 9px 16px; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.conflict { color: var(--warn); }
.conflict b { display: block; margin-bottom: 2px; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .tab { padding: 10px 10px; }
  .range { margin-left: auto; }
  #main { padding: 12px; }
  .drawer { width: 100vw; top: 0; }
  .form { grid-template-columns: 1fr; }
  .skillgrid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer { transition: transform .18s ease; }
}

/* ---------- status ---------- */
.status { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.status .card { padding: 0; overflow: hidden; }
.status .card-head { display: flex; align-items: baseline; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--rule-soft); }
.status .card-head h3 { flex: 1; }
.status .card-head .count { font-size: 22px; font-weight: 600; }
.status .card-head .count.warn { color: var(--gap); }
.status table.list { border: 0; }
.status .list td, .status .list th { padding: 7px 16px; }
.status .grouphead td { background: var(--paper); font-weight: 600; padding: 8px 16px 4px; }
.status .empty { border: 0; padding: 28px 16px; }
.streakbar { display: inline-flex; gap: 1px; vertical-align: middle; margin-right: 8px; }
.streakbar i { width: 5px; height: 12px; background: var(--ink-3); border-radius: 1px; }
/* Same thresholds as the + marker: 15+, 21+, 28+ straight days. */
.streakbar i.ot1 { background: var(--ot-1); }
.streakbar i.ot2 { background: var(--ot-2); }
.streakbar i.ot3 { background: var(--ot-3); }
.asof { display: flex; align-items: center; gap: 8px; }
.asof input[type=date], .asof input[type=month] { border: 1px solid var(--rule); border-radius: var(--radius); padding: 5px 8px; background: var(--panel); }
@media (max-width: 1100px) { .status { grid-template-columns: 1fr; } }

/* ---------- reports ---------- */
/* One column: the staffing tables are too wide to sit half a screen across. */
.reports { display: grid; gap: 20px; align-items: start; max-width: 1100px; }
.reports .card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.reports .card-head h3 { flex: 1; margin-bottom: 0; }
.reports .card-head .count { font-size: 22px; font-weight: 600; }
.reports .card-head .count.warn { color: var(--gap); }
.reports p { margin: 0 0 8px; }
.reports .row { display: flex; gap: 8px; align-items: center; }
/* An <a> styled as a button still needs to sit on the text baseline. */
.reports a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.reports .list { margin-top: 4px; }
.reports details > summary { cursor: pointer; color: var(--ink-2); }
.reports ul.method { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; }
.reports ul.method li { margin-bottom: 5px; }

/* The headline numbers of the staffing report. */
.bignums { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.bignum {
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; background: var(--paper);
}
.bignum .n { font-size: 28px; font-weight: 600; line-height: 1.1; }
.bignum .l { font-size: 13px; }
.bignum .sub { font-size: 11.5px; color: var(--ink-2); }
.bignum.bad .n { color: var(--gap); }
.bignum.ok .n { color: var(--ok); }
