/* ==========================================================================
   Precision Garage Door — Payroll Console
   Design system lifted from phase-0/wireframes/02-console.html (direction D2),
   selected by Joel on 2026-08-17.

   D2 was chosen because it is the direction closest to ServiceTitan, which the
   technicians already use daily. Two properties of that choice are load-bearing
   and must survive into the build:

     - EXCEPTION-FIRST. The reconciliation found 9 unreconciled invoices out of
       151; a short actionable list is the true shape of the work, so the data
       screens lead with what needs attention rather than with a full grid.
     - TABLES SCROLL SIDEWAYS ON MOBILE rather than dropping columns, so a
       technician on a phone is never shown a subset of their own pay without
       being told. Settled at wireframe review.

   ⚠️ Density is the known trade-off. D2 shows ~8 table rows per screen against
   D1's 30, and Joel reviews ~168 invoices per pay period. Mixing D2's chrome
   with a denser review grid is a legitimate and anticipated combination.
   ========================================================================== */

:root {
  /* Navy — sidebar, headings, the accent card */
  --ink:            #0f1c2e;
  --navy-900:       #122036;
  --navy-700:       #1d3153;
  --navy-400:       #768db0;   /* 4.8:1 on navy-900: the sidebar's 10-11px text needs 4.5 */
  --navy-300:       #9db0cc;
  --navy-200:       #8fa5c4;

  /* Teal — the single accent. Actions, active state, positive figures */
  --teal:           #37b6a4;
  --teal-deep:      #1a8273;   /* under white text: 4.7:1, where the brand teal gives 2.5 */
  --teal-tint:      #e2f6ef;
  --teal-ink:       #12775f;

  /* Slate — body text and its quieter registers */
  --slate:          #55677e;   /* 4.9:1 or better on every background here */
  --slate-light:    #5e7087;   /* 4.5:1 on white and the app background; was 2.8 */
  --slate-deep:     #4d6180;

  /* Surfaces */
  --bg:             #eef1f6;
  --bg-app:         #f4f6fa;
  --surface:        #fff;
  --border:         #dce3ed;
  --border-soft:    #eaeff6;
  --border-faint:   #f2f5f9;
  --chip-neutral:   #e8edf5;

  /* Amber — warnings, and the "this creates a new version" callout */
  --amber:          #e8a33d;
  --amber-tint:     #fdf0e0;
  --amber-wash:     #fff7e8;
  --amber-ink:      #9a5c05;
  --amber-body:     #7a5410;

  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 3px rgba(15, 28, 46, .07);
  --shadow-lift:    0 18px 50px rgba(0, 0, 0, .3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font: 14px/1.5 "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { display: flex; height: 100vh; background: var(--bg-app); overflow: hidden; }

.sidebar {
  width: 220px; flex: none;
  background: var(--navy-900); color: #fff;
  padding: 20px 0;
  display: flex; flex-direction: column;
}

.brand { padding: 0 20px 22px; font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.brand small {
  display: block; font-weight: 400; font-size: 10px;
  color: var(--navy-400); letter-spacing: .08em; margin-top: 3px;
  text-transform: uppercase;
}

.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--navy-300); text-decoration: none;
  font-size: 13px; font-weight: 500;
  border: 0; background: none; width: 100%; text-align: left;
  font-family: inherit; cursor: pointer;
}
.sidebar a:hover { color: #fff; }
.sidebar a.active {
  background: var(--navy-700); color: #fff;
  box-shadow: inset 3px 0 0 var(--teal);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); flex: none; }

/* Groups. The nav scrolls on its own so a long list never pushes the identity
   block off the bottom — that block is how you know which account you are in. */
.nav-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.nav-group { margin-bottom: 2px; }
.nav-group-head {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 9px 20px 5px;
  background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--navy-400); text-align: left;
}
.nav-group-head:hover { color: var(--navy-300); }
.nav-group-caret { font-size: 9px; width: 8px; flex: none; }
.nav-group-items[hidden] { display: none; }

