/* Pavia BPLO staff console.
 *
 * The :root block is copied verbatim from web/portal/css/styles.css so the
 * console and the resident portal are demonstrably the same product. Nothing
 * console-specific goes inside it — additions live below, under their own
 * heading, so the next person can diff the two token blocks and see they
 * match.
 *
 * This is a dense working surface, not a marketing page: more rows per screen
 * than the portal, smaller type, and one accent doing all the work.
 */

/* ---------------------------------------------------------------- tokens - */

:root {
  --brand:       #146b2b;
  --brand-deep:  #0e5420;
  --brand-soft:  #28a745;
  --brand-tint:  #e6f2e9;
  --brand-wash:  #f2f9f4;

  --gold:        #d79d11;
  --gold-tint:   #fdf3d9;

  --ink:         #1b2318;
  --ink-2:       #495245;
  --ink-3:       #6f7a6c;
  --line:        #ded9c9;
  --line-soft:   #ebe6d7;

  --bg:          #faf5e9;
  --surface:     #ffffff;
  --surface-2:   #fffdf7;

  --danger:      #a8271f;
  --danger-bg:   #fceceb;
  --warn:        #8a5d00;
  --warn-bg:     #fdf2da;
  --ok:          #146b2b;
  --ok-bg:       #e6f2e9;
  --info:        #1f5673;
  --info-bg:     #e8f1f7;

  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;

  /* The only shadow. Offset and blur, never a zero-offset halo. */
  --lift:  0 6px 16px -6px rgba(27,35,24,.18), 0 2px 5px -2px rgba(27,35,24,.10);
  --lift-hi: 0 18px 40px -14px rgba(27,35,24,.26), 0 4px 10px -4px rgba(27,35,24,.12);

  --ease: cubic-bezier(.16,1,.3,1);
  --maxw: 1040px;

  --tap: 48px;   /* the floor for anything a thumb must hit */
}

/* --------------------------------------------------------- console only - */

:root {
  --console-maxw: 1180px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 0.95rem; }
p  { margin: 0 0 .6rem; }
a  { color: var(--brand-deep); }

/* ------------------------------------------------------------- icons --- */

.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { display: block; width: 100%; height: 100%; }
.btn .ico { width: 16px; height: 16px; }

/* ------------------------------------------------------------ the shell -- */
/*
 * A deep-green sidebar beside a cream page: the same two surfaces as the
 * sign-in screen, so the console reads as one place from the first screen.
 * The current page is the one item lit in the page's own cream, as though
 * the page reached into the sidebar to mark where you are.
 */

:root {
  --sb-w: 264px;
  --sb-w-c: 76px;
  --appbar-h: 60px;
}

.skip {
  position: absolute; left: 12px; top: -64px; z-index: 120;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .85rem;
  padding: 10px 14px; border-radius: var(--r-sm); text-decoration: none;
}
.skip:focus { top: 12px; outline: 3px solid var(--gold); outline-offset: 2px; }
main:focus { outline: none; }

body.has-sidebar { padding-left: var(--sb-w); }

.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: var(--sb-w);
  display: flex; flex-direction: column;
  color: #fff;
  background: linear-gradient(180deg, #13612a 0%, var(--brand-deep) 48%, #0b4419 100%);
  border-top: 3px solid var(--gold);
}

.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; }
.sb-brand { display: flex; align-items: center; gap: 12px; min-width: 0;
            color: #fff; text-decoration: none; border-radius: 12px; }
.sb-brand:focus-visible { outline: 2px solid var(--gold-hi, #f6cf63); outline-offset: 4px; }
.brand-mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.2), 0 4px 10px -2px rgba(0,0,0,.35);
}
.brand-mark img { display: block; width: 36px; height: auto; }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-brand-text strong { font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em;
                        white-space: nowrap; }
.sb-brand-text small { font-size: .74rem; color: rgba(255,255,255,.78); white-space: nowrap; }

.sb-close { display: none; }

.sb-env {
  display: flex; align-items: center; gap: 8px;
  margin: 0 16px 6px; padding: 7px 10px;
  border-radius: 10px; font-size: .76rem; color: #fbe7b0;
  background: rgba(215,157,17,.14); border: 1px solid rgba(246,207,99,.32);
}
.sb-env-pill, .env {
  font-size: .66rem; font-weight: 800; letter-spacing: .1em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--gold); color: #2b1f00;
}

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.sb-group + .sb-group { margin-top: 16px; }
.sb-group-label {
  margin: 10px 12px 6px; font-size: .68rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.68);
}
.sb-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.sb-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 12px;
  color: rgba(255,255,255,.86); text-decoration: none;
  font-size: .9rem; font-weight: 600;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.sb-link:hover { background: rgba(255,255,255,.09); color: #fff; }
.sb-link:focus-visible { outline: 2px solid #f6cf63; outline-offset: 1px; }
.sb-link.is-active {
  background: var(--bg); color: var(--brand-deep);
  box-shadow: 0 8px 18px -10px rgba(0,0,0,.55);
}
.sb-link.is-active .ico { color: var(--brand); }
.sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: var(--gold); color: #2b1f00;
  font-size: .72rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.sb-badge[hidden] { display: none; }

.sb-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.1);
           display: grid; gap: 8px; }
.sb-user {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px;
  color: #fff; text-decoration: none;
  background: rgba(255,255,255,.06);
  transition: background .16s var(--ease);
}
.sb-user:hover { background: rgba(255,255,255,.11); }
.sb-user.is-active { background: rgba(255,255,255,.13);
                     box-shadow: inset 0 0 0 1px rgba(246,207,99,.55); }
