/* Kit Dispatch Portal — frosted-glass interface, day and night.
   Layout: floating glass top bar over a slow aurora; content in translucent panels on a 1200px column. */
:root {
  --bg: #eef0f8;
  --ink: #161827;
  --ink-2: #3c4058;
  --muted: #666b85;
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.80);
  --glass-solid: #f8f8fc;
  --glass-pop: rgba(255, 255, 255, 0.58);
  --rim: rgba(255, 255, 255, 0.85);
  --edge: rgba(30, 34, 70, 0.10);
  --hair: rgba(30, 34, 70, 0.07);
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 12px 32px -12px rgba(40, 44, 90, 0.22);
  --accent: #c2336a;
  --accent-2: #6b4fe0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(194, 51, 106, 0.10);
  --focus: rgba(107, 79, 224, 0.45);

  --ok: #12805a;   --ok-soft: rgba(18, 128, 90, 0.12);
  --warn: #b25e00; --warn-soft: rgba(212, 128, 20, 0.15);
  --bad: #c62a2a;  --bad-soft: rgba(198, 42, 42, 0.11);
  --info: #2f5fd0; --info-soft: rgba(47, 95, 208, 0.11);
  --vio: #6b4fe0;  --vio-soft: rgba(107, 79, 224, 0.12);
  --teal: #0b7f86; --teal-soft: rgba(11, 127, 134, 0.12);
  --neu: #6a6f86;  --neu-soft: rgba(106, 111, 134, 0.13);

  --blob-1: #f6a5c4; --blob-2: #b4a6ff; --blob-3: #8fe0d6; --blob-4: #ffd59a;
  --blob-op: 0.75;

  --f-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --r-lg: 22px; --r-md: 14px; --r-sm: 10px;
  --blur: saturate(170%) blur(22px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090a14; --ink: #eef0fb; --ink-2: #c6c9dc; --muted: #9196b2;
    --glass: rgba(24, 26, 44, 0.50); --glass-strong: rgba(30, 32, 54, 0.82); --glass-solid: #171930; --glass-pop: rgba(28, 30, 52, 0.62);
    --rim: rgba(255, 255, 255, 0.09); --edge: rgba(255, 255, 255, 0.10); --hair: rgba(255, 255, 255, 0.06);
    --shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 16px 40px -16px rgba(0, 0, 0, 0.7);
    --accent: #ff6f9f; --accent-2: #9d86ff; --accent-ink: #1a0a12; --accent-soft: rgba(255, 111, 159, 0.14); --focus: rgba(157, 134, 255, 0.55);
    --ok: #4fd69c; --ok-soft: rgba(79, 214, 156, 0.14); --warn: #ffb44f; --warn-soft: rgba(255, 180, 79, 0.15);
    --bad: #ff7a72; --bad-soft: rgba(255, 122, 114, 0.15); --info: #7ea6ff; --info-soft: rgba(126, 166, 255, 0.15);
    --vio: #a996ff; --vio-soft: rgba(169, 150, 255, 0.16); --teal: #4dd2d8; --teal-soft: rgba(77, 210, 216, 0.14);
    --neu: #a3a8c2; --neu-soft: rgba(163, 168, 194, 0.14);
    --blob-1: #8a1d4c; --blob-2: #3a2a9c; --blob-3: #0b5d63; --blob-4: #6b3d08; --blob-op: 0.55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090a14; --ink: #eef0fb; --ink-2: #c6c9dc; --muted: #9196b2;
  --glass: rgba(24, 26, 44, 0.50); --glass-strong: rgba(30, 32, 54, 0.82); --glass-solid: #171930; --glass-pop: rgba(28, 30, 52, 0.62);
  --rim: rgba(255, 255, 255, 0.09); --edge: rgba(255, 255, 255, 0.10); --hair: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 16px 40px -16px rgba(0, 0, 0, 0.7);
  --accent: #ff6f9f; --accent-2: #9d86ff; --accent-ink: #1a0a12; --accent-soft: rgba(255, 111, 159, 0.14); --focus: rgba(157, 134, 255, 0.55);
  --ok: #4fd69c; --ok-soft: rgba(79, 214, 156, 0.14); --warn: #ffb44f; --warn-soft: rgba(255, 180, 79, 0.15);
  --bad: #ff7a72; --bad-soft: rgba(255, 122, 114, 0.15); --info: #7ea6ff; --info-soft: rgba(126, 166, 255, 0.15);
  --vio: #a996ff; --vio-soft: rgba(169, 150, 255, 0.16); --teal: #4dd2d8; --teal-soft: rgba(77, 210, 216, 0.14);
  --neu: #a3a8c2; --neu-soft: rgba(163, 168, 194, 0.14);
  --blob-1: #8a1d4c; --blob-2: #3a2a9c; --blob-3: #0b5d63; --blob-4: #6b3d08; --blob-op: 0.55;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--f-body); -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background-color .4s ease;
}
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: -0.015em; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--f-mono); font-size: .86em; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: 10px; background: var(--glass-strong); }
.skip:focus { left: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 22px; height: 22px; }