/* Indented under their heading, and a touch tighter than a top-level item —
   twenty rows plus five headings has to fit a laptop without scrolling. */
.sidebar .nav-group-items a { padding: 7px 20px 7px 35px; }

/* A grouped table: the line above each new group, so the eye sees where one
   tenure ends and the next begins without a heading per group. */
tbody tr.tier-first > td { border-top: 1px solid var(--border); }
tbody tr.tier-first:first-child > td { border-top: 0; }

.sidebar-foot {
  margin-top: auto; padding: 16px 20px;
  border-top: 1px solid var(--navy-700);
  font-size: 11px; color: var(--navy-400);
}
.sidebar-foot strong { display: block; color: #fff; font-weight: 600; font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--surface);
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  flex: none;
  display: flex; align-items: flex-start; gap: 20px;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.topbar p { color: var(--slate); font-size: 13px; margin-top: 2px; }

.content { flex: 1; overflow: auto; padding: 22px 26px; }

/* ==========================================================================
   Picker — the button-and-menu control
   --------------------------------------------------------------------------
   Was the tenant switcher's alone. Extracted when the reports screen needed
   the same control, because two things that choose one item from a short named
   list should not look like two different kinds of thing. `.switcher` is now
   just `.picker` that pushes itself to the right-hand end of the top bar.
   ========================================================================== */
.picker, .switcher { position: relative; flex: none; }
.switcher { margin-left: auto; }
.picker-btn, .switcher-btn {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  cursor: pointer; max-width: 280px;
}
.picker-btn:hover, .switcher-btn:hover { border-color: var(--navy-300); }
/* Locked: still readable, no longer offering. Matches a disabled <select>. */
.picker-btn:disabled { opacity: .55; cursor: not-allowed; }
.picker-btn:disabled:hover { border-color: var(--border); }
.picker-btn .loc, .switcher-btn .loc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* In a form the picker fits its column. With only the 280px cap, a long choice
   ("Correction — put right a figure that was wrong") pushed the button out of
   the panel's right edge instead of ending in an ellipsis. */
.form .picker { max-width: 100%; }
.form .picker-btn { max-width: 100%; }
.picker-btn .caret, .switcher-btn .caret { color: var(--slate); font-size: 10px; margin-left: 2px; }
.picker-menu, .switcher-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(15, 28, 46, .14);
  min-width: 280px; padding: 6px; z-index: 40;
}
.picker-menu button, .switcher-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; font: inherit; font-size: 13px;
  padding: 9px 11px; border-radius: 6px; cursor: pointer; text-align: left;
  color: var(--ink);
}
.picker-menu button:hover, .switcher-menu button:hover { background: var(--bg); }
.picker-menu button.current, .switcher-menu button.current { font-weight: 600; }
.picker-menu .tick, .switcher-menu .tick { color: var(--teal); margin-left: auto; font-weight: 700; }

/* A picker inside a panel head opens leftward — it is not at the right edge of
   the window like the switcher is, and a menu anchored right would hang off
   its own control. */
.picker .picker-menu { right: auto; left: 0; min-width: 240px; }
/* ** A long list scrolls inside the menu. ** 21 pay periods ran off the bottom
   of the window. This is the case a native <select> handled for free and the
   reason to be deliberate about it here rather than assume short lists. */
.picker-menu {
  max-height: min(52vh, 420px);
  overflow-y: auto;

  /* ⚠️ **`scrollbar-gutter: stable` is what makes the bar exist.** Measured in
     this browser: `overflow-y: auto` reserves a 0px gutter and so does
     `overflow-y: scroll` — it uses OVERLAY scrollbars, which appear only while
     you are already scrolling. At rest a capped list then looks exactly like a
     list that ends, and eleven pay periods below the fold are invisible.
     `scrollbar-gutter: stable` reserves 15px and draws a real one.

     Two earlier attempts at this failed silently and are worth not repeating:
     `::-webkit-scrollbar { width: 9px }` reserves nothing on its own, and
     `scrollbar-width: thin` beats the webkit rules in Chromium and collapses
     the gutter to 2px. */
  scrollbar-gutter: stable;
  scrollbar-color: var(--navy-300) transparent;
  overscroll-behavior: contain;   /* the page does not scroll on past the end */
}
.picker-menu::-webkit-scrollbar { width: 11px; }
.picker-menu::-webkit-scrollbar-track { background: transparent; }
.picker-menu::-webkit-scrollbar-thumb {
  background: var(--navy-300); border-radius: 6px;
  border: 3px solid var(--surface);   /* insets the thumb off the menu edge */
}
.picker-menu::-webkit-scrollbar-thumb:hover { background: var(--slate); }
.picker-wide .picker-menu { min-width: 320px; }
/* ** The scrim is why an outside click closes it. ** Transparent and behind the
   menu but above everything else, so the first click anywhere lands here. */
