/* ===========================================================================
   Zeitnachweis employer — v3 (design rounds 1+2, 2026-10-14)

   One stylesheet for the signed-in app and the sign-in pages. Paper
   background, ink-navy sidebar, white cards with a 1px navy hairline and
   18px radius, no shadows, amber only for running states, active markers,
   warning chips and the auth primary button outline. System fonts only.

   Layout by width:
     > 1024px   navy sidebar + content
     <= 1024px  top bar + bottom tab bar + "More" sheet; tables become cards
                and filter forms fold behind a "Filters" button (employer.js)
   =========================================================================== */

:root {
  /* Design tokens */
  --paper: #F7F5F0;
  --ink: #1F3A5F;
  --ink-dark: #152A45;
  --amber: #F2A516;
  --hairline: rgba(31, 58, 95, 0.9);
  --hairline-soft: rgba(31, 58, 95, 0.18);
  --radius: 18px;
  --radius-s: 12px;

  /* Component aliases (the class names below predate the tokens) */
  --ui-bg: var(--paper);
  --ui-surface: #ffffff;
  --ui-surface-strong: #ffffff;
  --ui-surface-muted: #f3f1ec;
  --ui-surface-sunken: #ece9e2;
  --ui-border: var(--hairline-soft);
  --ui-border-strong: var(--hairline);
  --ui-text: #1b2a3a;
  --ui-text-strong: var(--ink-dark);
  --ui-text-muted: #5b6b7d;
  --ui-text-soft: #7f8c9a;
  --ui-brand: var(--ink);
  --ui-brand-strong: var(--ink-dark);
  --ui-brand-soft: #e9edf3;
  --ui-brand-ring: rgba(31, 58, 95, 0.22);
  --ui-success: #0a6b41;
  --ui-success-soft: #e3f3ea;
  --ui-warning: var(--ink-dark);
  --ui-warning-soft: #fde7bf;
  --ui-danger: #b42318;
  --ui-danger-soft: #fdeceb;
  --ui-info: var(--ink);
  --ui-info-soft: #e9edf3;
  --ui-plan: var(--amber);
  --ui-plan-strong: #c47f05;
  --ui-shadow-sm: none;
  --ui-shadow-card: none;
  --ui-shadow-md: none;
  --ui-shadow-lg: 0 18px 48px rgba(21, 42, 69, 0.16);
  --ui-radius-sm: 8px;
  --ui-radius-md: var(--radius-s);
  --ui-radius-lg: var(--radius);
  --ui-radius-xl: var(--radius);
  --ui-control-h: 42px;
  --sidebar-w: 256px;
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Base ---------------------------------------------------------------- */

.dispatcher-body {
  min-height: 100vh;
  margin: 0;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

.dispatcher-body :focus-visible {
  outline: 2px solid var(--ui-brand);
  outline-offset: 2px;
}

.dispatcher-body a {
  color: var(--ui-brand-strong);
}

.dispatcher-body h1,
.dispatcher-body h2,
.dispatcher-body h3 {
  color: var(--ui-text-strong);
  letter-spacing: -0.015em;
}

/* marketing.css (loaded first, for shared tokens and the language picker)
   styles bare elements for the landing page: 80px of padding on every
   <section>, 52px h1, 36px section h2, 40px under section .lead. Undo that
   here at the lowest specificity that still beats it, so every component
   class below sets its own spacing. */
.dispatcher-body :where(section) {
  padding: 0;
}

.dispatcher-body h1 {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 750;
  line-height: 1.2;
}

.dispatcher-body h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.dispatcher-body h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.dispatcher-body .lead {
  max-width: 680px;
  margin: 0 0 12px;
  font-size: 15px;
}

/* Leaflet stacks its panes and controls at z-index 400–1000. Without a
   stacking context of its own a map draws over the sticky top bar and the
   tab bar when scrolled underneath them. */
.dispatcher-body .leaflet-container {
  isolation: isolate;
  z-index: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 500;
  padding: 10px 14px;
  border-radius: var(--ui-radius-md);
  background: var(--ui-text-strong);
  color: #fff !important;
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

#main:focus {
  outline: none;
}

.muted { color: var(--ui-text-muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---- App shell: desktop -------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  grid-row: 1 / span 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 0 18px;
  background: var(--ink);
  color: #fff;
  overflow-y: auto;
  z-index: 30;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px 26px;
  color: #fff !important;
  text-decoration: none !important;
}

.app-brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex: none;
}

.app-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.app-brand-text strong {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.app-brand-text em {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #fff !important;
  font: inherit;
  font-size: 15.5px;
  font-weight: 500;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.side-nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.side-nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--amber) !important;
  font-weight: 650;
}

.side-nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--amber);
}

.nav-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: none;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink-dark);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Sidebar foot: language, account name · Konto, Abmelden. */
.side-foot {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.side-foot .lang-menu {
  display: block;
  margin: 0 14px 8px;
}

.side-foot .lang-menu > summary {
  width: 100%;
  justify-content: flex-start;
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-s);
  background: transparent;
  color: #fff;
}

.side-foot .lang-menu > summary:hover,
.side-foot .lang-menu[open] > summary {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.side-foot .lang-menu-globe { color: var(--amber); }

.side-foot .lang-menu-caret {
  margin-left: auto;
}

/* At the foot of the sidebar the popover opens upwards and takes the
   sidebar's width: the sidebar scrolls, so anything wider is clipped. */
.side-foot .lang-menu-panel {
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  width: auto;
}

.side-account {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  min-height: 40px;
  padding: 8px 22px;
  color: #fff !important;
  font-size: 14.5px;
  text-decoration: none !important;
}

.side-account:hover .side-account-link,
.side-account.is-active .side-account-link {
  color: var(--amber);
}

.side-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-weight: 650;
}

.side-account-sep,
.side-account-link {
  color: rgba(255, 255, 255, 0.75);
}

.side-nav-item--foot {
  min-height: 42px;
  font-size: 15px;
}

.side-logout {
  width: 100%;
  text-align: left;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none !important;
}

.logout-form {
  margin: 0;
}

/* Main column */

.app-main {
  position: relative;
  min-width: 0;
  padding: 36px clamp(20px, 3vw, 44px) 40px;
}

.app-main > * {
  max-width: 1320px;
}

/* GEPRÜFT watermark (dashboard only): decorative, behind the content. */
.stamp-watermark {
  position: absolute;
  top: -20px;
  right: -10px;
  z-index: 0;
  color: var(--ink);
  opacity: 0.08;
  pointer-events: none;
  max-width: none;
}

.app-main > :not(.stamp-watermark) {
  position: relative;
  z-index: 1;
}

.app-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-border);
  color: var(--ui-text-soft);
  font-size: 12.5px;
}

.dispatcher-footer-link {
  color: inherit !important;
  font-weight: 600;
}

.dispatcher-footer-link:hover {
  color: var(--ui-brand) !important;
}

.app-topbar,
.tab-bar {
  display: none;
}

/* ---- App shell: phones and tablets -------------------------------------- */