/* ---------- aurora background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: var(--blob-op); will-change: transform; }
.aurora .b1 { width: 46vw; height: 46vw; left: -10vw; top: -14vw; background: var(--blob-1); animation: drift1 26s ease-in-out infinite alternate; }
.aurora .b2 { width: 40vw; height: 40vw; right: -8vw; top: -6vw; background: var(--blob-2); animation: drift2 30s ease-in-out infinite alternate; }
.aurora .b3 { width: 38vw; height: 38vw; left: 18vw; bottom: -18vw; background: var(--blob-3); animation: drift3 34s ease-in-out infinite alternate; }
.aurora .b4 { width: 30vw; height: 30vw; right: 6vw; bottom: -10vw; background: var(--blob-4); animation: drift1 38s ease-in-out infinite alternate-reverse; }
.aurora .grain { position: absolute; inset: 0; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes drift1 { to { transform: translate(6vw, 5vw) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-7vw, 6vw) scale(.94); } }
@keyframes drift3 { to { transform: translate(5vw, -6vw) scale(1.1); } }

/* ---------- glass surfaces ---------- */
.glass {
  background: var(--glass); border: 1px solid var(--rim); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-radius: var(--r-lg);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
.topbar-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 14px; border-radius: 18px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { flex: none; display: block; padding: 3px 8px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--hair); }
.brand-logo img { display: block; height: 54px; width: auto; }
.login-logo { display: flex; justify-content: center; }
.login-logo .brand-logo { padding: 5px 10px; border-radius: 12px; }
.login-logo .brand-logo img { height: auto; width: 100%; max-width: 180px; }
/* Brand and actions share the space either side equally, so the tabs sit in the middle of the bar. */
.top-left { flex: 1 1 0; min-width: 0; display: flex; }
.tabs { display: flex; flex: none; gap: 4px; padding: 4px; border-radius: 13px; background: var(--hair); }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 8px -3px rgba(0,0,0,.18); }
.top-actions { flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.theme-switch { display: flex; padding: 3px; border-radius: 12px; background: var(--hair); }
.theme-switch button { border: 0; background: none; width: 32px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 6px -2px rgba(0,0,0,.2); }
.user-chip { display: grid; place-items: center; padding: 3px; border-radius: 50%; border: 1px solid var(--edge); background: var(--glass); cursor: pointer; }
.user-chip:hover, .user-chip[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(108, 43, 217, .22); }
/* Same blue-to-purple as the logo */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--f-display); color: #fff; background: linear-gradient(135deg, #2148c0, #6c2bd9); flex: none; }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }
.menu-head .who { font-size: 14px; font-weight: 600; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.menu-head .who small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; border-radius: 14px; background: var(--glass-strong); z-index: 40; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; border: 0; background: none; text-decoration: none; color: var(--ink); font-size: 14px; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--hair); }
.rel { position: relative; }
.mobile-tabs { display: none; }