.picker-scrim { position: fixed; inset: 0; z-index: 39; }

/* ** A panel clips its own corners, which also clips a menu opening inside it.
   ** `.panel` carries `overflow: hidden` so a table's square corners do not
   poke past its rounded ones — correct, and it cut the last item off the
   report picker. This opts one panel out and restores the rounding on the
   table itself, which is the thing that needed clipping in the first place. */
/* ⚠️ `.panel.panel-has-menu`, not `.panel-has-menu`. Both are one class, so
   they tie on specificity and source order decides — and `.panel` is defined
   further down this file, so the single-class version lost silently and the
   menu stayed clipped. Two classes wins wherever the rule sits. */
.panel.panel-has-menu { overflow: visible; }
.panel-has-menu > table:last-child,
.panel-has-menu > .table-wrap:last-child { border-bottom-left-radius: var(--radius);
                                           border-bottom-right-radius: var(--radius);
                                           overflow: hidden; }

/* ==========================================================================
   Cards
   ========================================================================== */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
/* A fifth card (the pay run's "Flagged, no pay") wrapped the total onto a row of its own. */
.cards:has(> :nth-child(5)) { grid-template-columns: repeat(5, 1fr); }
.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 13px 18px; box-shadow: var(--shadow);
}
.card span {
  font-size: 11px; font-weight: 600; color: var(--slate);
  text-transform: uppercase; letter-spacing: .05em;
}
.card b { display: block; font-size: 26px; font-weight: 700; margin-top: 7px; letter-spacing: -.02em; }
.card.accent { background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); color: #fff; }
.card.accent span { color: var(--navy-200); }
.card b.good { color: var(--teal-ink); }

.bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--teal); }

/* ==========================================================================
   Panels and tables
   ========================================================================== */
.panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
/* A plain link in the page (an employee name, "Paychecks") was the browser's
   default blue. Zero specificity, so any classed link keeps its own style. */
:where(main a:not([class])) { color: var(--teal-ink); }

