/* Admin panel styles. Plain CSS, no build step and no CDN — the panel has to
   render on a server that may have no outbound internet access. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e6ea;
  --ink: #1c2430;
  --ink-soft: #667081;
  /* Royal blue, taken from the driver app's primary buttons so the panel and
     the app read as one product. 6.7:1 on white, which is where the previous
     brand colour sat — this token is used both as a button background and as
     link text, so it has to clear AA in both directions. */
  --brand: #1d4ed8;
  --brand-ink: #ffffff;
  /* A wash of --brand for hover shadows. Its own token because rgba() cannot
     be derived from a hex custom property without color-mix, and the last
     hardcoded copy of the brand colour is exactly what went stale. */
  --brand-tint: rgba(29, 78, 216, 0.12);
  --danger: #b3261e;
  --ok: #1c6b3c;
  --attention: #b4690e;
  --radius: 10px;
  --sidebar-w: 232px;
  --topbar-h: 60px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------------------------------------------------------------- shell */

.shell {
  min-height: 100vh;
}

.shell__body {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

/* --------------------------------------------------------------- topbar */

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__brand,
.login__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 700;
}

.topbar__name {
  font-weight: 600;
}

.topbar__name span {
  color: var(--ink-soft);
  font-weight: 400;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__user {
  color: var(--ink-soft);
  font-size: 14px;
}

.topbar__logout {
  margin: 0;
}

/* ---------------------------------------------------- notification bell */

.bell {
  position: relative;
}

.bell__button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.bell__button:hover,
.bell__button[aria-expanded='true'] {
  background: var(--brand-tint);
  color: var(--brand);
}

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

.bell__count {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.bell__count[hidden] {
  display: none;
}

.bell.is-ringing .bell__icon {
  animation: bell-ring 0.8s ease-in-out;
  transform-origin: 50% 10%;
}

@keyframes bell-ring {
  0%,
  100% {
    transform: rotate(0);
  }
  20% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-12deg);
  }
  60% {
    transform: rotate(8deg);
  }
  80% {
    transform: rotate(-4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bell.is-ringing .bell__icon {
    animation: none;
  }
}

.bell__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: 360px;
  max-width: calc(100vw - 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(28, 36, 48, 0.16);
  overflow: hidden;
}

.bell__panel[hidden] {
  display: none;
}

.bell__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.bell__read-all {
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.bell__read-all:disabled {
  color: var(--ink-soft);
  cursor: default;
}

.bell__list {
  max-height: 420px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.bell__item {
  position: relative;
  padding: 11px 14px 11px 26px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.bell__item:last-child {
  border-bottom: 0;
}

.bell__item:hover,
.bell__item:focus-visible {
  background: var(--bg);
  outline: none;
}

/* Unread: tinted, bold heading, and a dot — not colour alone. */
.bell__item.is-unread {
  background: var(--brand-tint);
}

.bell__item.is-unread::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 11px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
}

/* An ALERT (no driver accepted an order): red wash, red edge, and a label —
   not colour alone. Read ones keep the label but lose the wash. */
.bell__item.is-alert {
  box-shadow: inset 3px 0 0 var(--danger);
}

.bell__item.is-alert.is-unread {
  background: #fdecea;
}

.bell__item.is-alert.is-unread::before {
  background: var(--danger);
}

.bell__alert {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.bell__subject {
  font-size: 14px;
  font-weight: 500;
}

.bell__item.is-unread .bell__subject {
  font-weight: 700;
}

.bell__body {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.bell__time {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

.bell__empty {
  margin: 0;
  padding: 24px 14px;
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
}

/* -------------------------------------------------------------- sidebar */

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

.sidebar__link:hover {
  background: var(--bg);
}

.sidebar__link.is-active {
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

/* Sections that do not exist yet: visible so the shape of the panel is clear,
   but plainly not clickable. */
.sidebar__link.is-soon {
  color: #9aa3b0;
  cursor: default;
}

.sidebar__link.is-soon:hover {
  background: transparent;
}

.sidebar__icon {
  font-size: 12px;
  opacity: 0.75;
}

.sidebar__foot {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* -------------------------------------------------------------- content */

.content {
  flex: 1;
  padding: 26px 28px;
  min-width: 0;
}

.content__title {
  margin: 0 0 4px;
  font-size: 22px;
}

.content__lead {
  margin: 0 0 22px;
  color: var(--ink-soft);
}

/* ===========================================================================
   Dashboard
   ---------------------------------------------------------------------------
   Built from the same tokens as the rest of the panel — no new palette. The
   only additions are two tints of existing colours, for chart fills that need
   to sit behind text.

   Some widgets are labelled "Sample". Those tables exist but hold no history
   yet, and an empty chart reads as a broken panel rather than an honest zero.
   The badge is load-bearing: a dashboard is read as fact, and an unlabelled
   invented figure is the one thing this panel must never show.
=========================================================================== */

.dash__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

.dash__head .content__title {
  margin-bottom: 0;
}

.dash__date {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.dash__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* The chart earns twice the width of the list beside it; below 960px they
   stack, because a seven-bar chart in half a phone is unreadable. */
@media (min-width: 960px) {
  .dash__grid--two {
    grid-template-columns: 2fr 1fr;
  }
}

/* ---- headline figures --------------------------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}

a.kpi:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 10px var(--brand-tint);
}

a.kpi:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.kpi__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.kpi__value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Cents ride smaller than the dollars so the eye lands on the figure. */
.kpi__cents {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-soft);
}

.kpi__foot {
  font-size: 12px;
  color: var(--ink-soft);
}

.kpi--attention {
  border-color: var(--attention);
}

.kpi--attention .kpi__value {
  color: var(--attention);
}

.trend {
  font-weight: 600;
}

.trend--up {
  color: var(--ok);
}

.trend--down {
  color: var(--danger);
}

/* A live figure gets a dot rather than a word, so the row stays one line. */
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.dot--live {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(28, 107, 60, 0.16);
}

.dot--idle {
  background: #c3c9d2;
}

/* ---- panels ------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel__meta {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* Every panel says where its numbers come from, or what will replace them. */
.panel__note {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.panel__note code {
  font-size: 11px;
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 5px;
}

.panel__empty {
  margin: 0;
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--sample {
  background: #fdf3e3;
  color: var(--attention);
}

/* ---- weekly bars -------------------------------------------------------- */

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  min-height: 150px;
}

.bars__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bars__track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 110px;
}

.bars__bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: #c8d6f6;
}

/* One bar carries the accent — the peak. Colouring all seven would say
   nothing, and the week's high is the thing worth finding at a glance. */
.bars__bar--peak {
  background: var(--brand);
}

.bars__value {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bars__day {
  font-size: 11px;
  color: var(--ink-soft);
}

/* ---- demand zones ------------------------------------------------------- */

.zones {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.zone:last-child {
  border-bottom: none;
}

.zone__name {
  font-size: 13px;
  font-weight: 500;
}

.zone__level {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.zone__level--busy {
  background: #fde8e6;
  color: var(--danger);
}

.zone__level--steady {
  background: #fdf3e3;
  color: var(--attention);
}

.zone__level--quiet {
  background: var(--bg);
  color: var(--ink-soft);
}

/* ---- pipeline ----------------------------------------------------------- */

.pipeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline__row {
  display: grid;
  grid-template-columns: 96px 1fr 34px;
  align-items: center;
  gap: 10px;
}

.pipeline__label {
  font-size: 12px;
  color: var(--ink-soft);
}

.pipeline__track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.pipeline__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.pipeline__fill--brand {
  background: var(--brand);
}

.pipeline__fill--attention {
  background: var(--attention);
}

.pipeline__fill--ok {
  background: var(--ok);
}

.pipeline__value {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- account counts ----------------------------------------------------- */

.counts {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.counts__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: 7px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.counts__row:last-child {
  border-bottom: none;
}

a.counts__row:hover {
  background: var(--bg);
}

a.counts__row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.counts__label {
  font-size: 13px;
}

.counts__value {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.counts__row--attention .counts__value {
  color: var(--attention);
}

/* ---- activity feed ------------------------------------------------------ */

.feed {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feed__item {
  display: grid;
  grid-template-columns: 10px 46px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.feed__item:last-child {
  border-bottom: none;
}

.feed__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-1px);
}

.feed__dot--ok {
  background: var(--ok);
}

.feed__dot--bad {
  background: var(--danger);
}

.feed__dot--brand {
  background: var(--brand);
}

.feed__dot--attention {
  background: var(--attention);
}

.feed__time {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.feed__what {
  font-size: 13px;
}

.feed__who {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: right;
}

@media (max-width: 620px) {
  .feed__item {
    grid-template-columns: 10px 46px 1fr;
  }

  .feed__who {
    grid-column: 3;
    text-align: left;
  }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

a.card:hover {
  border-color: var(--brand);
}

.card--attention {
  border-color: var(--attention);
}

.card__label {
  color: var(--ink-soft);
  font-size: 13px;
}

.card__value {
  font-size: 28px;
  font-weight: 650;
}

.card__note {
  color: var(--ink-soft);
  font-size: 12px;
}

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tab {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.tab:hover {
  border-color: var(--brand);
}

.tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- search */

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

.search__input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.search__input:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}

/* An anchor carrying .btn must render as the same box a <button> does, or a
   link and a real button sitting side by side will not line up: an anchor is
   inline and inherits the body line-height, so the shared padding would build a
   taller control on a different baseline. */
a.btn {
  display: inline-block;
  line-height: normal;
  text-align: center;
  text-decoration: none;
}

/* ---------------------------------------------------------------- pager */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pager__count {
  font-size: 13px;
  color: var(--ink-soft);
}

.pager__links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pager__link {
  display: inline-block;
  min-width: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}

.pager__link:hover:not(.is-current):not(.is-disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.pager__link.is-current {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

/* Kept in the flow rather than hidden, so the controls do not shift position
   as you move between the first, middle and last page. */
.pager__link.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager__gap {
  padding: 0 2px;
  color: var(--ink-soft);
}

/* Wide tables scroll inside this rather than pushing the page sideways. */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.table th,
.table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th {
  background: #fafbfc;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

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

.cell--key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.cell--modes {
  white-space: normal;
}

/* ---------------------------------------------------------------------------
   Delivery modes — the checkbox set inside each partner row.

   Editable in place rather than behind a separate page: it is one boolean per
   kind of work, and an admin setting it is usually looking at the approval
   decision in the same row.

   The Save button is always present rather than appearing on change: a control
   that materialises under the pointer is easy to miss and easy to mis-click,
   and this is a permission change.
--------------------------------------------------------------------------- */

.modes {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}

/* Dimmed while a save is in flight, so a slow network reads as "working"
   rather than "the toggle did nothing". */
.modes.is-saving {
  opacity: 0.55;
}

/* ---- the switch ---------------------------------------------------------
   A real checkbox, visually hidden but still focusable, with the track drawn
   beside it. Keyboard and screen readers get a checkbox; everyone else gets a
   switch. `:checked + .switch__track` is what ties the two together, so no
   JavaScript is needed to draw the state.
-------------------------------------------------------------------------- */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.switch__track {
  position: relative;
  flex: none;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #cbd5e1;
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.3);
  transition: transform 0.15s ease;
}

.switch__input:checked + .switch__track {
  background: var(--brand);
}

.switch__input:checked + .switch__track::after {
  transform: translateX(13px);
}

/* The focus ring belongs on the track, since the input itself is invisible. */
.switch__input:focus-visible + .switch__track {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}

.switch__label {
  font-size: 12px;
  color: var(--ink-soft);
}

/* Mid-route depends on the two above it, so it sits indented under them. */
.switch--sub {
  margin-left: 16px;
}

.switch__input:disabled ~ .switch__label,
.switch__input:disabled + .switch__track {
  opacity: 0.4;
}

.switch:has(.switch__input:disabled) {
  cursor: not-allowed;
}

/* Shown only when the page script did not run — then it is the whole control. */
.modes__save {
  margin-top: 3px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}

.modes__save:hover {
  border-color: var(--brand);
  color: var(--brand);
}

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

/* Shown in the document viewer when a partner has filed nothing yet. The
   viewer opens for every partner now, so "nothing here" needs to look
   deliberate rather than like a panel that failed to load. */
.docs__empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---- toasts -------------------------------------------------------------
   Bottom-right, stacked newest last, out of the way of the table. Click to
   dismiss early; otherwise they time out — errors last longer, because by then
   the admin may be looking at a different row.
-------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.45;
  color: #fff;
  background: #1e293b;
  box-shadow: 0 6px 20px rgb(15 23 42 / 0.22);
  cursor: pointer;
  animation: toast-in 0.18s ease-out both;
}

.toast--ok {
  background: #15803d;
}

.toast--bad {
  background: #b91c1c;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* A toast that slides is decorative; the message is the point. */
@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-leaving,
  .switch__track,
  .switch__track::after {
    animation: none;
    transition: none;
  }
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill--ok {
  background: #e7f4ec;
  color: #1c6b3c;
}

.pill--off {
  background: #f0f1f3;
  color: var(--ink-soft);
}

.pill--warn {
  background: #fcf1e2;
  color: var(--attention);
}

.pill--bad {
  background: #fdecea;
  color: var(--danger);
}

/* Keeps View / Approve / Reject on one line; each decision is its own form,
   which would otherwise stack as block elements. */
.rowactions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rowactions form {
  margin: 0;
}

/* Result of the last approve/reject, shown above the table. */
.banner {
  margin: 0 0 16px;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 13px;
}

.banner--ok {
  background: #e7f4ec;
  color: #1c6b3c;
}

.banner--bad {
  background: #fdecea;
  color: var(--danger);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 1px 2px 1px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------------
   Application details, under each delivery partner row.

   A plain <details> element, so the panel needs no JavaScript to open one —
   which matters here, because the admin panel is expected to work with no
   outbound internet access and this survives its own scripts failing to load.
   --------------------------------------------------------------------------- */

.detailrow > td {
  padding: 0 14px 10px;
  /* The table pins every other cell to one line; this one has to wrap. */
  white-space: normal;
}

.appdetail > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 6px 0;
  user-select: none;
}

.appdetail > summary:hover {
  color: var(--ink);
}

/* auto-fit, so four sections sit side by side on a wide screen and fold to one
   column on a narrow one without a media query per breakpoint. */
.appdetail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  padding: 8px 0 4px;
}

.appdetail__grid h4 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.appdetail__grid dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  font-size: 13px;
}

.appdetail__grid dt {
  color: var(--ink-soft);
}

.appdetail__grid dd {
  margin: 0;
  /* Licence numbers and long street addresses must not widen the column. */
  overflow-wrap: anywhere;
}

.appdetail__none {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--ink-soft);
}

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--attention);
  border-radius: var(--radius);
  padding: 18px 20px;
  max-width: 640px;
}

.notice__title {
  margin: 0 0 8px;
  font-size: 16px;
}

.notice p {
  margin: 0 0 8px;
  color: var(--ink-soft);
}

.notice p:last-child {
  margin-bottom: 0;
}

code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

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

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* `hidden` alone loses to `display: grid`, so it is restated here. */
.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 22, 30, 0.55);
}

.modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  /* max-height, not height: the panel was sized for a full-bleed iframe, but a
     list of one document should not open as a near-full-screen empty box. */
  max-height: min(86vh, 100%);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0;
  font-size: 16px;
}

.modal__close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 4px;
}

.modal__close:hover {
  color: var(--ink);
}

.modal__sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* The list fills whatever is left under the header, and scrolls on its own so
   the header and footer stay put with five documents in view. */
.modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
  padding: 16px 18px;
}

.modal__foot {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------- doc list */

.doclist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The whole row is the link, so the click target is the full card rather than
   a small filename. */
.doc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}

.doc:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 10px var(--brand-tint);
}

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

.doc__badge {
  flex: none;
  min-width: 46px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
}

/* min-width: 0 lets the long S3 key below actually ellipsis instead of
   stretching the row. */
.doc__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.doc__name {
  font-weight: 600;
  font-size: 14px;
}

.doc__file,
.doc__path {
  font-size: 12px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc__path {
  font-size: 11px;
  opacity: 0.75;
}

.doc__open {
  flex: none;
  font-size: 16px;
  color: var(--ink-soft);
}

.doc:hover .doc__open {
  color: var(--brand);
}

/* --------------------------------------------------------- doc cards

   One card per document type, which is the unit an admin decides on. A licence
   is two files inside one card with one Reject button; front and back are the
   same document and a partner re-photographs the card either way. */

.doccards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doccard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}

.doccard__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.doccard__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.doccard__meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* The files sit on the card's own ground, so the card reads as one thing with
   parts rather than as a heading above unrelated rows. */
.doccard__files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doccard__waiting {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* Approve and Reject, side by side under the files they decide on. Each is its
   own form so the button carries its own decision — the same shape as the
   row-level review buttons, which keeps the two sets of controls consistent
   even though they decide different things. */
.doccard__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.doccard__decision {
  margin: 0;
}

/* Stops the page behind the modal scrolling under it. */
body.is-modal-open {
  overflow: hidden;
}

/* ---------------------------------------------------------------- login */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login__title {
  margin: 0;
  font-size: 20px;
}

.login__note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.login__intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.field__aside {
  color: var(--brand);
  text-decoration: none;
  font-size: 12px;
}

.field__aside:hover {
  text-decoration: underline;
}

.notice-inline {
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #eef6ee;
  color: #1c6b3c;
  font-size: 13px;
}

.field__input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  background: #fff;
}

.field__input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: transparent;
}

.alert {
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fdecea;
  color: var(--danger);
  font-size: 13px;
}

/* --------------------------------------------------------------- button */

.btn {
  font: inherit;
  /* inline-flex rather than the button default, so a label centres itself
     whatever goes in it — two words, an icon, a spinner. As inline-block the
     content drifted off-centre the moment it was not one plain word. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* An inline-flex box sits on the text baseline by default, which leaves two
     buttons in a table cell a pixel or two out of line with each other. */
  vertical-align: middle;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  /* A button's label is a name, not a sentence. Without this a button inside a
     flex row is a flex item that shrinks to fit the space left over and breaks
     its label across two lines — which is what turned "Add band" into "Add"
     above "band" beside a band table's heading. */
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

/* A press you can feel. Kept off disabled buttons, which should not move. */
.btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* Keyboard focus has to be visible — the same ring the icon buttons use, so
   tabbing through the panel looks like one product. `:focus-visible` rather
   than `:focus` keeps it off mouse clicks, where it reads as a stuck state. */
.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

.btn--primary {
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

/* `--brand-tint` exists for exactly this: a wash of the brand colour that
   lifts the button on hover without inventing a second blue. */
.btn--primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 2px 8px var(--brand-tint);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--ink-soft);
}

/* Solid confirm buttons, reused inside the SweetAlert dialog via customClass. */
.btn--ok {
  background: var(--ok);
  color: #fff;
  font-weight: 600;
}

.btn--ok:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn--bad {
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}

.btn--bad:hover:not(:disabled) {
  filter: brightness(1.08);
}

/* Danger as an outline, for a destructive action that lives in a table row.
   A column of solid red Delete buttons is the loudest thing on the page and
   competes with the one action that should lead — the same reasoning already
   written above `.iconbtn`, whose `--bad` variant this borrows its colours
   from so the two tables match. It fills in on hover, so the button still
   reads as destructive at the moment it is actually being clicked. */
.btn--bad-ghost {
  background: var(--surface);
  border-color: #f0c4c0;
  color: var(--danger);
  font-weight: 500;
}

.btn--bad-ghost:hover:not(:disabled) {
  background: #fdecea;
  border-color: currentColor;
}

/* --------------------------------------------------- icon row actions */

/* The sprite only holds <symbol> definitions; nothing in it should render. */
.sprite {
  display: none;
}

/* Compact action buttons: icon plus label, sized to sit inside a table row
   without stretching it. Outlined by default so a row of them reads as a
   toolbar rather than three competing calls to action. */
.iconbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.iconbtn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.iconbtn:hover:not(:disabled) {
  border-color: currentColor;
  background: var(--bg);
}

.iconbtn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.iconbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.iconbtn--ok {
  color: var(--ok);
  border-color: #bfe3cd;
}

.iconbtn--ok:hover:not(:disabled) {
  background: #e7f4ec;
}

.iconbtn--bad {
  color: var(--danger);
  border-color: #f0c4c0;
}

.iconbtn--bad:hover:not(:disabled) {
  background: #fdecea;
}

/* Replaces the buttons once a decision has been made. */
.reviewed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.reviewed svg {
  width: 13px;
  height: 13px;
}

/* Rejected and waiting on the partner. Carries the same amber as the Pending
   pill, so the row reads as one state: still open, but not the admin's move. */
.reviewed--waiting {
  color: var(--attention);
  font-weight: 600;
}

/* ------------------------------------------------ sweetalert2 branding */

.swal-popup {
  border-radius: 14px;
  padding-bottom: 8px;
}

.swal-title {
  font-size: 19px;
}

/* The default coloured ring belongs to SweetAlert's own icon set; this slot
   holds the Send-It mark instead, so the ring is dropped. */
.swal-icon-wrap {
  border: 0;
  margin: 12px auto 6px;
}

.swal-brand {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.swal-lead {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.swal-detail {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink-soft);
}

.swal-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* Mandatory rejection reason. */
.swal-field {
  margin: 4px 0 12px;
  text-align: left;
}

.swal-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* The required marker. Colour alone is not a signal, so the label also spells
   out that the field is the reason and the dialog refuses to submit without
   it — this is the visual shorthand, not the whole message. */
.req {
  color: var(--danger);
  font-weight: 700;
}

.swal-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}

.swal-textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}

.swal-hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* buttonsStyling is off, so the dialog uses .btn — this only spaces them. */
.swal2-actions {
  gap: 8px;
}

.btn--block {
  width: 100%;
}

/* Buttons that are actually links still need to look centred and clickable. */
.btn--center {
  text-align: center;
  text-decoration: none;
}

/* Row-sized. Matches `.iconbtn`'s padding and weight so the two tables in the
   panel read as the same control at the same size.

   Deliberately no `display` of its own: it used to say `inline-block`, which
   beat the base `.btn` rule on specificity order and left these the only
   buttons in the panel not centring their own label. */
.btn--sm {
  padding: 5px 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* ------------------------------------------------------- reference data */

/* Search on the left, "Add" pinned to the right of the same row. */
.refbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.refbar .search {
  margin-bottom: 0;
}

/* Keeps Edit/Delete together and stops the column stretching with the table. */
.table__actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.table__actions .btn + .btn {
  margin-left: 6px;
}

/* Stacks the modal's inputs; `.field` itself only lays out one label + input. */
.modal__body .field + .field {
  margin-top: 14px;
}

.field__hint {
  font-size: 12px;
  color: var(--ink-soft);
}

/* The footer is normally a note; with buttons in it, it becomes an action bar. */
.modal__foot--actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* -------------------------------------------------------------- pricing */

/* A titled block on the Pricing page — the settings form, the bands table and
   the preview are each one of these, so the page reads as three steps rather
   than one long form. */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.panel__lead {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* Money and count inputs are short; a full-width row for "$5.00" reads as a
   text field and invites a sentence. */
.fieldgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

/* The currency sign sits inside the input's border so the field is
   unambiguous without the label having to spell out the unit. */
.money {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
}

.money:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.money__sign {
  color: var(--ink-soft);
  font-size: 14px;
}

/* The border and focus ring belong to the wrapper, so the inner input drops
   both rather than drawing a second box inside the first. */
.money__input {
  border: 0;
  outline: 0;
  box-shadow: none;
  padding: 9px 0;
  width: 100%;
  font: inherit;
  color: inherit;
  background: transparent;
}

/* The worked example. Deliberately shaped like the app's price card, so an
   admin can compare it against the screen a customer sees. */
.preview {
  max-width: 420px;
}

.preview__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 7px 0;
}

.preview__row + .preview__row {
  border-top: 1px solid var(--border);
}

.preview__row--total {
  border-top: 2px solid var(--ink);
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 600;
  font-size: 16px;
}

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

.preview__detail {
  color: var(--ink-soft);
  font-size: 12px;
}

.preview__amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 720px) {
  .shell__body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar__foot {
    display: none;
  }

  .topbar__user {
    display: none;
  }
}

/* -------------------------------------------------------- driver reports */

.reports__reason {
  width: auto;
  min-width: 180px;
}

.reports__sub {
  font-size: 12px;
  color: var(--ink-soft);
}

/* A long note must not stretch the table; the full text is in the title
   tooltip and on the detail page. */
.reports__note {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reportdetail__back {
  margin: 0 0 6px;
  font-size: 14px;
}

.reportdetail__back a {
  color: var(--brand);
  text-decoration: none;
}

.reportdetail__pill {
  margin-left: 8px;
  vertical-align: middle;
}

.reportdetail__label {
  margin: 14px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.reportdetail__note {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------- legal pages */

/* The "In short" box spans the form under the two short fields. */
.legal__field {
  margin-bottom: 18px;
}

.legal__textarea {
  resize: vertical;
  line-height: 1.5;
}

/* A section's text runs to several paragraphs; room to read it while editing. */
.legal__textarea--tall {
  min-height: 200px;
}

/* Section modal — a little wider than the panel's default, for the text box. */
.legal__modal {
  width: min(760px, 100%);
}

/* The form sits between the panel and its header / body / footer, so it has
   to be the flex column itself. Without this the body cannot scroll and the
   footer with the Save button is cut off below the panel's max-height. */
.legal__modalform {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.legal__modalbody {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
}

/* The flex gap spaces the fields; the panel-wide `.field + .field` margin
   would double it. */
.legal__modalbody .field + .field {
  margin-top: 0;
}

/* No. and Heading side by side — the number only ever needs a few digits. */
.legal__row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
}

.legal__optional {
  font-size: 12px;
  color: var(--ink-soft);
  opacity: 0.8;
}

.legal__modal .modal__foot {
  padding: 12px 18px;
}

/* Table cells are `nowrap` panel-wide; these two columns hold sentences, so
   they wrap instead of running underneath the Edit / Delete buttons. */
.legal__heading {
  min-width: 180px;
  white-space: normal;
}

.legal__preview {
  min-width: 240px;
  white-space: normal;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Two lines of the text are enough to recognise a section; the rest is in
   the Edit modal. */
.legal__clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* ------------------------------------------------- pricing: address change */

/* The two stages side by side, so the rule reads at a glance before any input:
   free before pickup, a fee after it. */
.stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stage {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  background: linear-gradient(180deg, #f6fbf8 0%, var(--surface) 70%);
}

.stage--paid {
  background: linear-gradient(180deg, #f3f6fe 0%, var(--surface) 70%);
}

.stage__tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.stage__tag--free {
  background: #e7f4ec;
  color: var(--ok);
}

.stage__tag--paid {
  background: var(--brand-tint);
  color: var(--brand);
}

.stage__price {
  margin: 10px 0 8px;
  font-size: 26px;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stage__plus {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}

.stage__list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
}

.stage__list li + li {
  margin-top: 4px;
}

.stage__list strong {
  color: var(--ink);
}

/* The worked example under the form. Set apart with a dashed rule so it reads
   as a sandbox rather than as settings that get saved. */
.calc {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.calc__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 8px;
}

.calc__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
}

.calc__lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.calc__km {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.calc__km .field__input {
  width: 96px;
}

/* The address-change schedule, inside the Address change panel: a quieter
   heading than the panel's own, so it reads as part of the same card. */
.subpanel {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.subpanel__title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

/* "Over 30 km — $21 + $1/km": the rule past the last band, set in the form
   above rather than edited in the row, so it is drawn as a note. */
.table__note-row td {
  color: var(--ink-soft);
  font-style: italic;
  background: var(--bg);
}

/* ===========================================================================
   Delivery partners page
   ---------------------------------------------------------------------------
   Everything here is scoped under `.partners`, so the shared table, pill and
   switch styles the other pages use are untouched. Same tokens as the rest of
   the panel; no new palette.
=========================================================================== */

.partners .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- header: title on the left, search on the right ---- */

.partners__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.partners__lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.partners__lead strong {
  color: var(--ink);
}

.partners__search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.partners__field {
  position: relative;
  display: flex;
  align-items: center;
}

.partners__field svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--ink-soft);
  pointer-events: none;
}

.partners__field input {
  width: 280px;
  max-width: 60vw;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.partners__field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

/* ---- the table card ---- */

.partners__card {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.ptable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ptable th {
  padding: 11px 12px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ptable td {
  padding: 14px 12px;
  vertical-align: top;
}

.ptable .ptable__end {
  text-align: right;
}

/* One partner = one tbody: the row and its application panel divide and
   highlight together. */
.pgroup + .pgroup {
  border-top: 1px solid var(--border);
}

.pgroup:hover {
  background: #fbfcfd;
}

/* A deleted account is kept for the record but has nothing left to act on. */
.pgroup.is-deleted .pwho,
.pgroup.is-deleted .pmeta {
  opacity: 0.6;
}

.pgroup.is-deleted .pwho__avatar {
  background: #eef0f3;
  color: var(--ink-soft);
}

/* ---- partner: avatar, name, phone ---- */

.pwho {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 170px;
}

.pwho__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 15px;
  font-weight: 700;
}

.pwho__avatar svg {
  width: 18px;
  height: 18px;
}

.pwho__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pwho__name {
  font-weight: 600;
  color: var(--ink);
}

.pwho__name--none {
  font-weight: 500;
  font-style: italic;
  color: var(--ink-soft);
}

.pwho__phone {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pwho__verified {
  width: 14px;
  height: 14px;
  color: var(--ok);
}

.pwho__unverified {
  font-size: 11px;
  font-weight: 600;
  color: var(--attention);
}

/* ---- application: verdict pill and the facts under it ---- */

.pmeta {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.pmeta li {
  display: flex;
  /* Wraps on a narrow screen so the action buttons never get pushed off the card. */
  align-items: center;
  gap: 6px;
  min-width: 150px;
  line-height: 1.35;
}

.pmeta svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.pmeta .pmeta--warn {
  color: var(--attention);
  font-weight: 600;
}

/* Three small segments: how far through "Apply to drive" they got. */
.psteps {
  display: inline-flex;
  gap: 2px;
}

.psteps i {
  width: 8px;
  height: 4px;
  border-radius: 2px;
  background: #dfe3e8;
}

.psteps i.is-on {
  background: var(--brand);
}

/* ---- delivery modes ---- */

.partners .pmodes {
  gap: 7px;
}

.partners .switch__label {
  font-size: 13px;
}

/* An "on" switch reads as the stronger fact, so its label darkens too. */
.partners .switch__input:checked ~ .switch__label {
  color: var(--ink);
  font-weight: 500;
}

.partners .switch--sub {
  margin-left: 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.pnone {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---- account: status pill over the access switch ---- */

.paccount {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.paccount .pill {
  margin-right: 4px;
}

.pblock {
  margin: 0;
}

/* Blocking is the one switch where "on" is bad news, so it turns red. */
.pblock .switch__input:checked + .switch__track {
  background: var(--danger);
}

.pwho__joined {
  font-size: 12px;
  color: var(--ink-soft);
  opacity: 0.85;
  white-space: nowrap;
}

/* ---- actions ---- */

/* One line: the decision pair, then the icon group. */
.pactions {
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}

/* Approve / Reject. Approve is solid, because it is the move a pending row
   is waiting on; Reject is a soft tint that only goes solid under the pointer,
   so a row of them never reads as a column of alarms. */
.pbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.pbtn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

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

.pbtn:active {
  transform: translateY(1px);
}

.pbtn--approve {
  background: var(--ok);
  color: #fff;
  box-shadow: 0 1px 2px rgb(28 107 60 / 0.25);
}

.pbtn--approve:hover {
  background: #17593a;
  box-shadow: 0 3px 10px rgb(28 107 60 / 0.25);
}

.pbtn--reject {
  background: #fdecea;
  color: var(--danger);
}

.pbtn--reject:hover {
  background: var(--danger);
  color: #fff;
}

/* Documents + Details: two icon buttons joined into one control. */
.pseg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.pseg__btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.pseg__btn + .pseg__btn {
  border-left: 1px solid var(--border);
}

.pseg__btn svg {
  width: 16px;
  height: 16px;
}

.pseg__btn:hover {
  background: var(--bg);
  color: var(--brand);
}

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

.pactions__more {
  display: none;
}

.partners-js .pactions__more {
  display: grid;
}

.pactions__more svg {
  transition: transform 0.15s ease;
}

.pactions__more[aria-expanded='true'] {
  background: var(--brand-tint);
  color: var(--brand);
}

.pactions__more[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

/* ---- application panel ---- */

.ptable .pdetail > td {
  padding: 0 16px 12px;
}

/* With the script, the row's Details button is the toggle: the panel is
   hidden until it is pressed, and the <details> summary is not needed. */
.partners-js .pdetail:not(.is-open) {
  display: none;
}

.partners-js .pdetail .appdetail > summary {
  display: none;
}

.partners-js .pdetail > td {
  padding-top: 2px;
  padding-bottom: 16px;
}

.partners .appdetail__grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.partners .appdetail__grid section {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.partners .appdetail__none {
  padding: 4px 0;
}

@media (prefers-reduced-motion: reduce) {
  .pactions__more svg,
  .pbtn,
  .pseg__btn,
  .partners__field input {
    transition: none;
  }
}

@media (max-width: 720px) {
  .partners__search,
  .partners__field,
  .partners__field input {
    width: 100%;
    max-width: none;
  }

  .partners__field {
    flex: 1;
  }
}

/* The outer columns keep a little more air against the card's edge. */
.ptable th:first-child,
.ptable td:first-child {
  padding-left: 18px;
}

.ptable th:last-child,
.ptable td:last-child {
  padding-right: 18px;
}

/* ===========================================================================
   All orders — list and order page
   ---------------------------------------------------------------------------
   Scoped under `.orders`. Reuses the Delivery partners header, search and
   table card (`.partners__*`, `.ptable`) so the two lists read as one panel;
   everything new is built from the existing tokens — no new palette.
=========================================================================== */

.orders .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- status pill: five tones, one per kind of state ---- */

.opill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.opill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.opill--info { background: var(--brand-tint); color: var(--brand); }
.opill--ok   { background: #e7f4ec; color: var(--ok); }
.opill--warn { background: #fcf1e2; color: var(--attention); }
.opill--bad  { background: #fdecea; color: var(--danger); }
.opill--off  { background: #f0f1f3; color: var(--ink-soft); }

.opill--lg {
  padding: 5px 12px;
  font-size: 13px;
  vertical-align: middle;
}

/* ---- tabs: pills with a count ---- */

.orders__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.orders__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.orders__tab:hover {
  border-color: var(--brand);
  box-shadow: 0 1px 6px var(--brand-tint);
}

.orders__count {
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.orders__tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

.orders__tab.is-active .orders__count {
  background: rgb(255 255 255 / 0.22);
  color: var(--brand-ink);
}

/* "Needs attention" with something in it is the one tab that should shout. */
.orders__tab.is-alert:not(.is-active) .orders__count {
  background: #fdecea;
  color: var(--danger);
}

.orders__empty {
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--ink-soft);
}

.orders__empty p {
  margin: 4px 0;
}

.orders__empty strong {
  color: var(--ink);
}

/* ---- the list ---- */

.otable td {
  vertical-align: top;
}

.otable__row {
  border-top: 1px solid var(--border);
  transition: background 0.12s ease;
}

.otable__row:hover {
  background: #fbfcfd;
}

.otable__ref {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.otable__ref:hover {
  color: var(--brand);
}

.otable__name {
  font-weight: 600;
}

.otable__sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.otable__none {
  font-size: 13px;
  font-style: italic;
  color: var(--ink-soft);
}

.otable__tag {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

.otable__tag svg {
  width: 14px;
  height: 14px;
}

.otable__money {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.otable__open {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.otable__open:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.otable__open svg {
  width: 15px;
  height: 15px;
}

/* Pickup over drop-off, joined by the two dots the apps use. */
.otable__route {
  min-width: 220px;
  max-width: 340px;
}

.route {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.route + .route {
  margin-top: 3px;
}

.route__dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.route__dot--from {
  border: 2px solid var(--brand);
  background: var(--surface);
}

.route__dot--to {
  background: var(--ok);
}

.route__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

/* ===== order page ===== */

.odetail__back {
  margin: 0 0 14px;
}

.odetail__back a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.odetail__back a:hover {
  color: var(--brand);
}

.odetail__back svg {
  width: 16px;
  height: 16px;
}

/* ---- header card ---- */

.ohero {
  margin-bottom: 16px;
  padding: 22px 24px 20px;
  background:
    linear-gradient(135deg, var(--brand-tint), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.ohero__eyebrow {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.ohero__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 2px 0 4px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.ohero__meta {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.ohero__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.ohero__fact {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ohero__fact dt {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ohero__fact dd {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---- progress ---- */

.ostep {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.ostep__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

/* The line to the next step, drawn from this dot's centre. */
.ostep__item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 13px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--border);
}

.ostep__item.is-done:not(:last-child)::after {
  background: var(--ok);
}

.ostep__dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: #fff;
}

.ostep__dot svg {
  width: 14px;
  height: 14px;
}

.ostep__item.is-done .ostep__dot {
  border-color: var(--ok);
  background: var(--ok);
}

.ostep__item.is-done.ostep__item--bad .ostep__dot {
  border-color: var(--danger);
  background: var(--danger);
}

.ostep__item.is-current .ostep__dot {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-tint);
}

.ostep__item.is-current.ostep__item--warn .ostep__dot {
  border-color: var(--attention);
  box-shadow: 0 0 0 4px #fcf1e2;
}

.ostep__label {
  font-size: 13px;
  font-weight: 600;
}

.ostep__item.is-todo .ostep__label {
  color: var(--ink-soft);
  font-weight: 500;
}

.ostep__when {
  min-height: 16px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* ---- two columns ---- */

.odetail__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 1100px) {
  .odetail__grid {
    grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
  }
}

.odetail__main,
.odetail__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

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

.ocard {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.ocard__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
}

.ocard__meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.ocard__sub {
  margin: 16px 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ocard__empty {
  margin: 0;
  padding: 14px 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.ocard__hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---- facts: label left, value right ---- */

.ofacts {
  display: grid;
  grid-template-columns: minmax(110px, 40%) 1fr;
  gap: 8px 14px;
  margin: 0;
  font-size: 13.5px;
}

.ofacts dt {
  color: var(--ink-soft);
}

.ofacts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.ofacts--tight {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

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

.oroute {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The dashed line joining pickup to drop-off. */
.oroute::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 48px;
  left: 4px;
  border-left: 2px dashed var(--border);
}

.oroute__leg {
  position: relative;
  display: flex;
  gap: 14px;
}

.oroute__leg .route__dot {
  margin-top: 6px;
  width: 11px;
  height: 11px;
}

.oroute__body p {
  margin: 0;
}

.oroute__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.oroute__address {
  font-size: 15px;
  font-weight: 600;
}

.oroute__extra {
  font-size: 13px;
  color: var(--ink-soft);
}

.oroute__extra a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.oroute__extra svg {
  width: 13px;
  height: 13px;
}

.onote {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--attention);
  border-radius: 6px;
  background: #fdf6ec;
  font-size: 13px;
}

/* ---- photos ---- */

.ophotos + .ophotos {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ophotos__title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
}

.ophotos__caption {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.ophotos__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.ophotos__item {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

a.ophotos__item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgb(15 23 42 / 0.12);
}

.ophotos__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ophotos__item--missing {
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---- history ---- */

.otimeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.otimeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 12px;
  padding-bottom: 14px;
}

/* The rail between dots. */
.otimeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 0;
  left: 6px;
  width: 2px;
  background: var(--border);
}

.otimeline__dot {
  position: relative;
  margin-top: 5px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
  background: var(--brand);
}

.otimeline__item--ok .otimeline__dot { background: var(--ok); }
.otimeline__item--warn .otimeline__dot { background: var(--attention); }
.otimeline__item--bad .otimeline__dot { background: var(--danger); }
.otimeline__item--off .otimeline__dot { background: #c3c9d2; }

.otimeline__body p {
  margin: 0;
}

.otimeline__title {
  font-size: 14px;
  font-weight: 600;
}

.otimeline__detail {
  font-size: 13px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.otimeline__when {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- blocks: one door problem, one report ---- */

.oblock + .oblock {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.oblock__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.oblock__when {
  flex: 1;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.oblock__note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 13.5px;
  white-space: pre-wrap;
}

/* ---- small tables inside a card ---- */

.otable-wrap {
  overflow-x: auto;
  margin: 0 -20px -18px;
  border-top: 1px solid var(--border);
}

.ominitable td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

.ominitable th:first-child,
.ominitable td:first-child {
  padding-left: 20px;
}

.ominitable .ominitable__wrap {
  white-space: normal;
  min-width: 220px;
}

/* ---- people ---- */

.operson {
  display: flex;
  gap: 12px;
}

.operson + .operson {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.operson__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 700;
}

.operson__avatar--alt {
  background: #e7f4ec;
  color: var(--ok);
}

.operson__avatar--partner {
  background: #fcf1e2;
  color: var(--attention);
}

.operson p {
  margin: 0;
}

.operson__role {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.operson__name {
  font-weight: 600;
}

.operson__name--none {
  font-weight: 500;
  font-style: italic;
  color: var(--ink-soft);
}

.operson__line {
  font-size: 13px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.operson__link {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

/* ---- money ---- */

.omoney__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.omoney__row small {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
}

.omoney__row--sub {
  color: var(--ink-soft);
}

.omoney__row--total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
}

.olist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.olist__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.olist__item p {
  margin: 0;
}

.olist__title {
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.olist__sub {
  font-size: 12px;
  color: var(--ink-soft);
}

.olist__end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

/* ---- rating ---- */

.orating {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 2px;
  color: #d5d9df;
}

.orating .is-on {
  color: #f2a900;
}

@media (max-width: 720px) {
  .ostep {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 14px;
  }

  .ostep__item::after {
    display: none;
  }

  .otimeline__item {
    grid-template-columns: 14px 1fr;
  }

  .otimeline__when {
    grid-column: 2;
  }
}

/* ---------------------------------------------------------------------------
   Driver wallets

   Selects are styled here rather than anywhere earlier because this is the
   first screen in the panel to put one next to a text input. The native
   control is a different height and a different border from `.field__input`
   in every browser, so a row holding both lines up nowhere — which is exactly
   how the wallet forms first shipped.
   --------------------------------------------------------------------------- */

/* The native arrow and chrome are dropped, and an arrow is drawn as a
   background image instead, so the control is the same height and border as a
   text input in every browser. `padding-right` leaves room for it. */
select.field__input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23667081' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select.field__input:disabled {
  color: var(--ink-soft);
  background-color: var(--bg);
  cursor: not-allowed;
}

/* A row of fields that submits together — the adjustment form, the driver
   type, the payout hold. `align-items: end` so a field carrying a label still
   has its control level with the button beside it. */
.walletform {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.walletform .field {
  flex: 0 1 auto;
  min-width: 180px;
}

/* The one field that should take whatever room is left — a reason, a note. */
.walletform .field--grow {
  flex: 1 1 320px;
  min-width: 220px;
}

/* Buttons sit on the baseline of the inputs beside them rather than being
   stretched by `align-items: end`. */
.walletform .btn {
  flex: 0 0 auto;
  height: 38px;
}

/* An amount in a table: the sign carries the meaning, so the colour only
   reinforces it and is never the only cue. */
.amount--in {
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.amount--out {
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

/* A balance that has gone below zero — a deduction larger than what was
   there. Shown as owed rather than clamped to zero, so the next earnings
   visibly go against it. */
.balance--negative {
  color: var(--danger);
}

/* Money columns line up on the decimal point. */
.wallet-figure {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
