/* Surface Water staff workspace: one visual system for every staff page.
 * UI design call "UI 08:43" (board 20261119-1547), first set: points 1, 2, 4, 5, 8, then 3 and 9.
 *
 * Built only on the vendored website tokens (vendor/ui_foundation.css, --ui-*); no new
 * colours. Dark is the tokens' default and body.theme-light (set by sw_theme.js from
 * prefers-color-scheme) switches to their light set, so every page has both themes.
 * The header is navy in both themes, so inside it the dark-theme token values are used
 * directly (the same rule sw_public.css follows for the public header).
 * Rules: Bariol for page titles, the Perspective sans for everything else; monospace
 * only for reference numbers (.ref: SW-00002, UARN, UPRN); no spaced capitals; section
 * titles sentence case 16 px semibold; at most one amber primary per card; every
 * control at least 44 px; links in the link token; status text in the status tokens.
 * Lives under /assets (public) because the sign-in page uses it too; it holds styling
 * only. Phone layouts (UI points 6 and 7) come in a later pass: nothing here sets a
 * fixed page width, and tables scroll inside their own box.
 */
:root { --sw-staff-head: 60px; }
* { box-sizing: border-box; }
html { background: var(--ui-bg); }
body.sw-staff { margin: 0; min-height: 100vh; background: var(--ui-bg); color: var(--ui-text);
                font-family: var(--ui-font-body); font-size: 15px; line-height: 1.5; }
body.sw-staff a { color: var(--ui-link); text-underline-offset: 2px; }
body.sw-staff :focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.ref { font-family: var(--ui-font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ui-text-muted); }
.small { font-size: var(--ui-text-sm); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden;
      clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- 1. Header: navy bar, mark + "Surface Water", nav, search, counts ---------------- */
#staffnav { position: relative; z-index: 50; display: flex; align-items: center; gap: 12px;
            height: var(--sw-staff-head); padding: 0 16px 0 20px; background: var(--ui-navy);
            color: #f5f7fb; border-bottom: 1px solid rgba(255, 255, 255, 0.13);
            font-family: var(--ui-font-body); font-size: 15px; }
#staffnav .brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
                   color: #ffffff; text-decoration: none; font-weight: 600; font-size: 17px;
                   white-space: nowrap; margin-right: 8px; }
#staffnav .brand .plogo { width: 30px; height: 30px; flex: none; }
#staffnav nav { display: flex; gap: 4px; }
#staffnav nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
                  border-radius: var(--ui-radius); color: #f5f7fb; text-decoration: none;
                  font-weight: 500; white-space: nowrap; }
#staffnav nav a:hover { background: rgba(255, 255, 255, 0.08); }
#staffnav nav a.active { background: var(--ui-amber); color: var(--ui-on-amber); font-weight: 600; }
#staffnav .spacer { flex: 1; }
#staffnav .gsearch { width: 260px; min-height: 44px; padding: 0 12px; font: inherit; font-size: 15px;
                     color: #f5f7fb; background: rgba(255, 255, 255, 0.08);
                     border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--ui-radius); }
#staffnav .gsearch::placeholder { color: #a6b3c5; }
#staffnav .gsearch:focus { outline: 3px solid var(--ui-amber); outline-offset: 1px; }
#staffnav .pstrip { display: flex; align-items: center; gap: 4px 14px; font-size: 14px;
                    color: #a6b3c5; white-space: nowrap; }
#staffnav .pstrip a { display: inline-flex; align-items: center; min-height: 44px; color: #f5f7fb;
                      text-decoration: none; }
#staffnav .pstrip a:hover { text-decoration: underline; }
#staffnav .pstrip b { font-weight: 600; margin-right: 4px; }
#staffnav .hbtn { display: none; align-items: center; justify-content: center; gap: 8px;
                  min-width: 44px; min-height: 44px; padding: 0 12px; font: inherit; font-size: 15px;
                  font-weight: 600; color: #f5f7fb; background: transparent;
                  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--ui-radius); cursor: pointer; }