@media (max-width: 1024px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    display: none;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    /* Solid for the same reason as the tab bar: a backdrop-filter would
       become the containing block of the language sheet inside it. */
    background: #fff;
    border-bottom: 1px solid var(--ui-border);
  }

  /* The top bar is a stacking context (sticky + z-index); while its language
     sheet is open it has to sit above the tab bar, or the bar covers the
     sheet's last rows and its backdrop. */
  .app-topbar:has(.lang-menu[open]),
  .app-topbar.has-open-menu {
    z-index: 70;
  }

  .app-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: none;
    color: var(--ink-dark) !important;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none !important;
  }

  .app-topbar-wordmark {
    white-space: nowrap;
  }

  .app-topbar-brand img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .app-topbar-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    padding-left: 10px;
    border-left: 1px solid var(--ui-border);
    color: var(--ui-text-muted);
    font-size: 14.5px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
  }

  .app-topbar .lang-menu > summary {
    min-height: 36px;
    padding: 0 9px;
    gap: 5px;
  }

  .app-topbar .lang-menu-caret {
    display: none;
  }

  .avatar-link {
    width: 36px;
    height: 36px;
  }

  .avatar-link.is-active {
    box-shadow: 0 0 0 3px var(--ui-brand-ring);
  }

  .app-main {
    padding: 20px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  }

  .app-footer {
    margin-top: 28px;
    text-align: center;
  }

  .tab-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding: 0 4px var(--safe-bottom);
    /* Solid, not backdrop-filter: a filter makes the bar the containing
       block for position:fixed children, and the "More" sheet and its
       backdrop would then be sized to the bar instead of the screen. */
    background: #fff;
    border-top: 1px solid var(--ui-border);
  }

  .tab-bar-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    height: var(--tabbar-h);
    padding: 0 2px;
    color: var(--ui-text-muted) !important;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none !important;
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
  }

  .tab-bar-item::-webkit-details-marker {
    display: none;
  }

  .tab-bar-item .nav-label {
    max-width: 100%;
  }

  .tab-bar-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 30px;
    border-radius: 999px;
    transition: background 140ms ease;
  }

  .tab-bar-item .nav-icon svg {
    width: 22px;
    height: 22px;
  }

  .tab-bar-item.is-active {
    color: var(--ink-dark) !important;
    font-weight: 700;
  }

  /* Active tab: 3px amber bar along the top edge of the cell. */
  .tab-bar-item.is-active::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 8px;
    right: 8px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--amber);
  }

  .tab-bar-item.is-active .nav-icon {
    background: transparent;
  }

  .tab-bar-item .nav-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    margin: 0;
    min-width: 18px;
    padding: 0 5px;
    font-size: 10.5px;
  }

  .tab-bar-item .nav-lock {
    display: none;
  }

  /* The fifth cell of the tab bar. Not display:contents — a <details> with
     no box of its own does not render its open content. */
  .more-menu {
    display: block;
    min-width: 0;
  }

  .more-menu[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(11, 25, 40, 0.42);
    animation: ftFade 140ms ease-out;
  }

  .sheet {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 10px 14px calc(18px + var(--safe-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--ui-surface);
    box-shadow: 0 -12px 40px rgba(11, 25, 40, 0.2);
    animation: langSheetIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .sheet::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: #d3dde6;
  }

  .sheet-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 4px 14px;
  }

  .sheet-head-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
  }

  .sheet-head-text strong {
    overflow: hidden;
    color: var(--ui-text-strong);
    font-size: 15.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sheet-head-text span {
    color: var(--ui-text-soft);
    font-size: 12.5px;
    font-weight: 600;
  }

  .sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--ui-surface-muted);
    color: var(--ui-text-muted);
    cursor: pointer;
  }

  .sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .sheet-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 84px;
    padding: 10px 6px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-lg);
    background: var(--ui-surface-muted);
    color: var(--ui-text) !important;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
  }

  /* German compounds ("Registrierungscodes") are one word wider than a
     tile; hyphenate by the page language rather than overflow. */
  .sheet-item .nav-label {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-hyphens: auto;
    hyphens: auto;
  }

  .sheet-item .nav-icon svg {
    width: 22px;
    height: 22px;
  }

  .sheet-item.is-active {
    border-color: var(--hairline);
    background: var(--ui-brand-soft);
    color: var(--ink-dark) !important;
    box-shadow: inset 0 3px 0 var(--amber);
  }

  .sheet-item .nav-badge,
  .sheet-item .nav-lock {
    position: absolute;
    top: 8px;
    right: 8px;
    margin: 0;
  }

  .sheet-item--root {
    color: #9a4508 !important;
    background: #fdf5ee;
  }

  .sheet-list {
    display: grid;
    gap: 2px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--ui-border);
  }

  .sheet-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 50px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--ui-radius-md);
    background: none;
    color: var(--ui-text) !important;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
  }

  .sheet-row svg {
    width: 20px;
    height: 20px;
    color: var(--ui-text-muted);
  }

  .sheet-row.is-active {
    background: var(--ui-brand-soft);
    color: var(--ui-brand-strong) !important;
  }

  .sheet-row--danger,
  .sheet-row--danger svg {
    color: var(--ui-danger) !important;
  }

  body.sheet-open {
    overflow: hidden;
  }
}

@media (max-width: 400px) {
  .app-topbar-wordmark {
    display: none;
  }
}

@media (max-width: 340px) {
  .sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Auth split layout (login, sign-up, forgot, reset, verify) ---------- */

.dispatcher-body.is-guest {
  background: var(--paper);
}

.auth-split {
  display: grid;
  grid-template-columns: 45fr 55fr;
  min-height: 100vh;
}

.auth-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--ink);
  color: #fff;
  overflow: hidden;
}

.auth-panel-inner {
  display: grid;
  justify-items: center;
  gap: 28px;
  width: min(100%, 420px);
  text-align: center;
}

.auth-panel-icon {
  width: clamp(140px, 18vw, 220px);
  height: auto;
  border-radius: 22%;
}

.auth-panel-brand {
  display: grid;
  gap: 4px;
}

.auth-panel-brand strong {
  font-size: clamp(36px, 4.2vw, 56px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.auth-panel-brand span {
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 400;
  opacity: 0.92;
}

.auth-checks {
  display: grid;
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 17px;
}

.auth-checks li {
  position: relative;
  padding-left: 34px;
}

.auth-checks li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 3px;
  width: 16px;
  height: 9px;
  border-left: 3.5px solid var(--amber);
  border-bottom: 3.5px solid var(--amber);
  transform: rotate(-45deg);
}

.auth-panel-stamp {
  position: absolute;
  left: -18px;
  bottom: -18px;
  color: #fff;
  opacity: 0.22;
  pointer-events: none;
}

.auth-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 40px 24px 24px;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px 22px;
  color: var(--ui-text-muted);
  font-size: 14px;
}

.auth-footer .lang-menu > summary {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ui-text-muted);
  font-weight: 600;
}

.auth-footer .lang-menu > summary:hover {
  color: var(--ink-dark);
  background: transparent;
}

.auth-footer .lang-menu-panel {
  top: auto;
  bottom: calc(100% + 8px);
}

@media (max-width: 820px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
  }

  /* Compact header band: icon + wordmark + subtitle, check lines and stamp
     drop out. */
  .auth-panel {
    padding: 14px 16px;
    justify-content: flex-start;
  }

  .auth-panel-inner {
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
  }

  .auth-panel-icon {
    width: 44px;
    border-radius: 11px;
  }

  .auth-panel-brand {
    gap: 0;
  }

  .auth-panel-brand strong {
    font-size: 20px;
  }

  .auth-panel-brand span {
    font-size: 13.5px;
  }

  .auth-checks,
  .auth-panel-stamp {
    display: none;
  }

  .auth-main {
    align-items: flex-start;
    padding: 24px 16px 8px;
  }

  .auth-footer {
    padding: 10px 16px 20px;
  }
}

/* ---- Page header ("hero") ----------------------------------------------- */

.dispatcher-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 24px;
  padding: 0;
}

.dispatcher-hero > div:first-child {
  min-width: 0;
}

.dispatcher-hero h1 {
  margin: 0;
  color: var(--ui-text-strong);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.dispatcher-hero .lead {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--ui-text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.dispatcher-hero .lead .muted {
  color: inherit;
}

.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--ui-text-soft);
  font-size: 12.5px;
  font-weight: 650;
}

.page-kicker a {
  color: var(--ui-text-muted) !important;
}

.hero-actions,
.form-actions,
.filter-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.form-actions {
  margin-top: 20px;
}

.form-actions > form {
  margin: 0;
}

.dispatcher-hero .page-actions,
.dispatcher-hero .hero-actions {
  flex: none;
}

/* A line of facts under the title: owner link, status badge. */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

a.page-kicker {
  color: var(--ui-text-muted) !important;
  text-decoration: none !important;
}

a.page-kicker:hover {
  color: var(--ui-brand-strong) !important;
}

/* Numbers in the page header */
.hero-metrics,
.route-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

@media (min-width: 1025px) {
  .dispatcher-hero .hero-metrics,
  .dispatcher-hero .route-summary {
    flex-wrap: nowrap;
  }
}

.hero-metric {
  min-width: 108px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--ui-surface);
}

