/* SyncRide admin console. Brand: navy #1B2E6B, green #22C55E (mirrors the app / syncride.in palette).
 * r10 shell (round 10 contract D2 to D5): grouped sidebar with a desktop icon rail and a mobile drawer, fluid
 * full-width content, responsive tables (cards below 640 px), floating jump-to-top and assistant buttons.
 * No inline styles anywhere (the CSP forbids them); no :has(), container queries or nesting (D5 browsers). */
:root {
  --navy: #1b2e6b;
  --navy-900: #0c1638;
  --navy-800: #0f1a45;
  --navy-700: #152458;
  --navy-500: #2841cc;
  --navy-100: #d4d9f5;
  --navy-50: #eef0ff;
  --green: #22c55e;
  --green-400: #4ade80;
  --green-700: #15803d;
  --green-800: #166534;
  --green-soft: #dcfce7;
  --text: #1a1a2e;
  --muted: #535a68;
  --subtle: #6b7280;
  --border: #e3e6ef;
  --border-soft: #edeff5;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --info: #1e40af;
  --info-soft: #dbeafe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 26, 69, 0.04), 0 4px 14px rgba(27, 46, 107, 0.05);
  --shadow-lg: 0 18px 50px rgba(9, 16, 50, 0.18);
  --focus-ring: #2841cc;
  --focus: 0 0 0 3px rgba(40, 65, 204, 0.28);
  /* spacing scale */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  /* shell */
  --sidebar-w: 264px;
  --rail-w: 64px;
  --topbar-h: 60px;
  --gutter: 16px;
  --nav-row: 40px;
  --nav-item: 36px;
  --fab: 48px;
  --fab-gap: 12px;
  --fab-edge: 16px;
  /* bottom padding of <main> so the floating buttons never cover the end of a page (D4) */
  --fab-zone: calc(var(--fab) * 2 + var(--fab-gap) + var(--fab-edge) * 2);
  --assistant-w: 400px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (min-width: 1024px) {
  :root {
    --gutter: 24px;
  }
}
@media (pointer: coarse) {
  :root {
    --nav-row: 44px;
    --nav-item: 44px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
html {
  scroll-padding-top: calc(var(--topbar-h) + 8px);
}
body {
  background: var(--bg);
  font-size: 15px;
  overflow-x: hidden;
}
[hidden] {
  display: none !important;
}
img,
svg {
  max-width: 100%;
}
a {
  color: var(--navy-500);
  text-underline-offset: 2px;
}
a:hover {
  color: var(--navy);
}
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  color: var(--navy);
  margin: 0;
  line-height: 1.25;
}
p {
  margin: 0.25rem 0;
}
.muted {
  color: var(--muted);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  letter-spacing: 0.02em;
}
.big {
  font-size: 1.15rem;
  font-weight: 700;
}
.prewrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 42ch;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 300;
  background: var(--surface);
  color: var(--navy);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus {
  top: 12px;
  box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------------------ buttons */
.btn {
  --btn-bg: var(--navy);
  --btn-fg: #fff;
  --btn-border: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}
.btn:hover {
  filter: brightness(1.08);
  color: var(--btn-fg);
}
.btn:active {
  filter: brightness(0.96);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}
.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
}
.btn-primary {
  --btn-bg: var(--navy);
  --btn-border: var(--navy);
}
.btn-secondary {
  --btn-bg: var(--surface);
  --btn-fg: var(--navy);
  --btn-border: var(--navy-100);
}
.btn-secondary:hover {
  --btn-border: var(--navy);
  filter: none;
  background: var(--navy-50);
}
.btn-danger {
  --btn-bg: var(--danger);
  --btn-border: var(--danger);
}
.btn-warn {
  --btn-bg: #b45309;
  --btn-border: #b45309;
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--navy);
  --btn-border: var(--navy-100);
}
.btn-ghost:hover {
  filter: none;
  background: var(--navy-50);
}
.btn-link {
  --btn-bg: transparent;
  --btn-fg: var(--navy-500);
  --btn-border: transparent;
  padding: 0 8px;
}
.btn-link:hover {
  filter: none;
  text-decoration: underline;
}
.btn-icon {
  --btn-bg: transparent;
  --btn-fg: var(--navy);
  --btn-border: transparent;
  width: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 12px;
}
.btn-icon:hover {
  filter: none;
  background: var(--navy-50);
}
.btn.is-busy {
  position: relative;
  color: transparent;
}
.btn.is-busy::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
.btn-secondary.is-busy::after {
  border-color: var(--navy-100);
  border-top-color: var(--navy);
}

/* ------------------------------------------------------------------ brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: none;
  display: block;
}
.brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.brand-logo {
  font-weight: 800;
  font-style: italic;
  font-size: 21px;
  letter-spacing: -0.03em;
  color: var(--navy);
  white-space: nowrap;
}
.brand-accent {
  color: var(--green-700);
}
.brand-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-800);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.brand--light .brand-logo {
  color: #fff;
}
.brand--light .brand-accent {
  color: var(--green-400);
}
.brand--light .brand-tag {
  color: #dcfce7;
  background: rgba(34, 197, 94, 0.22);
}
.brand--dark .brand-mark {
  width: 36px;
  height: 36px;
}

/* ------------------------------------------------------------------ login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #dfe5ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #d9f7e5 0%, transparent 55%), var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(27, 46, 107, 0.12);
  border: 1px solid var(--border-soft);
  padding: 32px 28px;
}
.login-title {
  margin-top: 24px;
  font-size: 26px;
  font-weight: 800;
}
@media (max-width: 400px) {
  .login-card {
    padding: 24px 18px;
  }
}
.stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.notice {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: 14px;
}

/* ------------------------------------------------------------------ fields */
.field {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  border: 0;
  padding: 0;
  min-width: 0;
}
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.field-help {
  font-size: 12.5px;
  color: var(--muted);
}
.field-error,
.form-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 0;
}
.field-error:empty {
  display: none;
}
.form-error {
  background: var(--danger-soft);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.field-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.field-counter {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
input[type='text'],
input[type='tel'],
input[type='email'],
input[type='url'],
input[type='password'],
input[type='search'],
input[type='date'],
input[type='datetime-local'],
input[type='time'],
textarea,
select {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
input:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface-2);
  color: var(--subtle);
  cursor: not-allowed;
}
textarea {
  resize: vertical;
  min-height: 88px;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--navy);
  outline: none;
  box-shadow: var(--focus);
}
[aria-invalid='true'] {
  border-color: var(--danger) !important;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--navy);
  flex: none;
}
.check-list {
  display: grid;
  gap: 2px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 2px 16px;
}
.fieldset legend {
  padding: 0;
  margin-bottom: 6px;
}
.inline-field {
  display: grid;
  gap: 4px;
  min-width: 140px;
  flex: 1 1 160px;
  max-width: 320px;
}