#staffnav .hbtn:hover { background: rgba(255, 255, 255, 0.08); }
#staffnav .hbtn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2;
                      stroke-linecap: round; }

/* Under 1024 px: nav behind a Menu button, search behind an icon (full-width field), the
   counts hidden. Both panels open below the bar; the page itself never gets wider. */
@media (max-width: 1023.98px) {
  #staffnav { padding: 0 12px 0 16px; }
  #staffnav .hbtn { display: inline-flex; }
  #staffnav .pstrip { display: none; }
  #staffnav nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
                  gap: 0; padding: 8px 12px 12px; background: var(--ui-navy);
                  border-bottom: 1px solid rgba(255, 255, 255, 0.13); }
  #staffnav.nav-open nav { display: flex; }
  #staffnav nav a { padding: 0 12px; }
  #staffnav .gsearch { display: none; position: absolute; top: calc(100% + 8px); left: 12px; right: 12px;
                       width: auto; min-height: 48px; background: var(--ui-navy); }
  #staffnav.search-open .gsearch { display: block; }
  #staffnav.search-open::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 64px;
                                 background: var(--ui-navy); z-index: -1; }
}
@media (max-width: 420px) { #staffnav .brand span { font-size: 15px; } }

/* Global search results (staff_chrome.js places it under the field). */
.gs-dd { position: fixed; z-index: 60; display: none; max-height: 50vh; overflow: auto;
         background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-line-strong);
         border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-lg); font-family: var(--ui-font-body);
         font-size: 15px; }
.gs-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 44px;
          padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--ui-line); }
.gs-row:last-child { border-bottom: 0; }
.gs-row:hover, .gs-row.active { background: var(--ui-surface-2); }
.gs-kind { font-size: var(--ui-text-sm); color: var(--ui-text-muted); min-width: 70px; }
.gs-hint, .gs-empty { color: var(--ui-text-muted); }
.gs-new { font-weight: 600; color: var(--ui-link); }

/* ---- Page frame -------------------------------------------------------------------- */
.sw-main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }
.sw-main.narrow { max-width: 640px; }
.sw-title { font-family: var(--ui-font-heading); font-weight: 400; font-size: var(--ui-text-xl);
            line-height: 1.15; color: var(--ui-heading); margin: 0 0 6px; }
.sw-sub { color: var(--ui-text-muted); margin: 0 0 20px; max-width: 52rem; }
.sw-head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---- 2. Cards, section titles, the label and value list ----------------------------- */
.card { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg);
        padding: 20px; }
.card + .card { margin-top: 16px; }
.sec { font-family: var(--ui-font-body); font-size: 16px; font-weight: 600; line-height: 1.3;
       color: var(--ui-heading); margin: 0 0 12px; text-transform: none; letter-spacing: 0; }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 2px 16px;
      padding: 9px 0; border-bottom: 1px solid var(--ui-line); font-size: 15px; text-align: left; }
.kv > :first-child { color: var(--ui-text-muted); }
.kv .v { font-family: inherit; font-weight: 400; text-align: left; overflow-wrap: anywhere; }
.kv.filerow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.kv.filerow > :first-child { flex: 1 1 220px; color: var(--ui-text); }

/* ---- 4. Buttons: website primary (amber, one per card) and secondary ------------------ */
.act, .sw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
                min-height: var(--ui-tap); padding: 10px 18px; font-family: var(--ui-font-body);
                font-size: var(--ui-text-sm); font-weight: 600; line-height: 1.2; text-decoration: none;
                border-radius: var(--ui-radius); border: 1px solid var(--ui-btn-secondary-line);
                background: var(--ui-surface); color: var(--ui-btn-secondary-text); cursor: pointer;
                white-space: nowrap; }