.hero-metric .label,
.route-summary .label,
.metric-card .label,
.metric-compact .label {
  display: block;
  color: var(--ui-text-muted);
  font-size: 12.5px;
  font-weight: 550;
}

.hero-metric strong,
.route-summary strong,
.metric-card strong,
.metric-compact strong {
  display: block;
  margin-top: 4px;
  color: var(--ui-text-strong);
  font-size: 24px;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.route-hero .badge {
  min-height: 26px;
  padding: 0 10px;
}

/* ---- Alerts -------------------------------------------------------------- */

.alert {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 46px;
  margin: 0 0 16px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-lg);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.45;
}

.alert[hidden] {
  display: none !important;
}

.alert-info {
  border-color: var(--hairline-soft);
  background: var(--ui-info-soft);
  color: var(--ink-dark);
}

.alert-error {
  border-color: #f4cdc9;
  background: var(--ui-danger-soft);
  color: #8a1c12;
}

.alert-warning {
  border-color: var(--amber);
  background: var(--ui-warning-soft);
  color: var(--ink-dark);
}

.alert-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--ui-radius-sm);
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.alert-copy-btn:hover {
  background: var(--ui-surface-muted);
}

.alert-copy-btn.is-copied {
  border-color: rgba(10, 107, 65, 0.3);
  color: var(--ui-success);
}

/* ---- Panels -------------------------------------------------------------- */

.auth-card,
.card-panel,
.surface-panel,
.table-shell,
.hero-panel {
  position: relative;
  min-width: 0;
  margin: 0 0 18px;
  padding: 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--ui-surface);
}

.surface-panel-muted {
  background: var(--ui-surface-muted);
}

.surface-panel-strong {
  background: var(--ui-surface-strong);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 18px;
  padding: 0;
}

.panel-header > div:first-child {
  min-width: 0;
  flex: 1 1 260px;
}

.panel-header h2,
.panel-header h3,
.surface-title,
.table-title,
.panel-title {
  margin: 0;
  color: var(--ui-text-strong);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.012em;
}

.panel-header p,
.section-lead,
.table-subtitle,
.panel-lead {
  margin: 4px 0 0;
  color: var(--ui-text-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.panel-header .page-actions {
  margin: 0;
}

.eyebrow-meta {
  display: block;
  margin-bottom: 4px;
  color: var(--ui-text-soft);
  font-size: 12px;
  font-weight: 650;
}

/* ---- Grids --------------------------------------------------------------- */

.dashboard-grid,
.overview-grid,
.detail-grid,
.request-detail-grid {
  display: grid;
  gap: 18px;
  margin: 0 0 18px;
  padding: 0;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.9fr);
}

.overview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid,
.request-detail-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  align-items: start;
}

.dashboard-grid > *,
.detail-grid > *,
.request-detail-grid > * {
  min-width: 0;
}

.dashboard-grid > * > :last-child,
.detail-grid > * > :last-child,
.request-detail-grid > * > :last-child {
  margin-bottom: 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
  padding: 0;
}

.metric-card,
.metric-compact {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--ui-surface);
  color: inherit !important;
  text-decoration: none !important;
}

.metric-card .sub,
.metric-compact .sub,
.stat-sub {
  display: block;
  margin-top: 6px;
  color: var(--ui-text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.metric-card.is-warning {
  border-color: #f0d9a8;
  background: linear-gradient(180deg, #fffaf0 0%, #fff 100%);
}

.metric-card.is-warning .label {
  color: var(--ui-warning);
}

.metric-card.is-clickable {
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.metric-card.is-clickable:hover {
  border-color: var(--ui-border-strong);
  box-shadow: var(--ui-shadow-md);
  transform: translateY(-1px);
}

/* ---- Forms --------------------------------------------------------------- */

.inline-form,
.search-form,
.filter-form,
.toolbar {
  display: grid;
  gap: 12px;
}

.inline-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.search-form {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
}

.filter-form {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  align-items: end;
}

.filter-form .field-wide {
  grid-column: span 2;
}

/* Apply / reset (and exports, where offered) are a row of their own under
   the fields, never squeezed into one field-sized grid cell. */
.filter-form .filter-actions {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--ui-border);
}

.filter-exports {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.filter-exports .btn-link::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
}

.filter-form .field-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--ui-control-h);
  font-size: 14px;
}

.toolbar {
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
}

.toolbar-main,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-search,
.filter-form .field,
.form-grid .field,
.form-stack .field,
.stack-form label,
.inline-form label {
  display: block;
  min-width: 0;
}

.field-help,
.auth-card small {
  display: block;
  margin-top: 5px;
  color: var(--ui-text-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.form-grid .field-wide {
  grid-column: 1 / -1;
}

.stack-form {
  display: grid;
  gap: 14px;
}

/* A single column of fields reads best at form width, not at the width of
   a 1400px screen. Buttons stay lezn-aligned under the fields. */
.card-panel > .stack-form,
.surface-panel > .stack-form,
.card-panel > .form-stack,
.surface-panel > .form-stack {
  max-width: 640px;
}

.stack-form > .btn-primary,
.stack-form > .btn-secondary,
.stack-form > button {
  justify-self: start;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-form label > span,
.inline-form label > span,
.form-grid label > span,
.form-stack .field > span:first-child,
.filter-form .field > span,
.panel-kv span,
.form-meta span,
.kv-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--ui-text-muted);
  font-size: 13px;
  font-weight: 600;
}

.dispatcher-body input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="submit"]):not([type="button"]),
.dispatcher-body select,
.dispatcher-body textarea {
  width: 100%;
  min-height: var(--ui-control-h);
  padding: 9px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background-color: #fff;
  color: var(--ui-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.dispatcher-body select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2356697c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
}

.dispatcher-body input[type="date"],
.dispatcher-body input[type="datetime-local"],
.dispatcher-body input[type="time"] {
  min-width: 0;
}

.dispatcher-body textarea {
  min-height: 108px;
  resize: vertical;
}

.dispatcher-body input:not([type="checkbox"]):not([type="radio"]):hover,
.dispatcher-body select:hover,
.dispatcher-body textarea:hover {
  border-color: #b7c5d2;
}

.dispatcher-body input:not([type="checkbox"]):not([type="radio"]):focus,
.dispatcher-body select:focus,
.dispatcher-body textarea:focus {
  outline: none;
  border-color: var(--ui-brand);
  box-shadow: 0 0 0 3px var(--ui-brand-ring);
}

.dispatcher-body input[disabled],
.dispatcher-body select[disabled],
.dispatcher-body textarea[disabled],
.dispatcher-body input[readonly] {
  background-color: var(--ui-surface-muted);
  color: var(--ui-text-muted);
}

.dispatcher-body input[type="checkbox"],
.dispatcher-body input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  accent-color: var(--ui-brand);
}

/* A label that starts with a checkbox or radio is a single line: box, then
   text. Beats the stacked "caption above field" label layout. */
.dispatcher-body label.field-check,
.dispatcher-body label:has(> input[type="checkbox"]:first-child),
.dispatcher-body label:has(> input[type="radio"]:first-child) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  cursor: pointer;
}

.dispatcher-body label.field-check > span,
.dispatcher-body label:has(> input[type="checkbox"]:first-child) > span {
  display: inline;
  margin: 0;
  color: var(--ui-text);
  font-size: 14.5px;
  font-weight: 550;
}

.dispatcher-body input::placeholder,
.dispatcher-body textarea::placeholder {
  color: var(--ui-text-soft);
}

/* ---- Buttons ------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ui-control-h);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-md);
  font: inherit;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff !important;
}

.btn-primary:hover {
  border-color: var(--ui-brand-strong);
  background: var(--ui-brand-strong);
}

.btn-secondary {
  border-color: var(--hairline);
  background: #fff;
  color: var(--ink) !important;
}

.btn-secondary:hover {
  background: var(--ui-brand-soft);
}

.btn-danger {
  border-color: var(--ui-danger);
  background: var(--ui-danger);
  color: #fff !important;
}

.btn-danger:hover {
  border-color: #8a1c12;
  background: #8a1c12;
}

.btn-danger-outline {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff;
  color: var(--ui-danger) !important;
}

.btn-danger-outline:hover {
  background: var(--ui-danger-soft);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: none;
  color: var(--ui-brand-strong) !important;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none !important;
  cursor: pointer;
}

.btn-link:hover {
  background: var(--ui-brand-soft);
}

.btn-danger-inline,
.btn-link.btn-danger-inline {
  color: var(--ui-danger) !important;
}

.btn-danger-inline:hover {
  background: var(--ui-danger-soft);
}

.btn-primary[disabled],
.btn-secondary[disabled],
.btn-danger[disabled],
.btn-danger-outline[disabled],
.btn-link[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Locked (paid-plan) actions stay clickable: they lead to the upgrade page. */
.is-disabled {
  opacity: 0.6;
}

