:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #667085;
  --line: #d9dde3;
  --line-soft: #eceef2;
  --accent: #1f5fbf;
  --accent-soft: #e8f0fc;
  --calc: #f3f6ee;
  --calc-head: #e3ead6;
  --ok: #1d7a46;
  --bad: #b42318;
  --warn: #9a6700;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

.topbar {
  display: flex;
  flex-wrap: wrap;  /* narrow windows: the menu and the batch picker drop below the title */
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 20px;
  background: #16213a;
  color: #fff;
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; white-space: nowrap; }

/* "Go to tab" menu in the top bar */
.tab-menu { position: relative; margin-right: auto; }
.tab-menu-button { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; color: #fff;
  background: #22304f; border: 1px solid #3a4866; border-radius: 4px; padding: 4px 10px; min-width: 220px; cursor: pointer; }
.tab-menu-button:hover, .tab-menu-button[aria-expanded="true"] { border-color: #6d84b3; }
.tab-menu-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-menu-caret { color: #c9d2e3; font-size: 11px; }
.tab-menu-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 380px; max-width: calc(100vw - 40px);
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); }
.tab-menu-search { display: block; width: calc(100% - 16px); margin: 8px; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.tab-menu-search:focus { outline: none; border-color: var(--accent); }
.tab-menu-list { list-style: none; margin: 0; padding: 0 0 6px; max-height: 60vh; overflow-y: auto; }
.tab-menu-item { display: flex; flex-direction: column; padding: 6px 12px; cursor: pointer; border-left: 3px solid transparent; }
.tab-menu-item.hi { background: var(--accent-soft); }
.tab-menu-item.here { border-left-color: var(--accent); }
.tab-menu-item.here .tab-menu-name { font-weight: 600; }
.tab-menu-item.soon { cursor: default; color: #a8afbb; padding: 3px 12px; }
.tab-menu-detail { font-size: 12px; color: var(--muted); }
.tab-menu-heading { padding: 8px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-top: 1px solid var(--line-soft); margin-top: 4px; }
.tab-menu-empty { padding: 6px 12px; color: var(--muted); }
.batch-picker { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c9d2e3; }
.batch-picker select { font: inherit; padding: 4px 8px; border-radius: 4px; border: 1px solid #3a4866; background: #22304f; color: #fff; min-width: 220px; }

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs a, .tabs span {
  padding: 10px 14px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid transparent;
}
.tabs a:hover { background: var(--bg); }
.tabs a.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.tabs span.soon { color: #a8afbb; cursor: default; }
.tabs .sep { width: 1px; background: var(--line); margin: 8px 6px; padding: 0; }

main { padding: 20px; max-width: 1600px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

button, .button {
  font: inherit;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
button.secondary { background: #fff; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
input[type=text] { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; min-width: 260px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 6px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fbfcfd;
  cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #e3f4ea; color: var(--ok); }
.pill.bad { background: #fde8e6; color: var(--bad); }
.pill.muted { background: var(--line-soft); color: var(--muted); }
.pill.warn { background: #fdf3d8; color: var(--warn); }

.checks { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.checks li::before { content: "• "; }
.checks .fail { color: var(--bad); }

.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Spreadsheet tab */
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.source { font-size: 12.5px; color: var(--muted); text-align: right; }
.source a { color: var(--accent); }

.questions { background: #fffbea; border: 1px solid #f1e2a6; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.questions h2 { font-size: 13px; margin: 0 0 4px; }
.questions ul { margin: 0; padding-left: 18px; }

.grid-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { border: 1px solid var(--line-soft); padding: 6px 9px; white-space: nowrap; }
table.grid thead th { background: #f0f2f5; font-weight: 600; text-align: left; vertical-align: bottom; white-space: normal; min-width: 90px; }
table.grid thead tr.letters th { background: #fafbfc; color: #98a1b0; font-weight: 400; font-size: 11px; text-align: center; padding: 2px; }
table.grid thead tr.group th.calc-group { background: var(--calc-head); text-align: center; }
table.grid thead th.calc { background: var(--calc-head); }
table.grid td.calc { background: var(--calc); }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.err { color: var(--bad); text-align: center; font-family: var(--mono); font-size: 12px; }
table.grid tbody tr:hover td { background-color: var(--accent-soft); }
table.grid tfoot td { font-weight: 600; background: #f0f2f5; }

button.small { padding: 3px 10px; font-size: 13px; }
td.actions { white-space: nowrap; }
td.actions > * + * { margin-left: 10px; }

.row.spread { justify-content: space-between; }
textarea.full { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; cursor: pointer; }

/* EUI tab */
h2.section { margin: 24px 0 8px; font-size: 16px; }
table.grid.eui td, table.grid.eui th { padding: 4px 8px; }
table.grid tr.group-start td { border-top: 2px solid var(--line); }
table.grid td.sub-label { color: var(--muted); white-space: nowrap; }
table.grid td.total, table.grid tr.total-row td { font-weight: 600; background: #f0f2f5; }
table.grid td.calc-label { color: var(--muted); }
table.grid td.paid { background: #e3f4ea; color: var(--ok); font-weight: 600; }
table.grid td.in { padding: 2px 4px; background: #f5f9ff; box-shadow: inset 0 0 0 1px #b9cff5; }
table.grid td.warn-cell { background: #fdf3d8; box-shadow: inset 0 0 0 1px #f0d48a; }
table.grid td.small-dates { font-size: 12px; color: var(--muted); }
.cell-input { font: inherit; font-size: 13px; padding: 2px 4px; border: 1px solid transparent; border-radius: 3px; background: transparent; width: 100%; min-width: 0; }
.cell-input:hover, .cell-input:focus { border-color: var(--accent); background: #fff; outline: none; }
.cell-input.num { text-align: right; }
.cell-input.custom { color: #8a5a00; font-weight: 600; }
.cell-input.pct, .cell-input.rate { width: 64px; display: inline-block; border-color: #b9cff5; background: #f5f9ff; text-align: right; }
.edit-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); border: 1px solid #b9cff5; border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.holidays { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.holidays .cell-input { width: 150px; border-color: var(--line); background: #fff; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #f5f9ff; border: 1px solid #b9cff5; border-radius: 12px; padding: 1px 4px 1px 10px; font-size: 13px; }
.chip-x { border: none; background: none; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; }
.chip-x:hover { color: var(--bad); }
.warnbox { background: #fdf3d8; border: 1px solid #f0d48a; border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; color: #6b4a00; }
.warnbox ul { margin: 4px 0 0; padding-left: 18px; }

/* Change marks. Each has its own shape so they can stack:
   teal   = edited in this batch: teal fill + thick teal bar on the left
   purple = different from the comparison batch: purple corner triangle (top right) + purple outline
   amber  = overridden report value: amber fill + amber bar (see "Overrides") */
:root {
  --chg: #6d28d9; --chg-soft: #efe7ff;
  --edited: #0d9488; --edited-soft: #ccf2ec;
  --corner: linear-gradient(225deg, var(--chg) 10px, transparent 10px);
}
.comparebox { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--chg); border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; font-size: 13.5px; }
.comparebox label { white-space: nowrap; font-weight: 600; }
.cell-input.compare-n { width: 52px; display: inline-block; border-color: var(--line); background: #fff; text-align: right; margin: 0 4px; }
.edits-line { flex-basis: 100%; }

.legend.chg, .legend.edited { display: inline-block; padding: 0 8px 0 10px; margin-right: 8px; color: var(--ink); }
.legend.chg { background: var(--chg-soft) var(--corner) no-repeat; box-shadow: 0 0 0 1px var(--chg); }
.legend.edited { background: var(--edited-soft); border-left: 4px solid var(--edited); }
.legend.twice { display: inline-block; padding: 0 8px; margin-right: 8px; color: var(--ink); background: #fdf3d8; box-shadow: 0 0 0 1px #f0d48a; }
.legend.small { font-size: 11px; font-weight: 400; margin-left: 8px; }

/* Table cells */
table.grid td.chg { background-image: var(--corner); box-shadow: inset 0 0 0 1px var(--chg); }
table.grid td.chg:not(.ovr):not(.calc):not(.edited):not(.banded) { background-color: var(--chg-soft); }
table.grid td.ovr.chg { box-shadow: inset 3px 0 0 var(--ovr-line), inset 0 0 0 1px var(--chg); }
table.grid td.ovr.changed.chg { box-shadow: inset 3px 0 0 var(--bad), inset 0 0 0 1px var(--chg); }
table.grid tr.new-row td { background-color: var(--chg-soft); }
table.grid tr.new-row td:first-child { box-shadow: inset 4px 0 0 var(--chg); }

/* Typed-in inputs and holiday chips */
.cell-input.edited { background-color: var(--edited-soft); box-shadow: inset 4px 0 0 var(--edited); border-color: var(--edited); }
.cell-input.chg { background-image: var(--corner); background-repeat: no-repeat; border-color: var(--chg); }
.cell-input.chg:not(.edited) { background-color: var(--chg-soft); }
.cell-input.edited:hover, .cell-input.edited:focus { background-color: var(--edited-soft); }
.chip.edited { background: var(--edited-soft); border: 2px solid var(--edited); }
.chip.chg { border: 2px solid var(--chg); }
.chip.chg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chg); margin-left: -4px; }
.chip.edited.chg { border-color: var(--edited); box-shadow: 0 0 0 2px var(--chg); }

/* Questions box */
.questions.edited-box { box-shadow: inset 4px 0 0 var(--edited); }
.questions.chg-box { background-image: var(--corner); background-repeat: no-repeat; outline: 1px solid var(--chg); }

/* Color key in the changes box */
.color-key { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 6px; font-size: 12.5px; }
.key-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 18px; height: 16px; border-radius: 2px; display: inline-block; }
.swatch.edited { background: var(--edited-soft); box-shadow: inset 4px 0 0 var(--edited), 0 0 0 1px var(--edited); }
.swatch.chg { background: var(--chg-soft) var(--corner) no-repeat; box-shadow: 0 0 0 1px var(--chg); }
.swatch.ovr { background: var(--ovr); box-shadow: inset 4px 0 0 var(--ovr-line), 0 0 0 1px var(--ovr-line); }
.swatch.ovr.changed { box-shadow: inset 4px 0 0 var(--bad), 0 0 0 1px var(--bad); }
.legend.ovr.changed { border-left-color: var(--bad); }

/* Report checklist on the Import page */
.pill.stored { background: #e6eefb; color: var(--accent); }
table.checklist tr.missing td { color: var(--muted); }
table.checklist td { vertical-align: middle; }
.progress { width: 180px; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }

/* Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 5;
}
.modal {
  background: var(--bg);
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(16, 24, 40, .3);
  width: min(1400px, 100%);
  padding: 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-head h1 { font-size: 18px; }
.modal-head .sub { margin-bottom: 6px; }

/* Overrides */
:root { --ovr: #fff1c2; --ovr-line: #e0b94a; }
table.grid td.ovr, table.grid tbody tr:hover td.ovr { background-color: var(--ovr); box-shadow: inset 3px 0 0 var(--ovr-line); }
table.grid td.ovr.changed { box-shadow: inset 3px 0 0 var(--bad); }
table.grid.editable tbody td:not(.key) { cursor: pointer; }
table.grid.editable tbody td:not(.key):hover { outline: 2px solid var(--accent); outline-offset: -2px; }
table.grid.editable tbody td[data-field] { user-select: none; }
table.grid.editable tbody td.selected { background: #dbe8f7; box-shadow: inset 0 0 0 2px var(--accent); }
table.grid td.key { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.legend.ovr { display: inline-block; background: var(--ovr); border-left: 3px solid var(--ovr-line); padding: 1px 8px; margin-right: 10px; color: var(--ink); }
.flag { background: #fde8e6; color: var(--bad); border-radius: 4px; padding: 8px 10px; font-size: 13px; }
.flag-inline { color: var(--bad); font-size: 12px; }
.form-error { color: var(--bad); margin: 0; min-height: 1em; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(380px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(16, 24, 40, .12);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.drawer[hidden] { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-head .sub { margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.kv span { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; min-width: 0; width: 100%; }
.modes { border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.modes legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.mode { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.mode small { color: var(--muted); }

.carried { font-size: 12px; color: #8a5a00; }
button.carry { background: #fff7e0; color: #8a5a00; border-color: #e0b94a; white-space: nowrap; }
button.carry:hover { background: #fdeebf; }

/* Batches panel */
button.danger { color: var(--bad); border-color: #e7a19a; }
button.danger:hover { background: #fde8e6; }
.small-pill { margin-left: 8px; font-size: 11px; font-weight: 400; }
table.batches tr.current td { background: var(--accent-soft); }
.cell-input.boxed { width: auto; border-color: var(--line); background: #fff; padding: 5px 6px; }

/* Banner while viewing an earlier batch */
.batch-banner { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 20px; background: #fff4d6; border-bottom: 1px solid #f0d48a; color: #6b4a00; font-size: 13.5px; }
.batch-banner[hidden] { display: none; }
.compare-note { color: #6b4a00; font-size: 12.5px; }
.warnbox.fy { background: #eef4ff; border-color: #b9cff5; color: var(--ink); }
.warnbox.fy .link { font-size: 12.5px; }

/* Headcount (Wk): a grid of inputs, one per person and week */
table.grid.hc td.in { padding: 1px 2px; min-width: 38px; }
table.grid.hc .cell-input.num { width: 40px; }
table.grid.hc td.name-cell { min-width: 170px; }
table.grid td.row-actions { white-space: nowrap; padding: 2px 4px; }
table.grid th.current-week, table.grid td.current-week { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
table.grid tr.section-row td { background: #f0f2f5; font-weight: 600; color: var(--muted); }
h3.subsection { margin: 16px 0 6px; font-size: 14px; }
.add-person { margin: 6px 0 4px; gap: 6px; }
.add-person .cell-input { width: 220px; border-color: var(--line); background: #fff; }

/* Dashboard (Wkly): the workbook's colour bands, and notes rows */
/* Colour bands keep their colour when the row is hovered, so their text stays readable. */
table.grid td.band-good, table.grid tbody tr:hover td.band-good, table.grid tr.total-row td.band-good { background: #d7f0dc; }
table.grid td.band-ok, table.grid tbody tr:hover td.band-ok, table.grid tr.total-row td.band-ok { background: #fdf3d8; }
table.grid td.band-low, table.grid tbody tr:hover td.band-low, table.grid tr.total-row td.band-low { background: #fde2cf; }
table.grid td.band-on, table.grid tbody tr:hover td.band-on { background: #e4ecfb; }
.year-notes .cell-input.wide { width: 480px; }
/* Rev Forecast tabs */
table.grid.rev td.qtr-end, table.grid.rev th.qtr-end { border-right: 2px solid var(--line); }
table.grid.rev tr.unmapped td:first-child { font-style: italic; color: var(--muted); }
table.grid.rev .cell-input.money { width: 90px; min-width: 0; }
.rev-cats .rev-cat { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.rev-cats .rev-cat .cell-input.name { width: 220px; min-width: 0; }
/* % of target, the workbook's colours: target blocks FF5050 / gold 60% lighter / green 40% lighter; summary FF0000 / FFC000 */
table.grid tr td.pct-low, table.grid tbody tr:hover td.pct-low, .band.pct-low { background: #ff5050; }
table.grid tr td.pct-near, table.grid tbody tr:hover td.pct-near, .band.pct-near { background: #ffe699; }
table.grid tr td.pct-met, table.grid tbody tr:hover td.pct-met, .band.pct-met { background: #a9d08e; }
table.grid tr td.pct-miss, table.grid tbody tr:hover td.pct-miss, .band.pct-miss { background: #ff0000; }
table.grid tr td.pct-close, table.grid tbody tr:hover td.pct-close, .band.pct-close { background: #ffc000; }
/* Utilization (Wk) hours per person: the workbook's 40-hour colours (92D050; accent 6, 25% darker) */
table.grid td.week-full, table.grid tbody tr:hover td.week-full, .band.week-full { background: #92d050; }
table.grid td.week-over, table.grid tbody tr:hover td.week-over, .band.week-over { background: #548235; color: #fff; }
/* "banded" cells keep their colour (set in --band) when overridden: the amber shows as a thick left edge and a
   bottom-left corner instead of the fill, so both reasons stay visible. Purple keeps its top-right corner. */
.week-full { --band: #92d050; } .week-over { --band: #548235; }
:root { --ovr-corner: linear-gradient(45deg, var(--ovr-line) 12px, transparent 12px); }
table.grid tbody tr td.banded.ovr, table.grid tbody tr:hover td.banded.ovr, .band.banded.ovr {
  background-color: var(--band); background-image: var(--ovr-corner); background-repeat: no-repeat;
  box-shadow: inset 4px 0 0 var(--ovr-line), inset 0 0 0 1px var(--ovr-line);
}
table.grid tbody tr td.banded.ovr.changed, table.grid tbody tr:hover td.banded.ovr.changed {
  background-image: linear-gradient(45deg, var(--bad) 12px, transparent 12px); box-shadow: inset 4px 0 0 var(--bad), inset 0 0 0 1px var(--bad);
}
table.grid tbody tr td.banded.ovr.chg { background-image: var(--ovr-corner), var(--corner); box-shadow: inset 4px 0 0 var(--ovr-line), inset 0 0 0 1px var(--chg); }
table.grid tbody tr td.banded.ovr.changed.chg { background-image: linear-gradient(45deg, var(--bad) 12px, transparent 12px), var(--corner); }
.band-legend { margin-right: 16px; }
.band { display: inline-block; padding: 0 6px; margin: 0 2px; border-radius: 3px; color: var(--ink); }
.band.band-good { background: #d7f0dc; } .band.band-ok { background: #fdf3d8; } .band.band-low { background: #fde2cf; }
table.grid.dash { width: auto; font-size: 12px; }
table.grid.dash th, table.grid.dash td { padding: 3px 4px; }
table.grid.dash thead th { min-width: 0; text-align: right; }
table.grid.dash thead th .week-end { display: block; font-weight: normal; color: #6b7280; font-size: 11px; }
table.grid.dash td.in { padding: 1px; }
table.grid.dash tr.note-row .cell-input { width: 38px; min-width: 0; font-size: 11px; padding: 1px 2px; }
table.grid.dash td:first-child { min-width: 220px; max-width: 280px; white-space: normal; }
.section-row .from-tab { font-weight: 400; font-size: 12px; margin-left: 6px; }
/* Import page: the Salesforce connection line */
.panel.salesforce .button { display: inline-block; white-space: nowrap; margin: 2px 6px 2px 0; }
/* Headcount (Mth): affiliates' calculated FTE shows as the empty cell's placeholder */
table.grid.hc .cell-input::placeholder { color: #6b7280; font-style: italic; }
/* Utilization (Mth): target percentages */
table.grid .cell-input.pct-input { width: 64px; min-width: 0; }

/* Right-click menu on report cells (marks.js), and the cell it goes to in the "Edit report data" popup */
table.grid td.from-report { cursor: context-menu; }
.cell-menu { position: fixed; z-index: 1000; display: flex; flex-direction: column; min-width: 180px; padding: 4px 0;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); }
.cell-menu button { all: unset; padding: 6px 14px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.cell-menu button:hover, .cell-menu button:focus { background: var(--accent-soft); outline: none; }
table.grid td.located { outline: 3px solid var(--accent); outline-offset: -3px; animation: located 1.2s ease-out 2; }
@keyframes located { 50% { outline-color: transparent; } }

/* "Where this comes from" panel for calculated cells (cell-source.js) */
table.grid td.from-calc { cursor: context-menu; }
.drawer.cell-source { z-index: 900; overflow-y: auto; width: min(460px, 100vw); }
.drawer.cell-source .drawer-head .row { gap: 6px; flex-wrap: nowrap; }
.source-formula { margin: 10px 0 4px; font-weight: 600; }
.source-expr { margin: 0 0 12px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
table.list.source-inputs { width: 100%; font-size: 13px; }
table.list.source-inputs td { vertical-align: top; padding: 5px 4px; }
table.list.source-inputs td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list.source-inputs td:last-child { white-space: nowrap; text-align: right; }
table.list.source-inputs button + button { margin-left: 4px; }
#view .located:not(td) { outline: 3px solid var(--accent); outline-offset: 2px; animation: located 1.2s ease-out 2; }
.source-return:not(:empty) { margin: -6px 0 12px; }
/* Duration: the workbook's colours (Excel's "light red", "yellow" and "green" cell styles; errors 00B0F0;
   last month accent 1, 40% lighter, with dark blue text) */
table.grid tr td.dur-red, table.grid tbody tr:hover td.dur-red, .band.dur-red { background: #ffc7ce; color: #9c0006; }
table.grid tr td.dur-yellow, table.grid tbody tr:hover td.dur-yellow, .band.dur-yellow { background: #ffeb9c; color: #9c5700; }
table.grid tr td.dur-green, table.grid tbody tr:hover td.dur-green, .band.dur-green { background: #c6efce; color: #006100; }
table.grid tr td.dur-last, table.grid tbody tr:hover td.dur-last, .band.dur-last { background: #8ea9db; color: #203764; }
table.grid tr td.dur-err, table.grid tbody tr:hover td.dur-err, .band.dur-err { background: #00b0f0; color: #fff; }
/* Rev by Acct (Mth): the summaries side by side, and the classification inputs */
.rba-summaries { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.rba-summaries .rba-summary { flex: 0 1 auto; }
table.grid.rba .cell-input.rba-class { width: 110px; min-width: 0; }

/* Staff Util & Assign (Mth): the workbook's colours, 75% or more green, over 100% light blue */
table.grid tr td.su-good, table.grid tbody tr:hover td.su-good, .band.su-good { background: #c6efce; color: #006100; }
table.grid tr td.su-over, table.grid tbody tr:hover td.su-over, .band.su-over { background: #9dc3e6; }
table.staff-util input.short { width: 70px; min-width: 0; }
table.grid td.neg { color: #c00000; }
table.grid td.from-earlier { background: #f2f0ea; font-style: italic; }

/* ---------- signing in, the user menu, the Users page (static/js/account.js) ---------- */
body.signed-out .tabs, body.signed-out .tab-menu, body.signed-out .batch-picker, body.signed-out .batch-banner { display: none; }
.auth-box { max-width: 380px; margin: 48px auto; padding: 24px 28px; background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; display: flex; flex-direction: column; gap: 12px; }
.auth-box h1 { margin: 0 0 4px; font-size: 22px; }
.auth-box .field { display: flex; flex-direction: column; gap: 4px; }
.auth-box input { font: inherit; padding: 6px 8px; }
.auth-box pre { background: var(--line-soft); padding: 8px 10px; border-radius: 4px; overflow-x: auto; }
.user-menu { position: relative; margin-left: 12px; }
.user-btn { background: transparent; color: #fff; border: 1px solid #3a4866; border-radius: 4px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.user-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--panel); color: var(--ink); border: 1px solid var(--line-soft); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 180px; display: flex; flex-direction: column; padding: 4px 0; }
.user-menu-list[hidden] { display: none; }
.user-menu-list a, .user-menu-list button { padding: 8px 14px; text-align: left; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.user-menu-list a:hover, .user-menu-list button:hover { background: var(--accent-soft); color: var(--accent); }
.topbar > .pill.warn { margin-left: 12px; }
table.grid.users tr.inactive td { color: var(--muted); }
table.grid.users td.row { white-space: nowrap; }
form.add-user { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
form.add-user .field { display: flex; flex-direction: column; gap: 4px; }
form.add-user input, form.add-user select { font: inherit; padding: 5px 8px; }

/* ---------- Change history (static/js/history.js) ---------- */
table.grid.history td { vertical-align: top; }
table.grid.history tr.undone td { color: var(--muted); }
table.grid.history td button { margin-top: 6px; }
pre.history-json { max-height: 240px; overflow: auto; font-size: 11px; background: var(--line-soft); padding: 6px 8px; border-radius: 4px; margin: 4px 0 0; }

/* ---------- two-step sign-in (renderMfa in static/js/account.js) ---------- */
.auth-box.wide { max-width: 520px; }
.auth-box .code-input { font: inherit; font-size: 20px; letter-spacing: 3px; padding: 6px 10px; width: 10ch; }
.auth-box form.row .code-input { margin-right: 4px; }
.mfa-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.mfa-steps .qr { margin: 8px 0; }
.mfa-steps .qr img { display: block; border: 1px solid var(--line-soft); border-radius: 4px; }
.mfa-steps code.secret { display: inline-block; margin-top: 6px; font-size: 14px; letter-spacing: 1px; background: var(--line-soft); padding: 4px 8px; border-radius: 4px; }
pre.recovery { font-size: 16px; line-height: 1.6; background: var(--line-soft); padding: 10px 14px; border-radius: 4px; columns: 2; }
.auth-box label.remember { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.auth-box label.remember input { margin-top: 2px; }

/* Salesforce reports page */
table.grid.sf-reports td { vertical-align: top; }
table.grid.sf-reports select, table.grid.sf-reports input[type=date] { display: block; margin-bottom: 3px; }
table.grid.sf-reports .cell-input { border-color: var(--line); background: #fff; }
table.grid.sf-reports .report-id { width: 15em; font-family: var(--mono); }
table.grid.sf-reports .shift { width: 5em; }
table.grid.sf-reports .notes { width: 16em; }
table.grid.sf-reports input[type=date][hidden] { display: none; }
table.grid.sf-reports td.range { white-space: nowrap; }
table.grid.sf-reports tr.bad-row td { background: #fde8e6; }

/* Import: saved pulls */
.load-pulled { margin-top: 10px; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Import: the batch list scrolls past 10 batches, header kept in view */
.batch-scroll { overflow-y: auto; }
.batch-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }

/* Graph popup (static/js/graphs.js, charts.js). Series colors: a colorblind-checked categorical order, used in this order. */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
}
.modal.graphs { width: min(1000px, 100%); }
.chart-list { display: grid; gap: 16px; margin-top: 8px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.chart-card h2 { font-size: 15px; margin: 0 0 4px; }
.chart-card .sub { margin: 0 0 6px; }
.chart-empty { color: var(--muted); font-style: italic; margin: 12px 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.chart-legend .swatch.line { width: 16px; height: 0; border-top: 2px solid var(--c); border-radius: 0; background: none; }
.chart-legend .swatch.dash { border-top-style: dashed; }
.chart-legend .swatch.ref { border-top: 1px dashed var(--muted); }
.chart-plot { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .tick { font-size: 11px; fill: var(--muted); }
.chart-svg .value { font-size: 11px; fill: var(--ink); }
.chart-svg .donut-total { font-size: 18px; font-weight: 600; fill: var(--ink); }
.chart-svg .grid { stroke: var(--line-soft); }
.chart-svg .axis { stroke: var(--line); }
.chart-svg .ref { stroke: var(--muted); stroke-dasharray: 4 3; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.dash { stroke-dasharray: 6 4; }
.chart-svg .dot { stroke: var(--panel); stroke-width: 1; pointer-events: none; }
.chart-svg .mark { pointer-events: none; }
.chart-svg .slice { pointer-events: auto; stroke: var(--panel); stroke-width: 2; }
.chart-svg .hit { fill: transparent; }
.chart-svg .hit:hover { fill: var(--accent-soft); fill-opacity: .45; }
.chart-tip {
  position: absolute; pointer-events: none; white-space: pre; z-index: 1;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 4px 12px rgba(16, 24, 40, .15); padding: 6px 8px; font-size: 12px; line-height: 1.4;
}
