/* ==========================================================================
   PathFlow web — design system
   Palette and type come from the PathFlow apps: green #1CE092 on near-black
   #131314, iOS-grey surfaces, Montserrat. The shell is always dark; the work
   surface inside it follows the light/dark theme.
   ========================================================================== */

:root {
  --green: #1ce092;
  --green-strong: #16b070;
  --green-soft: rgba(28, 224, 146, .14);
  --orange: #ffa130;
  --orange-soft: rgba(255, 161, 48, .16);
  --red: #ff5963;
  --red-soft: rgba(255, 89, 99, .14);
  --blue: #36b4ff;
  --blue-soft: rgba(54, 180, 255, .16);

  --shell: #131314;
  --shell-2: #1c1c1e;
  --shell-line: rgba(255, 255, 255, .08);
  --shell-text: #ebebf1;
  --shell-muted: #8e8e93;

  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-xl: 26px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:root,
:root[data-theme='light'] {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #ebebf1;
  --surface-3: #e5e5ea;
  --line: rgba(19, 19, 20, .08);
  --text: #131314;
  --text-2: #4a4a4f;
  --muted: #8e8e93;
  --glass: rgba(255, 255, 255, .82);
  --glass-line: rgba(255, 255, 255, .6);
  --shadow-s: 0 1px 2px rgba(19, 19, 20, .06), 0 2px 8px rgba(19, 19, 20, .05);
  --shadow-m: 0 8px 28px rgba(19, 19, 20, .12);
  --shadow-l: 0 24px 64px rgba(19, 19, 20, .22);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #1c1c1e;
  --surface: #2c2c2e;
  --surface-2: #3a3a3c;
  --surface-3: #48484a;
  --line: rgba(255, 255, 255, .09);
  --text: #f2f2f7;
  --text-2: #c7c7cc;
  --muted: #8e8e93;
  --glass: rgba(36, 36, 38, .82);
  --glass-line: rgba(255, 255, 255, .08);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-m: 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-l: 0 24px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---- reset ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--shell);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* ---- boot -------------------------------------------------------------- */

.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--shell-text); }
.boot__mark {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(28, 224, 146, .2); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
.boot__text { font-weight: 600; letter-spacing: .04em; color: var(--shell-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

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

.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100vh; background: var(--shell); }

.side { display: flex; flex-direction: column; padding: 22px 14px 16px; color: var(--shell-text); min-height: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 12px 22px; }
.brand__mark { width: 40px; height: 32px; object-fit: contain; flex: none; }
.brand__logo { height: 46px; width: auto; display: block; }
.auth__panel-logo { display: none; height: 40px; width: auto; margin-bottom: 22px; }
.brand__name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.brand__name b { color: var(--green); font-weight: 700; }

/* The active marker sits flush with the sidebar edge, outside the item: the
   negative margin widens the scroll box so it is not clipped. */
.nav { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--shell-line); padding: 16px 14px 0 0; margin-right: -14px; overflow: hidden auto; min-height: 0; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav__label { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #636366; padding: 16px 14px 7px; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-m);
  color: #aeaeb2; font-weight: 500; text-align: left; text-decoration: none;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav__item svg { width: 21px; height: 21px; transition: transform .25s var(--ease); }
.nav__item:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.nav__item:hover svg { transform: scale(1.08); }
.nav__item.is-active { background: var(--green-soft); color: var(--green); font-weight: 600; }
.nav__item.is-active::after {
  content: ''; position: absolute; right: -14px; top: 50%; translate: 0 -50%;
  width: 4px; height: 22px; border-radius: 4px 0 0 4px; background: var(--green);
}
.side__foot .nav__item.is-active::after { display: none; }
.nav__badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

.side__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--shell-line); display: grid; gap: 4px; }
.me { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-m); text-align: left; width: 100%; color: inherit; transition: background .18s var(--ease); }
.me:hover { background: rgba(255, 255, 255, .055); }
.me__avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; object-fit: cover; }
.me__name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__role { display: block; font-size: 11.5px; color: var(--shell-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__text { min-width: 0; }
.me { text-decoration: none; }

.main { position: relative; margin: 10px 10px 10px 0; border-radius: var(--radius-xl); background: var(--bg); overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.main__host { position: relative; flex: 1; min-height: 0; }
.view { position: absolute; inset: 0; overflow: auto; animation: view-in .35s var(--ease); }

/* support mode strip */
.viewas { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 9px 16px; background: var(--orange); color: #131314; font-size: 13px; font-weight: 600; flex: none; }
.viewas svg { width: 18px; height: 18px; flex: none; }
.viewas__text { flex: 1 1 240px; min-width: 0; }
.viewas .btn { background: #131314; color: #fff; border-color: transparent; }
.viewas-hint { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--text); font-size: 12.5px; line-height: 1.45; }
.viewas-hint svg { width: 18px; height: 18px; flex: none; color: var(--orange); margin-top: 1px; }
.view--map { overflow: hidden; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page { padding: 30px 34px 40px; max-width: 1320px; margin: 0 auto; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page__title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.page__sub { color: var(--muted); margin-top: 4px; }
.page__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* mobile top bar (only under 900px) */
.topbar { display: none; }

/* ---- primitives -------------------------------------------------------- */

.card { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-s); }
.card--pad { padding: 20px; }
.card__title { font-size: 15px; font-weight: 700; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-m);
  border-radius: var(--radius-l);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-m);
  font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s var(--ease), background .18s, box-shadow .18s, opacity .18s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--green); color: #0b2b1d; box-shadow: 0 6px 18px rgba(28, 224, 146, .32); }
.btn--primary:hover { background: #2ff0a3; }
.btn--danger { background: var(--red-soft); color: var(--red); }
.btn--danger:hover { background: rgba(255, 89, 99, .24); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: var(--radius-s); }
.btn--block { width: 100%; }
.btn--icon { width: 40px; padding: 0; }
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(11, 43, 29, .25); border-top-color: #0b2b1d; animation: spin .7s linear infinite;
}
.btn:not(.btn--primary).is-loading::after { border-color: var(--line); border-top-color: var(--text); }

.field { display: grid; gap: 7px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-m);
  background: var(--surface-2); border: 1.5px solid transparent; outline: none;
  transition: border-color .18s, background .18s;
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 90px; }
.input::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); background: var(--surface); }
.input--search { padding-left: 40px; background-repeat: no-repeat; background-position: 13px center; background-size: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.select { appearance: none; padding-right: 38px; background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; width: 100%; height: 100%; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 28px; background: var(--surface-3); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .22s var(--ease); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; }

.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-m); background: var(--surface-2); gap: 2px; }
.seg__btn { height: 34px; padding: 0 14px; border-radius: 11px; font-weight: 600; font-size: 12.5px; color: var(--text-2); transition: background .18s, color .18s, box-shadow .18s; white-space: nowrap; }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-s); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--plain::before { display: none; }
.pill--green { background: var(--green-soft); color: var(--green-strong); }
.pill--orange { background: var(--orange-soft); color: #c97a16; }
.pill--red { background: var(--red-soft); color: var(--red); }
.pill--blue { background: var(--blue-soft); color: #1b8fd6; }
:root[data-theme='dark'] .pill--green { color: var(--green); }
:root[data-theme='dark'] .pill--orange { color: var(--orange); }
:root[data-theme='dark'] .pill--blue { color: var(--blue); }

.empty { display: grid; justify-items: center; gap: 8px; padding: 46px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .55; margin-bottom: 6px; }
.empty__title { font-weight: 700; font-size: 15px; color: var(--text); }

.skeleton { border-radius: var(--radius-s); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

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

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.cell-main { font-weight: 600; max-width: 260px; }
.cell-sub { font-size: 12px; color: var(--muted); max-width: 260px; }
.thumb { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); object-fit: contain; flex: none; display: grid; place-items: center; color: var(--muted); }
.thumb svg { width: 22px; height: 22px; }

/* ---- overlay: modal / sheet / toast ------------------------------------ */

.scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(10, 10, 12, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-l); animation: pop .28s var(--ease); }
.modal--wide { width: min(760px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 26px 6px; }
.modal__title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.modal__sub { color: var(--muted); margin-top: 3px; font-size: 13px; }
.modal__body { padding: 16px 26px 8px; overflow-y: auto; display: grid; gap: 16px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 26px 24px; }
.modal__close { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.modal__close:hover { background: var(--surface-3); }
.modal__close svg { width: 16px; height: 16px; }

#toast-root { position: fixed; z-index: 80; bottom: 26px; left: 50%; translate: -50% 0; display: grid; gap: 10px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 16px; background: #1c1c1e; color: #fff; font-weight: 500; font-size: 13.5px; box-shadow: var(--shadow-l); animation: toast-in .3s var(--ease); max-width: min(520px, 90vw); }
.toast svg { width: 18px; height: 18px; }
.toast--ok svg { color: var(--green); }
.toast--err svg { color: var(--red); }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ---- auth -------------------------------------------------------------- */

.auth { height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr); background: var(--shell); overflow: hidden; }
.auth__hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; color: #fff;
  background:
    radial-gradient(900px 520px at 78% 8%, rgba(28, 224, 146, .22), transparent 60%),
    radial-gradient(700px 480px at 8% 96%, rgba(54, 180, 255, .13), transparent 60%),
    var(--shell); }
.auth__grid { position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 72%); -webkit-mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 72%); }
.auth__route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.auth__route path { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 6 12; opacity: .55; animation: dash 28s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -720; } }
.auth__ping { fill: var(--green); }
.auth__ping-ring { fill: none; stroke: var(--green); stroke-width: 2; transform-origin: center; transform-box: fill-box; animation: ping 2.4s var(--ease) infinite; }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
.auth__copy { position: relative; max-width: 520px; }
.auth__h { font-size: clamp(30px, 3.2vw, 44px); font-weight: 700; line-height: 1.12; letter-spacing: -.025em; }
.auth__h em { font-style: normal; color: var(--green); }
.auth__p { margin-top: 16px; color: #aeaeb2; font-size: 15px; max-width: 440px; }
.auth__stats { position: relative; display: flex; gap: 34px; flex-wrap: wrap; }
.auth__stat b { display: block; font-size: 22px; font-weight: 700; }
.auth__stat span { color: var(--shell-muted); font-size: 12.5px; }

.auth__panel { display: grid; place-items: center; padding: 32px; margin: 10px; border-radius: var(--radius-xl); background: var(--bg); overflow-y: auto; }
.auth__form { width: min(380px, 100%); display: grid; gap: 18px; }
.auth__title { font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.auth__lead { color: var(--muted); margin-top: -10px; }
.auth__link { color: var(--green-strong); font-weight: 600; font-size: 13px; justify-self: start; }
.auth__link:hover { text-decoration: underline; }
.auth__error { padding: 11px 14px; border-radius: var(--radius-m); background: var(--red-soft); color: var(--red); font-weight: 500; font-size: 13px; }
.auth__note { padding: 11px 14px; border-radius: var(--radius-m); background: var(--green-soft); color: var(--green-strong); font-weight: 500; font-size: 13px; }
.auth__legal { color: var(--muted); font-size: 12px; text-align: center; }

/* ---- live map ---------------------------------------------------------- */

.mapbox { position: absolute; inset: 0; background: var(--surface-2); }
.mapbox:not(.is-ready)::after {
  content: ''; position: absolute; z-index: 1; left: calc(50% - 17px); top: calc(50% - 17px); width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--green-soft); border-top-color: var(--green); animation: spin .8s linear infinite;
}
.mapboxgl-ctrl-bottom-left, .mapboxgl-ctrl-bottom-right { opacity: .75; }
.mapboxgl-map { font-family: var(--font); }

.fleet { position: absolute; top: 16px; left: 16px; bottom: 16px; width: 330px; display: flex; flex-direction: column; z-index: 3; overflow: hidden; transition: transform .35s var(--ease), opacity .25s; }
.fleet.is-collapsed { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.fleet__head { padding: 18px 18px 12px; display: grid; gap: 12px; }
.fleet__title { font-size: 17px; font-weight: 700; }
.fleet__count { color: var(--muted); font-weight: 500; font-size: 13px; }
.fleet__list { flex: 1; overflow-y: auto; padding: 2px 10px 12px; display: grid; gap: 4px; align-content: start; }
.fleet__filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 11px; border-radius: 14px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); transition: background .15s, color .15s; }
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--text); color: var(--bg); }