/* ---- Auth card ----------------------------------------------------------- */

.auth-card {
  width: 100%;
  max-width: 460px;
  margin: 0;
  padding: 36px 36px 30px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: #fff;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-align: center;
}

.auth-card .lead {
  margin: 0 0 24px;
  color: var(--ui-text-muted);
  font-size: 15px;
  text-align: center;
}

.auth-card form label {
  display: block;
  margin-bottom: 16px;
}

.auth-card form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-dark);
  font-size: 14px;
  font-weight: 600;
}

.auth-card form .btn-primary,
.auth-card form .btn-secondary {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}

/* Auth pages only: the primary button carries a thin amber outline. */
.auth-card .btn-auth.btn-primary {
  box-shadow: 0 0 0 2px var(--amber);
  border-color: var(--ink);
}

.auth-card .btn-auth.btn-primary:hover {
  background: var(--ink-dark);
  border-color: var(--ink-dark);
}

.auth-forgot {
  margin: -6px 0 18px;
  font-size: 14px;
}

.auth-forgot a,
.auth-alt a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-divider {
  width: 60%;
  margin: 24px auto 18px;
  border: 0;
  border-top: 1px solid var(--hairline-soft);
}

.auth-alt,
.auth-note {
  margin: 0;
  color: var(--ui-text);
  font-size: 14.5px;
  text-align: center;
}

.auth-alt--small {
  margin-top: 10px;
  font-size: 13px;
}

.auth-alt--small a {
  color: var(--ui-text-muted);
  font-weight: 500;
}

.auth-card small {
  display: block;
  margin-top: 5px;
  color: var(--ui-text-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

.zn-email-hint {
  display: block;
  margin-top: 5px;
  color: var(--ui-text-soft);
  font-size: 12.5px;
}

.zn-email-hint-apply {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--ui-brand);
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 820px) {
  .auth-card {
    max-width: none;
    padding: 24px 18px 22px;
  }

  .auth-card h1 {
    font-size: 26px;
  }
}

/* ---- Tables -------------------------------------------------------------- */

.table-shell {
  overflow: hidden;
  padding: 0;
}

.table-shell-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ui-border);
}

.table-shell-header > div:first-child {
  min-width: 0;
}

.table-toolbar {
  display: grid;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface-muted);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ui-border);
  text-align: left;
  vertical-align: middle;
}

/* Cells stay on one line (a date split over three lines is unreadable);
   .table-scroll takes the overflow on narrow desktops. The first column
   holds the name and may wrap. */
.table th,
.table td {
  white-space: nowrap;
}

.table td:first-child {
  min-width: 160px;
  white-space: normal;
}

.table th {
  padding-top: 11px;
  padding-bottom: 11px;
  background: var(--ui-surface-muted);
  color: var(--ink-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* Table inside a card: no header fill, hairline under the header row. */
.table--plain th {
  padding-left: 0;
  padding-right: 0;
  background: transparent;
  border-bottom: 1px solid var(--hairline);
  font-size: 15px;
}

.table--plain td {
  padding-left: 0;
  padding-right: 0;
  border-bottom-color: var(--hairline-soft);
}

.table--plain td:first-child {
  min-width: 0;
}

.table--plain tbody tr:hover {
  background: none;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background 100ms ease;
}

.table tbody tr:hover {
  background: #faf9f6;
}

.table a {
  color: var(--ui-text-strong);
  font-weight: 650;
}

.table a:hover {
  color: var(--ui-brand-strong);
}

.table a.btn-primary,
.table a.btn-secondary {
  color: #fff;
}

.table tr.row-unread > td:first-child {
  box-shadow: inset 3px 0 0 #e5484d;
}

.table code,
.code-big {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-muted);
  color: var(--ui-text-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.code-big {
  min-height: 36px;
  padding: 0 12px;
  font-size: 17px;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions > * + * {
  margin-left: 2px;
}

.row-actions .btn-link,
.row-actions .btn-danger-outline {
  min-height: 32px;
  padding: 0 8px;
  font-size: 13.5px;
}

.row-actions .btn-danger-outline {
  border-color: transparent;
  background: transparent;
}

.row-actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.amount {
  font-variant-numeric: tabular-nums;
}

/* ---- Badges -------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  /* One line by definition: a wrapped status pill overflows its own colour. */
  white-space: nowrap;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
}

/* Success: pale green. Warning: amber with ink text. Neutral: paper grey. */
.badge-active,
.badge-success {
  border-color: rgba(10, 107, 65, 0.2);
  background: var(--ui-success-soft);
  color: var(--ui-success);
}

.badge-expired,
.badge-muted {
  border-color: var(--hairline-soft);
  background: var(--ui-surface-muted);
  color: var(--ui-text-muted);
}

.badge-used {
  border-color: var(--hairline-soft);
  background: var(--ui-brand-soft);
  color: var(--ink-dark);
}

.badge-pending,
.badge-warning {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--ink-dark);
}

.badge-running {
  border-color: var(--hairline-soft);
  background: #fff;
  color: var(--ink-dark);
}

.badge-running::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
}

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

.empty-state {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 36px 20px;
  color: var(--ui-text-muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ui-text-strong);
  font-size: 16px;
  font-weight: 700;
}

/* ---- Pagination ---------------------------------------------------------- */

.pager-wrap {
  padding: 14px 20px;
  border-top: 1px solid var(--ui-border);
}

.pager,
.pager ul,
.pager-wrap .pagination,
.pager-wrap nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager li,
.pager-wrap .pagination li,
.pager-wrap nav ul li {
  list-style: none;
}

.pager a,
.pager span,
.pager strong,
.pager-wrap .pagination a,
.pager-wrap .pagination span,
.pager-wrap .pagination strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-md);
  color: var(--ui-text-muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.pager a:hover,
.pager-wrap .pagination a:hover {
  background: var(--ui-surface-muted);
  color: var(--ui-text-strong);
}

.pager strong,
.pager .active a,
.pager .active span,
.pager-wrap .pagination .active a,
.pager-wrap .pagination .active span {
  background: var(--ink);
  color: #fff;
}

/* ---- Key/value tiles ----------------------------------------------------- */

.kv-grid,
.form-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.form-meta {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-border);
}

.panel-kv {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface-muted);
  /* User input (campaign and area names) may be one long word. */
  overflow-wrap: anywhere;
  hyphens: auto;
}

.panel-kv strong,
.panel-kv div,
.form-meta div,
.kv-grid div {
  color: var(--ui-text-strong);
  font-size: 15px;
  font-weight: 650;
}

.danger-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-color: rgba(180, 35, 24, 0.22);
  background: #fff8f7;
}

.danger-zone > div {
  min-width: 0;
  flex: 1 1 260px;
}

.danger-zone > form,
.danger-zone > .badge {
  flex: 0 0 auto;
}

.danger-zone h3 {
  margin: 0 0 4px;
  color: var(--ui-danger);
  font-size: 16px;
}

.danger-zone p {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 13.5px;
}

.code-highlight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid #cfe0f5;
  border-radius: var(--ui-radius-lg);
  background: var(--ui-brand-soft);
}

/* ---- Filter disclosure (added by employer.js at phone width) ----------- */

.filter-toggle {
  display: none;
}

/* ---- Responsive: tablets ------------------------------------------------- */

@media (max-width: 1180px) {
  .dashboard-grid,
  .detail-grid,
  .request-detail-grid,
  .chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid,
  .toolbar,
  .inline-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-form .field-wide {
    grid-column: 1 / -1;
  }

  .dispatcher-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
}