/* ------------------------------------------------------------------ shell (r10 D2, D3) */
.shell {
  min-height: 100vh;
}
.frame {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* sidebar */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-700) 100%);
  color: #dfe4fb;
}
.sidebar-head {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-head .brand-logo {
  font-size: 20px;
}
.sidebar-close {
  --btn-fg: #fff;
  display: none;
}
.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
}
.sidebar :focus-visible {
  outline-color: var(--green-400);
}
.nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 10px 16px;
}
.nav-group + .nav-group {
  margin-top: 2px;
}
.nav-group-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--nav-row);
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #dfe4fb;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-group-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-group-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-group-btn .chev {
  width: 16px;
  height: 16px;
  opacity: 0.75;
  transition: transform 0.2s ease;
}
.nav-group-btn[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}
.nav-group.has-active > .nav-group-btn {
  color: #fff;
}
.nav-group.has-active > .nav-group-btn .icon:first-child {
  color: var(--green-400);
}
.nav-list {
  list-style: none;
  margin: 2px 0 6px;
  padding: 0 0 0 32px;
  position: relative;
  display: grid;
  gap: 1px;
}
.nav-list::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
}
.nav-flyout-title {
  display: none;
}
.nav-link {
  display: flex;
  align-items: center;
  min-height: var(--nav-item);
  padding: 4px 12px;
  border-radius: 8px;
  color: #c9d0f2;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-link[aria-current='page'] {
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--green);
}
.nav-link[aria-current='page']:focus-visible {
  outline-color: var(--green-400);
}
/* r10 D2: when one open group is still too tall for the viewport (>= 640 px high), rows get denser. */
.nav.is-dense {
  --nav-row: 34px;
  --nav-item: 32px;
}
.nav.is-dense {
  padding-top: 6px;
  padding-bottom: 8px;
}
.nav.is-dense .nav-list {
  margin-bottom: 2px;
}
.nav.is-dense .nav-group + .nav-group {
  margin-top: 0;
}
@media (pointer: coarse) {
  .nav.is-dense {
    --nav-row: 36px;
    --nav-item: 34px;
  }
}