.dev { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; text-align: left; width: 100%; transition: background .15s; }
.dev:hover { background: var(--surface-2); }
.dev.is-selected { background: var(--green-soft); }
.dev__img { width: 46px; height: 46px; border-radius: 13px; background: var(--surface-2); object-fit: contain; flex: none; }
.dev.is-selected .dev__img { background: rgba(255, 255, 255, .6); }
.dev__name { font-weight: 600; font-size: 13.5px; }
.dev__meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dev__speed { margin-left: auto; text-align: right; flex: none; }
.dev__speed b { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dev__speed span { font-size: 10.5px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot--moving { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot--idle { background: var(--orange); }
.dot--parked { background: var(--blue); }
.dot--offline { background: #aeaeb2; }

.map-tools { position: absolute; top: 16px; right: 16px; z-index: 3; display: grid; gap: 8px; justify-items: end; }
.tool-group { display: grid; padding: 4px; border-radius: 16px; gap: 2px; }
.tool { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); transition: background .15s, color .15s; position: relative; }
.tool svg { width: 20px; height: 20px; }
.tool:hover { background: var(--surface-2); color: var(--text); }
.tool.is-active { background: var(--green); color: #0b2b1d; }
.tool[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; translate: 0 -50%; padding: 6px 10px; border-radius: 9px; background: #1c1c1e; color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; }

.style-menu { position: absolute; right: 58px; top: 0; padding: 8px; display: grid; gap: 4px; width: 190px; animation: pop .2s var(--ease); }
.style-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; font-weight: 500; text-align: left; }
.style-menu button:hover { background: var(--surface-2); }
.style-menu button.is-active { color: var(--green-strong); font-weight: 600; }
.style-menu i { width: 26px; height: 26px; border-radius: 8px; flex: none; border: 1px solid var(--line); }

.panel-toggle { position: absolute; top: 16px; left: 16px; z-index: 2; }

.detail { position: absolute; left: 362px; right: 74px; bottom: 16px; z-index: 3; padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 880px; transition: left .35s var(--ease); animation: pop .3s var(--ease); }
.fleet.is-collapsed ~ .detail { left: 16px; }
.detail__head { display: flex; align-items: center; gap: 13px; }
.detail__img { width: 54px; height: 54px; border-radius: 15px; background: var(--surface-2); object-fit: contain; flex: none; }
.detail__name { font-size: 16.5px; font-weight: 700; }
.detail__addr { font-size: 12.5px; color: var(--muted); }
.detail__actions { margin-left: auto; display: flex; gap: 6px; flex: none; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 8px; }
.metric { padding: 11px 13px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.metric__label { font-size: 11px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.metric__label svg { width: 14px; height: 14px; }
.metric__value { font-size: 17px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric__value small { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 2px; }

/* history markers — live vehicles are GPU layers, see map/fleet-map.js */

.stop-mk { width: 26px; height: 26px; border-radius: 50%; background: var(--orange); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.end-mk { width: 18px; height: 18px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.end-mk--start { background: var(--green); }
.end-mk--finish { background: var(--shell); }

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

.split { position: absolute; inset: 0; display: grid; grid-template-columns: 400px minmax(0, 1fr); }
.split__side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.split__head { padding: 26px 22px 14px; display: grid; gap: 14px; }
.split__scroll { flex: 1; overflow-y: auto; padding: 4px 22px 22px; display: grid; gap: 16px; align-content: start; }
.split__map { position: relative; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 13px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-s); }
.stat__label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.stat__value { font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

.timeline { display: grid; position: relative; }
.tl { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 0 0 6px; text-align: left; width: 100%; }
.tl::before { content: ''; position: absolute; left: 16px; top: 34px; bottom: -2px; width: 2px; background: var(--surface-3); }
.tl:last-child::before { display: none; }
.tl__icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; z-index: 1; }
.tl__icon svg { width: 17px; height: 17px; }
.tl--trip .tl__icon { background: var(--green-soft); color: var(--green-strong); }
.tl--stop .tl__icon { background: var(--orange-soft); color: #c97a16; }
.tl__body { padding: 9px 13px 11px; border-radius: 14px; transition: background .15s; margin-bottom: 6px; }
.tl:hover .tl__body { background: var(--surface); }
.tl.is-active .tl__body { background: var(--surface); box-shadow: var(--shadow-s); }
.tl__title { font-weight: 600; display: flex; justify-content: space-between; gap: 10px; }
.tl__time { color: var(--muted); font-weight: 500; font-size: 12.5px; font-variant-numeric: tabular-nums; flex: none; }
.tl__meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.player { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 3; padding: 12px 16px; display: flex; align-items: center; gap: 14px; }
.player__play { width: 42px; height: 42px; border-radius: 50%; background: var(--green); color: #0b2b1d; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px rgba(28, 224, 146, .35); }
.player__play svg { width: 18px; height: 18px; }
.player__time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 96px; }
.player__time small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.player__speed { font-weight: 700; font-size: 12.5px; padding: 0 10px; height: 32px; border-radius: 10px; background: var(--surface-2); flex: none; }
.range { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 6px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--green) var(--fill, 0%), var(--surface-3) var(--fill, 0%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--green); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--green); }

/* ---- alerts ------------------------------------------------------------ */

.alert-list { display: grid; }
.alert { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; transition: background .15s; }
.alert:last-child { border-bottom: 0; }
.alert:hover { background: var(--surface-2); }
.alert__icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.alert__icon svg { width: 20px; height: 20px; }
.alert__icon--green { background: var(--green-soft); color: var(--green-strong); }
.alert__icon--orange { background: var(--orange-soft); color: #c97a16; }
.alert__icon--red { background: var(--red-soft); color: var(--red); }
.alert__icon--blue { background: var(--blue-soft); color: #1b8fd6; }
.alert__title { font-weight: 600; }
.alert.is-unread .alert__title::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: 8px; vertical-align: middle; }
.alert__sub { font-size: 12.5px; color: var(--muted); }
.alert__time { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.day-head { padding: 18px 20px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar .select { height: 40px; width: auto; min-width: 180px; background-color: var(--surface); box-shadow: var(--shadow-s); }
.toolbar .input--search { min-width: 260px; }

/* ---- settings rows ----------------------------------------------------- */

.setting { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
/* The text block (after the icon, or first when there is no icon) takes the slack. */
.setting > :nth-child(2):not(.setting__ctrl),
.setting > :first-child:not(.setting__icon) { flex: 1; min-width: 0; }
.setting__icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.setting__icon svg { width: 19px; height: 19px; }
.setting__title { font-weight: 600; }
.setting__desc { font-size: 12.5px; color: var(--muted); }
.setting__ctrl { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.setting__ctrl .input { width: 96px; height: 38px; text-align: center; }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }

.geo { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; width: 100%; text-align: left; transition: background .15s; }
.geo:hover { background: var(--surface); }
.geo.is-selected { background: var(--surface); box-shadow: var(--shadow-s); }
.geo__swatch { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; color: #fff; }
.geo__swatch svg { width: 18px; height: 18px; }
.draw-hint { position: absolute; top: 16px; left: 50%; translate: -50% 0; z-index: 3; padding: 10px 16px; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 12px; white-space: nowrap; }

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

@media (max-width: 1100px) {
  .split { grid-template-columns: 340px minmax(0, 1fr); }
  .cols { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: var(--shell-text); }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; background: var(--shell); transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-l); }
  .side.is-open { transform: none; }
  .side-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .5); }
  .nav__item.is-active::after { display: none; }
  .main { margin: 0 6px 6px; border-radius: 20px; }
  .page { padding: 22px 16px 32px; }
  .page__title { font-size: 22px; }
  /* Live map on a phone: the list is an overlay you open and close, the map
     tools keep the top-right corner, the vehicle card is one compact strip. */
  .fleet { width: auto; left: 10px; top: 10px; right: 62px; bottom: auto; max-height: 62%; }
  .panel-toggle { left: 10px; top: 10px; }
  .map-tools { top: 10px; right: 10px; }
  .tool[data-tip]:hover::after { display: none; }
  .detail { left: 10px !important; right: 10px; bottom: 10px; padding: 12px; gap: 10px; }
  .detail__img { width: 44px; height: 44px; }
  .detail__head .row { flex-wrap: wrap; row-gap: 3px; }
  .detail__name { flex: 1 1 100%; font-size: 15px; }
  .detail__addr { display: none; }
  .detail__actions .btn__label { display: none; }
  .detail__actions .btn { width: 34px; padding: 0; }
  .metrics { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .metrics::-webkit-scrollbar { display: none; }
  .metric { flex: 0 0 104px; }
  .player { left: 10px; right: 10px; bottom: 10px; gap: 10px; }
  .player__time { min-width: 74px; }
  .draw-hint { left: 10px; right: 10px; translate: none; white-space: normal; flex-wrap: wrap; justify-content: center; }
  .split { grid-template-columns: 1fr; grid-template-rows: minmax(0, 46%) minmax(0, 1fr); }
  .split__side { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .split__head { padding-top: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth__hero { display: none; }
  .auth__panel-logo { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .toolbar .input, .toolbar .select, .toolbar .input--search { min-width: 0; flex: 1 1 160px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