/* ---- Responsive: phones -------------------------------------------------- */

@media (max-width: 720px) {
  .dispatcher-body {
    font-size: 15px;
  }

  .dispatcher-hero {
    margin-bottom: 18px;
  }

  .dispatcher-hero h1 {
    font-size: 24px;
  }

  .dispatcher-hero .lead {
    font-size: 14.5px;
  }

  /* Header actions become a row of equal, thumb-sized buttons. */
  /* Header actions become equal, thumb-sized buttons: two per row when
     there are several (route detail has four exports), one row when two. */
  .dispatcher-hero .page-actions,
  .dispatcher-hero .hero-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  }

  .dispatcher-hero .page-actions > *,
  .dispatcher-hero .hero-actions > * {
    width: 100%;
    min-width: 0;
  }

  .dispatcher-hero .page-actions > .badge,
  .dispatcher-hero .hero-actions > .badge {
    width: auto;
    justify-self: start;
  }

  /* Text links in a phone header read as buttons there. */
  .dispatcher-hero .page-actions > .btn-link,
  .dispatcher-hero .hero-actions > .btn-link {
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--ui-border-strong);
    background: #fff;
  }

  .dispatcher-hero .page-actions > form > button {
    width: 100%;
    min-height: 44px;
  }

  .kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .panel-kv {
    padding: 12px 14px;
  }

  .dispatcher-hero .page-actions .btn-primary,
  .dispatcher-hero .page-actions .btn-secondary,
  .dispatcher-hero .hero-actions .btn-primary,
  .dispatcher-hero .hero-actions .btn-secondary {
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    white-space: normal;
  }

  .hero-metrics,
  .route-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hero-metric {
    min-width: 0;
  }

  .metric-strip {
    gap: 10px;
  }

  .metric-card,
  .metric-compact {
    padding: 14px;
  }

  .metric-card strong,
  .hero-metric strong {
    font-size: 22px;
  }

  .card-panel,
  .surface-panel,
  .hero-panel {
    padding: 18px 16px;
  }

  .table-shell {
    border-radius: var(--ui-radius-lg);
  }

  .table-shell-header,
  .table-toolbar,
  .pager-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel-header {
    margin-bottom: 14px;
  }

  .search-form,
  .form-grid,
  .latlng-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-header .page-actions {
    width: 100%;
  }

  .panel-header .page-actions form {
    flex-wrap: wrap;
  }

  .search-form,
  .filter-form {
    gap: 10px;
  }

  .form-actions > .btn-primary,
  .form-actions > .btn-secondary,
  .form-actions > a.btn-link {
    flex: 1 1 auto;
  }

  /* Long action labels (FR/IT/ES reach ~35 characters) get a full row each. */
  .form-actions--stack > form,
  .form-actions--stack > a,
  .form-actions--stack > button,
  .form-actions--stack > form > button,
  .flag-row > form,
  .flag-row > form > .btn-primary {
    flex: 1 1 100%;
    width: 100%;
  }

  .form-actions--stack .btn-primary,
  .form-actions--stack .btn-secondary,
  .form-actions--stack .btn-danger,
  .form-actions--stack .btn-danger-outline,
  .flag-row > form > .btn-primary {
    white-space: normal;
    line-height: 1.3;
    padding-top: 8px;
    padding-bottom: 8px;
    text-wrap: balance;
  }

  .danger-zone > form,
  .danger-zone > form .btn-danger,
  .danger-zone > form .btn-danger-outline {
    width: 100%;
  }

  /* Filters fold behind a toggle (employer.js adds .has-filter-toggle). */
  .filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--ui-border-strong);
    border-radius: var(--ui-radius-md);
    background: #fff;
    color: var(--ui-text-strong);
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
  }

  .filter-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--ui-text-muted);
  }

  .filter-toggle .filter-count {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--ui-brand-soft);
    color: var(--ui-brand-strong);
    font-size: 12.5px;
  }

  .filter-toggle .filter-caret {
    margin-left: auto;
    transition: transform 160ms ease;
  }

  .has-filter-toggle.is-filters-open .filter-toggle .filter-caret {
    transform: rotate(180deg);
  }

  .has-filter-toggle > .panel-header {
    display: none;
  }

  .has-filter-toggle:not(.is-filters-open) .filter-form,
  .has-filter-toggle:not(.is-filters-open) .search-form.is-foldable {
    display: none;
  }

  .has-filter-toggle.is-filters-open .filter-form {
    margin-top: 14px;
  }

  .surface-panel.has-filter-toggle {
    padding: 12px;
  }

  .filter-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .filter-form .field-wide,
  .filter-form .filter-actions,
  .filter-form > .btn-primary,
  .filter-form > button {
    grid-column: 1 / -1;
  }

  .filter-form .filter-actions > * {
    flex: 1 1 auto;
  }

  /* One export per row: "Excel exportieren" does not fit a third of a
     phone, and a list of downloads reads naturally top to bottom. */
  .filter-exports {
    display: grid;
    flex-basis: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-left: 0;
  }

  .filter-exports .btn-link {
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--ui-border);
    background: #fff;
    font-size: 14px;
  }

  /* Tables become one card per row. employer.js copies each column
     heading into data-label and adds .is-stacked. */
  .table.is-stacked,
  .table.is-stacked tbody,
  .table.is-stacked tr,
  .table.is-stacked td {
    display: block;
    width: 100%;
  }

  .table.is-stacked thead {
    display: none;
  }

  /* Two columns of label-over-value: half the height of one label/value
     line per field, and still scannable. Title and actions span both. */
  .table.is-stacked tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 16px;
    padding: 16px;
    border-bottom: 1px solid var(--ui-border);
  }

  .table.is-stacked tbody tr:last-child {
    border-bottom: 0;
  }

  /* Inside a padded panel the panel already supplies the side margin. */
  .card-panel .table.is-stacked tr,
  .surface-panel .table.is-stacked tr {
    padding-left: 0;
    padding-right: 0;
  }

  .table.is-stacked tr:hover {
    background: none;
  }

  .table.is-stacked td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--ui-text-strong);
    font-size: 14.5px;
    font-weight: 550;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .table.is-stacked td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    color: var(--ui-text-soft);
    font-size: 12px;
    font-weight: 600;
  }

  .table.is-stacked td[data-label=""]::before,
  .table.is-stacked td.cell-title::before {
    content: none;
  }

  .table.is-stacked td.cell-title,
  .table.is-stacked td[data-label=""] {
    grid-column: 1 / -1;
  }

  .table.is-stacked td.cell-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    font-size: 16px;
    font-weight: 700;
  }

  .table.is-stacked td.cell-title a {
    font-size: 16px;
  }

  .table.is-stacked td.row-actions {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--ui-border);
    white-space: normal;
  }

  .table.is-stacked td.row-actions > * {
    margin: 0;
  }

  .table.is-stacked td.row-actions::before {
    content: none;
  }

  .table.is-stacked td.row-actions .btn-link,
  .table.is-stacked td.row-actions .btn-danger-outline {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--ui-border);
    background: #fff;
  }

  .table.is-stacked td:empty {
    display: none;
  }

  /* In a half-width card column a long status ("Pairing code created",
     "Code d'appairage créé") may take two lines rather than spill out. */
  .table.is-stacked .badge {
    max-width: 100%;
    padding-top: 2px;
    padding-bottom: 2px;
    border-radius: 10px;
    line-height: 1.3;
    white-space: normal;
  }

  /* Paid / billed toggles are badges that are also buttons: thumb-sized. */
  .table.is-stacked .flag-btn {
    min-height: 36px;
    padding: 4px 12px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 650;
  }

  .table.is-stacked tr.row-unread {
    box-shadow: inset 3px 0 0 #e5484d;
  }

  .table.is-stacked tr.row-unread > td:first-child {
    box-shadow: none;
  }

  .pager-wrap .pagination,
  .pager-wrap nav ul {
    justify-content: center;
  }
}


/* ===========================================================================
   Page-specific components (carried over from v1, restyled by the tokens)
   =========================================================================== */

/* ---- Chart ------------------------------------------------------------- */

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card .chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
}