body.sw-staff a.act { color: var(--ui-btn-secondary-text); }
.act:hover, .sw-btn:hover { background: var(--ui-btn-secondary-hover); }
.act.primary, .sw-btn.primary { background: var(--ui-amber); border-color: var(--ui-amber); color: var(--ui-on-amber); }
.act.primary:hover, .sw-btn.primary:hover { background: #ffcb33; border-color: #ffcb33; }
.act.block, .sw-btn.block { width: 100%; }
.act:disabled, .act[aria-disabled="true"], .sw-btn:disabled {
  background: var(--ui-surface-2); border-color: var(--ui-line); color: var(--ui-text-muted);
  cursor: not-allowed; opacity: 1; filter: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.filepick { position: relative; }
.filepick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filepick:focus-within { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.fname { color: var(--ui-text-muted); font-size: var(--ui-text-sm); overflow-wrap: anywhere; }

/* Form fields: website field colours, 44 px. */
body.sw-staff input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
body.sw-staff select, body.sw-staff textarea {
  min-height: var(--ui-tap); padding: 0 12px; font: inherit; font-size: 16px; color: var(--ui-field-text);
  background: var(--ui-field-bg); border: 1px solid var(--ui-field-line); border-radius: var(--ui-radius-sm); }
body.sw-staff select { padding-right: 8px; }
body.sw-staff input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ui-navy); }
body.theme-light.sw-staff input[type=checkbox] { accent-color: var(--ui-navy); }
.lab { display: block; font-size: var(--ui-text-sm); font-weight: 600; color: var(--ui-text); margin: 16px 0 6px; }
.field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.field-row .fld { display: flex; flex-direction: column; gap: 6px; font-size: var(--ui-text-sm); font-weight: 600; }

/* ---- 5. Status text and chips in the token status colours ----------------------------- */
.msg { font-size: var(--ui-text-sm); margin-top: 10px; min-height: 1em; }
.ok, .st-ok { color: var(--ui-ok-text); }
.err, .st-err { color: var(--ui-error-text); }
.warn, .st-warn { color: var(--ui-warn-text); }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px;
        font-size: 13px; font-weight: 600; line-height: 1.3; background: var(--ui-surface-2); color: var(--ui-text);
        text-transform: none; letter-spacing: 0; font-family: var(--ui-font-body); white-space: nowrap; }
.chip.ok { background: var(--ui-ok-bg); color: var(--ui-ok-text); }
.chip.warn { background: var(--ui-warn-bg); color: var(--ui-warn-text); }
.chip.err { background: var(--ui-error-bg); color: var(--ui-error-text); }
.chip.info { background: var(--ui-info-bg); color: var(--ui-info-text); }
.chip.amber { background: var(--ui-amber); color: var(--ui-on-amber); }
.banner { display: block; padding: 10px 12px; margin: 4px 0 8px; border-radius: var(--ui-radius);
          font-size: var(--ui-text-sm); background: var(--ui-info-bg); color: var(--ui-info-text); }
.banner.ok { background: var(--ui-ok-bg); color: var(--ui-ok-text); }
.banner.warn { background: var(--ui-warn-bg); color: var(--ui-warn-text); }

/* ---- Tables (Cases, Submissions, Prospects): token styles, scroll inside their box ---- */
.sw-table-wrap { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg);
                 overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sw-table { width: 100%; border-collapse: collapse; font-size: 15px; text-align: left; }
.sw-table th { font-size: var(--ui-text-sm); font-weight: 600; color: var(--ui-text-muted);
               background: var(--ui-surface-2); padding: 12px 14px; white-space: nowrap; text-transform: none;
               letter-spacing: 0; vertical-align: bottom; }
.sw-table th[data-k] { cursor: pointer; user-select: none; }
.sw-table th .arr { color: var(--ui-text); }
.sw-table td { padding: 12px 14px; border-top: 1px solid var(--ui-line); vertical-align: top; }
.sw-table tr.row { cursor: pointer; }
.sw-table tr.row:hover { background: var(--ui-surface-2); }
.sw-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw-table td .act { min-height: 44px; }
.sw-table .cell-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- 3. Stage stepper: one row of rounded pills, then the next step as a sentence ---- */
#flowbar { margin: 18px 0 4px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.step { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 16px;
        border-radius: 999px; font-size: var(--ui-text-sm); font-weight: 600; border: 1px solid var(--ui-line);
        background: var(--ui-surface-2); color: var(--ui-text-muted); }