.panel + .panel, .panel + .cards, .callout + .panel, .callout + .cards { margin-top: 16px; }
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 15px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--slate);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 18px; border-bottom: 1px solid var(--border-soft);
}
td { padding: 10px 18px; border-bottom: 1px solid var(--border-faint); }
tr.highlight { background: var(--teal-tint); }
tr.muted-row { background: #fdfbf3; }

/* Money and counts align on the decimal and never reflow between renders. */
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.sub { color: var(--slate-light); font-size: 12px; display: block; }
.note { color: var(--slate); }

.who { white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #d7e0ee; color: var(--slate-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  vertical-align: middle; margin-right: 9px;
}
.avatar.tech { background: var(--teal-deep); color: #fff; }

/* ==========================================================================
   Chips, buttons, callouts
   ========================================================================== */
.chip {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}
.chip-ok   { background: var(--teal-tint);   color: var(--teal-ink); }
.chip-warn { background: var(--amber-tint);  color: var(--amber-ink); }
.chip-none { background: var(--chip-neutral); color: var(--slate-deep); }

/* Used by the work-role and rate-sheet tables, which rendered them as browser
   defaults (grey bordered buttons, plain text) until 2026-11-03. */
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px;
        border-radius: 20px; background: var(--chip-neutral); color: var(--slate-deep); }
.muted { color: var(--slate); }
tr.warn td { background: var(--amber-wash); }
/* Voided, never deleted: still on record, visibly no longer in force. */
tr.voided td { color: var(--slate-light); text-decoration: line-through; }
tr.voided td:last-child { text-decoration: none; }
tr.retired td { color: var(--slate-light); }
.btn-link { background: none; border: 0; padding: 4px 6px; font: inherit; font-size: 13px;
            font-weight: 600; color: var(--teal-ink); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-link:disabled { opacity: .55; cursor: not-allowed; text-decoration: none; }
.btn-link.danger { color: #b3261e; }

.btn {
  background: var(--teal-deep); color: #fff; border: 0;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  /* A two-word action in a narrow column wrapped to "End / here". */
  white-space: nowrap;
  /* A link styled as a button (Payslip, Statement) kept its underline. */
  text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn.ghost {
  background: var(--bg); color: var(--ink);
  /* A border, because the ghost fill is nearly white and against a white panel
     the control stopped reading as a button at all. */
  border: 1px solid var(--border);
}
.btn.ghost:hover:not(:disabled) { border-color: var(--navy-300); }
.btn.push { margin-left: auto; }

/* Destructive, and the ONLY red in the system. It exists so that a button which
   removes something cannot be mistaken for one that saves — nothing else on any
   screen is this colour, so it never has to be read twice. */
.btn.danger { background: #b3261e; color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }

.callout {
  background: var(--amber-wash); border-left: 4px solid var(--amber);
  border-radius: var(--radius-sm); padding: 14px 18px;
  margin-top: 16px; font-size: 13px; color: var(--amber-body);
}

/* Something done, not something to watch: the teal accent, never amber. */
.callout.ok { background: var(--teal-tint); border-left-color: var(--teal); color: var(--teal-ink); }

.empty { padding: 44px 18px; text-align: center; color: var(--slate); }
.empty b { display: block; font-size: 15px; color: var(--ink); margin-bottom: 6px; }

/* ==========================================================================
   Sign in
   ========================================================================== */
.login-wrap {
  width: 100%; height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  padding: 20px;
}
.login-card {
  width: 400px; max-width: 100%;
  background: var(--surface); border-radius: 16px;
  padding: 36px; box-shadow: var(--shadow-lift);
}
.login-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -.02em; }
.login-card > p { color: var(--slate); font-size: 13px; margin-bottom: 24px; }
.login-brand { font-weight: 800; font-size: 16px; margin-bottom: 26px; }
.login-brand small {
  display: block; font-weight: 400; font-size: 10px;
  color: var(--slate-light); letter-spacing: .09em; margin-top: 3px;
}

.tabs { display: flex; background: var(--bg); border-radius: 9px; padding: 3px; margin-bottom: 18px; }
.tabs button {
  flex: 1; text-align: center; padding: 8px; font: inherit;
  font-size: 13px; font-weight: 600; color: var(--slate);
  border: 0; background: none; border-radius: 7px; cursor: pointer;
}
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

.field {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 14px; font-family: inherit; margin-bottom: 12px;
}
.field:focus { outline: 0; border-color: var(--teal); }

/* ==========================================================================
   Dropdowns — the same control, whether native or ours
   --------------------------------------------------------------------------
   Every <select> in the app carries `.field`, which is a TEXT INPUT style:
   full width, 12px padding, a 9px radius. Four pages had already worked around
   it inline — `style="padding:4px 8px"` six times — which is the tell that the
   shared style was wrong for this element rather than that those pages were
   special.

   This makes a native dropdown the twin of `.picker-btn`, so the two are
   indistinguishable when closed. **They cannot match when OPEN**: a native
   select's list is drawn by the operating system and is not ours to style.
   That is the trade, and it is the right way round — the native list brings
   keyboard type-ahead, native scrolling and the platform's touch behaviour,
   which matter more on a long list than a matching popup does.
   ========================================================================== */
select.field {
  /* Height is matched to `.picker-btn` deliberately: the picker is a flex row
     whose line-height comes from its spans, and a select's does not, so equal
     padding gives unequal heights — 33px against 37.5px. Setting it here is
     what makes the two sit level side by side. */
  height: 37.5px; line-height: 1.2;
  padding: 8px 12px; border-width: 1px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--ink);
  background-color: var(--bg); cursor: pointer;
  /* The same ▼ the picker draws, in the same slate, so the two read as one
     control. `appearance: none` is what lets it be ours instead of the
     platform's chevron. */
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 9px 6px;
  padding-right: 30px;
}
select.field:hover { border-color: var(--navy-300); }
select.field:focus { border-color: var(--teal); }
/* A dropdown in a toolbar sizes to its content; one in a form fills the row. */
.panel-head select.field, .toolbar select.field { width: auto; margin-bottom: 0; }
.field.code { text-align: center; letter-spacing: .5em; font-size: 20px; font-weight: 700; }

.btn-block {
  width: 100%; padding: 13px; background: var(--teal-deep); color: #fff;
  border: 0; border-radius: 9px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-block:disabled { opacity: .55; cursor: not-allowed; }
.hint { text-align: center; font-size: 12px; color: var(--slate-light); margin-top: 16px; }
.error { background: var(--amber-tint); color: var(--amber-ink); border-radius: var(--radius-sm);
         padding: 10px 13px; font-size: 13px; margin-bottom: 14px; }

/* ==========================================================================
   Mobile — technicians check their pay on a phone
   ========================================================================== */
@media (max-width: 640px) {
  .shell { flex-direction: column; height: auto; min-height: 100vh; }

  .sidebar {
    width: 100%; flex-direction: row; flex-wrap: wrap;
    padding: 10px 0 0; align-items: center;
  }
  .brand { padding: 0 14px 8px; width: 100%; font-size: 14px; }
  .sidebar a { padding: 8px 12px; font-size: 11px; gap: 5px; width: auto; }
  .sidebar a.active { box-shadow: inset 0 -3px 0 var(--teal); background: transparent; }
  .sidebar-foot { margin-top: 0; width: 100%; border-top: 1px solid var(--navy-700); padding: 8px 14px; }

  /* A phone gets the strip, not the outline. Headings would cost a whole row
     each for structure nobody scans on a 360px screen, and the group is always
     open there so nothing is unreachable. */
  .nav-scroll { display: flex; flex-wrap: wrap; width: 100%; overflow: visible; flex: 0 0 auto; }
  .nav-group { display: contents; }
  .nav-group-head { display: none; }
  .nav-group-items { display: flex; flex-wrap: wrap; }
  .nav-group-items[hidden] { display: flex; }
  .sidebar .nav-group-items a { padding: 8px 12px; }

  .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar h1 { font-size: 17px; }
  .content { padding: 14px 16px; }
  .switcher { margin-left: 0; width: 100%; }
  .switcher-btn { max-width: none; width: 100%; }
  .switcher-menu { left: 0; right: 0; min-width: 0; }

  .cards, .cards:has(> :nth-child(5)) { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card b { font-size: 20px; }
  .panel-head { padding: 12px 14px; }
  .btn, .btn.ghost { font-size: 11px; padding: 6px 11px; margin-left: 0; }
  .btn.push { margin-left: 0; }

  /* Settled at wireframe review: tables scroll sideways rather than dropping
     columns, so no figure is hidden from a technician on a phone. */
  .panel { overflow-x: auto; }
  table {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch; width: 100%; max-width: 100%;
    box-shadow: inset -16px 0 13px -13px rgba(0, 0, 0, .30);
    font-size: 11px;
  }
  thead, tbody, tr { display: table; width: max-content; min-width: 100%; table-layout: auto; }
  th, td { white-space: nowrap; padding: 8px 10px; }
  .avatar { width: 24px; height: 24px; font-size: 9px; margin-right: 6px; }
}

/* ==========================================================================
   The edit panel — every create and every change
   ==========================================================================
   Settled 2026-09-05: editing opens a floating panel OVER the screen. It used
   to unfold inside the table it edits, which moved every row below it, made an
   input band read as another row of data, and had no room for an editor that
   holds a table of its own. The reasoning lives in EditPanel.razor.

   A review verdict is not an edit and stays inline — accept, acknowledge,
   approve, dismiss. Those are the work of the screen, done a hundred times a
   period, and a panel would put a step in front of each one.
   ========================================================================== */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 28, 46, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 20px 24px;
  overflow-y: auto;
}
/* Focused on open so Escape reaches the handler; the ring would be a ring
   around the whole screen. */
.scrim:focus { outline: none; }
/* The panel takes focus when it opens so a screen reader enters it; that is
   not a keyboard stop, so no ring. The guards either side are empty. */
.sheet:focus { outline: none; }
.sheet-guard { width: 0; height: 0; overflow: hidden; }

.sheet {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  width: 560px; max-width: 100%;
  display: flex; flex-direction: column;
  max-height: 86vh;
}
/* For an editor that holds a table — brackets, ladder rungs, a tier's rates. */
.sheet.wide { width: 900px; }

.sheet-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: flex-start; gap: 12px; flex: none;
}
.sheet-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
/* A title holding one long unbroken word (a name) wraps inside the panel; it
   pushed the close button thousands of pixels off the edge (2026-11-18). */
.sheet-head > div { min-width: 0; overflow-wrap: anywhere; }
.sheet-head p { color: var(--slate); font-size: 12.5px; margin-top: 3px; }
.sheet-x {
  margin-left: auto; flex: none;
  background: none; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--slate-light);
  padding: 0 2px;
}
.sheet-x:hover { color: var(--ink); }

.sheet-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.sheet-body > .error { margin-bottom: 14px; }

.sheet-foot {
  padding: 13px 20px; border-top: 1px solid var(--border-soft);
  background: var(--bg-app); border-radius: 0 0 var(--radius) var(--radius);
  display: flex; align-items: center; gap: 10px; flex: none;
}
/* The footnote is the standing hint — what saving will actually do. It takes the
   slack and the buttons keep their own width; letting it push made "Set hours"
   wrap onto two lines. */
.sheet-foot .note { font-size: 12px; line-height: 1.4; flex: 1; min-width: 0; }
.sheet-foot .btn { white-space: nowrap; flex: none; }

/* A table inside a panel is an editor, not a report: tighter, and flush with
   the panel's own padding rather than the table's. */
.sheet-body table { font-size: 13px; }
.sheet-body th { padding: 7px 10px; }
.sheet-body td { padding: 6px 10px; }
.sheet-body th:first-child, .sheet-body td:first-child { padding-left: 0; }
.sheet-body th:last-child,  .sheet-body td:last-child  { padding-right: 0; }
.sheet-body tbody tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------------------
   Fields inside a panel
   -------------------------------------------------------------------------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; }
.form > label { display: block; }
.form > label.full { grid-column: 1 / -1; }
.form .lbl {
  display: block; font-size: 11px; font-weight: 600; color: var(--slate);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px;
}
.form .field { margin-bottom: 0; padding: 9px 11px; font-size: 13.5px; }
/* ⚠️ `background-color`, NOT the `background` shorthand. The shorthand resets
   background-image, which silently erased the caret drawn above — the select
   rendered with no chevron at all and nothing said so. */
select.field { background-color: var(--surface); }
/* text-align, explicitly: the sign-in `.hint` centres itself, and a centred
   line under a left-aligned field reads as a caption for the panel rather than
   as a note about the box above it. */
.form .hint, .sheet-body .hint {
  display: block; text-align: left;
  font-size: 12px; color: var(--slate-light); margin-top: 5px;
}
/* A run of controls that is not a field grid — "add a row", a toggle pair. */
.form-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
/* A checkbox reads as a line of text, not as a labelled box in the grid. */
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 15px; height: 15px; accent-color: var(--teal); }