.chart-gridline {
  stroke: var(--ui-border);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.chart-bar {
  fill: var(--ui-brand);
}

.chart-bar:hover {
  fill: var(--ui-brand-strong);
}

.chart-bar-empty {
  fill: var(--ui-border);
}

.chart-xlabel,
.chart-ylabel {
  fill: var(--ui-text-soft);
  font-size: 10px;
}

/* ---- Donut ------------------------------------------------------------- */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.donut {
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
}

.donut-bg {
  fill: none;
  stroke: var(--ui-border);
  stroke-width: 12;
}

.donut-active {
  fill: none;
  stroke: var(--ui-brand);
  stroke-width: 12;
  stroke-linecap: round;
}

.donut-num {
  fill: var(--ui-text-strong);
  font-size: 22px;
  font-weight: 700;
}

.donut-sub {
  fill: var(--ui-text-soft);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--ui-text-muted);
  font-size: 13.5px;
}

.donut-legend .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 2px;
  vertical-align: 1px;
}

.swatch-active {
  background: var(--ui-brand);
}

.swatch-revoked {
  background: var(--ui-border-strong);
}

/* ---- Map / route ------------------------------------------------------- */

.route-hero .badge {
  height: 24px;
  padding: 0 10px;
}

.route-map,
.request-map {
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
}

.route-map {
  height: 420px;
}

.request-map {
  height: 320px;
  margin: 8px 0;
  cursor: crosshair;
}

.latlng-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

/* ---- Map drawing toolbar (request and area forms) ----------------------- */

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.map-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface-muted);
}

.map-tools-label {
  padding: 0 6px 0 4px;
  color: var(--ui-text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.map-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.map-tool:hover {
  background: #fff;
}

.map-tool.is-active {
  border-color: rgba(24, 119, 200, 0.35);
  background: #fff;
  color: var(--ui-brand-strong);
  box-shadow: var(--ui-shadow-sm);
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

@media (max-width: 720px) {
  .map-tools {
    display: grid;
    width: 100%;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
  }

  .map-tools-label {
    display: none;
  }

  .map-tool {
    justify-content: center;
    min-height: 40px;
    padding: 0 6px;
  }

  .map-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* ---- Combobox ---------------------------------------------------------- */

.combo {
  position: relative;
}

.combo .combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  background: #fff;
  box-shadow: var(--ui-shadow-md);
  max-height: 260px;
  overflow-y: auto;
  z-index: 30;
}

.combo .combo-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
}

.combo .combo-list li:hover,
.combo .combo-list li.active {
  background: var(--ui-surface-muted);
}

.combo .combo-list li[hidden] {
  display: none;
}

.combo .combo-list li[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Extra carriers on a job: one picker per row, nothing until "+" is used. */
.extra-carriers {
  display: grid;
  gap: 8px;
}

.extra-carriers:not(:empty) {
  margin-top: 8px;
}

.extra-carrier-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.extra-carrier-row .combo {
  flex: 1 1 auto;
  min-width: 0;
}

.extra-carrier-add {
  justify-self: start;
  margin-top: 6px;
  padding: 0;
}

/* "+2" next to the lead carrier in the job list. */
.crew-chip {
  min-height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  border-color: var(--ui-border);
  background: var(--ui-surface-muted);
  color: var(--ui-text-muted);
  font-size: 12px;
  cursor: help;
}

/* Job detail: who is on the job. */
.crew-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crew-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface-muted);
  overflow-wrap: anywhere;
}

.crew-list .crew-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ui-text-strong);
  font-weight: 650;
}

.crew-list form {
  margin: 0;
}

.crew-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.crew-add .combo {
  flex: 1 1 200px;
  min-width: 0;
}

.map-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* ---- Flag chips -------------------------------------------------------- */

.flag-toggle {
  margin: 0;
}

.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ui-border-strong);
  background: #fff;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.flag-chip:hover {
  background: var(--ui-surface-muted);
}

.flag-chip-on {
  background: var(--ui-success-soft);
  color: var(--ui-success);
  border-color: rgba(4, 122, 74, 0.22);
}

.flag-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.flag-btn:hover {
  filter: brightness(0.97);
}

.check-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-muted);
}

.check-grid label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--ui-text);
  font-size: 13.5px;
  font-weight: 500;
}

.check-grid input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin-top: 2px;
}

.inline-delete {
  display: inline;
  margin-left: 8px;
}

/* ---- Modal ------------------------------------------------------------- */

.zn-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 18, 32, 0.5);
  animation: ftFade 120ms ease-out;
}

.zn-modal-overlay[hidden] {
  display: none;
}

.zn-modal {
  width: min(440px, 100%);
  padding: 24px 24px 18px;
  border-radius: 14px;
  border: 1px solid var(--ui-border);
  background: #fff;
  box-shadow: var(--ui-shadow-lg);
  animation: ftPop 140ms ease-out;
}