.step.done { background: transparent; border-color: var(--sw-step-line, var(--ui-line-strong)); color: var(--ui-text); }
.step.done::before { content: ""; width: 6px; height: 11px; margin: -3px 4px 0 1px; border: solid currentColor;
                     border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.current { background: var(--ui-navy); border-color: var(--ui-navy); color: #ffffff; }
body.sw-staff { --sw-step-line: var(--ui-line-strong); }
body.theme-light.sw-staff { --sw-step-line: var(--ui-navy); }
body:not(.theme-light) .step.current { border-color: var(--ui-line-strong); }
.next-hint { margin: 10px 0 0; color: var(--ui-text); }

/* ---- Pipeline board ------------------------------------------------------------------ */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.lane { display: block; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg);
        padding: 18px; text-decoration: none; color: var(--ui-text); }
body.sw-staff a.lane { color: var(--ui-text); }
.lane:hover { border-color: var(--ui-line-strong); background: var(--ui-surface-2); }
.lane h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; color: var(--ui-heading); }
.lane .n { font-family: var(--ui-font-heading); font-size: 2.25rem; line-height: 1; color: var(--ui-heading); }
.lane .n small { font-family: var(--ui-font-body); font-size: var(--ui-text-sm); color: var(--ui-text-muted); margin-left: 6px; }
.lane .sv { font-size: var(--ui-text-sm); color: var(--ui-text-muted); margin-top: 10px; }
.lane .noest { font-size: var(--ui-text-sm); color: var(--ui-warn-text); margin-top: 4px; }

/* ---- Two-column case layout ---------------------------------------------------------- */
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-top: 20px; }
@media (max-width: 1023.98px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.list-table { width: 100%; border-collapse: collapse; font-size: var(--ui-text-sm); }
.list-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--ui-line); vertical-align: top; }

/* ---- 9. Sign-in: the website sign-in card -------------------------------------------- */
body.sw-signin { min-height: 100vh; display: flex; flex-direction: column; }
.si-top { height: var(--sw-staff-head); display: flex; align-items: center; padding: 0 20px; background: var(--ui-navy);
          border-bottom: 1px solid rgba(255, 255, 255, 0.13); }
.si-top img { width: 120px; height: auto; display: block; }
.si-wrap { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px 48px; }
.si-card { width: 100%; max-width: 26rem; background: var(--ui-surface); border: 1px solid var(--ui-line);
           border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow); padding: 32px 28px; }
.si-card h1 { font-family: var(--ui-font-heading); font-weight: 400; font-size: var(--ui-text-xl); line-height: 1.15;
              color: var(--ui-heading); margin: 0 0 6px; }
.si-card .si-sub { color: var(--ui-text-muted); margin: 0 0 24px; }
.si-or { display: flex; align-items: center; gap: 12px; color: var(--ui-text-muted); font-size: var(--ui-text-sm); margin: 24px 0 8px; }
.si-or::before, .si-or::after { content: ""; flex: 1; height: 1px; background: var(--ui-line); }
.si-card input { width: 100%; }
.si-err { color: var(--ui-error-text); font-size: var(--ui-text-sm); min-height: 20px; margin-top: 12px; }
.si-foot { text-align: center; color: var(--ui-text-muted); font-size: var(--ui-text-sm); margin: 20px 0 0; }

@media (max-width: 600px) {
  .sw-main { padding: 20px 16px 40px; }
  .card { padding: 16px; }
  .si-card { padding: 24px 20px; }
}

/* Cases list: rows that carry an indicative estimate keep their marker, now a thin amber
   rule on the first cell (amber as a fill, never as text). */
