@font-face {
  font-family: Manrope;
  src: url("/brand/manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans KZ";
  src: url("/brand/noto-sans-kz.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #17242e;
  --paper: #eaf0f5;
  --white: #fff;
  --azure: #06b6d4;
  --link: #046f81;
  --muted: #455966;
  --line: #c7d2da;
  --hair: #dde5eb;
  --control: #8a9aa6;
  --info: #e1f5f9;
  --green: #11703f;
  --amber: #8f4e00;
  --warn-bg: #fff4e0;
  --warn-line: #ecd9b4;
  --warn-ink: #6b3a00;
  --error: #b42318;
  --error-bg: #fdecea;
  font-family: Manrope, "Noto Sans KZ", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3, p, dd, dt, li { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(26px, 6vw, 34px); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 19px; line-height: 1.3; font-weight: 700; }
h3 { margin: 0; font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--link); font-weight: 700; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-weight: 500; }
.ok { color: var(--green); font-weight: 700; }
.todo { color: var(--amber); font-weight: 700; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: 8px; top: -60px; z-index: 5; padding: 10px 14px; border-radius: 10px; background: var(--white); }
.skip:focus { top: 8px; }

/* Controls */
button, select, input, textarea { font: inherit; color: inherit; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--ink);
  font-weight: 700; line-height: 1.25; text-decoration: none; text-align: center;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--paper); color: var(--ink); }
