/* Jyvery Régie — operations interface
 * A compact control room for support, dispatch and validation. The official
 * wordmark stays untouched; the interface borrows only its violet and orange.
 */

:root {
  --canvas: #f5f5f8;
  --canvas-deep: #ececf2;
  --surface: #ffffff;
  --surface-muted: #fafafd;
  --line: #e2e1e9;
  --line-strong: #c9c6d5;

  --rail: #191523;
  --rail-raised: #231d31;
  --rail-line: #342c45;
  --rail-text: #f7f4ff;
  --rail-muted: #aaa2b9;

  --violet: #5B40DD;
  --violet-dark: #432caf;
  --violet-deep: #2c1b7a;
  --violet-soft: #ece9ff;
  --violet-wash: #f7f5ff;
  --violet-ring: rgb(91 64 221 / 17%);

  --orange: #FBA004;
  --orange-ink: #855000;
  --orange-soft: #fff0d1;

  --ink-hi: #17131f;
  --ink: #322d3b;
  --ink-mid: #656071;
  --ink-low: #777183;

  --st-created: #5b6478;
  --st-accepted: #1769c2;
  --st-preparing: #6546cd;
  --st-ready: #855000;
  --st-assigned: #087267;
  --st-transit: #9b5a00;
  --st-done: #08734b;
  --st-canceled: #b4212a;
  --st-failed: #931821;

  --ok: #08734b;
  --warn: #855000;
  --bad: #b4212a;

  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 12px;
  --shadow-menu: 0 24px 70px rgb(20 15 30 / 28%);
  --shadow-dialog: 0 30px 90px rgb(20 15 30 / 25%);

  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sidebar-w: 248px;
  --topbar-h: 68px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; touch-action: manipulation; }
button, select, summary { cursor: pointer; }
a { color: var(--violet-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--violet); }
::selection { background: var(--violet); color: #fff; }
[hidden] { display: none !important; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-hi);
  box-shadow: var(--shadow-menu);
  transform: translateY(-150%);
  transition: transform 160ms ease-out;
}
.skip-link:focus { transform: none; }

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

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: var(--rail);
  color: var(--rail-text);
  border-right: 1px solid #100d17;
}