.sw-table tr.est td:first-child, .sw-table tr.precedent td:first-child { box-shadow: inset 3px 0 0 var(--ui-amber); }
.kv .v.ref, .ref { font-family: var(--ui-font-mono); white-space: nowrap; }
#billuploads, #attachments { margin-top: 12px; }

/* Selects (UI 09:22 fix b): the Perspective styled select, rounded, token surface and a
   chevron; in the dark theme the dark field surface, not white. */
body.sw-staff select { appearance: none; -webkit-appearance: none; min-height: var(--ui-tap);
  padding: 0 40px 0 12px; border-radius: var(--ui-radius); cursor: pointer;
  background-color: var(--ui-surface-2); color: var(--ui-text); border: 1px solid var(--ui-line-strong);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
body.theme-light.sw-staff select { background-color: var(--ui-field-bg); color: var(--ui-field-text);
  border-color: var(--ui-field-line); }
body.sw-staff select option { background: var(--ui-surface); color: var(--ui-text); }

/* ---- 7. Tables under 1024 px: each row becomes a card ------------------------------
   Line 1 the reference and status, line 2 the address, line 3 the key figure (labelled
   from data-label), then the row's actions. Cells not named here stay in the desktop
   table only. Marked up by c-* classes on the cells. */
.only-card { display: none; }
.sw-table.no-score .c-score { display: none; }
@media (max-width: 1023.98px) {
  .sw-table-wrap.cards { background: none; border: 0; border-radius: 0; overflow: visible; }
  .cards .sw-table, .cards .sw-table tbody { display: block; }
  .cards .sw-table thead { display: none; }
  .cards .sw-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start;
                        background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg);
                        padding: 14px 16px; margin-bottom: 12px; }
  .cards .sw-table td { display: none; padding: 0; border: 0; text-align: left; white-space: normal; }
  .cards .sw-table td.c-ref { display: block; grid-column: 1; grid-row: 1; font-weight: 600; }
  .cards .sw-table td.c-status { display: block; grid-column: 2; grid-row: 1; justify-self: end; text-align: right;
                                 max-width: 62vw; overflow-wrap: anywhere; }
  .cards .sw-table td.c-status .chip { white-space: normal; }
  .cards .sw-table td.c-addr { display: block; grid-column: 1 / -1; grid-row: 2; }
  .cards .sw-table td.c-key { display: block; grid-column: 1 / -1; grid-row: 3; font-weight: 600; }
  .cards .sw-table td.c-key::before { content: attr(data-label) " "; font-weight: 400; color: var(--ui-text-muted); }
  .cards .sw-table td.c-flags { display: block; grid-column: 1 / -1; grid-row: 4; }
  .cards .sw-table td.c-act { display: block; grid-column: 1 / -1; grid-row: 5; }
  .cards .sw-table td.c-act:empty, .cards .sw-table td.c-flags:empty { display: none; }
  .cards .sw-table tr.est td:first-child, .cards .sw-table tr.precedent td:first-child { box-shadow: none; }
  .cards .sw-table tr.est, .cards .sw-table tr.precedent { box-shadow: inset 3px 0 0 var(--ui-amber); }
}
/* Text fields match the selects in the dark theme (the dark field surface). */
body.sw-staff:not(.theme-light) input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not(.gsearch),
body.sw-staff:not(.theme-light) textarea {
  background: var(--ui-surface-2); color: var(--ui-text); border-color: var(--ui-line-strong); }
body.sw-staff:not(.theme-light) input::placeholder { color: var(--ui-text-muted); }

/* Release points (UI, set 2 OK): phone hint wording, no empty key-figure line, and on
   the case page "Move the case" straight after the stepper. */
.hint-phone { display: none; }
@media (max-width: 1023.98px) {
  .hint-wide { display: none; }
  .hint-phone { display: inline; }
  .cards .sw-table td.c-key.none { display: none; }
  .grid2 { display: flex; flex-direction: column; gap: 16px; }
  .grid2 > div { display: contents; }
  .grid2 .card + .card { margin-top: 0; }
  #movecard { order: -1; }
}