/* top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))) {
  .topbar {
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
  }
}
.nav-toggle {
  margin-left: -6px;
}
.nav-toggle .icon {
  width: 22px;
  height: 22px;
}
.icon-rail {
  display: none;
}
.topbar-brand .brand-logo {
  font-size: 19px;
}
.topbar-spacer {
  flex: 1 1 auto;
}
.crumbs {
  min-width: 0;
  display: none;
}
.crumbs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 14px;
}
.crumb {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  min-width: 0;
}
.crumb + .crumb::before {
  content: '/';
  margin: 0 8px;
  color: var(--subtle);
}
.crumb:last-child {
  color: var(--navy);
  font-weight: 700;
}
.crumb a {
  color: var(--navy);
  text-decoration: none;
}
.crumb a:hover {
  text-decoration: underline;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-user-text {
  display: none;
  min-width: 0;
  line-height: 1.2;
}
.topbar-user-name {
  font-weight: 700;
  color: var(--navy);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.topbar-user-role {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.avatar--sm {
  width: 34px;
  height: 34px;
  font-size: 12.5px;
}
.signout .icon {
  width: 18px;
  height: 18px;
}

/* main content: fluid, full width, no max-width container (D3) */
.main {
  flex: 1 0 auto;
  min-width: 0;
  width: 100%;
  padding: var(--s5) var(--gutter) calc(var(--fab-zone) + env(safe-area-inset-bottom));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  outline: none;
}
@media (min-width: 1024px) {
  .main {
    padding-top: var(--s6);
  }
}

.scrim,
.assistant-scrim {
  position: fixed;
  inset: 0;
  background: rgba(9, 16, 50, 0.48);
}
.scrim {
  z-index: 45;
}
.assistant-scrim {
  z-index: 55;
}

/* phones and tablets: off-canvas drawer */
@media (max-width: 1023.98px) {
  .sidebar {
    width: min(304px, 86vw);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(9, 16, 50, 0.35);
  }
  .sidebar-close {
    display: inline-flex;
  }
  .nav-open {
    overflow: hidden;
  }
}
@media (max-width: 1023.98px) and (max-height: 639.98px) {
  .nav {
    overflow-y: auto;
  }
}