/* ---------- buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 11px;
  border: 1px solid var(--edge); background: var(--glass-strong); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: transform .12s ease, box-shadow .2s ease, background .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(0,0,0,.3); }
.btn:active { transform: translateY(0); }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 20px -10px var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hair); box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--bad); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--edge);
  background: var(--glass-strong); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--focus); }
.invalid .input { border-color: var(--bad); }
.input::placeholder { color: var(--muted); opacity: .8; }
.input-ic { position: relative; }
.input-ic .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-ic .input { padding-left: 38px; }
.req::after { content: " *"; color: var(--accent); }

/* Rounded glass dropdowns (enhanceSelect in app.js). The real <select> stays in the page, visually hidden. */
.sel-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.sel-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; cursor: pointer; font-weight: 500; }
.sel-btn:hover { border-color: color-mix(in srgb, var(--accent-2) 35%, var(--edge)); }
.sel-btn .sel-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn .ic { flex: none; color: var(--muted); transition: transform .18s ease; }
.sel-btn[aria-expanded="true"] { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--focus); }
.sel-btn[aria-expanded="true"] .ic { transform: rotate(180deg); color: var(--accent-2); }
.sel-btn:disabled { opacity: .55; cursor: default; }
/* Dropdown lists and calendars float over the page as frosted glass: see-through, with a strong blur behind. */
.sel-pop, .cal-pop, .set-pop {
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,0) 60%), var(--glass-pop);
  border: 1px solid var(--rim); box-shadow: var(--shadow), 0 22px 48px -18px rgba(20, 22, 60, .38);
  -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
}
.sel-pop {
  position: fixed; z-index: 200; padding: 6px; border-radius: 14px; overflow-y: auto; overscroll-behavior: contain; outline: none;
  animation: sel-in .14s ease-out; transform-origin: top center; scrollbar-width: thin;
}
.sel-pop.up { transform-origin: bottom center; }
@keyframes sel-in { from { opacity: 0; transform: scale(.97); } }
.sel-opt { display: flex; align-items: center; gap: 6px; padding: 7px 12px 7px 6px; border-radius: 9px; font-size: 14px; line-height: 1.35; cursor: pointer; color: var(--ink); white-space: nowrap; }
.sel-opt.active { background: var(--accent-2); color: var(--accent-ink); }
.sel-opt[aria-disabled="true"] { opacity: .45; cursor: default; }
.sel-check { width: 18px; display: grid; place-items: center; flex: none; color: var(--accent-2); }
.sel-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sel-count { margin-left: auto; padding-left: 18px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sel-opt.active .sel-check, .sel-opt.active .sel-count { color: inherit; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .sel-pop, .cal-pop, .set-pop { background: var(--glass-solid); } }

/* Date fields: the portal's calendar (enhanceDate in app.js) replaces the browser's, which cannot be styled. */
.date-wrap { position: relative; display: block; }
.date-wrap > .input { padding-right: 42px; }
.date-wrap > .input::-webkit-calendar-picker-indicator { display: none; }
/* The real date input stays in the form (value, min/max, events) but out of sight; the DD/MM/YYYY text box is shown. */
.date-wrap > .date-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.date-wrap > .input[aria-invalid="true"] { border-color: var(--bad); }
.date-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.date-btn:hover, .date-btn[aria-expanded="true"] { background: var(--hair); color: var(--accent-2); }
.cal-pop { position: fixed; z-index: 200; width: 292px; padding: 12px; border-radius: 18px; animation: sel-in .14s ease-out; transform-origin: top left; }
.cal-pop.up { transform-origin: bottom left; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font: 600 15px var(--f-display); color: var(--ink); }
.cal-nav { width: 32px; height: 32px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.cal-nav:hover { background: var(--hair); color: var(--ink); }
.cal-nav:disabled { opacity: .3; cursor: default; background: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; }
.cal-day { height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: 500 13.5px var(--f-body); font-variant-numeric: tabular-nums; cursor: pointer; }
.cal-day:hover { background: var(--hair); }
.cal-day.out { color: var(--muted); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent-2); font-weight: 700; }
.cal-day.sel { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; box-shadow: 0 6px 14px -8px var(--accent); }
.cal-day:disabled { opacity: .28; cursor: default; background: none; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hair); }
.cal-link { border: 0; background: none; color: var(--accent-2); font-weight: 600; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.cal-link:hover { background: var(--hair); }
.cal-link:disabled { opacity: .4; cursor: default; background: none; }
@media (prefers-reduced-motion: reduce) { .sel-pop, .cal-pop, .set-pop { animation: none; } .sel-btn .ic { transition: none; } }

/* ---------- shell & page header ---------- */
.shell { max-width: 1240px; margin: 0 auto; padding: 26px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 4px 4px 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.page-head h1 { font-size: clamp(24px, 3.2vw, 32px); font-weight: 600; margin-top: 4px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* Team page: Email notifications / Daily reminder as header icons, each opening a pop-over card. */
.team-head { position: relative; }
.set-btn { position: relative; }
.set-btn[aria-expanded="true"] { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--focus); color: var(--accent-2); }
.set-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--neu); box-shadow: 0 0 0 2px var(--glass-strong); }
.set-dot.on { background: var(--ok); }
.set-pop { position: absolute; z-index: 150; top: calc(100% + 8px); right: 4px; width: min(400px, calc(100% - 8px)); border-radius: 16px; animation: sel-in .14s ease-out; transform-origin: top right; }
.set-pop[hidden] { display: none; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; text-align: left; cursor: default; }
button.stat { cursor: pointer; font: inherit; color: inherit; }
button.stat:hover { border-color: var(--accent-2); }
.stat .k { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat .k .dot { width: 8px; height: 8px; border-radius: 3px; background: currentColor; }
.stat .v { font: 600 28px/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.stat.alert .v { color: var(--bad); }
.stat .glow { position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; filter: blur(28px); opacity: .45; }

/* ---------- status ribbon ---------- */
.ribbon { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ribbon-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--hair); gap: 2px; }
.ribbon-bar span { display: block; height: 100%; min-width: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 3px 6px; margin: -3px -6px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.legend button:hover, .legend button[aria-pressed="true"] { background: var(--hair); color: var(--ink); }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend b { font-variant-numeric: tabular-nums; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px; }
.toolbar .grow { flex: 1 1 260px; min-width: 0; }
.toolbar select.input, .toolbar .sel-btn { width: auto; min-width: 150px; flex: 0 1 auto; }
.toolbar .sel-btn { max-width: 300px; }
.count { font-size: 13px; color: var(--muted); padding: 0 6px; white-space: nowrap; }

/* ---------- register table ---------- */
.panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.reg { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.reg thead th {
  position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 12px 14px; background: var(--glass-strong); border-bottom: 1px solid var(--edge); white-space: nowrap;
}
.reg td { padding: 13px 14px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.reg tbody tr { cursor: pointer; transition: background .15s; }
.reg tbody tr:hover { background: var(--hair); }
.reg tbody tr:last-child td { border-bottom: 0; }
.reg .c-name { font-weight: 600; color: var(--ink); line-height: 1.3; }
.reg .c-loc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.reg .c-ref { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.sub.late { color: var(--bad); font-weight: 600; }
.sub.soon { color: var(--warn); font-weight: 600; }
.cn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cn-type { font: 700 10.5px/1 var(--f-mono); padding: 4px 6px; border-radius: 6px; background: var(--vio-soft); color: var(--vio); letter-spacing: .04em; }
.track { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--accent-2); background: var(--vio-soft); white-space: nowrap; }
.track:hover { filter: brightness(1.1); text-decoration: underline; }
.qty { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.reg th.r { text-align: right; }
.reg .kits { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.t-info { color: var(--info); background: var(--info-soft); }
.t-vio { color: var(--vio); background: var(--vio-soft); }
.t-warn { color: var(--warn); background: var(--warn-soft); }
.t-teal { color: var(--teal); background: var(--teal-soft); }
.t-ok { color: var(--ok); background: var(--ok-soft); }
.t-neu { color: var(--neu); background: var(--neu-soft); }
.t-bad { color: var(--bad); background: var(--bad-soft); }
.flag { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--bad); text-transform: uppercase; letter-spacing: .05em; }
.sample-chip { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); vertical-align: 2px; }

.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .art { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: var(--accent-2); background: var(--vio-soft); margin-bottom: 6px; }
.empty h3 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 46ch; }

/* ---------- drawer & modal ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 25, .32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s ease; }
.drawer {
  position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); display: flex; flex-direction: column;
  border-radius: 24px 0 0 24px; border-right: 0; background: var(--glass-strong); animation: slide .28s cubic-bezier(.2,.8,.2,1);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--hair); }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 20px; font-weight: 600; margin-top: 4px; }
.drawer-body > *, .modal > * { flex-shrink: 0; }
.drawer-body:focus, .modal:focus { outline: none; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--hair); flex-wrap: wrap; }
.drawer.wide { width: min(900px, 100vw); }
.modal { position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); padding: 26px; background: var(--glass-strong); animation: pop .22s ease; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { font-size: 21px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.97); opacity: 0; } }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--hair); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--hair); }
.facts > div { background: var(--glass); padding: 11px 13px; min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 3px 0 0; font-weight: 500; overflow-wrap: anywhere; }
/* Dispatch details read like the form they were typed into: the form's own labels, not small capitals. */
.facts.as-form dt { font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.facts-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 -4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* journey seek-bar */
.journey { padding: 16px 16px 14px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--hair); }
.journey-track { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); }
.journey-track::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 13px; height: 3px; border-radius: 3px; background: var(--hair); }
.journey-fill { position: absolute; left: 12.5%; top: 13px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s ease; }
.stop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.stop .node { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-solid); border: 2px solid var(--edge); color: var(--muted); z-index: 1; }
.stop.done .node { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.stop.now .node { box-shadow: 0 0 0 5px var(--accent-soft); }
.stop.done, .stop.now { color: var(--ink); }
.journey-note { margin-top: 12px; font-size: 13px; padding: 8px 11px; border-radius: 10px; }

.card { padding: 16px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--hair); display: flex; flex-direction: column; gap: 12px; }
.card h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: 12px; }
.form-section > h3 { font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-family: var(--f-body); display: flex; align-items: center; gap: 8px; }
.form-error { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-weight: 500; font-size: 14px; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--hair); }
.timeline li:last-child::before { display: none; }
.timeline .tdot { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--glass-solid); background: currentColor; box-shadow: 0 0 0 1px var(--edge); }
.timeline .thead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.timeline .tstatus { font-weight: 600; color: var(--ink); }
.timeline .tmeta { font-size: 12.5px; color: var(--muted); }
.notif { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 8px; }
.notif.ok { color: var(--ok); background: var(--ok-soft); }
.notif.bad { color: var(--bad); background: var(--bad-soft); }
/* Consignment-wise report: all 10 columns fit the page width (headings may wrap; tighter cells; status notes in normal case). */
.mini.cw { font-size: 13px; }
.mini.cw th { white-space: normal; vertical-align: bottom; padding: 8px; letter-spacing: .04em; font-size: 11px; }
.mini.cw td { vertical-align: top; padding: 10px 8px; }
.mini.cw td.mono { white-space: nowrap; font-size: 11.5px; }
.mini.cw td.loc { min-width: 160px; }
.mini.cw td.date { white-space: nowrap; }
.mini.cw .flag { display: block; margin-top: 5px; font-size: 11.5px; text-transform: none; letter-spacing: 0; line-height: 1.3; }
.mini.cw tbody tr { cursor: pointer; }
.mini.cw tbody tr:hover { background: var(--hair); }
.timeline .tnote { margin-top: 4px; font-size: 14px; color: var(--ink-2); }