.sb-user:focus-visible { outline: 2px solid #f6cf63; outline-offset: 1px; }
.sb-avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: #f6cf63; color: #3a2a00;
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
}
.sb-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-user-text strong, .sb-user-text small {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-text strong { font-size: .85rem; }
.sb-user-text small { font-size: .72rem; color: rgba(255,255,255,.76); }

.sb-actions { display: flex; gap: 6px; }
.sb-signout, .sb-toggle {
  position: relative; flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 10px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.88);
  font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.sb-signout .ico, .sb-toggle .ico { width: 18px; height: 18px; }
.sb-signout:hover { background: rgba(168,39,31,.28); border-color: rgba(255,170,160,.5); color: #fff; }
.sb-toggle:hover { background: rgba(255,255,255,.09); color: #fff; }
.sb-signout:focus-visible, .sb-toggle:focus-visible { outline: 2px solid #f6cf63; outline-offset: 1px; }
.sb-signout.is-loading { opacity: .65; cursor: progress; }
.sb-toggle .ico-expand { display: none; }

/* The slim bar above the page: where you are, and which environment. */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--appbar-h); padding: 0 28px;
  background: rgba(250,245,233,.94);
  -webkit-backdrop-filter: saturate(1.3) blur(8px); backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.sb-open, .appbar-brand { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--ink-2); }
.crumbs .ico { width: 14px; height: 14px; color: var(--ink-3); }
.crumbs [aria-current] { color: var(--ink); font-weight: 700; }
.appbar-spacer { flex: 1; }
.appbar-date { font-size: .8rem; color: var(--ink-2); }

.sb-scrim { display: none; }

/* --- desktop: collapsible to icons -------------------------------------- */
@media (min-width: 960px) {
  .sb-collapsed body.has-sidebar { padding-left: var(--sb-w-c); }
  .sb-collapsed .sidebar { width: var(--sb-w-c); }
  .sb-collapsed .sb-head { justify-content: center; padding: 16px 0 14px; }
  .sb-collapsed .sb-brand-text,
  .sb-collapsed .sb-env-text,
  .sb-collapsed .sb-group-label,
  .sb-collapsed .sb-user-text { display: none; }
  .sb-collapsed .sb-env { justify-content: center; margin: 0 12px 6px; padding: 6px 0; }
  .sb-collapsed .sb-nav { overflow: visible; padding: 6px 12px; }
  .sb-collapsed .sb-group + .sb-group { margin-top: 10px; padding-top: 10px;
                                        border-top: 1px solid rgba(255,255,255,.12); }
  .sb-collapsed .sb-link { justify-content: center; padding: 0; }
  /* Out of sight, still the link's name. */
  .sb-collapsed .sb-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .sb-collapsed .sb-badge {
    position: absolute; top: 3px; right: 4px;
    min-width: 18px; height: 18px; padding: 0 5px; font-size: .62rem;
  }
  .sb-collapsed .sb-user { justify-content: center; padding: 6px 0; background: transparent; }
  .sb-collapsed .sb-actions { flex-direction: column; }
  .sb-collapsed .sb-toggle .ico-collapse { display: none; }
  .sb-collapsed .sb-toggle .ico-expand { display: inline-flex; }

  /* A name beside each icon on hover or keyboard focus. */
  .sb-collapsed .sb-link::after,
  .sb-collapsed .sb-user::after,
  .sb-collapsed .sb-signout::after,
  .sb-collapsed .sb-toggle::after {
    position: absolute; left: calc(100% + 14px); top: 50%;
    transform: translate(-4px, -50%); opacity: 0; pointer-events: none;
    background: var(--ink); color: #fff; white-space: nowrap;
    font-size: .78rem; font-weight: 650; padding: 6px 10px; border-radius: 8px;
    box-shadow: var(--lift);
    transition: opacity .14s var(--ease), transform .14s var(--ease);
    z-index: 50;
  }
  .sb-collapsed .sb-link::after, .sb-collapsed .sb-user::after { content: attr(data-label); }
  .sb-collapsed .sb-signout::after { content: "Sign out"; }
  .sb-collapsed .sb-toggle::after { content: "Expand sidebar"; }
  .sb-collapsed .sb-link:hover::after, .sb-collapsed .sb-link:focus-visible::after,
  .sb-collapsed .sb-user:hover::after, .sb-collapsed .sb-user:focus-visible::after,
  .sb-collapsed .sb-signout:hover::after, .sb-collapsed .sb-signout:focus-visible::after,
  .sb-collapsed .sb-toggle:hover::after, .sb-collapsed .sb-toggle:focus-visible::after {
    opacity: 1; transform: translate(0, -50%);
  }
}

/* --- phones and small tablets: an off-canvas drawer --------------------- */
@media (max-width: 959px) {
  body.has-sidebar { padding-left: 0; }
  body.sb-locked { overflow: hidden; }

  .sidebar {
    width: min(300px, 86vw); z-index: 70;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .24s var(--ease), visibility 0s linear .24s;
  }
  .sidebar.is-open {
    transform: none; visibility: visible;
    transition: transform .24s var(--ease);
    box-shadow: 0 0 48px rgba(0,0,0,.4);
  }
  .sb-close {
    display: grid; place-items: center; flex: none; margin-left: auto;
    width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px;
    background: rgba(255,255,255,.09); color: #fff; cursor: pointer;
  }
  .sb-close:focus-visible { outline: 2px solid #f6cf63; outline-offset: 1px; }
  .sb-toggle { display: none; }

  .sb-scrim {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: rgba(8,22,12,.52);
    opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
  }
  .sb-scrim.is-on { opacity: 1; pointer-events: auto; }

  .appbar { padding: 0 16px; gap: 10px; }
  .sb-open {
    display: grid; place-items: center; flex: none;
    width: 44px; height: 44px; padding: 0; margin-left: -6px;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); color: var(--ink); cursor: pointer;
  }
  .sb-open:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
  .appbar-brand { display: flex; align-items: center; gap: 8px;
                  color: var(--ink); text-decoration: none; }
  .appbar-brand img { width: 30px; height: auto; }
  .appbar-brand strong { font-size: .98rem; font-weight: 800; }
  .crumbs, .appbar-date { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar.is-open, .sb-scrim { transition: none !important; }
}

/* -------------------------------------------------------------- layout -- */

main { max-width: var(--console-maxw); margin: 0 auto; padding: 28px 28px 64px; }
.page-head h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; }
/* Back links carry a drawn arrow, not a text glyph. */
.crumb a, .page-head p a, .print-bar #back {
  display: inline-flex; align-items: center; gap: 6px;
}
.crumb a .ico, .page-head p a .ico { width: 16px; height: 16px; }
.move-to, .tl-arrow { display: inline-flex; align-items: center; gap: 4px; }
.move-to .ico, .tl-arrow .ico { width: 14px; height: 14px; }

.page-head {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head p { color: var(--ink-2); margin: 4px 0 0; font-size: .875rem; }
.page-head .spacer { margin-left: auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  box-shadow: var(--lift);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
}
.card-body { padding: 18px; }

/* --------------------------------------------------------------- tabs --- */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: .82rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .18s var(--ease);
}
.tab:hover { border-color: var(--brand-soft); color: var(--ink); }
.tab.is-active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.tab .count {
  background: var(--brand-tint); color: var(--brand-deep);
  border-radius: 999px; padding: 1px 7px;
  font-size: .72rem; font-weight: 800;
}
.tab.is-active .count { background: rgba(255,255,255,.22); color: #fff; }

/* -------------------------------------------------------------- tables -- */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3);
  padding: 10px 18px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.table td {
  padding: 13px 18px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: var(--brand-wash); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); font-size: .8rem; }
.strong { font-weight: 600; }

/* --------------------------------------------------------------- pills -- */

.pill {
  display: inline-block; border-radius: 999px;
  padding: 3px 10px; font-size: .72rem; font-weight: 700;
  letter-spacing: .01em; white-space: nowrap;
}
.pill-ok     { background: var(--ok-bg);     color: var(--ok); }
.pill-warn   { background: var(--warn-bg);   color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info   { background: var(--info-bg);   color: var(--info); }
.pill-quiet  { background: var(--line-soft); color: var(--ink-2); }

/* ------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: .875rem; font-weight: 650;
  cursor: pointer;
  background: var(--brand); color: #fff;
  transition: transform .16s var(--ease), background .16s var(--ease),
              box-shadow .16s var(--ease), opacity .16s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--brand-deep); box-shadow: var(--lift); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .tab:focus-visible, .stat:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}

.btn-quiet  { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover:not(:disabled) { background: var(--brand-wash); border-color: var(--brand-soft); }
.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #8d1f19; }
.btn-warn   { background: var(--warn); }
.btn-warn:hover:not(:disabled) { background: #6f4b00; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .8rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------- forms -- */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: .78rem; font-weight: 650;
  color: var(--ink-2); margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.field .hint { font-size: .74rem; color: var(--ink-3); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.form-error {
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: .84rem; margin-bottom: 14px;
}

/* -------------------------------------------------------------- states -- */

.state { padding: 40px 24px 44px; text-align: center; }
.state-art { display: block; width: 168px; height: auto; margin: 0 auto 12px; }
.pick-results .state-art, .lightbox-in .state-art { width: 110px; }
.state-title { font-weight: 650; color: var(--ink); margin-bottom: 4px; }
.state-body  { color: var(--ink-3); font-size: .875rem; max-width: 46ch;
               margin-left: auto; margin-right: auto; }
.state .btn { margin-top: 14px; }
.state-denied .state-title { color: var(--warn); }
.state-error  .state-title,
.state-offline .state-title { color: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- loading -- */
/*
 * Three layers, from most to least specific:
 *   1. a skeleton in the shape of what is coming (tables, cards, detail);
 *   2. the seal inside a green-and-gold ring, where the shape is unknown;
 *   3. a gold bar along the top edge whenever a request is in flight.
 * Both 1 and 2 fade in after a beat, so a fast response never flashes.
 */

.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.skeleton, .state-loading { animation: appear .28s var(--ease) .12s both; }

/* The branded spinner. */
.state-loading { padding: 48px 24px 40px; }
.loader {
  position: relative; width: 64px; height: 64px; margin: 0 auto 14px;
  display: grid; place-items: center;
}
.loader::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--brand-tint);
  border-top-color: var(--brand);
  border-right-color: var(--gold);
  animation: spin .9s linear infinite;
}
.loader img { display: block; width: 38px; height: auto; }
.state-loading .state-body { color: var(--ink-2); font-weight: 600; }
.pick-results .state-loading { padding: 18px 12px; }
.pick-results .loader { width: 40px; height: 40px; margin-bottom: 8px; }
.pick-results .loader img { width: 24px; }

/* Skeleton bones. One warm neutral from the palette, one soft sweep. */
.sk {
  display: block; height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, var(--line-soft) 0%, #f7f3e9 45%, var(--line-soft) 90%);
  background-size: 260% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -60% 0; } }