.zn-modal-title {
  margin: 0 0 8px;
  color: var(--ui-text-strong);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.zn-modal-title:empty {
  display: none;
}

.zn-modal-message {
  margin: 0 0 20px;
  color: var(--ui-text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.zn-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.zn-modal-open {
  overflow: hidden;
}


/* --- Root overview ---------------------------------------------------- */
.sidebar-nav-item--root { margin-top: auto; color: #c55a11; }
.sidebar-nav-item--root.is-active,
.sidebar-nav-item--root:hover { color: #c55a11; background: #fdf3ea; }

.root-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 12px;
  margin: 6px 0 18px;
}
.kpi-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #e6e8ee;
  border-radius: 10px;
  background: #fafbfd;
}
.kpi-tile--warn   { border-color: #f2c57c; background: #fff7ea; }
.kpi-tile--danger { border-color: #e8a6a6; background: #fdecec; }
.kpi-tile .kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.kpi-tile .kpi-value {
  font-size: 28px;
  font-weight: 600;
  color: #111827;
  line-height: 1;
}

.root-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid #e2e5ec;
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  font-size: 13px;
  text-decoration: none;
  transition: background 120ms, border-color 120ms;
}
.filter-chip:hover { border-color: #c7ccd6; background: #f5f6f9; }
.filter-chip.is-active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.7;
}
.status-pill.is-trial  { background: #e7f0ff; color: #2857c5; }
.status-pill.is-active { background: #e6f6ec; color: #1f7a3a; }
.status-pill.is-warn   { background: #fdf0d7; color: #8a5a00; }
.status-pill.is-muted  { background: #eef0f4; color: #5b6472; }

.trial-warn    { color: #a24a00; font-weight: 500; }
.trial-expired { color: #b42318; font-weight: 500; }

.badge-root {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #fdecd7;
  color: #c55a11;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  vertical-align: middle;
}
.badge-warn {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #fdf0d7;
  color: #8a5a00;
  font-size: 11px;
  font-weight: 600;
}
.row-root { background: #fffaf4; }

.muted { color: #6b7280; }

/* Monetization panel */
.monetization-panel {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid #e6e8ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #fafbfd 0%, #fff 60%);
}
.monetization-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.monetization-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
}
.mrr-figure { text-align: right; }
.mrr-amount {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #0b7a3a;
  line-height: 1;
}
.mrr-label {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.monetization-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.mini-stat {
  padding: 10px 14px;
  border: 1px solid #eceff4;
  border-radius: 8px;
  background: #fff;
}
.mini-stat--warn { border-color: #f2c57c; background: #fff7ea; }
.mini-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
  line-height: 1;
}
.mini-stat-label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}

.tier-breakdown-title {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 600;
}
.tier-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tier-row {
  padding: 10px 12px;
  border: 1px solid #eceff4;
  border-radius: 8px;
  background: #fff;
}
.tier-row-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
}
.tier-bar-wrap {
  height: 6px;
  background: #eef1f5;
  border-radius: 999px;
  overflow: hidden;
}
.tier-bar {
  height: 100%;
  background: linear-gradient(90deg, #2f9e44 0%, #51cf66 100%);
  border-radius: 999px;
  transition: width 240ms ease-out;
}
.tier-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: #374151;
}
.tier-row-mrr {
  margin-left: auto;
  font-weight: 600;
  color: #0b7a3a;
}

/* --- Billing banner + plan card + pricing tiers ---------------------- */
.billing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin: 0 0 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid transparent;
  flex-wrap: wrap;
}
.billing-banner--warn   { background: #fff6e3; border-color: #f2c57c; color: #8a5a00; }
.billing-banner--danger { background: #fdecec; border-color: #e8a6a6; color: #9a1d1d; }
.billing-banner--muted  { background: #eef0f4; border-color: #d6dae2; color: #4b5563; }
.billing-banner-text { flex: 1 1 260px; }
.billing-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.billing-banner-actions form { display: inline; margin: 0; }

.plan-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 22px 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-xl);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
  flex-wrap: wrap;
}
.plan-card-main { display: flex; flex-direction: column; gap: 10px; flex: 1 1 320px; }
.plan-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.plan-card-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}
.plan-card-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
  line-height: 1.1;
}
.plan-card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 13px;
  color: #374151;
}
.plan-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.plan-card-actions form { margin: 0; }

.pricing-section { padding-top: 22px; }
.pricing-tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.pricing-tier {
  position: relative;
  padding: 20px 18px;
  border: 1px solid #e6e8ee;
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pricing-tier.is-featured {
  border-color: #111827;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.08);
}
.pricing-tier-badge {
  position: absolute;
  top: -10px;
  left: 18px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pricing-tier-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}
.pricing-tier-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.pricing-tier-price .amount {
  font-size: 26px;
  font-weight: 700;
  color: #0b1220;
}
.pricing-tier-price .per {
  font-size: 13px;
  color: #6b7280;
}
.pricing-tier form { margin: 0; }
.pricing-tier button { width: 100%; }

@keyframes ftFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ftPop {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Change-plan grid --------------------------------------------------- */
.change-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.change-plan-tier {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border, #dae2ea);
  border-radius: 12px;
  min-height: 220px;
}
.change-plan-tier.is-current {
  border-color: var(--brand, #1F3A5F);
  box-shadow: 0 0 0 3px rgba(24, 119, 200, .18);
}
.change-plan-tier.is-blocked {
  opacity: .68;
  background: #fafbfc;
}
.change-plan-tier h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.change-plan-tier .price .amount { font-size: 26px; font-weight: 800; }
.change-plan-tier .price .per { color: var(--muted, #6b7a87); font-size: 13px; margin-left: 4px; }
.change-plan-tier .cap {
  margin: 6px 0 0;
  color: var(--muted, #6b7a87);
  font-size: 13px;
}
.change-plan-tier .warn {
  margin: 0;
  color: #b3261e;
  font-size: 13px;
  font-weight: 600;
}
.change-plan-tier .pill {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(24, 119, 200, .12);
  color: var(--brand-dark, #152A45);
  font-size: 12px;
  font-weight: 700;
}
.change-plan-tier form { margin-top: auto; }
.change-plan-tier button[disabled] { cursor: not-allowed; opacity: .6; }


/* Carrier seats against the plan cap.
   Three tones rather than one, because "18 of 20" and "20 of 20" call for
   different reactions: the first is information, the second is a blocked
   action. Muted by default so a dispatcher with room to spare is not nagged
   on every visit. */
.carrier-seats {
  margin: 6px 0 0;
  font-size: 0.875rem;
}
.carrier-seats a { margin-left: 6px; }
.carrier-seats--muted { color: var(--ui-text-muted); }
.carrier-seats--warn  { color: #8A5A00; font-weight: 600; }
.carrier-seats--error { color: #B3261E; font-weight: 600; }

/* ---------------------------------------------------------------------------
   Coverage map
   Mobile first: the filter row wraps, the legend sits under the map, and the
   map itself is sized in vh so a phone gets a usable map rather than a letterbox.
   --------------------------------------------------------------------------- */

.coverage-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.coverage-filter .field-inline {
  flex: 0 1 auto;
  min-width: 140px;
  margin: 0;
}

.coverage-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}

.coverage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.coverage-stat {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface, #fff);
}

.coverage-map {
  width: 100%;
  height: 55vh;
  min-height: 320px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
}

.coverage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
}

.coverage-layers,
.coverage-carriers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.coverage-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  /* Comfortably tappable without turning the legend into a wall of buttons. */
  min-height: 32px;
  cursor: pointer;
}

.coverage-toggle input[disabled] + span,
.coverage-toggle input[disabled] ~ span {
  color: var(--ui-text-muted);
}

.coverage-swatch {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  flex: 0 0 auto;
}

@media (min-width: 900px) {
  .coverage-map { height: 62vh; }
}

@media (max-width: 720px) {
  .coverage-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }

  .coverage-filter .field-inline {
    min-width: 0;
  }

  .coverage-filter > .btn-primary,
  .coverage-filter > .coverage-presets {
    grid-column: 1 / -1;
  }

  .coverage-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .coverage-presets .btn-link {
    justify-content: center;
    min-height: 44px;
    padding: 4px 6px;
    border: 1px solid var(--ui-border);
    background: #fff;
    font-size: 13.5px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .coverage-map {
    height: 62vh;
  }
}

/* On a phone the panel's 28px of padding costs the map a quarter of its
   width — 229px of 375. The map is the page, so it gets the full panel
   width and the padding shrinks around it. */
@media (max-width: 700px) {
  .surface-panel.coverage-panel .coverage-map {
    width: auto;
    margin-left: -16px;
    margin-right: -16px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
}

/* What an account deletion takes with it. A plain list would inherit the
   browser's bullets and indent, which reads as prose next to a card panel;
   this is a tally the reader is meant to scan and recognise. */
.kv-list {
  list-style: none;
  margin: 10px 0 14px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.kv-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f5f8fb;
  font-size: 14px;
}

.kv-list li strong {
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* First visit to the codes page: three numbered steps instead of an empty
   table, so the account's first action is obvious. */
.first-run {
  border: 1px solid var(--hairline);
  background: #fff;
}

.first-run-steps {
  margin: 8px 0 12px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
  font-size: 14.5px;
}

.first-run-steps li::marker {
  color: var(--brand, #1F3A5F);
  font-weight: 700;
}

/* Dashboard onboarding video: shown until the account dismisses it. */
.onboarding-video .panel-header form {
  flex-shrink: 0;
}

.onboarding-video-player {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 4px 0 0;
  border-radius: 12px;
  border: 1px solid var(--ui-border, #d8e5ef);
  background: #152A45;
}

.onboarding-video-hint {
  margin: 10px 0 0;
}

/* Account: current report logo. Checkerboard so a transparent PNG is legible. */
.branding-logo-preview {
  display: inline-block;
  padding: 10px;
  border: 1px solid var(--ui-border, #d8e5ef);
  border-radius: 8px;
  background: repeating-conic-gradient(#f1f4f7 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.branding-logo-preview img {
  display: block;
  max-height: 64px;
  max-width: 260px;
}

/* ---------------------------------------------------------------------------
   Route assistant (pilot) — job detail card + map stops
   --------------------------------------------------------------------------- */
.route-plan .kv-grid {
  margin-bottom: 10px;
}

.route-plan-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
}

.route-plan-setting {
  margin: 0;
}

.route-plan-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-warning-soft);
  color: var(--ui-warning);
  font-size: 13px;
}

.route-plan-heading {
  margin: 16px 0 6px;
  font-size: 14px;
  color: var(--ui-text-strong);
}

.route-plan-streets {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: plan;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
}

.route-plan-streets li {
  counter-increment: plan;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 7px 12px;
  font-size: 14px;
  border-top: 1px solid var(--ui-border);
}

.route-plan-streets li:first-child {
  border-top: 0;
}

.route-plan-streets li::before {
  content: counter(plan);
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--ui-plan-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

/* Name keeps a readable width; on a phone the metres and badges drop to
   their own line instead of squeezing the name into a column of syllables. */
.route-plan-name {
  flex: 1 1 10em;
  min-width: 0;
  overflow-wrap: break-word;
}

.route-plan-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.route-plan-len {
  flex: 0 0 auto;
  color: var(--ui-text-muted);
  font-variant-numeric: tabular-nums;
}

.route-plan-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 14px;
}

.leaflet-marker-icon.plan-stop {
  border-radius: 11px;
  background: var(--ui-plan-strong);
  border: 2px solid #fff;
  box-shadow: var(--ui-shadow-sm);
  color: #fff;
  font: 700 10px/18px system-ui, sans-serif;
  text-align: center;
}


/* ---- Zeitnachweis additions -------------------------------------------- */
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-deleted td { opacity: 0.55; text-decoration: line-through; }
.table tr.is-deleted td .badge { text-decoration: none; }
.table tr.is-muted td { opacity: 0.6; }
.text-danger { color: var(--ui-danger); font-weight: 700; }
.finding-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.finding-list li { padding: 10px 0; border-bottom: 1px solid var(--hairline-soft); font-size: 14.5px; }
.finding-list li:last-child { border-bottom: 0; }
.code-reveal-grid { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.code-reveal-grid > div { flex: 1 1 260px; }
.code-big { font-size: 32px; font-weight: 800; letter-spacing: 0.14em; color: var(--ui-brand); margin: 6px 0; font-variant-ligatures: none; }
.code-qr { border: 1px solid var(--hairline); border-radius: 12px; background: #fff; }
.first-run-steps { padding-left: 22px; }
.first-run-steps li { margin-bottom: 6px; }

/* ===========================================================================
   v3 components (dashboard KPI tiles, presence table, month progress)
   =========================================================================== */

/* Page header: h1 + muted date line. */
.dispatcher-hero h1 {
  font-size: clamp(28px, 2.6vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.dispatcher-hero .lead {
  margin-top: 4px;
  font-size: 16px;
}

/* KPI tiles: 4 → 2 → 1 columns. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 18px;
}

.kpi {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 20px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: #fff;
  color: inherit !important;
  text-decoration: none !important;
}

.kpi--link:hover {
  background: #fcfbf9;
}

.kpi-label {
  display: block;
  color: var(--ink-dark);
  font-size: 15.5px;
  font-weight: 500;
}

.kpi-value {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: clamp(34px, 3.2vw, 46px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kpi-value small {
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0;
}

.kpi-value.is-amber {
  color: var(--amber);
}

.kpi-sub {
  display: block;
  margin-top: 8px;
  color: var(--ui-text-muted);
  font-size: 13px;
}

.kpi-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.kpi-row .kpi-value {
  flex: none;
}

.kpi-list {
  flex: 1 1 auto;
  min-width: 0;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ui-text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: right;
}

.kpi-list li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .kpi {
    padding: 16px;
  }

  .kpi-list {
    text-align: left;
  }

  .kpi-row {
    flex-direction: column;
    gap: 2px;
  }
}

/* Running dot (amber) before a name. */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
  vertical-align: 1px;
}

.dot--running {
  background: var(--amber);
}

.panel-foot {
  margin: 16px 0 0;
  font-size: 14.5px;
}

.link-underline {
  color: var(--ink) !important;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Two-column dashboard row: presence table wider than the findings card. */
.dashboard-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
}

/* Month progress rows. */
.month-rows {
  display: grid;
  gap: 4px;
}

.month-row {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 16px;
  min-height: 36px;
}

.month-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.month-bar {
  display: flex;
  height: 14px;
  min-width: 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ui-surface-sunken);
}

.month-bar-done {
  display: block;
  height: 100%;
  background: var(--ink);
}

.month-bar-today {
  display: block;
  height: 100%;
  background: var(--amber);
}

.month-hours {
  min-width: 7ch;
  text-align: right;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-dark);
}

.month-actions {
  display: inline-flex;
  gap: 6px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--ink) !important;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none !important;
}

.btn-pill:hover {
  background: var(--ui-brand-soft);
}

.month-cta {
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .month-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hairline-soft);
  }

  .month-row:last-child {
    border-bottom: 0;
  }

  .month-name {
    grid-column: 1;
    grid-row: 1;
    font-weight: 600;
  }

  .month-hours {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    font-size: 14px;
  }

  .month-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .month-actions {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .month-cta {
    justify-content: stretch;
  }

  .month-cta .btn-primary {
    width: 100%;
    min-height: 46px;
  }

  .stamp-watermark {
    width: 140px !important;
    height: 140px !important;
    top: -10px;
    right: -20px;
  }
}

/* =====================================================================
   Spacing pass after the visual review of 2026-10-14. Overrides on
   purpose at the end of the file: every rule here answers one cramped
   spot seen in the screenshots (zn-review), see git log.
   ===================================================================== */

/* Filters sat flush against the card edge. */
.table-shell > .filter-form,
.surface-panel > .filter-form,
.filter-form {
  padding: 18px 20px 16px;
  row-gap: 14px;
}
.table-shell > .filter-form {
  border-bottom: 1px solid var(--ui-border);
  background: #fcfbf9;
}
.filter-form .filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Table cells breathe a little more and the first/last column keep the
   same inset as the card padding so text never touches the hairline. */
.table th,
.table td {
  padding: 13px 16px;
}
.table th:first-child,
.table td:first-child {
  padding-left: 22px;
}
.table th:last-child,
.table td:last-child {
  padding-right: 22px;
}
.table--plain th:first-child,
.table--plain td:first-child {
  padding-left: 0;
}
.table--plain th:last-child,
.table--plain td:last-child {
  padding-right: 0;
}

/* Footnotes under tables inside a shell were glued to the border. */
.table-shell > p.muted,
.table-shell > .panel-foot,
.surface-panel > p.muted.small:last-child {
  margin: 0;
  padding: 14px 22px 16px;
  border-top: 1px solid var(--ui-border);
  line-height: 1.5;
}

/* Compliance rule counters: give them the KPI rhythm instead of a
   second cramped row of cards. */
.rule-grid,
.compliance-kpis {
  gap: 14px;
  margin: 0 0 18px;
}

/* Dashboard: the first KPI listed names beside the big number and
   truncated them. Names go underneath, full width. */
.kpi-row {
  flex-direction: column;
  gap: 4px;
}
.kpi-list {
  text-align: left;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline-soft, #e6e2d8);
  font-size: 13px;
}
.kpi {
  padding: 20px 22px 18px;
}
.kpi-sub {
  margin-top: 10px;
}

/* Month rows: more vertical rhythm, hours and Soll on two lines on
   narrower desktops instead of one long squeezed string. */
.month-rows {
  gap: 10px;
}
.month-row {
  min-height: 40px;
  gap: 8px 18px;
}
.month-hours .muted {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

/* Dashboard two-column row stacks before the presence table runs out
   of room (the 390px render showed letters stacked vertically). */
@media (max-width: 1100px) {
  .dashboard-grid,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Stacked cards (<720px): long cells must wrap, never clip. */
@media (max-width: 720px) {
  .table td,
  .table th {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table td::before {
    white-space: nowrap;
  }
  .filter-form,
  .table-shell > .filter-form {
    padding: 16px 16px 14px;
  }
  .table-shell > p.muted,
  .surface-panel > p.muted.small:last-child {
    padding: 12px 16px 14px;
  }
}

/* Watermark: smaller, fully inside the header, never clipped. */
.stamp-watermark {
  top: 8px;
  right: 12px;
  width: 150px !important;
  height: 150px !important;
  opacity: 0.06;
}
@media (max-width: 1024px) {
  .stamp-watermark {
    width: 110px !important;
    height: 110px !important;
    top: 6px;
    right: 8px;
  }
}

/* Page header: a little more air below the lead before the first card. */
.dispatcher-hero {
  margin-bottom: 26px;
}
.dispatcher-hero .lead {
  max-width: 68ch;
}

/* Entry detail: the version table's device-time note may wrap. */
.detail-grid .table td,
.detail-grid .table th {
  white-space: normal;
}

/* Compliance page: counters get the table-shell inset and a divider, the
   hint column wraps (it is a sentence, not a value). */
.table-shell > .metric-strip {
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: #fff;
}
.table .col-wrap,
.table td.col-wrap {
  white-space: normal;
  min-width: 28ch;
  max-width: 60ch;
  line-height: 1.45;
}
@media (max-width: 720px) {
  .table td.col-wrap {
    grid-column: 1 / -1;
  }
  .table td.col-wrap::before {
    display: block;
    margin-bottom: 2px;
  }
  .table-shell > .metric-strip {
    padding: 14px 16px;
  }
}