.sidebar__brand {
  min-height: 92px;
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--rail-line);
}
.sidebar__plate {
  flex: none;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.sidebar__plate img {
  display: block;
  width: auto;
  height: 32px;
}
.sidebar__product {
  min-width: 0;
  padding-left: 12px;
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--rail-line);
}
.sidebar__product strong {
  color: var(--rail-text);
  font-size: .82rem;
  font-weight: 720;
  letter-spacing: .01em;
}
.sidebar__product span {
  overflow: hidden;
  color: var(--rail-muted);
  font-size: .65rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar__nav {
  padding: 14px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar__group {
  margin: 18px 10px 6px;
  /* 4.83:1 on the rail. These are the smallest type on the surface and were
     at 4.32:1 — under AA, which uppercase micro-type on a dark ground reaches
     without anybody seeing it happen. */
  color: #88819c;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.sidebar__group--first { margin-top: 4px; }
.sidebar__nav a {
  position: relative;
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #c7c1d1;
  font-size: .86rem;
  font-weight: 560;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.sidebar__nav a:hover {
  border-color: var(--rail-line);
  background: var(--rail-raised);
  color: #fff;
}
.sidebar__nav a[aria-current="page"] {
  border-color: rgb(91 64 221 / 42%);
  background: rgb(91 64 221 / 20%);
  color: #fff;
  font-weight: 680;
}
.sidebar__nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset: 9px auto 9px -13px;
  width: 3px;
  background: var(--orange);
}
.sidebar__nav svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar__foot {
  margin-top: auto;
  padding: 16px 18px 18px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--rail-line);
  background: #15111d;
}
.sidebar__who { min-width: 0; display: grid; gap: 1px; }
.sidebar__who strong,
.sidebar__who span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sidebar__who strong { color: var(--rail-text); font-size: .78rem; font-weight: 650; }
.sidebar__who span { color: var(--rail-muted); font-size: .7rem; }
.sidebar__scopes { display: flex; flex-wrap: wrap; gap: 5px; }
.sidebar__scopes .tag {
  border-color: var(--rail-line);
  background: var(--rail-raised);
  color: #bbb4c8;
}
.sidebar__logout {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--rail-line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #d5cfdd;
  font-size: .76rem;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.sidebar__logout:hover { border-color: #554a68; background: var(--rail-raised); color: #fff; }
.sidebar__legal { display: flex; gap: 12px; font-size: .67rem; }
.sidebar__legal a { color: #8f879d; }
.sidebar__legal a:hover { color: #ddd7e5; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 clamp(16px, 2.5vw, 32px);
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
}
.menu-toggle { display: none; }
.topbar__search {
  position: relative;
  width: min(580px, 52vw);
  display: flex;
  align-items: center;
}
.topbar__search svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  pointer-events: none;
  fill: none;
  stroke: var(--ink-low);
  stroke-width: 1.7;
  stroke-linecap: round;
}
.topbar__search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 46px 9px 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink-hi);
  font-size: .86rem;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.topbar__search input::placeholder { color: var(--ink-low); }
.topbar__search input:hover { background: var(--surface); }
.topbar__search input:focus {
  outline: 0;
  border-color: var(--violet);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--violet-ring);
}
.topbar__search kbd {
  position: absolute;
  right: 10px;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-mid);
  font-family: var(--mono);
  font-size: .68rem;
  text-align: center;
  pointer-events: none;
}
.topbar__spacer { flex: 1; }
.topbar__time {
  padding-left: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.topbar__hint { color: var(--ink-low); font-size: .74rem; }
.topbar__clock {
  color: var(--ink-hi);
  font-family: var(--mono);
  font-size: .94rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
}
.topbar__clock small { color: var(--orange-ink); font-size: .9em; }

/* Content hierarchy ----------------------------------------------------- */

.main {
  width: min(1480px, 100%);
  margin-inline: auto;
  padding: clamp(24px, 3vw, 42px) clamp(18px, 3vw, 42px) 64px;
  animation: page-in 240ms ease-out both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(5px); }
}

.page-head {
  min-height: 62px;
  margin: 0 0 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.page-head > div:first-child { min-width: 0; flex: 1 1 340px; }
.page-head h1 {
  margin: 4px 0 0;
  color: var(--ink-hi);
  font-size: clamp(1.65rem, 2.7vw, 2.15rem);
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: -.038em;
}
.page-head .crumbs { margin: 0 0 5px; color: var(--ink-low); font-size: .76rem; }
.page-head .crumbs a { color: inherit; }
.page-head .subline {
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--ink-mid);
  font-size: .84rem;
}
.page-head__side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eyebrow {
  margin: 0;
  color: var(--orange-ink);
  font-size: .66rem;
  font-weight: 760;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 13px;
  color: var(--ink-hi);
  font-size: .92rem;
  font-weight: 720;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.small { font-size: .81rem; }
.muted { color: var(--ink-mid); }
.num { font-family: var(--mono); font-size: .94em; font-variant-numeric: tabular-nums; }
.sub { display: block; margin-top: 2px; color: var(--ink-mid); font-size: .74rem; }

/* Cards and information groups ----------------------------------------- */

.card {
  position: relative;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.admin-panels {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.admin-panels > .card { grid-column: span 6; }
.admin-panels > .card--wide { grid-column: 1 / -1; }
.card-row {
  min-height: 40px;
  padding: 9px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.card-row:last-child { border-bottom: 0; }
.card-row > :first-child { min-width: 0; }

/* Dashboard ------------------------------------------------------------- */

.page-head--dashboard { margin-bottom: 18px; }
.kpis {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.kpi {
  position: relative;
  min-height: 132px;
  padding: 19px 22px 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: inherit;
  text-decoration: none;
  transition: background 160ms ease;
}
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi::after {
  content: "";
  position: absolute;
  inset: auto 22px 0;
  height: 3px;
  background: var(--violet);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease-out;
}
.kpi:hover { background: var(--violet-wash); color: inherit; }
.kpi:hover::after { transform: scaleX(1); }
.kpi__label { color: var(--ink-mid); font-size: .77rem; font-weight: 650; }
.kpi__value {
  margin: 8px 0 5px;
  display: block;
  color: var(--ink-hi);
  font-family: var(--mono);
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -.04em;
}
.kpi__hint { color: var(--ink-low); font-size: .72rem; }
.kpi--warning .kpi__value { color: var(--warn); }
.kpi--danger .kpi__value { color: var(--bad); }
.kpi--success .kpi__value { color: var(--ok); }

.regie {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.regie__aside { display: grid; gap: 14px; }
.regie__aside .card-row { min-height: 36px; padding: 7px 0; }
.board-head {
  min-height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.board-head h2 { margin: 0; font-size: .9rem; }
.board-head .live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--orange-ink);
  font-size: .66rem;
  font-weight: 740;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.board-head .live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
  animation: live-pulse 1.8s ease-in-out infinite;
}

/* Real activity trace --------------------------------------------------- */

.trace {
  position: relative;
  height: 92px;
  margin: 0 0 16px;
  padding: 13px 18px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.trace__legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-low);
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.trace__legend strong { color: var(--orange-ink); font-weight: 760; }
.trace svg { display: block; width: 100%; height: 52px; }
.trace__area { fill: url(#trace-fill); }
.trace__line {
  fill: none;
  stroke: var(--orange);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: trace-draw 700ms ease-out forwards;
}
.trace__pin { fill: var(--orange); }
.trace__now { fill: var(--orange); animation: trace-now 2.4s ease-in-out infinite; }
@keyframes trace-draw { to { stroke-dashoffset: 0; } }
@keyframes trace-now {
  0%, 100% { opacity: .9; transform: scale(1); transform-origin: center; }
  50% { opacity: .35; transform: scale(1.7); transform-origin: center; }
}

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

.table-card { padding: 0; overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; scrollbar-width: thin; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.admin-table thead th {
  height: 43px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink-mid);
  font-size: .66rem;
  font-weight: 720;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr { transition: background 140ms ease; }
.admin-table tbody tr:hover td { background: var(--violet-wash); }
.admin-table td .sub { display: block; }
.admin-table .admin-actions { text-align: right; white-space: nowrap; }
.admin-table td.num, .admin-table th.num { text-align: right; }
.row-link { color: var(--ink-hi); font-weight: 680; text-decoration: none; }
.row-link:hover { color: var(--violet); text-decoration: underline; }

/* Status ---------------------------------------------------------------- */

.tag {
  width: max-content;
  max-width: 100%;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, currentColor 20%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 7%, var(--surface));
  color: var(--ink-mid);
  font-size: .69rem;
  font-weight: 680;
  line-height: 1.35;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}
.tag--plain::before { display: none; }
.tag--created { color: var(--st-created); }
.tag--accepted { color: var(--st-accepted); }
.tag--preparing { color: var(--st-preparing); }
.tag--ready, .tag--pending, .tag--warning, .tag--suspension { color: var(--st-ready); }
.tag--assigned { color: var(--st-assigned); }
.tag--in_transit { color: var(--st-transit); }
.tag--picked_up, .tag--delivered, .tag--active, .tag--open { color: var(--st-done); }
.tag--failed { color: var(--st-failed); }
.tag--canceled, .tag--suspended, .tag--ban, .tag--danger { color: var(--st-canceled); }
.tag--violet { color: var(--violet); }
.tag--lifted, .tag--expired { color: var(--ink-mid); }
.tag--preparing::before, .tag--in_transit::before { animation: live-pulse 1.8s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; transform: scale(.72); } }

/* Order journey --------------------------------------------------------- */

.track {
  --stops: 6;
  position: relative;
  width: 108px;
  height: 11px;
  margin-top: 6px;
  display: block;
}
.track::before,
.track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 2px;
  height: 2px;
  border-radius: 2px;
}
.track::before { right: 2px; background: var(--canvas-deep); }
.track::after {
  width: calc((var(--stop) - 1) / (var(--stops) - 1) * (100% - 4px));
  background: var(--track-color, var(--violet));
}
.track b {
  position: absolute;
  top: 1px;
  left: calc((var(--stop) - 1) / (var(--stops) - 1) * (100% - 8px));
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--track-color, var(--violet));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--track-color, var(--violet)) 18%, transparent);
}
.track[data-live] b { animation: live-pulse 1.7s ease-in-out infinite; }
.track[data-stop="1"] { --stop: 1; --track-color: var(--st-created); }
.track[data-stop="2"] { --stop: 2; --track-color: var(--st-accepted); }
.track[data-stop="3"] { --stop: 3; --track-color: var(--st-preparing); }
.track[data-stop="4"] { --stop: 4; --track-color: var(--st-ready); }
.track[data-stop="5"] { --stop: 5; --track-color: var(--st-assigned); }
.track[data-stop="6"] { --stop: 6; --track-color: var(--st-transit); }
.track--full { width: min(100%, 570px); height: 38px; margin: 13px 0 0; }
.track--full::before, .track--full::after { top: 7px; }
.track--full b { top: 4px; }
.track--full .track__stops {
  position: absolute;
  inset: 20px 0 auto;
  display: flex;
  justify-content: space-between;
  color: var(--ink-low);
  font-size: .61rem;
  font-weight: 560;
}
.track--full[data-stop="1"] .track__stops span:nth-child(1),
.track--full[data-stop="2"] .track__stops span:nth-child(2),
.track--full[data-stop="3"] .track__stops span:nth-child(3),
.track--full[data-stop="4"] .track__stops span:nth-child(4),
.track--full[data-stop="5"] .track__stops span:nth-child(5),
.track--full[data-stop="6"] .track__stops span:nth-child(6) { color: var(--track-color); font-weight: 760; }

/* Buttons and forms ----------------------------------------------------- */

.btn {
  min-height: 42px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--violet);
  border-radius: var(--radius-sm);
  background: var(--violet);
  color: #fff;
  font-size: .82rem;
  font-weight: 690;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.btn:hover { border-color: var(--violet-dark); background: var(--violet-dark); color: #fff; text-decoration: none; }
.btn:active { box-shadow: inset 0 1px 2px rgb(20 15 30 / 25%); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 700ms linear infinite;
}
@keyframes busy-spin { to { transform: rotate(1turn); } }
.btn.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.btn.secondary:hover { border-color: var(--violet); background: var(--violet-wash); color: var(--violet-dark); }
.btn.danger { border-color: #e6b6ba; background: var(--surface); color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: #fff5f5; color: #941821; }
.btn.small { min-height: 38px; padding: 7px 11px; font-size: .75rem; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.admin-filters {
  margin: 0 0 16px;
  padding: 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-muted);
}
.admin-filters .field { min-width: 170px; margin: 0; }
.field { margin: 0 0 14px; display: grid; gap: 6px; }
.field label {
  color: var(--ink-mid);
  font-size: .72rem;
  font-weight: 680;
}
.field input, .field select, .field textarea,
input.hours-field, select.small, select#new-rider {
  min-height: 42px;
  max-width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-hi);
  font-size: .86rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder, input.hours-field::placeholder { color: #8a8492; }
.field input:focus, .field select:focus, .field textarea:focus,
input.hours-field:focus, select.small:focus, select#new-rider:focus {
  outline: 0;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px var(--violet-ring);
}
.field .hint { color: var(--ink-mid); font-size: .72rem; }
input.hours-field { width: min(100%, 275px); font-family: var(--mono); font-size: .76rem; }

/* Feedback -------------------------------------------------------------- */

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .82rem;
}
.notice p { margin: 4px 0 0; }
.notice.error { border-left-color: var(--bad); background: #fff7f7; }
.notice.error strong { color: var(--bad); }
.notice.info { border-left-color: var(--violet); background: var(--violet-wash); }
.notice.info strong { color: var(--ink-hi); }
.notice.success { border-left-color: var(--ok); background: #f4fbf8; }
.empty {
  padding: clamp(42px, 8vw, 76px) 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 55%);
  color: var(--ink-mid);
  text-align: center;
}
.empty p { margin: 3px 0; }
.empty strong { color: var(--ink); }
.admin-tally { display: none; }
.pager { margin: 16px 0 0; }

/* Dialogs, timeline and secrets ---------------------------------------- */

dialog.app-dialog {
  width: min(500px, calc(100vw - 28px));
  max-height: min(86dvh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
}
dialog.app-dialog::backdrop { background: rgb(18 13 27 / 58%); backdrop-filter: blur(3px); }
.app-dialog form { padding: 22px; display: grid; gap: 2px; }
.app-dialog h3 { margin: 0 0 5px; color: var(--ink-hi); font-size: 1.1rem; }
.app-dialog .app-dialog__body { margin: 0 0 16px; color: var(--ink-mid); font-size: .84rem; }
.app-dialog .app-dialog__error { display: none; margin: 0 0 10px; color: var(--bad); font-size: .8rem; }
.app-dialog .app-dialog__error.is-visible { display: block; }
.app-dialog__actions { margin-top: 8px; display: flex; justify-content: flex-end; gap: 8px; }
.secret-box {
  margin: 8px 0;
  padding: 12px;
  display: block;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink-hi);
  font-family: var(--mono);
  font-size: .9rem;
  word-break: break-all;
}
.timeline { display: grid; }
.timeline__step { position: relative; padding: 2px 0 16px 22px; }
.timeline__step::before {
  content: "";
  position: absolute;
  top: 11px;
  bottom: -2px;
  left: 5px;
  width: 1px;
  background: var(--line-strong);
}
.timeline__step:last-child::before { display: none; }
.timeline__step::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  width: 11px;
  height: 11px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 2px var(--violet-soft);
}
.timeline__step--terminal::after { background: var(--ok); box-shadow: 0 0 0 2px #d8f3e7; }
.timeline__step--bad::after { background: var(--bad); box-shadow: 0 0 0 2px #f8dadd; }
.timeline__what { color: var(--ink-hi); font-size: .83rem; font-weight: 680; }
.timeline__what .muted { font-weight: 400; }
.timeline__meta { color: var(--ink-mid); font-size: .74rem; }

/* Login ----------------------------------------------------------------- */

body.admin-login-page {
  min-height: 100dvh;
  padding: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--rail);
}
.login-route {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-route::before {
  content: "";
  position: absolute;
  inset: -35% -20% auto auto;
  width: min(720px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgb(91 64 221 / 16%);
}
.login-route svg { width: 100%; height: 100%; }
.login-route path {
  fill: none;
  stroke: var(--orange);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1 8;
  opacity: .38;
}
.login-route path.login-route__road { stroke: #8d80a9; stroke-width: 2.2; stroke-dasharray: none; opacity: .12; animation: none; }
.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid #dedbe7;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}
.login-card .sidebar__plate { margin-bottom: 22px; }
.login-card .sidebar__plate img { height: 34px; }
.login-card h1 { margin: 0 0 5px; color: var(--ink-hi); font-size: 1.65rem; letter-spacing: -.035em; }
.login-card .lead { margin: 0 0 24px; color: var(--ink-mid); font-size: .86rem; }
.login-card .btn { width: 100%; margin-top: 4px; }
.login-foot { margin: 18px 0 0; color: var(--ink-low); font-size: .72rem; }

/* Responsive ------------------------------------------------------------ */

@media (max-width: 1180px) {
  .regie { grid-template-columns: 1fr; }
  .regie__aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-panels > .card { grid-column: span 12; }
}

@media (max-width: 940px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 300px);
    transform: translateX(-102%);
    transition: transform 190ms ease-out;
    box-shadow: var(--shadow-menu);
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgb(12 9 18 / 58%);
  }
  .menu-toggle {
    width: 42px;
    height: 42px;
    flex: none;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }
  .menu-toggle svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
  .topbar__search { width: min(560px, 62vw); }
}

@media (max-width: 700px) {
  :root { --topbar-h: 62px; }
  .topbar { padding-inline: 12px; gap: 9px; }
  .topbar__search { width: auto; flex: 1; }
  .topbar__search input { padding-right: 12px; }
  .topbar__search kbd, .topbar__spacer, .topbar__time { display: none; }
  .main { padding: 22px 14px 48px; }
  .page-head { align-items: flex-start; margin-bottom: 18px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-head__side { width: 100%; }
  .page-head__side .btn { flex: 1 1 auto; }
  .kpis { grid-template-columns: 1fr; }
  .kpi { min-height: 108px; }
  .kpi + .kpi { border-top: 1px solid var(--line); border-left: 0; }
  .regie__aside { grid-template-columns: 1fr; }
  .admin-filters { align-items: stretch; flex-direction: column; }
  .admin-filters .field { width: 100%; min-width: 0; }
  .admin-filters .row .btn { flex: 1; }
  .card { padding: 16px; }
  .card-row { align-items: flex-start; }
  .track--full .track__stops { font-size: .52rem; }
  .trace { height: 88px; padding-inline: 13px; }
  .trace__legend span:first-child { max-width: 55%; }
  .app-dialog form { padding: 18px; }
}

@media (max-width: 420px) {
  .sidebar__brand { min-height: 82px; }
  .login-card { padding: 24px 20px; }
  .page-head h1 { font-size: 1.7rem; }
  .track--full .track__stops span:nth-child(2),
  .track--full .track__stops span:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .trace__line { stroke-dasharray: none; stroke-dashoffset: 0; }
}

@media (forced-colors: active) {
  .sidebar, .sidebar__foot { border-color: CanvasText; }
  .btn, .card, .kpi, .tag, .notice, .menu-toggle { border: 1px solid ButtonText; }
}