.sk-line + .sk-line { margin-top: 8px; }
.sk-strong { height: 12px; }
.sk-sub    { height: 9px; }
.sk-title  { height: 20px; border-radius: 8px; }
.sk-th     { height: 8px; }
.sk-pill   { width: 66px; height: 22px; border-radius: 999px; }
.sk-num    { width: 36px; height: 1.3rem; margin: 2px 0 4px; border-radius: 6px; }
.sk-block  { height: 58px; border-radius: var(--r-sm); }
.sk-photo  { height: 230px; }
.sk-row    { height: 44px; margin-top: 10px; }
.sk-btn    { height: 40px; border-radius: 999px; margin-top: 12px; }
.sk-seal   { width: 58px; height: 58px; border-radius: 50%; }

.sk-table td { padding-top: 15px; padding-bottom: 15px; }
.sk-table tbody tr:hover { background: transparent; }
.sk-col { display: flex; flex-direction: column; gap: 8px; }
.sk-col .sk-line + .sk-line { margin-top: 0; }
.sk-stack > * + * { margin-top: 16px; }
.sk-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 16px; }
.sk-meta .sk-line + .sk-line { margin-top: 0; }
.sk-clear { display: grid; gap: 10px;
            grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.sk-facts li { align-items: center; }
.sk-facts .sk-line + .sk-line { margin-top: 0; }
.link-grid .sk-photo { height: 320px; }
.sk-doc-head {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 2px solid var(--line-soft);
}
.sk-doc-head .sk-line + .sk-line { margin-top: 0; }
.sk-doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px;
               margin: 14px 0 22px; }
.sk-doc-grid .sk-line + .sk-line { margin-top: 0; }
.stat.is-loading { cursor: progress; }

/* The top progress bar. Gold, so it reads on the green bar and the cream
 * page alike. Width is driven from ui.js with transforms. */
.topprogress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 3px; pointer-events: none;
  opacity: 0; transition: opacity .25s ease;
}
.topprogress.is-on { opacity: 1; }
.topprogress span {
  display: block; height: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--gold), #f6cf63);
  box-shadow: 0 0 10px rgba(215,157,17,.55);
  border-radius: 0 3px 3px 0;
}

/* A button doing work: a ring in its own text colour, before the label. */
.btn.is-loading { cursor: progress; }
.btn.is-loading:disabled { opacity: .88; }
.btn.is-loading::before {
  content: ""; flex: none;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; background: var(--line-soft); }
  .loader::before { animation: none; border-right-color: var(--brand-tint); }
  .topprogress span { transition: none !important; }
}

/* -------------------------------------------------------------- toasts -- */

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: var(--r-sm);
  font-size: .85rem; box-shadow: var(--lift-hi);
  animation: rise .22s var(--ease);
}
.toast-ok    { background: var(--brand-deep); }
.toast-error { background: var(--danger); }
.toast.out   { opacity: 0; transition: opacity .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- modal -- */

.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(27,35,24,.45);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-hi);
  width: min(520px, 100%);
  max-height: 88vh; overflow: auto;
  animation: pop .22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal-head { padding: 18px 20px 0; }
.modal-body { padding: 14px 20px; }
.modal-foot {
  padding: 14px 20px 18px;
  display: flex; gap: 10px; justify-content: flex-end;
}

/* --------------------------------------------------------- sign-in page - */

.signin-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--brand-tint), transparent 70%),
    var(--bg);
}
.signin {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-hi);
  padding: 30px 28px;
}
.signin .seal { display: block; width: 72px; height: auto; margin: 0 auto 14px; }
.signin h1 { font-size: 1.25rem; text-align: center; }
.signin .sub {
  text-align: center; color: var(--ink-2);
  font-size: .82rem; margin: 6px 0 20px;
}
.signin .btn { width: 100%; }

/* The console sign-in. The same split as the portal's: a green brand panel
 * carrying the seal, and the form on a card with the BPLO wordmark, which
 * has a white ground and so belongs on white. */

.auth { min-height: 100vh; min-height: 100dvh; display: grid; }
@media (min-width: 920px) {
  .auth { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
}

.auth-hero {
  position: relative; overflow: hidden; isolation: isolate;
  color: #fff;
  padding: 56px clamp(28px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: center;
  border-top: 4px solid var(--gold);
  background:
    radial-gradient(900px 520px at -10% -10%, rgba(255,255,255,.09), transparent 60%),
    linear-gradient(158deg, var(--brand-deep) 0%, var(--brand) 58%, #1d8038 100%);
}
.auth-hero::after {
  content: ""; position: absolute; z-index: -1;
  right: -60px; bottom: -60px; width: 340px; height: 340px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.08);
}
.auth-hero > * { max-width: 540px; }

.auth-hero-top { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.auth-seal {
  display: block; width: 84px; height: auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.28));
}
.auth-org {
  display: flex; flex-direction: column; line-height: 1.45;
  font-size: .76rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.9);
}
.auth-org span:first-child { color: #fff; }

.auth-hero h1 {
  font-size: clamp(2rem, 3.3vw, 2.75rem); font-weight: 800;
  letter-spacing: -.025em; line-height: 1.08; margin-bottom: 14px;
}
.auth-lede { font-size: 1.05rem; line-height: 1.55; color: rgba(255,255,255,.92);
             max-width: 44ch; margin: 0; }

.auth-points { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start;
                  color: rgba(255,255,255,.95); font-size: .95rem; }
.auth-points svg {
  width: 22px; height: 22px; flex: none; padding: 3px; margin-top: 1px;
  border-radius: 50%; color: #f6cf63; background: rgba(255,255,255,.1);
}

/* The hall, the permit and the checklist: drawn in the panel's own white
 * and gold. Dropped on short screens, where the form matters more. */
.auth-art { display: block; width: min(380px, 100%); height: auto; margin: 26px 0 -6px; }
@media (max-height: 860px) { .auth-art { display: none; } }

.auth-foot {
  margin: 36px 0 0; padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.18);
  font-size: .86rem; color: rgba(255,255,255,.88);
}
.auth-foot a { color: #fff; font-weight: 700; text-underline-offset: 3px; }
.auth-foot a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
  background:
    radial-gradient(760px 420px at 100% 0%, var(--brand-wash), transparent 70%),
    var(--bg);
  animation: rise .45s var(--ease) both;
}
.auth-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-hi);
  padding: 30px 32px 22px;
}
/* A green-to-gold rule along the top edge: the console's one flourish. */
.auth-card::before {
  content: ""; position: absolute; top: -1px; left: 28px; right: 28px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.auth-card.is-shaking { animation: shake .42s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.auth-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 22px;
}
.auth-wordmark { display: block; width: 100%; max-width: 206px; height: auto; }
.env-pill {
  flex: none; font-size: .68rem; font-weight: 800; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--gold); color: #3a2a00;
}
.env-pill[hidden] { display: none; }

.signin-form h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.015em; }
.signin-form .sub { color: var(--ink-2); font-size: .875rem; margin: 4px 0 20px; }
.signin-form .form-error { font-weight: 600; }
.signin-form .field { margin-bottom: 16px; }
.signin-form .field label { font-size: .8rem; color: var(--ink); }