/* --------------------------------------------------------------------------
   The edit affordance — the twin of tr.drill
   --------------------------------------------------------------------------
   `tr.drill` means "this row goes somewhere". `tr.editable` means "this row
   opens a panel". Same hover, different last cell, so a reader who has learned
   one has learned the other and can tell them apart at a glance.
   -------------------------------------------------------------------------- */
tr.editable { cursor: pointer; }
tr.editable:hover { background: var(--bg); }
tr.editable:hover td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
tr.editable:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

/* Fixed width, and drawn at rest rather than on hover — an affordance that only
   exists under a pointer is invisible on a touch screen and to anyone scanning
   for what can be changed. */
td.pen { width: 30px; text-align: right; color: var(--slate-light); }
tr.editable:hover td.pen { color: var(--teal); }

@media (max-width: 640px) {
  .scrim { padding: 0; align-items: stretch; }
  .sheet, .sheet.wide { width: 100%; max-height: 100%; border-radius: 0; }
  .sheet-foot { border-radius: 0; }
  .form { grid-template-columns: 1fr; }
}

/* FocusOnNavigate moves focus to the h1 on every navigation so screen readers
   announce the new page. Keep the focus move, drop the visible ring: the
   heading is not an interactive control, so an outline on it reads as a glitch
   rather than as guidance. :focus-visible was tried first and does not help —
   programmatic focus still counts as visible in Chrome. */