/* desktop: fixed sidebar, collapsible to a 64 px icon rail */
@media (min-width: 1024px) {
  .frame {
    margin-left: var(--sidebar-w);
    transition: margin-left 0.2s ease;
  }
  .topbar-brand {
    display: none;
  }
  .icon-menu {
    display: none;
  }
  .icon-rail {
    display: block;
  }
  .scrim {
    display: none;
  }
  .sidebar {
    transition: width 0.2s ease;
  }
  .nav-rail .sidebar {
    width: var(--rail-w);
  }
  .nav-rail .frame {
    margin-left: var(--rail-w);
  }
  .nav-rail .nav-toggle .icon-rail {
    transform: scaleX(-1);
  }
  .nav-rail .sidebar-head {
    justify-content: center;
    padding: 0;
  }
  .nav-rail .brand-text {
    display: none;
  }
  .nav-rail .nav {
    overflow: visible;
    padding: 10px 8px;
  }
  .nav-rail .nav-group {
    position: relative;
  }
  .nav-rail .nav-group-btn {
    justify-content: center;
    padding: 0;
    min-height: 44px;
  }
  .nav-rail .nav-group-btn .chev {
    display: none;
  }
  .nav-rail .nav-group-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .nav-rail .nav-group.has-active > .nav-group-btn {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 3px 0 0 var(--green);
  }
  .nav-rail .nav-group.is-flyout > .nav-group-btn {
    background: rgba(255, 255, 255, 0.18);
  }
  .nav-rail .nav-list {
    position: absolute;
    left: calc(100% + 12px);
    top: 0;
    z-index: 60;
    width: 240px;
    margin: 0;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
  }
  .nav-rail .nav-group:nth-last-child(-n + 3) > .nav-list {
    top: auto;
    bottom: 0;
  }
  .nav-rail .nav-list::before {
    display: none;
  }
  .nav-rail .nav-flyout-title {
    display: block;
    padding: 6px 10px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .nav-rail .nav-link {
    color: var(--text);
  }
  .nav-rail .nav-link:hover {
    background: var(--navy-50);
    color: var(--navy);
  }
  .nav-rail .nav-link[aria-current='page'] {
    background: var(--navy-50);
  }
  .nav-rail .nav-list :focus-visible {
    outline-color: var(--focus-ring);
  }
}
@media (min-width: 640px) {
  .crumbs {
    display: block;
  }
}
@media (min-width: 768px) {
  .topbar-user-text {
    display: grid;
  }
}
@media (max-width: 479.98px) {
  .signout {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }
  .signout-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .topbar {
    gap: 6px;
  }
}
@media (max-width: 399.98px) {
  .topbar-user {
    display: none;
  }
  .topbar-brand .brand-tag {
    display: none;
  }
}

/* ------------------------------------------------------------------ floating buttons (r10 D4) */
.fab-stack {
  position: fixed;
  right: calc(var(--fab-edge) + env(safe-area-inset-right));
  bottom: calc(var(--fab-edge) + env(safe-area-inset-bottom));
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fab-gap);
}
.fab {
  width: var(--fab);
  height: var(--fab);
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 26, 69, 0.22);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, opacity 0.2s ease, visibility 0s linear 0s, box-shadow 0.15s ease;
}
.fab .icon {
  width: 22px;
  height: 22px;
}
.fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 26, 69, 0.28);
}
.fab--assistant {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-500) 100%);
  color: #fff;
}
.fab--top {
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--navy-100);
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0s linear 0.2s;
}
.fab--top.is-visible {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-open .fab-stack,
.modal-open .fab-stack,
.assistant-open .fab-stack {
  display: none;
}

/* assistant placeholder panel */
.assistant {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: min(var(--assistant-w), 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(9, 16, 50, 0.16);
  padding-bottom: env(safe-area-inset-bottom);
}
.assistant-head {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 18px;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
}
.assistant-title {
  flex: 1 1 auto;
  font-size: 17px;
  font-weight: 800;
}
.assistant-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  gap: 16px;
}
.assistant-intro {
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  gap: 8px;
}
.assistant-badge {
  justify-self: start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--info);
  background: var(--info-soft);
  border-radius: 999px;
  padding: 3px 10px;
}
.assistant-soon {
  font-size: 18px;
  font-weight: 800;
  margin-top: 4px;
}
.assistant-compose {
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
@media (min-width: 1280px) {
  .assistant-open .frame {
    margin-right: var(--assistant-w);
  }
  .assistant {
    box-shadow: none;
  }
}

/* ------------------------------------------------------------------ page */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: var(--s5);
}
.page-head > div {
  min-width: 0;
}
.page-head > div:first-child {
  flex: 1 1 320px;
}
.page-head p.muted {
  max-width: 90ch;
  margin-top: 4px;
}
/* Views that put the subtitle next to the title (not inside a wrapper) still get it on its own line. */
.page-head > .page-title + p,
.page-head > .page-title + .muted {
  flex-basis: 100%;
  max-width: none;
  margin-top: -6px;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  outline: none;
  overflow-wrap: anywhere;
}
@media (min-width: 1024px) {
  .page-title {
    font-size: 26px;
  }
}
/* Headings receive focus programmatically after navigation (screen readers); they are not controls. */
.page-title:focus,
.page-title:focus-visible {
  box-shadow: none;
  outline: none;
}
.page-head--detail {
  margin-top: 6px;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 14px;
}
.back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-weight: 600;
  text-decoration: none;
}
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 10px;
}
.toolbar,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search {
  display: flex;
  gap: 8px;
  flex: 1 1 240px;
  min-width: 0;
  max-width: 480px;
}
.search input {
  flex: 1 1 auto;
}
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.segmented-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--navy-100);
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.segmented-btn:hover {
  background: var(--navy-50);
}
.segmented-btn.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
@media (pointer: coarse) {
  .segmented-btn,
  .btn-sm {
    min-height: 40px;
  }
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 16px;
}
@media (max-width: 639.98px) {
  .toolbar > *,
  .filters > * {
    flex: 1 1 100%;
    max-width: none;
  }
  .filters-actions {
    justify-content: flex-start;
  }
}

/* ------------------------------------------------------------------ panels, cards */
.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  min-width: 0;
}
@media (max-width: 479.98px) {
  .panel,
  .card {
    padding: 14px;
  }
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 16.5px;
  font-weight: 700;
}
.sub-title {
  font-size: 14px;
  font-weight: 700;
  margin: 14px 0 6px;
}
.sub-panel {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 6px;
}
.action-bar {
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.action-bar--compact {
  position: static;
  box-shadow: none;
  border: 0;
  padding: 12px 0 0;
  margin: 0;
  background: none;
}
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid transparent;
}
.alert p {
  flex-basis: 100%;
  margin: 2px 0;
}
.alert--warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #fde68a;
}
.alert--info {
  background: var(--info-soft);
  color: var(--info);
  border-color: #bfdbfe;
}
.alert--bad {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}
.alert--ok {
  background: var(--green-soft);
  color: var(--green-800);
  border-color: #bbf7d0;
}