.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-3); pointer-events: none;
  transition: color .16s var(--ease);
}
.input-wrap:focus-within .input-icon { color: var(--brand); }
.signin-form .field input {
  min-height: 50px; padding-left: 42px;
  font-size: 1rem;                     /* 16px: iOS does not zoom the page */
  border-radius: 12px; background: var(--surface-2);
}
.signin-form .field input:hover { border-color: #cfc8b4; }
.signin-form .field input:focus {
  border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 4px rgba(40,167,69,.2);
}
.signin-form #password { padding-right: 52px; }

.reveal {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--ink-2); cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.reveal:hover { background: var(--brand-wash); color: var(--brand-deep); }
.reveal:focus-visible { outline: 3px solid var(--brand); outline-offset: -4px; }
.reveal svg { width: 20px; height: 20px; }
.reveal .eye-shut,
.reveal[aria-pressed="true"] .eye-open { display: none; }
.reveal[aria-pressed="true"] .eye-shut { display: block; }

.caps-note { margin: 0; }
.caps-note.is-on {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 4px 10px; border-radius: 8px;
  font-size: .78rem; font-weight: 700;
  color: var(--warn); background: var(--warn-bg);
}
.caps-note.is-on::before {
  content: ""; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 8px solid currentColor;
}

.btn-block { width: 100%; }
.signin-form .btn-block {
  min-height: 50px; margin-top: 6px; font-size: .95rem;
  box-shadow: 0 10px 20px -12px rgba(20,107,43,.75);
}

.auth-card .env-note {
  margin-top: 16px; text-align: center;
  font-size: .76rem; font-weight: 600; color: var(--warn);
  background: var(--warn-bg); border-radius: var(--r-sm); padding: 8px 10px;
}
.auth-legal {
  margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line-soft);
  text-align: center; font-size: .76rem; color: var(--ink-2);
}

@media (max-width: 919px) {
  .auth-hero { padding: 22px 20px 24px; border-top-width: 3px; }
  .auth-hero::after { display: none; }
  .auth-hero-top { gap: 12px; margin-bottom: 14px; }
  .auth-seal { width: 54px; }
  .auth-org { font-size: .68rem; letter-spacing: .12em; }
  .auth-hero h1 { font-size: 1.55rem; margin-bottom: 6px; }
  .auth-lede { font-size: .9rem; }
  .auth-points, .auth-foot, .auth-art { display: none; }
  .auth-panel { align-items: flex-start; padding: 20px 16px 32px; }
  .auth-card { padding: 24px 20px 18px; }
  .auth-wordmark { max-width: 172px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card.is-shaking, .auth-panel { animation: none; }
}

/* ------------------------------------------------------- review layout -- */

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shot {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.shot h3 {
  padding: 9px 12px; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3);
  border-bottom: 1px solid var(--line-soft);
}
.shot img {
  display: block; width: 100%; height: 230px;
  object-fit: contain; background: #f4f1e6;
  cursor: zoom-in;
}
.shot.wide { grid-column: 1 / -1; }
.shot.wide img { height: 300px; }

.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
  font-size: .85rem;
}
.facts li:last-child { border-bottom: 0; }
.facts .k { color: var(--ink-3); }
.facts .v { font-weight: 600; text-align: right; }

.reasons { display: grid; gap: 8px; margin: 6px 0 4px; }
.reason {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.reason:hover { border-color: var(--brand-soft); background: var(--brand-wash); }
.reason input { margin-top: 3px; }
.reason .label { font-size: .85rem; font-weight: 600; }
.reason .hint  { font-size: .76rem; color: var(--ink-3); }

/* The one-time password panel. Deliberately loud: it is shown once. */
.once {
  background: var(--gold-tint);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  padding: 16px;
}
.once .value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem; font-weight: 700; letter-spacing: .04em;
  background: var(--surface); border: 1px dashed var(--gold);
  border-radius: var(--r-sm); padding: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  word-break: break-all;
}
.once .warn { font-size: .8rem; color: var(--warn); margin: 10px 0 0; }

/* ------------------------------------------------------- shared bits -- */

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: .78rem; }
.crumb { margin: 0 0 4px !important; font-size: .82rem; }
.btn-row .spacer { margin-left: auto; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack > .card + .card { margin-top: 0; }
.sub-head {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); margin: 16px 0 6px;
}
.notice {
  background: var(--warn-bg); color: var(--warn);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: .84rem; margin-bottom: 14px;
}
.explain p { color: var(--ink-2); font-size: .875rem; max-width: 75ch; }
.explain p:last-child { margin-bottom: 0; }
.plain-list { margin: 0; padding-left: 18px; font-size: .875rem; }

/* A wide table scrolls inside its card instead of pushing the page sideways. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table td.wrap { max-width: 32ch; white-space: normal; word-break: break-word;
                 font-size: .82rem; color: var(--ink-2); }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:focus-visible { outline: 2px solid var(--brand-soft);
                                      outline-offset: -2px; }
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--brand-deep); text-decoration: underline; }

/* ---------------------------------------------------------- stat cards -- */

.stats {
  display: grid; gap: 10px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--r);
  box-shadow: var(--lift);
  padding: 12px 14px;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.stat:hover { border-color: var(--brand-soft); }
.stat.is-active { border-color: var(--brand); background: var(--brand-wash); }
.stat-n { font-size: 1.5rem; font-weight: 800; line-height: 1.1;
          font-variant-numeric: tabular-nums; color: var(--brand-deep); }
.stat.is-zero .stat-n { color: var(--ink-3); }
.stat-label { font-size: .74rem; font-weight: 650; color: var(--ink-2); }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .search { flex: 1 1 320px; max-width: 520px; margin-bottom: 12px; }

.pager[hidden] { display: none; }
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--line-soft);
}

/* ---------------------------------------------------------- permit page - */