button:disabled { cursor: wait; opacity: .6; }
.dark { border-color: var(--ink); background: var(--ink); color: var(--white); }
.dark:hover { background: #24343f; color: var(--white); }
.cta { min-height: 48px; padding: 0 22px; border-color: var(--azure); border-radius: 12px; background: var(--azure); font-size: 16px; font-weight: 800; }
.cta:hover { background: #15c6df; }
.link-btn {
  min-height: 44px; padding: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-align: left;
  justify-content: flex-start; align-self: flex-start;
}
.link-btn:hover { background: transparent; color: var(--ink); }
.link-btn.todo { color: var(--amber); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--link); outline-offset: 2px;
}
input, select, textarea {
  width: 100%; min-width: 0; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--control); border-radius: 10px;
  background-color: var(--white); color: var(--ink);
}
textarea { padding: 10px 12px; resize: vertical; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; padding: 0; accent-color: var(--link); flex: none; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.field > :is(input, select, textarea) { font-size: 15px; font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.pick { width: auto; min-height: 44px; max-width: 100%; border-color: var(--line); font-weight: 700; }
.segmented { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.segmented button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.stepper button { min-width: 44px; padding: 0; border: 0; background: transparent; font-size: 20px; }
.stepper button:hover:not(:disabled) { background: var(--paper); }
.stepper button:disabled { cursor: default; opacity: .35; }
.stepper span { min-width: 126px; padding: 0 4px; font-weight: 700; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border-radius: 999px; font-weight: 600; }
.chips button[aria-pressed="true"] { border-color: var(--info); background: var(--info); color: var(--link); font-weight: 700; }
.actions, .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions.end { justify-content: flex-end; }
.error { color: var(--error); font-weight: 600; }
.error:empty { display: none; }

/* Shell */
.top { background: var(--ink); color: var(--white); }
.top-inner, main, footer.wrap { max-width: 1320px; margin: 0 auto; }
.top-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 14px 24px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; }
.product { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
#nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 420px; }
#nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: 10px; color: var(--white); font-weight: 600; text-decoration: none;
}
#nav a:hover { background: #263640; }
#nav a[aria-current="page"] { background: var(--info); color: var(--link); font-weight: 700; }
.top :is(a, button):focus-visible { outline-color: var(--azure); }
.account { display: flex; gap: 8px; min-width: 0; }
.account button { border-color: #50616f; background: transparent; color: var(--white); font-weight: 600; white-space: nowrap; }
#account { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.account button:hover { background: #263640; color: var(--white); }
main { display: flex; flex-direction: column; gap: 20px; padding: 28px 24px 32px; }
main:focus { outline: 0; }
.page { display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.page-head.baseline { align-items: baseline; }
.page-head .lead { margin-top: 4px; }
.page-head.baseline .lead { margin: 0; }
footer.wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 0 24px 32px; color: var(--muted); font-size: 13px;
}
#notice {
  position: sticky; top: 8px; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid #bfe3ea;
  background: var(--info); color: var(--link); font-weight: 600;
}
#notice.success { border-color: #bfdccb; background: #e3f3e9; color: var(--green); }
#notice.error { border-color: #f2c4bf; background: var(--error-bg); color: var(--error); }

/* Surfaces */
.panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.panel.flush, .panel.map-panel, .panel.list-panel { padding: 0; overflow: hidden; }
.panel.accent { border: 2px solid var(--link); padding: 20px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.panel-head > a { display: inline-flex; align-items: center; min-height: 44px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 12px; }
.pad { padding: 16px 18px; }
.split { display: flex; flex-wrap: wrap; align-items: stretch; gap: 20px; }
.split.start { align-items: flex-start; }
.split > .wide { flex: 999 1 560px; min-width: 0; }
.split > .side { flex: 1 1 340px; min-width: 0; }
.split > .list-panel { flex: 1 1 380px; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--white);
  color: var(--ink); font-weight: 400; text-decoration: none;
}
a.card:hover { border-color: var(--link); color: var(--ink); }
.card .kicker { font-size: 13px; font-weight: 700; color: var(--amber); }
.card .kicker.ok { color: var(--green); }
.card .title { font-size: 17px; font-weight: 700; }
.card .desc { color: var(--muted); }
.card .more { margin-top: 4px; color: var(--link); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px; align-items: start; }
.dashed {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 14px 18px; border: 1px dashed #50616f; border-radius: 14px;
  background: transparent; color: var(--link); font-weight: 700; text-align: center; text-decoration: none;
}
.dashed.tall { min-height: 220px; border-radius: 18px; font-size: 19px; font-weight: 800; }
.dashed .muted { font-size: 15px; font-weight: 400; }
.pill { padding: 5px 10px; border-radius: 999px; background: var(--paper); color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.on { background: var(--info); color: var(--link); }
.pill.late { background: var(--warn-bg); color: var(--warn-ink); }
.note { padding: 14px 16px; border-radius: 12px; background: var(--paper); color: var(--muted); }
.panel > .note { background: var(--paper); }
.warn-box {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 18px;
  border: 1px solid var(--warn-line); border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink);
}
.warn-box strong { font-weight: 800; }
.warn-box ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.warn-box a { color: var(--warn-ink); }
.empty { padding: 32px 20px; color: var(--muted); text-align: center; }
.empty h3 { margin-bottom: 4px; color: var(--ink); font-size: 17px; }

/* Figures */
dl { margin: 0; }
dd { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { font-size: 22px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stats.tinted { padding: 16px; border-radius: 12px; background: var(--paper); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.stat-cards > div { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.stat-cards dt { color: var(--muted); font-size: 13px; }
.stat-cards dd { margin-top: 2px; font-size: 28px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-cards dd small { font-size: 15px; font-weight: 600; color: var(--muted); }
.pairs { display: flex; flex-direction: column; gap: 10px; }
.pairs > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pairs dt { color: var(--muted); }
.pairs dd { font-weight: 700; text-align: right; }
.pairs .zero :is(dt, dd) { color: var(--muted); font-weight: 400; }
.pairs .link-btn { min-height: 24px; text-align: right; }

/* Lists and tables */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--hair); }
.rows .day-head { padding: 10px 18px; background: #f4f7f9; color: var(--muted); font-size: 13px; font-weight: 700; }
.rows .plain { padding: 16px 18px; color: var(--muted); }
.rows a {
  display: flex; flex-direction: column; gap: 4px; min-height: 44px; padding: 14px 18px;
  color: var(--ink); font-weight: 400; text-decoration: none;
}
.rows a:hover { background: #f4f7f9; }
.rows a:focus-visible { outline-offset: -3px; }
.rows a[aria-current="true"] { background: var(--info); box-shadow: inset 4px 0 0 var(--link); }
.rows .line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.rows .line:first-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.rows a[aria-current="true"] .line:first-child { font-weight: 800; }
.rows .line:last-child > :first-child { color: var(--muted); }
.list-tools { padding: 12px 18px; border-bottom: 1px solid var(--hair); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
thead th { padding: 8px 12px; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
tbody td, tbody th { padding: 12px; border-top: 1px solid var(--hair); vertical-align: top; }
:is(th, td):first-child { padding-left: 0; }
:is(th, td):last-child { padding-right: 0; }
td small, th small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.num { text-align: right; }
tr[aria-current="true"] { background: var(--info); }
tr[aria-current="true"] td:first-child { padding-left: 12px; box-shadow: inset 4px 0 0 var(--link); }
tr[aria-current="true"] td:last-child { padding-right: 12px; }
td a, td .link-btn { min-height: 24px; }
.cell-label { display: none; }
table.wide-table { min-width: 940px; text-align: right; font-size: 16px; }
table.wide-table :is(th, td):first-child, table.wide-table :is(th, td):last-child { text-align: left; }
table.wide-table tbody th { min-width: 150px; font-weight: 700; }
table.wide-table tr.total :is(th, td) { border-top: 2px solid var(--ink); font-weight: 800; }

/* Today */
.map-panel { display: flex; flex-direction: column; }
.map-panel .panel-head { padding: 14px 18px 8px; }
.live-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 18px 12px; }
.live-toolbar .field { flex-direction: row; align-items: center; gap: 8px; }
.live-toolbar select { width: auto; min-height: 44px; }
#fix-state { margin-left: auto; padding: 5px 10px; border-radius: 999px; background: var(--paper); color: var(--muted); font-size: 13px; font-weight: 700; }
#fix-state.fresh { background: var(--info); color: var(--link); }
#fix-state.stale { background: var(--warn-bg); color: var(--warn-ink); }
#fix-state.failed { background: var(--error-bg); color: var(--error); }
#live-map, #history-map { display: block; width: 100%; border: 0; background: #dfe8ee; }
#live-map { height: 420px; flex: 1 1 auto; }
#track-caption { padding: 0 18px 16px; }
#track-caption:empty { display: none; }
#history-map { height: 340px; }
.live-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; padding: 14px 18px; border-top: 1px solid var(--hair); }
.live-info:empty { display: none; }
.live-info .metric-label { color: var(--muted); font-size: 13px; }
.live-info strong { font-weight: 700; }
.car-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 12px; }
.car-head p { margin-top: 2px; color: var(--muted); }
.card-grid .car-head h2 { font-size: 22px; font-weight: 800; }

/* Trip and receipt details */
.back { display: none; }
.bound { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 12px; background: var(--paper); }
.bound strong { font-size: 17px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1 1 240px; }
fieldset { margin: 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 700; }
legend + * { clear: both; }
details > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; color: var(--link); font-weight: 700; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+"; width: 14px; font-size: 18px; text-align: center; }
details[open] > summary::before { content: "−"; }
details[open] > summary { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.receipt { display: block; border: 1px solid var(--line); border-radius: 12px; background: #f4f7f9; overflow: hidden; }
.receipt img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.receipt.none { display: flex; align-items: center; justify-content: center; min-height: 160px; color: var(--muted); }
.amount { font-size: 22px; font-weight: 800; white-space: nowrap; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* Month */
.bars { display: flex; align-items: flex-end; gap: 6px; min-height: 200px; margin: 0; padding: 8px 0 0; list-style: none; overflow-x: auto; }
.bars li { flex: 1 0 34px; max-width: 110px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bars .value { font-weight: 700; font-size: 13px; white-space: nowrap; }
.bars .bar { width: 100%; min-height: 2px; border-radius: 6px 6px 0 0; background: var(--link); }
.bars .day { width: 100%; padding-top: 6px; border-top: 2px solid var(--ink); color: var(--muted); font-size: 13px; text-align: center; white-space: nowrap; }

/* Fleet */
.inset { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--paper); }
.code-box textarea { min-height: 96px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }

/* Dialogs */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: 92vh; margin: auto; padding: 24px;
  border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--white);
  box-shadow: 0 18px 60px #17242e40;
}
dialog::backdrop { background: #17242e91; }
dialog > form, dialog > .stack { display: flex; flex-direction: column; gap: 14px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head h2 { font-size: 22px; font-weight: 800; }
.close { min-width: 44px; padding: 0; font-size: 22px; line-height: 1; }
#direct-settings { padding-top: 8px; border-top: 1px solid var(--hair); }
#direct-settings > * + * { margin-top: 10px; }

@media (max-width: 720px) {
  .top-inner { padding: 12px 16px; gap: 10px 16px; }
  #nav { order: 3; flex-basis: 100%; gap: 2px; }
  #nav a { padding: 0 10px; }
  .account { flex: 1 1 0; justify-content: flex-end; }
  .account button { padding: 0 12px; }
  #account .role { display: none; }
  main { padding: 20px 16px 28px; gap: 16px; }
  .page { gap: 16px; }
  footer.wrap { padding: 0 16px 24px; }
  .panel { padding: 16px; border-radius: 16px; }
  .split { gap: 16px; }
  .toolbar { width: 100%; }
  .toolbar > .pick, .toolbar > .btn, .toolbar > button { flex: 1 1 150px; }
  .back { display: inline-flex; }
  #live-map { height: 320px; }
  #history-map { height: 260px; }
  #fix-state { margin-left: 0; }
  .stats dd { font-size: 20px; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cards dd { font-size: 22px; }
  .cta { flex: 1 1 auto; }
  dialog { padding: 18px; }
  /* Narrow tables become one card per record. */
  .stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stacked, .stacked tbody { display: block; }
  .stacked tbody tr { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px 14px; padding: 14px 0; border-top: 1px solid var(--hair); }
  .stacked tbody tr[aria-current="true"] { padding: 14px 10px; border-radius: 10px; }
  .stacked td > a { display: inline-flex; align-items: center; min-height: 44px; }
  .stacked .pill { display: inline-block; white-space: normal; }
  .stacked tbody td { padding: 0 !important; border: 0; box-shadow: none !important; text-align: left; }
  .stacked .cell-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
}
@media (max-width: 400px) {
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-cards > div { padding: 12px 14px; }
  .stepper span { min-width: 108px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .btn, #nav a, .rows a { transition: background-color .12s; }
}