/* ------------------------------------------------------------------ stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  border-top: 4px solid var(--navy-100);
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
a.stat:hover {
  border-color: var(--navy-100);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(27, 46, 107, 0.1);
  transform: translateY(-1px);
}
.stat--info {
  border-top-color: var(--navy-500);
}
.stat--warn {
  border-top-color: #f59e0b;
}
.stat--bad {
  border-top-color: var(--danger);
}
.stat--zero {
  border-top-color: var(--green);
}
.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--navy);
  min-height: 40px;
  display: flex;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 600;
}
.stat-na {
  color: var(--subtle);
}
.score {
  display: grid;
  justify-items: center;
  background: var(--navy-50);
  border-radius: var(--radius);
  padding: 10px 18px;
}
.score-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
}
.score-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ------------------------------------------------------------------ tables (r10 D3)
 * >= 640 px: horizontal scroll container with a sticky header (the wrapper caps its height at one viewport so the
 * header stays in view while the rows scroll). Below 640 px every row is a labelled card (ui.table / labelTables). */
.table-wrap {
  overflow: auto;
  max-height: max(360px, calc(100vh - var(--topbar-h) - 40px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
.panel .table-wrap {
  box-shadow: none;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f7f8fc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody th {
  font-weight: 500;
}
.table tbody tr:last-child > * {
  border-bottom: 0;
}
.table tbody tr:hover > * {
  background: var(--surface-2);
}
.row--flagged > :first-child {
  box-shadow: inset 4px 0 0 #f59e0b;
}
.row--muted {
  color: var(--muted);
}
.col-wide {
  min-width: 320px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.pager-summary {
  padding: 10px 2px;
  font-size: 13px;
}

@media (max-width: 639.98px) {
  .table-wrap {
    overflow: visible;
    max-height: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .table,
  .table tbody,
  .table tr,
  .table th,
  .table td {
    display: block;
    width: 100%;
  }
  .table caption {
    display: block;
  }
  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 6px 14px;
    margin-bottom: 10px;
  }
  .panel .table tbody tr {
    box-shadow: none;
  }
  .table tbody tr:last-child {
    margin-bottom: 0;
  }
  .table tbody tr:hover > * {
    background: transparent;
  }
  .table tbody tr > * {
    display: grid;
    grid-template-columns: minmax(88px, 36%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    justify-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .table tbody tr > *:last-child {
    border-bottom: 0;
  }
  .table tbody tr > *::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 2px;
  }
  .table tbody tr > [data-label='']::before,
  .table tbody tr > :not([data-label])::before {
    content: none;
  }
  .table tbody tr > [data-label=''],
  .table tbody tr > :not([data-label]) {
    display: block;
  }
  /* The first cell (the row header) is the card title. */
  .table tbody tr > th:first-child {
    display: block;
    font-weight: 700;
    font-size: 15px;
    padding-top: 10px;
  }
  .table tbody tr > th:first-child::before {
    content: none;
  }
  .table tbody tr > * > * {
    min-width: 0;
  }
  .row--flagged {
    border-left: 4px solid #f59e0b;
  }
  .row--flagged > :first-child {
    box-shadow: none;
  }
  .col-wide,
  .table .person,
  .bar-cell,
  .cor-flags {
    min-width: 0;
  }
  .table .mono {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table .clamp {
    max-width: none;
  }
  .table td .inline-actions,
  .table td .btn {
    max-width: 100%;
  }
  .table td .btn {
    white-space: normal;
  }
  .pager {
    justify-content: space-between;
  }
  .pager > .muted {
    flex-basis: 100%;
  }
}

/* ------------------------------------------------------------------ pills, tags, people */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.pill--good {
  background: var(--green-soft);
  color: var(--green-800);
}
.pill--info {
  background: var(--info-soft);
  color: var(--info);
}
.pill--warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill--bad {
  background: var(--danger-soft);
  color: var(--danger);
}
.pill--neutral {
  background: #eef0f4;
  color: #4b5563;
}
.pill--flag {
  background: #fff1e6;
  color: #9a3412;
  border: 1px solid #fed7aa;
  margin: 1px 4px 1px 0;
}
.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--navy-50);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
}
.tag--admin {
  background: var(--navy);
  color: #fff;
}
.person {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-50);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}
.person-text {
  display: grid;
  min-width: 0;
}
.person-name {
  font-weight: 600;
  overflow-wrap: break-word;
}
.table .person {
  min-width: 190px;
}
.table .mono {
  white-space: nowrap;
}
.person-meta {
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ definition lists */
.kv {
  display: grid;
  grid-template-columns: minmax(120px, min(34%, 280px)) minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}
.kv dt {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}
@media (max-width: 479.98px) {
  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .kv dd {
    margin-bottom: 10px;
  }
}

/* ------------------------------------------------------------------ compare + documents */
.compare-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 760px) {
  .compare-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.compare-values {
  background: var(--navy-50);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-width: 0;
}
.compare-docs,
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 12px;
}
.doc {
  margin: 0;
  display: grid;
  gap: 6px;
}
.doc-frame,
.doc-missing {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f3f4f8;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.doc-missing {
  color: var(--subtle);
  font-size: 13px;
  border-style: dashed;
}
.doc-open {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background: none;
  cursor: zoom-in;
}
.doc-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #111827;
}
.doc-file,
.doc-error {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 8px;
  font-size: 13px;
}
.doc-error {
  color: var(--danger);
}
.doc-file-kind {
  font-weight: 700;
  color: var(--navy);
}
.doc-caption {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

/* ------------------------------------------------------------------ timeline, ratings, misc */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.timeline-item {
  border-left: 3px solid var(--navy-100);
  padding: 2px 0 2px 12px;
  min-width: 0;
}
.timeline-head {
  font-size: 14px;
}
.timeline-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
details.json summary {
  cursor: pointer;
  color: var(--navy-500);
  font-size: 13px;
  min-height: 28px;
}
details.json pre {
  margin: 6px 0 0;
  padding: 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  overflow: auto;
  max-width: min(60ch, 100%);
}
.card-list {
  display: grid;
  gap: 12px;
}
.rating-card.is-hidden {
  opacity: 0.85;
  border-style: dashed;
}
.rating-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.rating-people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.stars {
  color: #b45309;
  font-size: 18px;
  letter-spacing: 1px;
}
.stars-off {
  color: #d1d5db;
}
.quote {
  margin: 8px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--navy-100);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.criteria {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 0;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.report-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.report-item {
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}
.levels {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.level-head {
  font-size: 14px;
}

/* ------------------------------------------------------------------ states: loading, empty, error */
.state {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  border-radius: var(--radius);
}
.state p {
  max-width: 60ch;
}
.state--loading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.state--empty {
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
}
.panel .state--empty,
.card .state--empty {
  padding: 28px 12px;
}
.state--error {
  background: #fff8f8;
  border: 1px solid #fecaca;
}
.state--soon {
  background: var(--surface);
  border-color: var(--navy-100);
  padding: 56px 16px;
}
.state-title {
  font-weight: 700;
  color: var(--text);
  font-size: 16px;
}
.state--error .state-title {
  color: var(--danger);
}
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--navy-100);
  border-top-color: var(--navy);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner--sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ dialogs + toasts */
.dialog {
  border: 0;
  border-radius: 18px;
  padding: 24px;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: 0 24px 60px rgba(9, 16, 50, 0.3);
  color: var(--text);
}
.dialog::backdrop {
  background: rgba(9, 16, 50, 0.5);
}
@media (max-width: 479.98px) {
  .dialog {
    padding: 18px 16px;
    border-radius: 16px;
  }
  .dialog-actions .btn {
    flex: 1 1 auto;
  }
}
.dialog-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}
.dialog-text {
  color: var(--muted);
  margin-bottom: 14px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.lightbox {
  width: min(1100px, calc(100vw - 24px));
  padding: 12px;
  background: #0b1020;
  color: #fff;
}
.lightbox-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
}
.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  margin: 0 auto;
  object-fit: contain;
}
/* Toasts sit top right under the bar, clear of the floating buttons (D4). */
.toasts {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: calc(16px + env(safe-area-inset-right));
  z-index: 200;
  display: grid;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}
@media (max-width: 479.98px) {
  .toasts {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--navy-800);
  color: #fff;
  box-shadow: 0 10px 30px rgba(9, 16, 50, 0.25);
  font-size: 14px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast--success {
  background: var(--green-800);
}
.toast--error {
  background: var(--danger);
}
.toast--out {
  opacity: 0;
  transform: translateY(-8px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* ------------------------------------------------------------------ round 5: admin operations (OPS-ADMIN) */
.stat--static:hover {
  border-color: var(--border-soft);
}
.stat-hint {
  font-size: 12px;
  color: var(--muted);
}
.stat-hint--na {
  color: var(--warn);
}
.state--unavailable .state-title {
  color: var(--navy);
}
.text-bad {
  color: var(--danger);
}
.tag--pending {
  background: var(--info-soft);
  color: var(--info);
}
.tag--verified {
  background: var(--green-soft);
  color: var(--green-700);
}
.tag--rejected,
.tag--bad {
  background: var(--danger-soft);
  color: var(--danger);
}
.tag--not_started {
  background: var(--border-soft);
  color: var(--muted);
}
.thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.thread-msg {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--navy-50);
  max-width: 80ch;
}
.thread-msg--agent {
  background: var(--green-soft);
  justify-self: end;
}
.thread-msg--system {
  background: var(--border-soft);
  color: var(--muted);
}
.dialog--wide {
  width: min(960px, calc(100vw - 24px));
}
textarea.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.4;
  width: 100%;
  min-height: 360px;
  white-space: pre;
  tab-size: 2;
}
.compare-values .mono.big {
  white-space: nowrap;
}

/* ---------------------------------------------------------------- r9 admin: KPIs, corridors, pricing, SmartMatch, plans */
input[type='number'] {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
input[type='number']:focus {
  outline: none;
  box-shadow: var(--focus);
  border-color: var(--green);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 12px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-top: 4px solid var(--navy-100);
  box-shadow: var(--shadow);
}
.kpi--strong {
  border-top-color: var(--green);
}
.kpi--on_target {
  border-top-color: var(--navy-500);
}
.kpi--below_target {
  border-top-color: #f59e0b;
}
.kpi--na {
  border-top-color: var(--border);
}
.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
}
.kpi-value--na {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}
.kpi-label {
  font-weight: 600;
}
.kpi-ratio,
.kpi-reason {
  font-size: 13px;
  color: var(--muted);
}
.kpi details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--navy-500);
}
.kpi details p {
  font-size: 13px;
  margin: 6px 0;
}
.bar-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}
.bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 40px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
progress.bar {
  width: 100%;
  height: 10px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 6px;
  background: var(--border-soft);
  overflow: hidden;
}
progress.bar::-webkit-progress-bar {
  background: var(--border-soft);
  border-radius: 6px;
}
progress.bar::-webkit-progress-value {
  background: var(--navy-500);
  border-radius: 6px;
}
progress.bar::-moz-progress-bar {
  background: var(--navy-500);
  border-radius: 6px;
}
progress.bar--demand::-webkit-progress-value {
  background: #f59e0b;
}
progress.bar--demand::-moz-progress-bar {
  background: #f59e0b;
}
.cfg-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cfg-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.cfg-group {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.cfg-group > legend {
  font-weight: 600;
  padding: 0 4px;
}
.cfg-table input {
  min-width: 70px;
}
.weight-total {
  font-weight: 700;
}
.weight-total--bad {
  color: var(--danger);
}
.weight-total--ok {
  color: var(--green-700);
}
.delta--up {
  color: var(--green-700);
  font-weight: 600;
}
.delta--down {
  color: var(--danger);
  font-weight: 600;
}
@media (max-width: 640px) {
  .cfg-row {
    grid-template-columns: 1fr;
  }
}
.cor-flags {
  min-width: 140px;
}
.cor-flags .pill {
  white-space: normal;
}

/* ------------------------------------------------------------------ r16 Email section (js/views/email.js, email_ops.js) */
.em-tabs {
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.em-tabs .segmented-btn {
  text-decoration: none;
}
.em-stats {
  margin: 12px 0 16px;
}
.em-bars {
  display: grid;
  gap: 8px;
}
.em-bar {
  display: grid;
  grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) minmax(70px, auto);
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.em-bar-label {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.em-bar-value {
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.em-bar-failed {
  color: var(--danger);
  font-weight: 500;
}
.em-bar-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.em-bar-link:hover .em-bar-label {
  color: var(--navy-500);
  text-decoration: underline;
}
.em-bar-link:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.em-lane-p0 > :first-child {
  color: var(--danger);
}
.em-queue-meta {
  margin-top: 12px;
}
.em-inline-link {
  margin-left: 8px;
}
.em-meta {
  margin-bottom: 12px;
}
.em-vars {
  display: flex;
}
button.em-var {
  border: 1px solid var(--navy-100);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
button.em-var:disabled {
  cursor: default;
}
button.em-var:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.em-editor {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.em-preview {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f3f4f8;
  overflow: hidden;
}
.em-preview-frame {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
  background: #fff;
}
.em-preview-text {
  margin: 0;
  padding: 14px;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  background: #fff;
}
.em-preview-subject {
  margin: 10px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.em-sample {
  margin-top: 12px;
}
.em-sample summary {
  cursor: pointer;
  color: var(--navy-500);
  font-size: 14px;
}
.em-sample textarea {
  width: 100%;
}
.em-current {
  margin-left: 6px;
}
.em-full {
  flex-basis: 100%;
  margin: 0;
}
.em-num {
  width: 72px;
}
.em-addr-list {
  margin: 8px 0;
  padding-left: 18px;
  display: grid;
  gap: 2px;
  overflow-wrap: anywhere;
}
.dialog.em-drawer {
  margin: 0 0 0 auto;
  width: min(560px, 100vw);
  height: 100vh;
  max-height: 100vh;
  border-radius: 18px 0 0 18px;
}
.em-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.em-drawer-head .dialog-title {
  overflow-wrap: anywhere;
}
.em-drawer-body .kv {
  margin-top: 12px;
}
@media (max-width: 639.98px) {
  .em-bar {
    grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) auto;
  }
  .em-preview-frame {
    height: 440px;
  }
  .dialog.em-drawer {
    border-radius: 0;
  }
}

/* ------------------------------------------------------------------ r19 meetup form: when + venue pickers */
.dialog.dialog--meetup {
  width: min(720px, calc(100vw - 24px));
}
.mw {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.mw-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
}
.mw-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.mw-slots {
  flex-wrap: wrap;
  overflow: visible;
}
.mw-chip {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 1px;
  min-height: 40px;
  min-width: 64px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--navy-100);
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mw-chip:not(.is-active):not([disabled]):hover {
  background: var(--navy-50);
}
.mw-chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.mw-chip[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}
.mw-chip-sub {
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.8;
}
.mw-summary {
  margin: 4px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--navy-50);
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
}
.mw-month {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  max-width: 360px;
}
.mw-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.mw-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.mw-dow {
  font-size: 11.5px;
  color: var(--subtle);
  text-align: center;
}
.mw-day {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.mw-day:not(.is-active):not([disabled]):hover {
  background: var(--navy-50);
}
.mw-day.is-today {
  border-color: var(--navy-100);
}
.mw-day.is-active {
  background: var(--navy);
  color: #fff;
}
.mw-day[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.pp {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.pp-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  max-height: 260px;
  overflow: auto;
}
.pp-result {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.pp-result:hover,
.pp-result:focus-visible {
  background: var(--navy-50);
}
.pp-result .muted {
  font-size: 12.5px;
}
.pp-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13.5px;
}
.pp-map {
  height: 300px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}
.pp-map-note {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 13.5px;
}
.pp-status {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
/* Leaflet moves the pin with `transform`; the teardrop turns with `rotate`, which composes with it. */
.pp-pin {
  background: var(--danger);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 2px 6px rgba(9, 16, 50, 0.35);
  rotate: -45deg;
}
.pp-field {
  display: grid;
  gap: 4px;
}
.pp-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.pp-advanced summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}
.pp-coords {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 4px;
}
@media (max-width: 479.98px) {
  .pp-map {
    height: 240px;
  }
  .pp-coords {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ r22 live trips (js/views/live.js) */
.lv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.lv-layout--trip {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
}
.lv-map {
  height: 620px;
  min-height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.lv-map-note {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 13.5px;
}
.lv-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  max-height: 620px;
  overflow-y: auto;
  min-width: 0;
}
.lv-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.lv-status {
  margin: 4px 0 10px;
  font-size: 12.5px;
}
.lv-status--bad {
  color: var(--danger);
}
.lv-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.lv-trip {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-500);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
}
.lv-trip:hover,
.lv-trip:focus-visible {
  background: var(--navy-50);
}
.lv-trip--stale {
  border-left-color: var(--subtle);
}
.lv-trip--alert {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}
.lv-trip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lv-trip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lv-trip-line {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.lv-plate {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}
.lv-age--stale {
  color: var(--warn);
  font-weight: 600;
}
/* Vehicle marker: an SVG disc with an arrow the script turns by heading (SVG transform attribute, no inline style). */
.lv-car {
  background: transparent;
  border: 0;
}
.lv-car svg {
  display: block;
  filter: drop-shadow(0 2px 3px rgba(9, 16, 50, 0.35));
}
.lv-car-disc {
  fill: var(--navy-500);
  stroke: #fff;
  stroke-width: 3;
}
.lv-car-arrow,
.lv-car-dot {
  fill: #fff;
}
.lv-car--stale .lv-car-disc {
  fill: var(--subtle);
}
.lv-car--alert .lv-car-disc {
  fill: var(--danger);
}
.lv-end {
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(9, 16, 50, 0.35);
}
.lv-end--pickup {
  background: var(--green-700);
}
.lv-end--drop {
  background: var(--navy-900);
}
.lv-trail {
  stroke: var(--navy-500);
}
@media (max-width: 1023.98px) {
  .lv-layout,
  .lv-layout--trip {
    grid-template-columns: minmax(0, 1fr);
  }
  .lv-map {
    height: 420px;
  }
  .lv-side {
    max-height: none;
  }
}
@media (max-width: 479.98px) {
  .lv-map {
    height: 320px;
  }
}