/* ---------- reports ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meter { height: 6px; border-radius: 99px; background: var(--hair); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.meter.ok span { background: var(--ok); }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 16px; align-items: start; }
.section { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 17px; font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 44px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-row .track-bg { height: 10px; border-radius: 99px; background: var(--hair); overflow: hidden; }
.bar-row .track-bg span { display: block; height: 100%; border-radius: 99px; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--edge); white-space: nowrap; }
.mini td { padding: 10px; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; vertical-align: middle; }
.mini tr:last-child td { border-bottom: 0; }
.mini .r { text-align: right; }
.mini .prog { min-width: 110px; }
.mini .prog small { color: var(--muted); font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px; }
.filters .field { flex: 0 1 170px; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ---------- team ---------- */
.team-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--hair); flex-wrap: wrap; }
.user-row:last-child { border-bottom: 0; }
.user-row .grow { flex: 1; min-width: 140px; }
.role { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 7px; }

/* ---------- gate, boot, toasts, footer ---------- */
.gate { max-width: 440px; margin: 8vh auto 0; padding: 30px; display: flex; flex-direction: column; gap: 16px; }
.gate .lock { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.boot { display: flex; align-items: center; gap: 12px; padding: 22px; justify-content: center; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--edge); border-top-color: var(--accent-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px; background: var(--glass-strong); font-weight: 500; animation: pop-up .25s ease; max-width: 520px; }
.toast.ok .ic { color: var(--ok); }
.toast.bad .ic { color: var(--bad); }
@keyframes pop-up { from { transform: translateY(10px); opacity: 0; } }
.foot { max-width: 1240px; margin: 0 auto; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 30px max(16px, env(safe-area-inset-left, 0px)); display: flex; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; align-items: baseline; font-size: 12.5px; color: var(--muted); }
/* A thin dividing line across the top of the footer, in line with the page content. */
.foot::before { content: ""; flex: 0 0 100%; height: 1px; margin-bottom: 4px; background: var(--edge); }
/* On the same line as the portal name, at the right (wraps under it on a narrow screen). */
.credit { margin-left: auto; text-align: right; letter-spacing: .02em; }
.credit b { color: var(--ink-2); font-weight: 600; }
/* attention / staff notes */
.attention { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--warn) 45%, var(--rim)); }
.attention .grow { flex: 1; min-width: 200px; }
.att-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--warn); background: var(--warn-soft); flex: none; }
.att-parts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.flag.warn { color: var(--warn); }
.flag.neu { color: var(--neu); }
.docs-ind { display: inline-flex !important; align-items: center; gap: 4px; }
.staff-warn { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--ink); font-size: 14px; }
.staff-warn > .ic { color: var(--warn); margin-top: 2px; }
.staff-warn > div { display: flex; flex-direction: column; gap: 3px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; padding: 10px 12px; border-radius: 11px; border: 1px dashed var(--edge); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent-2); flex: none; }
.file-in { height: auto; padding: 6px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
/* The browser's own "Choose file" button, drawn like the portal's small buttons. */
.file-in::file-selector-button {
  height: 32px; padding: 0 14px; margin-right: 12px; border-radius: 9px; border: 1px solid var(--edge);
  background: var(--glass-strong); color: var(--ink); font: 600 13px var(--f-body); cursor: pointer;
  box-shadow: 0 2px 6px -3px rgba(0,0,0,.2); transition: background .15s, border-color .15s, box-shadow .15s;
}
.file-in:hover::file-selector-button { border-color: var(--accent-2); box-shadow: 0 6px 16px -8px rgba(0,0,0,.3); }
.file-in:focus-visible::file-selector-button { border-color: var(--accent-2); }
.doc-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.doc-row:last-of-type { border-bottom: 0; }
.doc-kind { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.doc-files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.doc-file { display: inline-flex; align-items: center; gap: 7px; padding: 5px 6px 5px 10px; border-radius: 10px; background: var(--hair); font-size: 13.5px; max-width: 100%; min-width: 0; }
.doc-file a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.doc-file small { white-space: nowrap; }
.upl { cursor: pointer; }
.upl.busy { opacity: .6; pointer-events: none; }
.upl.busy::after { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--edge); border-top-color: var(--accent-2); animation: spin .8s linear infinite; }
.cmp { display: flex; flex-direction: column; gap: 12px; }
.cmp-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) 48px minmax(0, .9fr); gap: 12px; align-items: center; font-size: 14px; }
.cmp-row .meter { margin: 0; height: 8px; }
/* Reports drill-down: figures that list their consignments when clicked. */
button.cmp-row, button.bar-row { background: none; border: 0; font: inherit; color: inherit; text-align: left; padding: 4px 6px; margin: -4px -6px; width: calc(100% + 12px); border-radius: 8px; cursor: pointer; }
button.cmp-row { font-size: 14px; }
button.bar-row { font-size: 13.5px; }
button.cmp-row:hover, button.bar-row:hover, tr.drill-row:hover td { background: var(--hair); }
button.cmp-row:focus-visible, button.bar-row:focus-visible, tr.drill-row:focus-visible, .drill-n:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.drill-hint { color: var(--accent-2); font-weight: 600; }
tr.drill-row { cursor: pointer; }
.drill-n { font: inherit; font-variant-numeric: tabular-nums; border: 0; cursor: pointer; }
.drill-n:not(.pill) { color: var(--accent-2); font-weight: 700; background: none; padding: 2px 4px; border-radius: 6px; text-decoration: underline; text-underline-offset: 3px; }
.drill-n:not(.pill):hover { background: var(--hair); }
.drill-n.pill { font-size: 12.5px; font-weight: 600; }
.drill-n.pill:hover { filter: brightness(.95); text-decoration: underline; }
/* District-wise progress takes the full width under Status breakdown, so all its columns fit without scrolling. */
.report-grid.stack { grid-template-columns: minmax(0, 1fr); }
.report-grid.stack .bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(3, auto); gap: 11px 40px; }
@media (max-width: 760px) { .report-grid.stack .bars { grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; grid-template-rows: none; } }
#dist-report .mini th { white-space: normal; vertical-align: bottom; }
/* Figures centred under their headings in the district and transporter tables; the name column stays left. */
:is(#dist-report, #trans-report) .mini :is(th, td):not(:first-child) { text-align: center; }
#dist-report .mini td.prog .meter { margin-left: auto; margin-right: auto; }
.drill-n.plain { padding: 0; color: inherit; font-weight: inherit; text-decoration: none; }
.drill-n.plain:hover small { color: var(--accent-2); text-decoration: underline; }
.drill-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.cmp-row b { text-align: right; }
.form-ok { padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 500; font-size: 14px; }
.form-info { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-weight: 500; font-size: 14px; }
.digest-preview { margin: 0; padding: 12px; border-radius: 10px; background: var(--hair); font: 12px/1.5 var(--f-mono); white-space: pre-wrap; max-height: 320px; overflow: auto; }
@media (max-width: 760px) { .cmp-row { grid-template-columns: 1fr 48px; } .cmp-row .meter { grid-column: 1 / -1; grid-row: 2; } .cmp-row small { grid-column: 1 / -1; } }
.scope { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--accent-2) 40%, var(--rim)); }
.scope .grow { flex: 1; min-width: 200px; }
.scope-ic { color: var(--accent-2); background: var(--vio-soft); }
.scope-name { font: 600 20px/1.2 var(--f-display); display: block; margin: 2px 0; }
.step-n { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 12px var(--f-display); color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.bulk-t td { vertical-align: top; }
.bulk-t tr.bad-row td { background: var(--bad-soft); }
.errs { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--bad); }
.errs b { color: var(--ink-2); font-weight: 600; }
/* receipt page */
.rc-wrap { max-width: 640px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.rc-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.rc-title { font-size: clamp(22px, 5vw, 28px); font-weight: 600; }
.rc-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin: 4px 0 0; }
.rc-facts dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rc-facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.rc-big { font: 600 22px/1.1 var(--f-display); }
.rc-done { flex-direction: row; align-items: flex-start; gap: 14px; border-color: color-mix(in srgb, var(--ok) 45%, var(--rim)); }
.rc-done h2 { font-size: 19px; margin-bottom: 4px; }
.rc-done p { margin: 4px 0; }
.rc-tick { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ok); flex: none; }
.rc-card h2 { font-size: 19px; font-weight: 600; }
.rc-num { font: 600 20px var(--f-display); height: 48px; }
.rc-submit { height: 48px; font-size: 16px; }
.rc-foot { text-align: center; font-size: 12.5px; }
.rc-staff.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--hair)); }
.rc-staff.mismatch { border-color: color-mix(in srgb, var(--warn) 55%, var(--hair)); }
.rc-staff h3 { flex-wrap: wrap; }
.rc-hist summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.rc-list { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.flag.ok { color: var(--ok); }
.sub-h { font-size: 14px; font-weight: 600; margin: 6px 0 2px; }
.act-wrap { max-height: 460px; overflow: auto; }
.mini tr.bad-row td { background: var(--bad-soft); }
@media (max-width: 560px) { .rc-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rc-card { padding: 16px; } }
.copybox { width: 100%; min-height: 160px; font-family: var(--f-mono); font-size: 12.5px; }
.noscript { padding: 20px; text-align: center; }

/* ---------- documents page ---------- */
.card h3 .h3-actions { margin-left: auto; display: flex; gap: 6px; }
.check.slim { padding: 7px 12px; font-size: 13.5px; align-items: center; background: var(--glass); }
.check.slim input { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.doc-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.doc-dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.bar-btn { width: 100%; border: 0; background: none; padding: 3px 6px; margin: -3px -6px; width: calc(100% + 12px); border-radius: 8px; cursor: pointer; color: inherit; font: inherit; font-size: 13.5px; text-align: left; }
.bar-btn:hover { background: var(--hair); }
.bar-btn > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.recent-item:hover { background: var(--hair); }
.recent-item .grow, .doc-name .grow { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.recent-item b, .doc-name b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item small, .doc-name small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.doc-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.doc-ic.pdf { color: var(--bad); background: var(--bad-soft); }
.doc-ic.img { color: var(--info); background: var(--info-soft); }

.doc-filters { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.df-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.df-head h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.df-head .muted { font-size: 12.5px; color: var(--warn); font-weight: 600; }
.df-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.df-dates { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.df-dates > .field:not(.quick-f):not(.mode-f) { flex: 0 1 170px; }
.df-dates .mode-f { flex: none; }
.df-dates .quick-f { flex: 1 1 100%; }
.df-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--hair); padding-top: 12px; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--hair); width: max-content; max-width: 100%; }
.seg button { border: 0; background: none; padding: 0 12px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 6px -2px rgba(0,0,0,.2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--edge); background: var(--glass); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent-2); color: var(--ink); }
.chip[aria-pressed="true"], .chip.on { background: var(--vio-soft); border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); color: var(--ink); }
.chip.on .ic { color: var(--muted); }