.topbar h1:focus { outline: none; }

/* ==========================================================================
   Drill-down rows — an operational mechanic used throughout
   ==========================================================================
   Any row that leads somewhere gets `.drill`. One affordance everywhere, so a
   reviewer learns it once: rows that respond look the same on every screen, and
   rows that do not are visibly inert rather than mysteriously unresponsive.

   Navigates to a ROUTE rather than opening a panel, deliberately — a drill-down
   has to survive a refresh, a back button and a pasted link. Sessions already
   survive a refresh; a review screen that loses your place on one would undo
   that.
   ========================================================================== */
tr.drill { cursor: pointer; }
tr.drill:hover { background: var(--bg); }
tr.drill:hover td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
tr.drill:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

/* The chevron sits in a fixed-width last cell so rows do not reflow on hover. */
td.chev { width: 28px; text-align: right; color: var(--slate-light); }
tr.drill:hover td.chev { color: var(--teal); }

/* Back link on a detail screen. */
.backlink {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--slate); text-decoration: none; margin-bottom: 4px;
}
.backlink:hover { color: var(--teal); }

/* Definition grid, for the facts at the top of a detail screen. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; }
.facts > div { padding: 13px 18px; border-right: 1px solid var(--border-faint); }
.facts > div:last-child { border-right: 0; }
.facts span {
  display: block; font-size: 11px; font-weight: 600; color: var(--slate);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px;
}
.facts b { font-size: 15px; font-weight: 700; }

@media (max-width: 640px) {
  .facts > div { border-right: 0; border-bottom: 1px solid var(--border-faint); }
}

/* ** The long-list picker. ** The filter stays put and the rows scroll under
   it — a filter box that scrolls away is one you cannot correct without
   scrolling back. picker.js caps the height of the menu; the flex column is
   what makes that cap land on the list rather than on the whole thing. */
.picker-menu-find { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.picker-find { padding: 6px; border-bottom: 1px solid var(--border); flex: none; }
.picker-find .field { width: 100%; height: 32px; font-size: 13px; }
.picker-find-list {
  overflow-y: auto; padding: 6px; min-height: 0;
  scrollbar-gutter: stable; overscroll-behavior: contain;
  scrollbar-color: var(--navy-300) transparent;
}
.picker-find-none, .picker-find-count {
  padding: 10px 12px; font-size: 12px; color: var(--slate-deep);
}
.picker-find-count { border-top: 1px solid var(--border); flex: none; padding: 6px 12px; }

/* The pipeline indicator in the top bar: a status line and three buttons. */
.pipeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.pipeline .chip { white-space: normal; }

/* The acting location, named even when there is only one (162): every number
   on the page belongs to it. */
.acting-location { font-size: 13px; font-weight: 600; color: var(--navy-700, #1e2a44); white-space: nowrap; }