.permit-head { margin-bottom: 16px; }
.permit-head .card-body > .form-error,
.permit-head .card-body > .notice { margin: 14px 0 0; }
.ph-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.ph-row h2 { font-size: 1.25rem; }
.ph-pills { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.ph-meta {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .85rem;
}
.ph-meta .k { color: var(--ink-3); margin-right: 6px; }
.permit-grid { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }

.move { padding: 10px 0; border-bottom: 1px solid var(--line-soft);
        display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.move:first-child { padding-top: 0; }
.move:last-child { border-bottom: 0; padding-bottom: 0; }
.move .btn { min-width: 0; }
.blocked { margin: 0; padding: 0; list-style: none; width: 100%;
           font-size: .78rem; color: var(--warn); }
.blocked li::before { content: "Blocked: "; font-weight: 700; }

/* The seven departments. Colour carries the state, and the word does too —
 * a grid read only by colour is unreadable to a colour-blind officer. */
.clear-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.clear {
  border: 1px solid var(--line-soft); border-left-width: 4px;
  border-radius: var(--r-sm); padding: 10px 12px;
  background: var(--surface-2); font-size: .82rem;
}
.clear.is-ok      { border-left-color: var(--ok); }
.clear.is-denied  { border-left-color: var(--danger); background: var(--danger-bg); }
.clear.is-pending { border-left-color: var(--line); }
.clear.is-mine    { box-shadow: 0 0 0 2px var(--brand-tint); }
.clear-top { display: flex; justify-content: space-between; gap: 8px; }
.clear-name { font-weight: 700; }
.clear-status { font-size: .7rem; font-weight: 800; text-transform: uppercase;
                letter-spacing: .05em; color: var(--ink-3); }
.clear.is-ok .clear-status     { color: var(--ok); }
.clear.is-denied .clear-status { color: var(--danger); }
.clear-remarks { margin-top: 4px; color: var(--ink-2); }

.checklist, .docs, .timeline { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 6px 0 6px 22px; position: relative; font-size: .85rem; }
/* Drawn marks, from the same icon set, in the state's colour. */
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 9px; width: 15px; height: 15px;
  background: var(--ok);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.checklist li.is-missing::before {
  background: var(--danger);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5h.01'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5h.01'/%3E%3C/svg%3E");
}
.docs li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: .85rem;
}
.docs li:last-child { border-bottom: 0; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--line-soft);
               position: relative; font-size: .85rem; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 15px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand-soft);
}
.tl-move { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tl-reason { margin-top: 4px; color: var(--ink-2); }

/* Line items: the editor, and the read-only summary. */
.lines-edit td { padding: 6px 8px; }
.lines-edit th { padding: 8px; }
.lines-edit input {
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; background: var(--surface); color: var(--ink);
}
.lines-edit input:focus { outline: none; border-color: var(--brand-soft);
                          box-shadow: 0 0 0 3px var(--brand-tint); }
.lines-edit input.num { text-align: right; font-variant-numeric: tabular-nums; }
.lines-edit .li-code { width: 130px; }
.lines-edit .li-amt  { width: 150px; }
.lines-edit .li-del  { width: 1%; }
.lines-edit tfoot td { border-top: 2px solid var(--line); padding: 12px 8px; }
.lines-edit tbody tr:hover { background: transparent; }
.is-bad, input.is-bad { color: var(--danger) !important;
                        border-color: var(--danger) !important; }
.lines { margin-top: 12px; font-size: .85rem; }
.lines td { padding: 7px 0; }
.lines tfoot td { border-top: 1px solid var(--line); }
.lines tbody tr:hover { background: transparent; }

/* ------------------------------------------------------------ narrower -- */

@media (max-width: 900px) {
  .review-grid, .permit-grid { grid-template-columns: 1fr; }
  /* On one column, the actions come first — they are why the page is open. */
  .permit-grid > .stack:last-child { order: -1; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  main { padding: 18px 16px 56px; }
  .shots { grid-template-columns: 1fr; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .table th.keep, .table td.keep { display: table-cell; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 8px 10px; }
  .stat-n { font-size: 1.15rem; }
  .stat-label { font-size: .68rem; }
  .toolbar .search { max-width: none; }
  .ph-pills { margin-left: 0; }
  .docs li { flex-wrap: wrap; }

  /* The line-item editor becomes one card per line: four inputs side by
   * side do not fit a phone, and a sideways-scrolling form is unusable. */
  .lines-edit, .lines-edit tbody, .lines-edit tr, .lines-edit td { display: block; width: 100%; }
  .lines-edit thead { display: none; }
  .lines-edit tbody tr { border: 1px solid var(--line-soft); border-radius: var(--r-sm);
                         padding: 6px; margin-bottom: 8px; }
  .lines-edit .li-code, .lines-edit .li-amt, .lines-edit .li-del { width: 100%; }
  .lines-edit td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: .7rem; font-weight: 700; color: var(--ink-3); margin-bottom: 3px;
  }
  .lines-edit td:nth-child(n+4) { display: block; }
  .lines-edit tbody td { border-bottom: 0; }
  .lines-edit tfoot tr { display: flex; justify-content: space-between; }
  .lines-edit tfoot td { display: block; width: auto; border-top: 0; }
  .lines-edit tfoot td:empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------------------------- print -- */
/*
 * The Tax Order and the permit. On screen, an A4 sheet on the console's
 * background; on paper, only the sheet. Black on white, no shadows, no brand
 * green — a government document photocopies, and colour does not survive it.
 */

.print-page { background: #e9e6dc; }
.print-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}
.print-bar .spacer { margin-left: auto; }

.sheet {
  width: min(210mm, calc(100% - 32px));
  min-height: 297mm;
  margin: 20px auto 40px;
  padding: 16mm 16mm 20mm;
  background: #fff; color: #000;
  box-shadow: var(--lift-hi);
  font-size: 11pt; line-height: 1.4;
}
.sheet .state { padding: 60px 0; }

.lh { text-align: center; border-bottom: 2px solid #000; padding-bottom: 10px;
      margin-bottom: 14px; position: relative; }
.lh-seal {
  position: absolute; left: 0; top: 0;
  width: 58px; height: 58px; border: 2px solid #000; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 8pt; font-weight: 800; letter-spacing: .06em;
}
.lh-text { font-size: 10pt; line-height: 1.35; }
.lh-muni { font-weight: 700; font-size: 11.5pt; }
.lh-office { font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
             font-size: 9.5pt; margin-top: 2px; }
.lh-title { margin-top: 12px; font-size: 17pt; text-transform: uppercase;
            letter-spacing: .08em; }

.psec { font-size: 10pt; text-transform: uppercase; letter-spacing: .08em;
        margin: 16px 0 6px; border-bottom: 1px solid #000; padding-bottom: 3px; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.pgrid-wide { grid-template-columns: 1fr; }
.pf { display: grid; grid-template-columns: 38% 1fr; gap: 8px; align-items: baseline; }
.pf-k { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; color: #444; }
.pf-v { font-weight: 600; border-bottom: 1px dotted #999; min-height: 1.4em;
        word-break: break-word; }
.pf-v.is-blank { border-bottom: 1px solid #000; }
.pf-note { font-size: 8pt; font-weight: 400; color: #555; }

.ptable { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
.ptable th, .ptable td { border: 1px solid #000; padding: 5px 8px; text-align: left; }
.ptable th { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable tfoot td { font-weight: 600; }
.ptable tr.total td { font-weight: 800; }

.permit-no { text-align: center; margin: 14px 0; }
.permit-no-v { font-size: 20pt; font-weight: 800; letter-spacing: .06em;
               font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.permit-no-v.is-tba { font-size: 14pt; color: #555; font-family: inherit;
                      font-style: italic; letter-spacing: 0; }
.plead { margin: 10px 0 16px; text-align: justify; }
.pnote { font-size: 9pt; color: #333; margin-top: 16px; }

.sigs { display: flex; justify-content: flex-end; gap: 40px; margin-top: 48px; }
.sig { width: 72mm; text-align: center; }
.sig-line { border-bottom: 1px solid #000; min-height: 1.6em; font-weight: 700;
            text-transform: uppercase; }
.sig-role { font-size: 9pt; margin-top: 3px; }

@media (max-width: 720px) {
  .sheet { padding: 18px; min-height: 0; font-size: 10pt; }
  .pgrid { grid-template-columns: 1fr; }
  .pf { grid-template-columns: 1fr; gap: 0; }
  .lh-seal { position: static; margin: 0 auto 8px; }
  .sigs { justify-content: center; }
  .sig { width: 100%; }
}

@page { size: A4; margin: 0; }
@media print {
  .no-print, #toasts { display: none !important; }
  html, body, .print-page { background: #fff !important; }
  .sheet {
    width: 210mm; min-height: 0; margin: 0;
    padding: 14mm 16mm; box-shadow: none; font-size: 11pt;
  }
  .pgrid { grid-template-columns: 1fr 1fr; }
  .pgrid-wide { grid-template-columns: 1fr; }
  .pf { grid-template-columns: 38% 1fr; }
  .lh-seal { position: absolute; margin: 0; }
  .sigs { justify-content: flex-end; }
  .sig { width: 72mm; }
  .ptable, .sigs { break-inside: avoid; }
}

/* ------------------------------------------------- parity 2 additions -- */

/* A checkbox that reads as a control in the toolbar, level with the search. */
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; margin-bottom: 12px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  font-size: .82rem; font-weight: 650; color: var(--ink-2);
}
.toggle:hover { border-color: var(--brand-soft); }
.toggle input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.toggle:has(input:checked) { border-color: var(--brand); background: var(--brand-wash);
                             color: var(--brand-deep); }

/* The verification QR on the printed permit: bottom left, level with the
 * signature, small enough to stay out of the way and large enough to scan
 * off a photocopy (about 28 mm). */
.sigs-qr { justify-content: space-between; align-items: flex-end; }
.pqr { text-align: center; flex: none; }
.pqr-code { display: block; width: 28mm; height: 28mm; }
.pqr-cap { font-size: 7.5pt; letter-spacing: .04em; margin-top: 2px; color: #222; }
@media (max-width: 720px) {
  .sigs-qr { flex-direction: column-reverse; align-items: center; gap: 24px; }
}
@media print {
  .sigs-qr { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}

/* -------------------------------------------------------- business links - */

#list > .link-req + .link-req { margin-top: 16px; }
.link-req .card-head h2 { font-size: 1rem; }
.link-grid {
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: start;
}
.link-grid .shot img { height: 320px; }
.link-out { font-size: .9rem; margin: 12px 0 0; }

.picks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 12px; background: var(--surface-2);
}
.pick-main { flex: 1; min-width: 0; font-size: .85rem; }
.pick-main .muted { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pick .btn { flex: none; }
.pick.is-owned { background: var(--surface); }
.pick-why { font-size: .76rem; color: var(--warn); margin-top: 4px; }
.pick-results .state { padding: 18px 12px; }

.lightbox { place-items: center; }
.lightbox-in {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 100%; max-height: 100%;
}
.lightbox-in img {
  display: block; max-width: min(1000px, 100%); max-height: calc(88vh - 60px);
  object-fit: contain; border-radius: var(--r-sm); background: #fff;
  box-shadow: var(--lift-hi);
}
.lightbox-in .state { background: var(--surface); border-radius: var(--r); }

@media (max-width: 900px) {
  .link-grid { grid-template-columns: 1fr; }
  .link-grid .shot img { height: 260px; }
}
@media (max-width: 720px) {
  .pick { flex-wrap: wrap; }
  .pick .btn { width: 100%; }
}

/* ---------------------------------------------------------- verify scan - */

.scan-grid {
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
.viewfinder {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-sm); background: #10160f;
  display: grid; place-items: center;
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder .vf-idle { color: rgba(255,255,255,.75); font-size: .85rem;
                       text-align: center; padding: 20px; max-width: 34ch; }
.viewfinder .vf-frame {
  position: absolute; inset: 18%; border: 2px solid rgba(255,255,255,.85);
  border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0,0,0,.25);
}
.viewfinder [hidden], .scan-grid .btn[hidden] { display: none !important; }
.scan-grid > .card + .card { margin-top: 0; }

.verdict { border-radius: var(--r); border: 1px solid var(--line-soft);
           border-left-width: 6px; padding: 16px 18px; background: var(--surface); }
.verdict-k { font-size: 1.35rem; font-weight: 800; letter-spacing: .02em; }
.verdict-art { float: right; width: 120px; height: auto; margin: -6px -6px 4px 12px; }
.verdict::after { content: ""; display: block; clear: both; }
.verdict-sub { color: var(--ink-2); font-size: .875rem; margin: 2px 0 10px; }
.verdict.is-valid   { border-left-color: var(--ok);     background: var(--ok-bg); }
.verdict.is-valid .verdict-k   { color: var(--ok); }
.verdict.is-invalid { border-left-color: var(--warn);   background: var(--warn-bg); }
.verdict.is-invalid .verdict-k { color: var(--warn); }
.verdict.is-missing { border-left-color: var(--danger); background: var(--danger-bg); }
.verdict.is-missing .verdict-k { color: var(--danger); }
.verdict.is-unknown { border-left-color: var(--ink-3); }
.verdict.is-unknown .verdict-k { color: var(--ink-2); }
.verdict .facts li { border-bottom-color: rgba(0,0,0,.08); }

@media (max-width: 900px) {
  .scan-grid { grid-template-columns: 1fr; }
}

/* ----------------------------------------------- form validation (form-errors.js) -
 *
 * How every console form says "this is not right yet": the field turns red
 * with its own message under it, the first one is brought into view with a
 * halo and a small shake, and a banner counts what is left with a Next
 * button. Colour is never the only signal — every invalid field also has an
 * icon and words, and aria-invalid.
 *
 * Its colours are tokens of its own, built from the shared ones, so the dark
 * values below are the only thing a dark console would need to change. The
 * console is light-only today, so dark applies when the page opts in with
 * <html data-theme="dark">, and does not follow the device on its own — a
 * dark banner on a cream page would be worse than none.
 */

:root {
  --fe-ink:        var(--danger);              /* message text, icon     */
  --fe-edge:       var(--danger);              /* invalid field border   */
  --fe-wash:       #fff8f6;                    /* invalid field fill     */
  --fe-halo:       rgba(168,39,31,.16);        /* resting ring           */
  --fe-halo-hi:    rgba(168,39,31,.34);        /* the pulse at its peak  */
  --fe-banner-bg:  #fff3f1;
  --fe-banner-line:#efc5bf;
  --fe-banner-ink: #5e1611;
  --fe-badge-bg:   var(--danger-bg);
  --fe-next-bg:    var(--danger);
  --fe-next-bg-hi: #8d1f19;
  --fe-next-ink:   #ffffff;
}
:root[data-theme="dark"] {
  --fe-ink:        #f29a8f;
  --fe-edge:       #e0786c;
  --fe-wash:       #2a1714;
  --fe-halo:       rgba(242,154,143,.20);
  --fe-halo-hi:    rgba(242,154,143,.42);
  --fe-banner-bg:  #2b1715;
  --fe-banner-line:#5c2a25;
  --fe-banner-ink: #f6d5d0;
  --fe-badge-bg:   #3a1a17;
  --fe-next-bg:    #b3342a;
  --fe-next-bg-hi: #c4433a;
  --fe-next-ink:   #ffffff;
}

/* The field. Doubled class: it has to outrank the sign-in page's own
 * focus ring without !important. */
:root input.fe-invalid.fe-invalid,
:root select.fe-invalid.fe-invalid,
:root textarea.fe-invalid.fe-invalid {
  border-color: var(--fe-edge);
  background-color: var(--fe-wash);
}
:root input.fe-invalid.fe-invalid:focus,
:root select.fe-invalid.fe-invalid:focus,
:root textarea.fe-invalid.fe-invalid:focus {
  border-color: var(--fe-edge);
  box-shadow: 0 0 0 3px var(--fe-halo);
}
.fe-has-error > label,
.signin-form .fe-has-error > label { color: var(--fe-ink); }
.input-wrap:has(.fe-invalid) .input-icon { color: var(--fe-ink); }

/* A group of checkboxes: ring the group, tint each choice's edge. */
.reasons.fe-invalid { border-radius: var(--r-sm); outline: 2px solid var(--fe-edge);
                      outline-offset: 4px; }
.reasons.fe-invalid .reason { border-color: var(--fe-banner-line); }

/* The message under the field. */
.fe-msg {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 6px 0 0; color: var(--fe-ink);
  font-size: .8rem; font-weight: 600; line-height: 1.35;
  animation: fe-in .2s var(--ease) both;
}
.fe-msg .ico { width: 15px; height: 15px; margin-top: 1px; }
.fe-msg + .hint { margin-top: 2px; }
.lines-edit .fe-msg { font-size: .74rem; }
.reasons + .fe-msg { margin-top: 10px; }

/* The pulse that lands with the field. */
.fe-pulse {
  animation: fe-halo .9s var(--ease) both,
             fe-shake .36s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes fe-halo {
  0%   { box-shadow: 0 0 0 0 var(--fe-halo-hi); }
  35%  { box-shadow: 0 0 0 7px var(--fe-halo-hi); }
  100% { box-shadow: 0 0 0 3px var(--fe-halo); }
}
@keyframes fe-shake {
  15%, 85% { transform: translateX(-1px); }
  30%, 70% { transform: translateX(4px); }
  45%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
}
@keyframes fe-in { from { opacity: 0; transform: translateY(-3px); } }

/* The banner: sticky, just under whatever bar covers the top (form-errors.js
 * measures it and sets `top`). */
.fe-banner {
  position: sticky; top: 8px; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 8px 8px 8px 10px;
  background: var(--fe-banner-bg); color: var(--fe-banner-ink);
  border: 1px solid var(--fe-banner-line); border-left: 4px solid var(--fe-edge);
  border-radius: var(--r-sm);
  box-shadow: var(--lift);
  animation: fe-in .22s var(--ease) both;
}
.fe-banner-badge {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fe-badge-bg); color: var(--fe-ink);
}
.fe-banner-badge .ico { width: 17px; height: 17px; }
.fe-banner-text { flex: 1; min-width: 0; margin: 0; font-size: .86rem; font-weight: 700; }
.fe-next {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px 0 14px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--fe-next-bg); color: var(--fe-next-ink);
  font: inherit; font-size: .8rem; font-weight: 700;
  transition: background .16s var(--ease);
}
.fe-next .ico { width: 15px; height: 15px; }
.fe-next:hover { background: var(--fe-next-bg-hi); }
.fe-next:focus-visible { outline: 3px solid var(--fe-edge); outline-offset: 2px; }

/* In a dialog: pinned to the dialog's top edge, full width. */
.modal > .fe-banner-modal {
  top: 0; margin: 0; z-index: 3;
  border-width: 0 0 1px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 6px 12px -10px rgba(27,35,24,.35);
  padding: 10px 12px 10px 16px;
}

@media (max-width: 640px) {
  .fe-banner { padding: 8px; gap: 8px; }
  .fe-banner-text { font-size: .82rem; }
  .fe-next { min-height: 44px; padding: 0 14px; }     /* thumb-sized */
}

@media (prefers-reduced-motion: reduce) {
  /* Halo only, no shake. The halo is a colour change, not movement, so it
   * is exempt from the page-wide `* { animation-duration: .01ms }` above. */
  .fe-pulse { animation: fe-halo .9s linear both; animation-duration: .9s !important; }
  .fe-msg, .fe-banner { animation: none; }
}

/* ------------------------------------------------------ identity review --
 *
 * The queue and the review page for identity verification. Same tokens, same
 * cards; what is new is a filter bar, a metric strip, an image viewer that
 * zooms, rotates and compares, and a decision bar that stays in reach.
 */

/* --- queue: the metric strip -------------------------------------------- */

.stats-kyc { grid-template-columns: repeat(8, minmax(0, 1fr)); }
a.btn { text-decoration: none; }
.kyc-table .nowrap { white-space: nowrap; }
@media (max-width: 1240px) { .stats-kyc { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-metric { cursor: default; box-shadow: none; background: var(--surface-2); }
.stat-metric:hover { border-color: var(--line-soft); }
.stat-metric .stat-n { color: var(--ink); font-size: 1.3rem; }
.stat-metric.is-warn .stat-n { color: var(--warn); }
.stat-metric.is-danger .stat-n { color: var(--danger); }
.stat-sub { font-size: .7rem; color: var(--ink-3); }
.stat-label .ico { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }

/* --- queue: filters ------------------------------------------------------ */

.kyc-filters {
  display: grid; gap: 10px 12px; align-items: end;
  grid-template-columns: minmax(220px, 2.2fr) repeat(5, minmax(120px, 1fr));
  margin-bottom: 10px;
}
.kyc-filters .field { margin: 0; }
.kyc-filters .field input, .kyc-filters .field select { min-height: 40px; padding: 8px 10px; font-size: .85rem; }
.search-wrap { position: relative; }
.search-wrap .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
                    color: var(--ink-3); pointer-events: none; }
.kyc-filters .search-wrap input { padding-left: 36px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-row .toggle { min-height: 36px; margin: 0; padding: 0 12px; font-size: .78rem; }
.filter-row .spacer { margin-left: auto; }
.result-line { font-size: .8rem; color: var(--ink-2); }
.result-line strong { color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--brand-soft); background: var(--brand-wash); color: var(--brand-deep);
  border-radius: 999px; padding: 3px 4px 3px 10px; font-size: .74rem; font-weight: 650;
}
.chip button {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
}
.chip button:hover { background: var(--brand-tint); }
.chip .ico { width: 12px; height: 12px; }

/* --- queue: rows ----------------------------------------------------------- */

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand-deep);
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.who-text { min-width: 0; }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.flag {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 2px 8px; font-size: .7rem; font-weight: 700; white-space: nowrap;
}
.flag .ico { width: 12px; height: 12px; }
.flag-danger { background: var(--danger-bg); color: var(--danger); }
.flag-warn   { background: var(--warn-bg); color: var(--warn); }
.flag-info   { background: var(--info-bg); color: var(--info); }
.flag-quiet  { background: var(--line-soft); color: var(--ink-2); }
.age { font-weight: 650; font-variant-numeric: tabular-nums; }
.age-warn { color: var(--warn); }
.age-danger { color: var(--danger); }
.kyc-table tr.is-dup td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.kyc-table tr.is-old td:first-child { box-shadow: inset 3px 0 0 var(--gold); }

.pager-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager-nav select { min-height: 34px; border: 1px solid var(--line); border-radius: 999px;
                    background: var(--surface); padding: 0 10px; font: inherit; font-size: .8rem; }

@media (max-width: 1100px) {
  .kyc-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kyc-filters .f-search { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .kyc-filters { grid-template-columns: 1fr 1fr; }
  .stats-kyc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Rows become cards: a phone cannot show seven columns, and a table that
   * scrolls sideways hides the column that says how long someone waited. */
  .kyc-table thead { display: none; }
  .kyc-table, .kyc-table tbody, .kyc-table tr, .kyc-table td { display: block; width: 100%; }
  .kyc-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .kyc-table tbody tr:last-child { border-bottom: 0; }
  .kyc-table td { border: 0; padding: 3px 0; }
  .kyc-table td[data-label]:not(.td-who) { display: flex; justify-content: space-between;
                                           gap: 12px; font-size: .84rem; }
  .kyc-table td[data-label]:not(.td-who)::before { content: attr(data-label); color: var(--ink-3);
                                                   font-size: .76rem; flex: none; }
  .kyc-table td[data-label] > div { text-align: right; }
  .kyc-table td.td-who { margin-bottom: 6px; }
  .kyc-table td.td-go { display: none; }
  .kyc-table tr.is-dup td:first-child, .kyc-table tr.is-old td:first-child { box-shadow: none; }
  .kyc-table tr.is-dup { box-shadow: inset 3px 0 0 var(--danger); }
  .kyc-table tr.is-old { box-shadow: inset 3px 0 0 var(--gold); }
}

/* --- review: header ------------------------------------------------------ */

.kyc-head { margin-bottom: 16px; }
.kyc-head-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.kyc-head h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }
.kyc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--ink-2); margin-top: 4px; }
.kyc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.kyc-meta .ico { width: 14px; height: 14px; color: var(--ink-3); }
.kyc-head .ph-pills { align-items: center; }

/* --- review: banners -------------------------------------------------------- */

.banner {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: var(--r); padding: 12px 16px; margin-bottom: 12px;
  border: 1px solid transparent; font-size: .85rem;
}
.banner > .ico { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner strong { display: block; font-size: .9rem; }
.banner p { margin: 2px 0 0; }
.banner-danger { background: var(--danger-bg); color: #6d1913; border-color: #efc5bf; }
.banner-danger > .ico { color: var(--danger); }
.banner-warn { background: var(--warn-bg); color: #5c3e00; border-color: #efd9a4; }
.banner-warn > .ico { color: var(--warn); }
.banner-info { background: var(--info-bg); color: #173f55; border-color: #c6dbe8; }
.banner-info > .ico { color: var(--info); }
.banner a { color: inherit; font-weight: 700; }

/* --- review: layout -------------------------------------------------------- */

.kyc-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
}
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .ico { color: var(--ink-3); width: 18px; height: 18px; }
.card-head .spacer { margin-left: auto; }

/* --- review: the image viewer ---------------------------------------------- */

.viewer-panes { display: grid; gap: 12px; }
.viewer.is-compare .viewer-panes { grid-template-columns: 1fr 1fr; }
.pane { border: 1px solid var(--line-soft); border-radius: var(--r-sm); overflow: hidden;
        background: var(--surface-2); display: flex; flex-direction: column; min-width: 0; }
.pane-bar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 6px 8px; border-bottom: 1px solid var(--line-soft); background: var(--surface);
}
.pane-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
              color: var(--ink-3); font-weight: 700; margin-right: auto; padding-left: 4px; }
.pane-bar select { min-height: 30px; border: 1px solid var(--line); border-radius: 8px;
                   background: var(--surface); font: inherit; font-size: .78rem;
                   padding: 0 6px; margin-right: auto; max-width: 52%; }
.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.icon-btn:hover { background: var(--brand-wash); color: var(--brand-deep); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.icon-btn .ico { width: 17px; height: 17px; }
.zoom-read { font-size: .72rem; font-variant-numeric: tabular-nums; color: var(--ink-3);
             min-width: 40px; text-align: center; }
.stage {
  position: relative; overflow: hidden; height: 440px;
  background:
    linear-gradient(45deg, #f1ecdd 25%, transparent 25%, transparent 75%, #f1ecdd 75%) 0 0 / 20px 20px,
    linear-gradient(45deg, #f1ecdd 25%, transparent 25%, transparent 75%, #f1ecdd 75%) 10px 10px / 20px 20px,
    #f7f3e8;
  cursor: grab; touch-action: none; user-select: none;
}
.stage.is-dragging { cursor: grabbing; }
.stage img {
  position: absolute; left: 50%; top: 50%;
  max-width: 100%; max-height: 100%;
  transform-origin: center center;
  transition: transform .18s var(--ease);
  pointer-events: none;
}
.stage.is-dragging img { transition: none; }
.stage .state { position: absolute; inset: 0; display: grid; place-content: center; padding: 16px; }
.viewer.is-compare .stage { height: 380px; }
.stage-hint { position: absolute; right: 8px; bottom: 8px; font-size: .68rem;
              background: rgba(27,35,24,.62); color: #fff; padding: 3px 8px; border-radius: 999px;
              pointer-events: none; }
.thumbs { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.thumb {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  width: 104px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font: inherit; color: var(--ink-2);
}
.thumb img, .thumb .thumb-none { width: 100%; height: 64px; object-fit: cover; border-radius: 6px;
                                 background: #f4f1e6; display: grid; place-items: center; }
.thumb .thumb-none .ico { color: var(--ink-3); }
.thumb span { font-size: .68rem; font-weight: 650; text-align: center; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
.thumb kbd { margin-left: 2px; }
.thumb.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); color: var(--brand-deep); }
.thumb:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.thumb:disabled { opacity: .5; cursor: default; }

.viewer-full { position: fixed; inset: 0; z-index: 55; background: rgba(15,22,13,.92);
               display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.viewer-full .viewer-panes { flex: 1; min-height: 0; }
.viewer-full .pane { min-height: 0; }
.viewer-full .stage { height: auto; flex: 1; }
.viewer-full-bar { display: flex; gap: 8px; justify-content: flex-end; }
.viewer-full-bar[hidden] { display: none; }

kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface);
  font: 650 .68rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-2); text-align: center;
}
.btn kbd { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); color: inherit; }
.btn-quiet kbd { background: var(--surface-2); border-color: var(--line); }

/* --- review: profile ------------------------------------------------------- */

.facts-group + .facts-group { margin-top: 6px; }
.facts-group .sub-head { margin-top: 10px; }
.facts-group:first-child .sub-head { margin-top: 0; }
.facts .v .pill { margin-left: 6px; vertical-align: 1px; }
.facts .v.is-missing { color: var(--ink-3); font-weight: 500; font-style: italic; }
.facts li.is-alert .v { color: var(--danger); }
.signal-note { font-size: .78rem; color: var(--ink-3); margin: 8px 0 0; }
.meter { height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; margin-top: 4px; }
.meter span { display: block; height: 100%; background: var(--brand-soft); }
.meter.is-mid span { background: var(--gold); }
.meter.is-low span { background: var(--danger); }

/* --- review: duplicates ---------------------------------------------------- */

.dupes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dupe { border: 1px solid #efc5bf; background: #fffaf9; border-radius: var(--r-sm); padding: 10px 12px;
        font-size: .82rem; }
.dupe-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dupe-top strong { font-size: .88rem; }
.dupe .muted { margin-top: 2px; }
.dupe a { font-weight: 650; }

/* --- review: attempts and audit -------------------------------------------- */

.attempts, .audit { list-style: none; margin: 0; padding: 0; }
.attempt { position: relative; padding: 0 0 16px 26px; }
.attempt::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0;
                   width: 2px; background: var(--line-soft); }
.attempt:last-child { padding-bottom: 0; }
.attempt:last-child::before { display: none; }
.attempt-dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%;
               background: var(--surface); border: 3px solid var(--brand-soft); }
.attempt.is-warn .attempt-dot { border-color: var(--gold); }
.attempt.is-danger .attempt-dot { border-color: var(--danger); }
.attempt.is-info .attempt-dot { border-color: var(--info); }
.attempt-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .86rem; }
.attempt-top strong { font-weight: 700; }
.attempt-body { font-size: .8rem; color: var(--ink-2); margin-top: 3px; }
.attempt-body ul { margin: 4px 0 0; padding-left: 18px; }
.attempt-note { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--line);
                background: var(--surface-2); border-radius: 0 6px 6px 0; font-size: .8rem;
                color: var(--ink-2); white-space: pre-wrap; }
.attempt.is-current { }
.attempt.is-current .attempt-top strong::after { content: " · this one"; color: var(--ink-3); font-weight: 600; }

.audit li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: .82rem; }
.audit li:last-child { border-bottom: 0; }
.audit-ico { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
             background: var(--line-soft); color: var(--ink-2); }
.audit-ico .ico { width: 15px; height: 15px; }
.audit-ico.is-ok { background: var(--ok-bg); color: var(--ok); }
.audit-ico.is-warn { background: var(--warn-bg); color: var(--warn); }
.audit-ico.is-danger { background: var(--danger-bg); color: var(--danger); }
.audit-ico.is-info { background: var(--info-bg); color: var(--info); }
.audit-main { flex: 1; min-width: 0; }
.audit-main .muted { font-size: .74rem; }
.audit-changes { margin: 3px 0 0; padding: 0; list-style: none; font-size: .76rem; color: var(--ink-2); }
.audit-changes del { color: var(--danger); }
.audit-changes ins { color: var(--ok); text-decoration: none; font-weight: 650; }
.viewers { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* --- review: notes and the decision bar ------------------------------------- */

.notes-box textarea { width: 100%; min-height: 84px; resize: vertical; padding: 10px 12px;
                      border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit;
                      font-size: .86rem; background: var(--surface); color: var(--ink); }
.notes-box textarea:focus { outline: none; border-color: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-tint); }
.notes-box .hint { font-size: .74rem; color: var(--ink-3); margin-top: 6px; }

.decision-bar {
  position: sticky; bottom: 12px; z-index: 30; margin-top: 18px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--lift-hi);
}
.decision-bar .db-text { font-size: .82rem; color: var(--ink-2); min-width: 0; flex: 1 1 220px; }
.decision-bar .db-text strong { color: var(--ink); }
.decision-bar .btn-row { flex-wrap: nowrap; }
.decision-bar .db-next { font-size: .78rem; display: inline-flex; align-items: center; gap: 6px;
                         color: var(--ink-2); cursor: pointer; }
.decision-bar .db-next input { accent-color: var(--brand); }
.reason-group + .reason-group { margin-top: 10px; }
.reason-group .sub-head { margin: 4px 0 6px; }
.confirm-check { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem;
                 padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 10px 0; }
.confirm-check input { margin-top: 3px; accent-color: var(--brand); }
.shortcuts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .85rem; }
.shortcuts li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0;
                border-bottom: 1px solid var(--line-soft); }

.sk-avatar { width: 56px; height: 56px; border-radius: 50%; }
.sk-viewer { height: 440px; }
.sk-thumbs { display: flex; gap: 8px; margin-top: 12px; }
.sk-thumb { width: 104px; height: 84px; }

@media (max-width: 1000px) {
  .kyc-grid { grid-template-columns: minmax(0, 1fr); }
  .kyc-grid > .stack { display: contents; }
}
@media (max-width: 720px) {
  .viewer.is-compare .viewer-panes { grid-template-columns: 1fr; }
  .stage, .viewer.is-compare .stage { height: 320px; }
  .stage-hint { display: none; }
  .thumb { width: calc(25% - 6px); min-width: 70px; }
  .kyc-head-row { gap: 12px; }
  .kyc-head .ph-pills { margin-left: 0; }
  .decision-bar { bottom: 8px; padding: 10px; gap: 8px; }
  .decision-bar .db-text { flex-basis: 100%; }
  .decision-bar .btn-row { width: 100%; }
  .decision-bar .btn-row .btn { flex: 1; padding: 0 10px; }
  .decision-bar kbd, .db-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .stage img { transition: none; }
}