.doc-toolbar { border-bottom: 1px solid var(--hair); }
.doc-applied { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; align-items: center; }
.doc-selbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; font-size: 13.5px; min-height: 52px; }
.doc-selbar.on { position: sticky; top: 74px; z-index: 5; background: var(--glass-strong); border-bottom: 1px solid var(--hair); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
#doc-table { transition: opacity .15s; }
#doc-table.busy { opacity: .55; pointer-events: none; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-table th { padding: 6px 10px; }
.doc-table .ck { width: 40px; text-align: center; }
.doc-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-2); cursor: pointer; vertical-align: middle; }
.doc-table tbody tr:hover { background: var(--hair); }
.doc-table tbody tr.sel { background: var(--vio-soft); }
.doc-table .d-main { max-width: 340px; }
.doc-table .sub { white-space: normal; }
.th-sort { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 4px 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.th-sort .arr { opacity: .4; font-size: 12px; }
.th-sort.on { color: var(--ink); }
.th-sort.on .arr { opacity: 1; color: var(--accent-2); }
.doc-name { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; min-width: 0; }
.doc-name:hover b { color: var(--accent-2); text-decoration: underline; }
.doc-table .acts { white-space: nowrap; }
.doc-table .acts .btn + .btn { margin-left: 4px; }
.doc-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--hair); font-size: 13px; }
.doc-pager:empty { display: none; }
.per-page { display: inline-flex; align-items: center; gap: 4px; }
.per-page .muted { margin-right: 4px; }
.pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pages .btn { min-width: 32px; }

