/* CommonTrack web: variant A of the MEDEO design (design/commontrack.dsai).
   Plain CSS with custom properties; every colour is a design token written
   once with light-dark(), so the theme follows prefers-color-scheme and
   <html data-theme> can pin it. Type scale: 11 / 12 / 15 / 22 / 40 / 72. */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  color-scheme: light dark;

  --land: light-dark(#F2F0EA, #242F3E);
  --panel: light-dark(#FFFFFFF5, #141D19F5);
  --sunken: light-dark(#F2F0EA, #0B110F);
  --ink: light-dark(#101A16, #E9EEE9);
  --ink-soft: light-dark(#3D4A44, #B9C2BC);
  --muted: light-dark(#5C6861, #93A39B);
  --line: light-dark(#E4E1D8, #2A3731);
  --rail: light-dark(#FFFFFF, #0B110F);
  --accent: light-dark(#C2410C, #FF7A2E);
  --accent-ink: light-dark(#9A3408, #FF8E4D);
  --accent-soft: light-dark(#FBE6D8, #3A1E0E);
  --on-accent: light-dark(#FFFFFF, #101A16);
  --ok: light-dark(#14683C, #4FCB87);
  --danger: light-dark(#C23B22, #FF7B63);

  --st-on-rent: light-dark(#1F5FD1, #6FA0FF);
  --st-on-rent-soft: light-dark(#DDE8FB, #13233F);
  --st-available: light-dark(#14683C, #4FCB87);
  --st-available-soft: light-dark(#DCEFE3, #10291C);
  --st-in-service: light-dark(#7E5000, #F0B84A);
  --st-in-service-soft: light-dark(#F6EBCF, #2E2409);
  --st-no-signal: light-dark(#565C59, #9AA49F);
  --st-no-signal-soft: light-dark(#E4E3DD, #1B2320);

  --map-road: light-dark(#FFFFFF, #26332E);

  --r-panel: 14px;
  --r-control: 8px;
  --r-sm: 6px;
  --control-h: 40px;
  --control-h-sm: 32px;
  --shadow: 0 1px 2px light-dark(#101A160F, #0000004D), 0 8px 24px light-dark(#101A1614, #00000059);

  --t-11: 11px;
  --t-12: 12px;
  --t-15: 15px;
  --t-22: 22px;
  --t-40: 40px;
  --t-72: 72px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--land);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--t-12);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
dl, dd { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tabular { font-variant-numeric: tabular-nums; }
.mono { letter-spacing: 0.02em; }
.small { font-size: var(--t-11); }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.pre { white-space: pre-wrap; }
.pad { display: block; padding: 10px 12px; }

/* ---- type ---------------------------------------------------------------- */

.eyebrow, .label {
  font-size: var(--t-11);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}
.h1 { font-size: var(--t-40); line-height: 1.1; letter-spacing: -0.02em; margin-top: 4px; }
.h2 { font-size: var(--t-22); line-height: 1.2; letter-spacing: -0.01em; margin-top: 4px; }
.section-title { margin: 24px 0 8px; }
.spaced { margin-top: 12px; }

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

.boot { position: fixed; inset: 0; background: var(--land); }

.app {
  display: grid;
  grid-template-columns: 60px 1fr;
  height: 100vh;
  overflow: hidden;
}

.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  gap: 4px;
  z-index: 2;
}
.rail__brand {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  margin-bottom: 20px;
}
.rail__group { display: flex; flex-direction: column; gap: 4px; }
.rail__spacer { flex: 1; }
.rail__item {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 120ms, color 120ms;
}
.rail__item:hover { background: var(--sunken); color: var(--ink); }
.rail__item.active { background: var(--accent-soft); color: var(--accent); }
.rail__avatar {
  margin-top: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sunken);
  border: 1px solid var(--line);
  font-size: var(--t-11);
  text-decoration: none;
  color: var(--ink-soft);
}

.stage { position: relative; overflow: hidden; }
.layer { position: absolute; inset: 0; padding: 16px; pointer-events: none; }

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

.map { position: absolute; inset: 0; background: var(--land); z-index: 0; }
.map__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--map-road) 2px, transparent 2px),
    linear-gradient(90deg, var(--map-road) 2px, transparent 2px);
  background-size: 160px 160px, 160px 160px;
  background-position: -1px -1px;
  opacity: 0.55;
}
.map--dim .map__grid { opacity: 0.3; }
.map-dot {
  display: block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px #101A1633;
  padding: 0;
}
.map > .map-dot, .map > .map-cluster, .map > .map-tip { position: absolute; }
.map > .map-dot { transform: translate(-50%, -50%); cursor: pointer; z-index: 1; }
.map > .map-dot:hover, .map-dot--picked { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); }
.map-cluster {
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--panel);
  border: 4px solid var(--st-on-rent);
  box-shadow: 0 2px 8px #101A1633;
  color: var(--ink);
  font-size: var(--t-12); font-weight: 600;
  padding: 0; cursor: pointer;
}
.map > .map-cluster { transform: translate(-50%, -50%); z-index: 2; }
.map-cluster--big { font-size: var(--t-15); }
.map-cluster--on-rent { border-color: var(--st-on-rent); }
.map-cluster--available { border-color: var(--st-available); }
.map-cluster--in-service { border-color: var(--st-in-service); }
.map-cluster--no-signal { border-color: var(--st-no-signal); }
.map-cluster:hover { filter: brightness(0.97); transform: translate(-50%, -50%) scale(1.06); }
.map-cluster__badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; border: 2px solid var(--panel);
  background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; line-height: 14px; text-align: center;
}
.map-tip {
  width: 250px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  border-radius: 10px;
  z-index: 3;
}
.map > .map-tip { transform: translate(18px, -50%); }
.map-tip--google { transform: translate(calc(50% + 14px), 50%); }
.map-tip__title { font-size: var(--t-15); font-weight: 600; }
.map-tip__accent { font-size: var(--t-11); color: var(--accent-ink); letter-spacing: 0.04em; }
.map-tip__line { font-size: var(--t-11); color: var(--muted); }
.map-tip__list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.map-tip .link { margin-top: 4px; }
.map-reset { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2; pointer-events: auto; }
.map__shapes { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map__zone circle, .map__zone polygon {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4;
}
.map__zone text { fill: var(--accent-ink); font-size: var(--t-11); font-family: inherit; font-weight: 600; }
.map__track { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.map__track-start { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }
.map__track-end { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.map-dot--on-rent { background: var(--st-on-rent); }
.map-dot--available { background: var(--st-available); }
.map-dot--in-service { background: var(--st-in-service); }
.map-dot--no-signal { background: var(--st-no-signal); }
.map-truck {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  color: #fff; background: var(--st-available);
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px #101A1666;
  cursor: pointer; transform: translateY(50%);
}
.map-truck:hover, .map-truck--picked { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent), 0 2px 6px #101A1666; }
.map-truck--on-rent { background: var(--st-on-rent); }
.map-truck--available { background: var(--st-available); }
.map-truck--in-service { background: var(--st-in-service); }
.map-truck--no-signal { background: var(--st-no-signal); }

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.split {
  display: flex;
  gap: 16px;
  height: 100%;
  align-items: flex-start;
  pointer-events: none;
}
.split > .panel {
  max-height: 100%;
  overflow: auto;
  padding: 24px;
  scrollbar-width: thin;
}
.list-panel { width: 660px; height: 100%; display: flex; flex-direction: column; }
.card-panel { width: 460px; height: 100%; }
.team-panel { width: 760px; }
.settings-panel { width: 620px; }
.stage-panel { width: 520px; display: flex; flex-direction: column; gap: 12px; }
.side-panel { width: 380px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

/* ---- controls ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h);
  padding: 0 16px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-size: var(--t-12);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-ink); }
.btn--secondary { background: var(--panel); color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn--secondary:hover:not(:disabled) { background: var(--sunken); }
.btn--sm { height: var(--control-h-sm); padding: 0 12px; }
.btn--wide { width: 100%; }

.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r-control);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.link, .link-btn {
  color: var(--accent-ink);
  text-decoration: none;
  background: none; border: 0; padding: 0;
  cursor: pointer;
  font-size: var(--t-12);
}
.link:hover, .link-btn:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.input {
  height: var(--control-h);
  width: 100%;
  padding: 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--sunken);
  font-size: var(--t-12);
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input--sm { height: var(--control-h-sm); }
.select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field-error { color: var(--danger); font-size: var(--t-11); }
.file-pick {
  flex: 1; min-width: 0;
  height: var(--control-h-sm); line-height: calc(var(--control-h-sm) - 2px);
  padding: 0 12px;
  border: 1px dashed var(--line); border-radius: var(--r-control);
  color: var(--muted); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-pick:hover { color: var(--ink); background: var(--sunken); }
input[type="file"]:focus-visible + .file-pick { outline: 2px solid var(--accent); outline-offset: 2px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-fields--invite { grid-template-columns: 1fr 180px; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.banner {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: var(--r-control);
  padding: 10px 12px;
  font-size: var(--t-12);
}

.search {
  display: flex; align-items: center; gap: 10px;
  height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--r-control);
  color: var(--muted);
}
.search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: 0;
  color: var(--ink);
  font-size: var(--t-12);
}
.search input::placeholder { color: var(--muted); }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.search--sunken { background: var(--sunken); border: 1px solid var(--line); margin-bottom: 16px; }

.seg-group { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; }
.seg-btn {
  height: var(--control-h-sm); padding: 0 16px;
  border: 0; border-right: 1px solid var(--line);
  background: transparent; cursor: pointer; font-size: var(--t-12);
}
.seg-btn:last-child { border-right: 0; }
.seg-btn.pressed { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ---- status: dot + uppercase word, never colour alone -------------------- */

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--t-11);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  white-space: nowrap;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status--on-rent, .seg--on-rent .dot, .chip--on-rent .dot { color: var(--st-on-rent); }
.status--available, .seg--available .dot, .chip--available .dot { color: var(--st-available); }
.status--in-service, .seg--in-service .dot, .chip--in-service .dot { color: var(--st-in-service); }
.status--no-signal, .seg--no-signal .dot, .chip--no-signal .dot { color: var(--st-no-signal); }

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

.center-stage {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  overflow: auto;
}
.auth-panel {
  position: relative;
  width: min(440px, 100%);
  padding: 32px;
  display: flex; flex-direction: column; gap: 20px;
}
.auth-panel .h1 { margin-top: 0; }
.brand-line { display: flex; align-items: center; gap: 10px; font-size: var(--t-15); }
.brand-square { width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--accent); }
.auth-foot { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-12); }

/* ---- overview ------------------------------------------------------------ */

.overview { position: absolute; inset: 0; pointer-events: none; }
.ov-top {
  position: absolute; top: 24px; left: 24px; right: 420px;
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
}
.search-wrap { width: 340px; display: flex; flex-direction: column; gap: 8px; }
.search-wrap .search { background: var(--panel); }
.search-hits { max-height: 360px; overflow: auto; padding: 6px; }
.hit {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  column-gap: 12px; padding: 8px 10px; border-radius: var(--r-control);
  text-decoration: none;
}
.hit .status { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.hit:hover { background: var(--sunken); }
.segbar { display: flex; overflow: hidden; }
.seg {
  display: flex; align-items: center; gap: 8px;
  height: var(--control-h);
  padding: 0 16px;
  border: 0; border-left: 1px solid var(--line);
  background: transparent; cursor: pointer;
}
.seg:first-child { border-left: 0; }
.seg:hover { background: var(--sunken); }
.seg.pressed { background: var(--accent-soft); }
.seg__count { font-size: var(--t-15); font-weight: 700; }
.seg__label { font-size: var(--t-11); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.attention {
  position: absolute; top: 24px; right: 24px;
  width: 360px; max-height: calc(100% - 48px);
  overflow: auto;
  padding: 16px 8px 8px;
}
.attention__head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 10px 10px; }
.attention__count { color: var(--accent); font-weight: 700; }
.attention .banner, .attention .loading, .attention .empty { margin: 0 10px 10px; }
.attention__list li + li { border-top: 1px solid var(--line); }
.attn {
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px;
  padding: 10px; border-radius: var(--r-control);
  text-decoration: none;
}
.attn[href]:hover { background: var(--sunken); }
.attn__title { font-weight: 600; }
.attn__when { color: var(--muted); font-size: var(--t-11); }
.attn__detail { grid-column: 1 / -1; color: var(--muted); font-size: var(--t-11); }
.attn--urgent, .attn--urgent[href]:hover { background: var(--accent-soft); }
.attn--urgent .attn__title { color: var(--accent-ink); }

.focal { position: absolute; left: 24px; bottom: 24px; padding: 20px 24px 18px; }
.focal__number {
  font-size: var(--t-72); line-height: 1; letter-spacing: -0.04em; font-weight: 500;
  margin: 10px 0 12px;
}
.focal__total { color: var(--muted); }

/* ---- trailers ------------------------------------------------------------ */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: var(--t-11);
  cursor: pointer;
}
.chip:hover { background: var(--sunken); }
.chip.pressed { background: var(--ink); color: var(--panel); border-color: var(--ink); font-weight: 700; }
.chip.pressed .dot { box-shadow: 0 0 0 1.5px var(--panel); }

.table-wrap { flex: 1; min-height: 0; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  position: sticky; top: 0;
  background: var(--panel);
  text-align: left;
  font-size: var(--t-11);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 10px;
}
.table td {
  height: 48px;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.table td a { text-decoration: none; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--sunken); }
.row-link:focus-within td, .row-link.selected td { background: var(--accent-soft); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; }

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

.back {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; margin-bottom: 16px;
}
.back:hover { color: var(--ink); }
.card-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.card-head .h1 { margin-top: 0; }
.card-head__meta { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  border: 0; background: none; cursor: pointer;
  padding: 10px 0;
  font-size: var(--t-11); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { display: flex; flex-direction: column; gap: 12px; }
.facts { display: flex; flex-direction: column; }
.fact {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.fact dd { text-align: right; }
.notes { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.upload { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.upload__row { display: flex; gap: 8px; align-items: center; }
.upload__row .select { width: 150px; flex: none; }
.docs .doc {
  display: grid; grid-template-columns: 16px 1fr auto auto; gap: 10px; align-items: center;
  padding: 6px 0; color: var(--ink-soft);
}
.doc__text { display: flex; flex-direction: column; min-width: 0; }
.doc__name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity .event { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }

/* ---- shared -------------------------------------------------------------- */

.share-group { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; }
.share-group__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.share-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  min-height: 44px; border-bottom: 1px solid var(--line);
}
.share-row .chips { margin: 0; gap: 4px; }
.share-row .chip { padding: 2px 8px; font-size: var(--t-11); cursor: default; }
.share-people { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; }
.from-owner { color: var(--muted); font-size: var(--t-11); font-weight: 400; display: block; }
.row-select { width: 28px; }
.row-select input { accent-color: var(--accent); }
.bulk-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }

/* ---- team ---------------------------------------------------------------- */

.person {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 140px 104px 100px 68px;
  gap: 12px; align-items: center;
  min-height: 59px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.person__who { display: flex; flex-direction: column; min-width: 0; }
.person__who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person__action { display: flex; justify-content: flex-end; gap: 4px; }
.person__scope { font-size: var(--t-12); white-space: nowrap; }
/* Trailer access: All / Selected, then the checklist. */
.scope-choice { display: flex; gap: 20px; flex-wrap: wrap; }
.picker__bulk { display: flex; gap: 12px; }
.viewers { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sunken); border: 1px solid var(--line);
  font-size: var(--t-11); color: var(--ink-soft);
}
.avatar--pending { color: var(--muted); }
.invite { display: flex; flex-direction: column; gap: 8px; padding: 16px; margin-bottom: 8px; background: var(--sunken); border-radius: var(--r-control); }
.invite .input { background: var(--panel); }
.roles-note { margin-top: 24px; }

/* ---- stage 2: shared pieces ---------------------------------------------- */

.eyebrow--accent { color: var(--accent-ink); }
.label--ok { color: var(--ok); }
.label--due { color: var(--danger); }
.status--muted { color: var(--muted); }
.status--danger { color: var(--danger); }
.dot--available { color: var(--st-available); }
.num { text-align: right; }
.table th.num { text-align: right; }
.due { color: var(--danger); font-weight: 600; }
.foot-note { margin-top: auto; padding-top: 24px; }
.head-actions { display: flex; gap: 8px; }
.list-panel--wide { width: 880px; }
.list-panel--mid { width: 760px; }
.link.small { font-size: var(--t-11); }
.prefs { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin-bottom: 8px; background: var(--sunken); border-radius: var(--r-control); }
.card-panel--wide { width: 520px; display: flex; flex-direction: column; }
.side-panel--wide { width: 420px; }
.tab-body--fill { flex: 1 0 auto; }
.btn--danger { background: var(--danger); color: var(--on-accent); }
.btn--danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn--grow { flex: 1; }
.link-btn--danger { color: var(--danger); }
.textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.row-fields--three { grid-template-columns: 1fr 1fr auto; align-items: end; }
.search--sm { height: var(--control-h-sm); margin-bottom: 8px; }

.rail__item { position: relative; }
.rail__badge {
  position: absolute; top: 3px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--rail);
}

/* In-app confirmation: inline, where the action was asked for. */
.confirm {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; margin: 8px 0;
  border: 1px solid var(--line); border-left: 3px solid var(--danger);
  border-radius: var(--r-control);
  background: var(--sunken);
}
.confirm--form { border-left-color: var(--ok); }
.confirm--form .input { background: var(--panel); }
.confirm__question { font-weight: 600; }
.confirm__actions { display: flex; gap: 8px; }
.confirm__actions--end { align-self: end; }
.row-confirm { border-bottom: 1px solid var(--line); }

/* Progress through a rental period. */
.meter { display: block; height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter__fill { display: block; height: 100%; border-radius: inherit; background: var(--st-on-rent); }
.meter__fill--done { background: var(--muted); }
.meter--thin { height: 3px; width: 100%; margin-top: 4px; }
.period { display: flex; flex-direction: column; min-width: 120px; }

.fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.toggles { display: flex; flex-direction: column; gap: 8px; }
.toggles--grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.toggle { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.toggle input { margin: 2px 0 0; accent-color: var(--accent); width: 14px; height: 14px; flex: none; }
.toggle__text { display: flex; flex-direction: column; }

/* Trailer pickers. */
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker__head { display: flex; justify-content: space-between; align-items: baseline; }
.picker__list { max-height: 220px; overflow: auto; border-top: 1px solid var(--line); }
.picker__error { padding: 6px 0; }
.pick {
  display: grid; grid-template-columns: 16px 8px 90px 1fr auto; gap: 10px; align-items: center;
  min-height: 40px; padding: 0 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.pick input { margin: 0; accent-color: var(--accent); }
.pick:hover { background: var(--sunken); }
.pick--on { background: var(--accent-soft); }
.pick:not(:has(.dot)) { grid-template-columns: 16px 90px 1fr auto; }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.total__sum { font-size: var(--t-22); font-weight: 500; }

/* ---- rental detail ------------------------------------------------------- */

.detail-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.detail-head .h1 { margin-top: 0; }
.detail-head__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.detail-head__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status-eyebrow { display: inline-flex; align-items: center; gap: 7px; }
.status-eyebrow.status--muted { color: var(--muted); }
.detail-foot { margin-top: auto; padding-top: 20px; display: flex; gap: 8px; }
.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-bottom: 4px; }
.money-cell { display: flex; flex-direction: column; gap: 4px; }
.money-cell__value { font-size: var(--t-22); font-weight: 500; letter-spacing: -0.01em; }
.money-cell__value--ok { color: var(--ok); }
.money-cell__value--due { color: var(--danger); }
.ledger__row {
  display: grid; grid-template-columns: 56px 1fr auto 72px; gap: 12px; align-items: center;
  min-height: 40px; border-bottom: 1px solid var(--line);
}
.ledger__row .status { justify-self: end; }
.ledger__row--payment { grid-template-columns: 56px 1fr auto 48px; }
.ledger__row--payment > :last-child { text-align: right; }
.trailer-line { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line); }
.trailer-line a { text-decoration: none; }
.card-head__rental { color: var(--st-on-rent); text-decoration: none; margin-top: 4px; }
.card-head__rental:hover { text-decoration: underline; }

/* ---- sharing ------------------------------------------------------------- */

.grant {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 130px 72px;
  gap: 12px; align-items: center; min-height: 60px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.grant--ended { opacity: 0.7; }
.grant__who, .grant__what { display: flex; flex-direction: column; min-width: 0; }
.grant__who > *, .grant__what > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grant__action { display: flex; justify-content: flex-end; }

/* ---- maintenance --------------------------------------------------------- */

.chip--overdue .dot { color: var(--danger); }
.task {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 84px 104px 80px;
  gap: 12px; align-items: center; min-height: 44px;
  border-bottom: 1px solid var(--line);
}
.task a { text-decoration: none; }
.task__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task__action { display: flex; justify-content: flex-end; }

/* ---- notifications ------------------------------------------------------- */

.inbox-panel { width: 520px; height: 100%; display: flex; flex-direction: column; }
.note { display: grid; grid-template-columns: 1fr 24px; align-items: center; border-bottom: 1px solid var(--line); }
.note__open {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0; border: 0; background: none; text-align: left; cursor: pointer; width: 100%;
}
.note__open:hover .note__title { text-decoration: underline; }
.note__icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sunken); border: 1px solid var(--line); color: var(--ink-soft);
}
.note__icon--urgent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.note__text { display: flex; flex-direction: column; min-width: 0; }
.note__text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note__title { color: var(--ink-soft); }
.note--unread .note__title { color: var(--ink); font-weight: 600; }
.note__title--urgent { color: var(--accent-ink); }
.note__dot { display: grid; place-items: center; width: 24px; height: 24px; border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; }

/* ---- empty and loading --------------------------------------------------- */

.empty { padding: 20px 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.empty__title { font-weight: 600; }
.loading { padding: 16px 0; }

/* ---- stage 3: overview live flag --------------------------------------- */

.focal__foot { display: flex; align-items: center; gap: 12px; }
.live-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.live-flag--on { color: var(--st-available); }
.live-flag--on .dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-flag--on .dot { animation: none; } }

/* ---- stage 3: shared pieces --------------------------------------------- */

.auth-aside { align-self: flex-end; margin-top: -8px; }
.notice { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r-control); background: var(--sunken); border: 1px solid var(--line); }
.notice--accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.notice--accent .muted { color: inherit; }
.settings-panel .notice--accent { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.notice__text { display: flex; flex-direction: column; gap: 2px; }
.section-title--first { margin-top: 0; }
.chips--tight { margin-bottom: 8px; }
.range { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.field--inline .input { width: 150px; }
.row-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.input--static { display: flex; align-items: center; background: transparent; border-style: dashed; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-panel--narrow { width: 440px; }
.table--compact td { height: 36px; }
.table--compact { margin-top: 4px; }
.gps-empty { padding: 4px 0 8px; }

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

.track { display: flex; flex-direction: column; gap: 10px; }
.track__svg { width: 100%; height: auto; display: block; }
/* The map draws the track when it is visible beside the card. */
.track__svg--narrow { display: none; }
@media (max-width: 900px) {
  /* The card covers the map here: draw the track in the card instead. */
  .track__svg--narrow { display: block; }
  .track__on-map { display: none; }
}
.track__land { fill: var(--land); stroke: var(--line); }
.track__line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.track__start { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }
.track__end { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.legs { list-style: none; margin: 0; padding: 0; }
.leg {
  display: grid; grid-template-columns: 70px 1fr; column-gap: 12px; row-gap: 2px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.leg__kind { grid-row: 1 / span 2; align-self: start; padding-top: 2px; }
.leg > :nth-child(3) { font-size: var(--t-11); }

/* ---- GPS integrations ---------------------------------------------------- */

.connections > .connection { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
/* Re-rendered parts of a row: their children lay out as the row's own. */
.connection__summary, .connection__trackers { display: contents; }
.connection__head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.connection__who { display: flex; flex-direction: column; min-width: 0; }
.connection__who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection__error { color: var(--danger); }
.connection__url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bind { padding: 12px; border-radius: var(--r-control); background: var(--sunken); display: flex; flex-direction: column; gap: 8px; }
.bind .input { background: var(--panel); }
.copy-row { display: flex; gap: 8px; align-items: center; }
.settings-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 16px; margin: 0; }
.settings-summary > div { display: flex; flex-direction: column; min-width: 0; }
.settings-summary dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions--inline { margin-top: 0; }
.provider-settings { border: 0; padding: 0; margin: 0; }
.provider-settings > legend { padding: 0; margin-bottom: 4px; }
.test-connection { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.test-result { margin: 0; padding: 8px 10px; border-radius: var(--r-control); border-left: 3px solid var(--line); background: var(--sunken); overflow-wrap: anywhere; }
.test-result--ok { border-left-color: var(--ok); color: var(--ok); }
.test-result--bad { border-left-color: var(--danger); }
.unmatched { display: flex; flex-direction: column; gap: 6px; }
.unmatched__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.unmatched__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.unmatched__bind { display: flex; gap: 8px; align-items: center; }
.input--sm { height: var(--control-h-sm); width: auto; min-width: 150px; }
.copy-row__value {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: var(--r-control);
  background: var(--sunken); border: 1px solid var(--line);
  overflow-wrap: anywhere; font-size: var(--t-11);
}
.code-block { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunken); padding: 10px; border-radius: var(--r-control); margin: 8px 0 0; font-size: var(--t-11); }

/* ---- geofences ----------------------------------------------------------- */

.zone {
  display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 12px; align-items: center;
  width: 100%; min-height: 56px; padding: 8px 8px; margin: 0 -8px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: none; text-align: left; cursor: pointer;
  box-sizing: content-box;
}
.zone:hover { background: var(--sunken); }
.zone--selected, .zone--selected:hover { background: var(--accent-soft); }
.zone--head { min-height: 0; padding-bottom: 6px; cursor: default; }
.zone--head:hover { background: none; }
.zone__text { display: flex; flex-direction: column; min-width: 0; }
.zone__text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone__inside { text-align: right; font-size: var(--t-15); font-weight: 600; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch__text { display: flex; flex-direction: column; }
.switch input {
  appearance: none; width: 32px; height: 18px; border-radius: 10px; margin: 0; flex: none;
  background: var(--line); position: relative; cursor: pointer; transition: background-color 120ms;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--panel); transition: transform 120ms;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:disabled { opacity: 0.6; cursor: default; }
.seg-btn:disabled { cursor: default; opacity: 0.7; }

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

.report-body { display: flex; flex-direction: column; flex: 1 0 auto; }
.fleet-strip { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; padding: 4px 0 8px; }
.fleet-strip__item { display: inline-flex; align-items: center; gap: 7px; }
.fleet-strip__item b { font-size: var(--t-15); color: var(--ink); }
.fleet-strip__item .label { color: var(--muted); }
.fleet-strip__total { font-size: var(--t-11); }
.report-table td { height: 40px; }
.util { display: grid; grid-template-columns: 1fr 52px; gap: 10px; align-items: center; min-width: 180px; }
.util__bar { height: 8px; }
.util__pct { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- platform admin ------------------------------------------------------ */

.admin { min-height: 100vh; display: flex; flex-direction: column; background: var(--land); }
.admin-bar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--rail); border-bottom: 1px solid var(--line);
}
.admin-bar__title { font-size: var(--t-15); font-weight: 600; }
.admin-bar__spacer { flex: 1; }
.admin-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; max-width: 1320px; width: 100%; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat__value { font-size: var(--t-40); line-height: 1.1; letter-spacing: -0.02em; }
.admin-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 8px 20px 12px; overflow: auto; }
.admin-section .table td { max-width: 320px; }
.admin .tabs { margin-bottom: 0; }

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .row-form { grid-template-columns: 1fr; }
  .split { flex-direction: column; }
  .list-panel, .list-panel--wide, .list-panel--mid, .card-panel, .team-panel, .settings-panel, .side-panel, .stage-panel, .inbox-panel { width: 100%; }
  /* A side form opens over its list, as a sheet: stacked below a full-height
     list it would sit outside the clipped stage, out of reach. */
  .split { position: relative; }
  .split > .side-panel { position: absolute; inset: 0; z-index: 1; max-height: none; }
  .panel-head { flex-wrap: wrap; align-items: flex-start; }
  .actions--inline { flex-wrap: wrap; }
  .ov-top { right: 24px; }
  .search-wrap { width: 100%; }
  .segbar { max-width: 100%; overflow-x: auto; }
  .attention { top: auto; bottom: 256px; left: 24px; right: 24px; width: auto; max-height: 40%; }
  .admin-bar > .muted { display: none; }
  .share-row { grid-template-columns: 1fr auto; padding: 6px 0; }
  .share-group__head { flex-wrap: wrap; }
}

/* ---- GPS freshness: last update and "Update now" ------------------------- */
.freshness {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--muted);
}
.freshness__when { color: var(--ink); }
.freshness--page { margin: 0 0 12px; }
.freshness--map {
  position: absolute; right: 408px; bottom: 24px;
  padding: 8px 10px 8px 12px;
}
.connection__freshness {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
@media (max-width: 1060px) {
  /* Above the focal number, clear of the attention list: beside the list
     there is no room for both the chip and the focal number. */
  .freshness--map { right: auto; left: 24px; bottom: 200px; }
}
@media (max-width: 600px) {
  /* Phones: the tracker table keeps its Unbind action in view. */
  .connection .table--compact th:nth-child(3), .connection .table--compact td:nth-child(3) { display: none; }
  .connection .table--compact td.mono { overflow-wrap: anywhere; }
}