/* ---------- document viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: #0c0d1a; color: #eef0fb; animation: fade .18s ease; }
.vw-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top, 0px)); border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.vw-title { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.vw-title b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-title small { font-size: 12.5px; color: #a3a8c2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vw-btn { height: 36px; min-width: 36px; padding: 0 8px; border-radius: 10px; border: 0; background: rgba(255,255,255,.07); color: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 600; }
.vw-btn:hover { background: rgba(255,255,255,.16); }
.vw-btn[disabled] { opacity: .35; cursor: default; }
.vw-btn:focus-visible { outline: 3px solid #9d86ff; outline-offset: 1px; }
.vw-zoom { min-width: 76px; font-variant-numeric: tabular-nums; }
.vw-pos { font-size: 13px; color: #c6c9dc; padding: 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vw-sep { width: 1px; height: 22px; background: rgba(255,255,255,.14); margin: 0 4px; }
.vw-main { flex: 1; min-height: 0; display: flex; }
.vw-thumbs { width: 196px; flex: none; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; border-right: 1px solid rgba(255,255,255,.08); scrollbar-width: thin; }
.vw-thumb { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.04); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.vw-thumb:hover { background: rgba(255,255,255,.1); }
.vw-thumb[aria-current] { border-color: #9d86ff; background: rgba(157,134,255,.16); }
.vw-pic { height: 104px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: rgba(255,255,255,.06); position: relative; }
.vw-pic img { width: 100%; height: 100%; object-fit: cover; }
.vw-pic.pdf { color: #ff8f88; }
.vw-pic.pdf i { position: absolute; bottom: 8px; font: 700 10.5px var(--f-body); font-style: normal; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px; background: #c62a2a; color: #fff; }
.vw-cap { display: flex; flex-direction: column; min-width: 0; }
.vw-cap b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-cap small { font-size: 11.5px; color: #a3a8c2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-stage { flex: 1; min-width: 0; overflow: auto; display: flex; padding: 16px; outline: none; overscroll-behavior: contain; }
.vw-stage.grabbing { cursor: grabbing; }
.vw-stage:has(#vw-img) { cursor: grab; }
.vw-canvas { position: relative; margin: auto; flex: none; }
.vw-canvas > img, .vw-canvas > iframe { position: absolute; left: 50%; top: 50%; transform-origin: center; display: block; border: 0; user-select: none; -webkit-user-drag: none; }
.vw-canvas > iframe { background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.vw-canvas > img { box-shadow: 0 10px 40px rgba(0,0,0,.5); image-orientation: from-image; }
.vw-card { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 24px; max-width: 360px; }
.vw-card .muted { color: #a3a8c2; }

@media (max-width: 1080px) {
  .doc-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc-dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-dash-grid > :last-child { grid-column: 1 / -1; }
  .df-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .doc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-stats .stat:first-child { grid-column: 1 / -1; }
  .doc-dash-grid, .df-grid { grid-template-columns: minmax(0, 1fr); }
  .df-dates > .field:not(.quick-f):not(.mode-f) { flex: 1 1 140px; }
  .df-dates .mode-f { flex-basis: 100%; }
  .doc-selbar.on { top: 66px; }
  .doc-table thead tr { display: flex; align-items: center; padding: 4px 6px; border-bottom: 1px solid var(--edge); flex-wrap: wrap; }
  .doc-table thead th { border: 0; padding: 4px 6px; }
  .doc-table thead th:not(.ck):not([aria-sort]) { display: none; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table tbody tr { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 12px 10px; border-bottom: 1px solid var(--hair); }
  .doc-table td { padding: 0; border: 0; }
  .doc-table td.ck { grid-row: 1 / span 5; width: auto; text-align: left; }
  .doc-table td.d-main { grid-column: 2 / -1; max-width: none; }
  .doc-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .doc-table td[data-label="Size"] { text-align: left; }
  .doc-table td.acts { grid-column: 2 / -1; text-align: left; }
  .vw-main { flex-direction: column-reverse; }
  .vw-thumbs { width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid rgba(255,255,255,.08); padding: 8px; }
  .vw-thumb { width: 116px; flex: none; }
  .vw-pic { height: 64px; }
  .vw-title { flex-basis: 100%; }
  .vw-tools { width: 100%; justify-content: center; }
  .vw-zoom { min-width: 58px; }
  .vw-sep { display: none; }
  .vw-stage { padding: 8px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis, .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid, .team-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .tabs { display: none; }
  .mobile-tabs { display: flex; position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 5px; gap: 4px; border-radius: 16px; }
  .mobile-tabs .tab { flex-direction: column; gap: 2px; padding: 7px 16px; font-size: 11.5px; }
  .shell { padding-bottom: 100px; }
  .foot { padding-bottom: 96px; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) {
  .brand-logo { padding: 2px 6px; }
  .brand-logo img { height: 42px; }
  .top-actions .btn span { display: none; }
  .top-actions .btn.sm { width: 34px; padding: 0; }
  .theme-switch button { width: 28px; }
}
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .kpis, .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reg thead { display: none; }
  .reg, .reg tbody, .reg tr, .reg td { display: block; width: 100%; }
  .reg tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--hair); }
  .reg td { padding: 0; border: 0; }
  .reg td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
  .reg td.c-main { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; }
  .reg td.c-main::before { display: none; }
  .reg td.c-status-m { display: none; }
  .reg .qty { text-align: left; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .drawer { border-radius: 22px 22px 0 0; top: 6vh; width: 100vw; padding-left: env(safe-area-inset-left, 0px); }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 36px; }
  .toolbar select.input, .toolbar .sel-btn { flex: 1 1 140px; max-width: none; }
  .topbar-in { gap: 8px; }
}
@media (min-width: 761px) {
  .c-status-d { display: none; }
  /* Register on wider screens: a line between columns, every heading and cell centred. */
  .reg thead th, .reg td { text-align: center; }
  .reg td { vertical-align: middle; }
  .reg thead th + th, .reg td + td { border-left: 1px solid var(--edge); }
  /* Compact, so all eleven columns fit in one strip without sliding sideways. */
  table.reg { font-size: 12px; }
  .reg thead th { font-size: 9.5px; letter-spacing: .03em; padding: 8px 5px; white-space: normal; line-height: 1.25; }
  .reg td { padding: 8px 5px; overflow-wrap: anywhere; }
  .reg .c-ref { font-size: 10px; }
  .reg .sub { font-size: 10.5px; }
  .reg .pill { font-size: 10.5px; padding: 3px 7px 3px 6px; gap: 4px; }
  .reg .flag { font-size: 10px; }
  .reg .mono { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print (reports) ---------- */
@media print {
  :root { --glass: #fff; --glass-strong: #fff; --rim: #ddd; --edge: #ccc; --hair: #e5e5e5; --ink: #000; --muted: #555; --shadow: none; }
  body { background: #fff; color: #000; font-size: 12px; }
  .aurora, .topbar, .mobile-tabs, .toasts, .no-print { display: none !important; }
  .foot span:not(.credit) { display: none; }
  .glass { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border-color: #ccc; }
  .shell { padding: 0; max-width: none; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .report-grid { grid-template-columns: 1fr 1.6fr; }
  .section, .stat { break-inside: avoid; }
}
