/* Доставка — additions to 001 (tokens.css, components.css). Nothing here redefines 001 tokens.
   Driver screens are built for one hand, gloves, sun and night: every target is at least 56 px, text at least 15 px. */
:root {
  --tap: 56px;          /* smallest target */
  --tap-main: 72px;     /* the one main action of a screen */
  --t-driver: 500 17px/1.35 var(--font);
  --t-big-num: 700 40px/1 var(--font);
  --r-btn: 16px;
}
/* outdoor contrast: in the light theme muted text is darker than in 001, lines are stronger */
[data-theme="light"] .d-app { --muted: #3f545d; --line: rgb(20 38 48 / .16); }

.sprite { display: none; }
.ic { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.d-app { max-width: 560px; margin: 0 auto; padding: 0 var(--pad) calc(var(--tap-main) + 40px + env(safe-area-inset-bottom)); font: var(--t-driver); }

/* top line: title and the connection state */
.d-top { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: var(--s2); min-height: 56px; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.d-top h1 { flex: 1; min-width: 0; font: 700 20px/1.2 var(--font); letter-spacing: var(--track-tight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn { width: var(--tap); height: var(--tap); margin-left: -14px; display: grid; place-items: center; border-radius: 14px; color: var(--accent); }
.net { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/1.2 var(--font); color: var(--muted); white-space: nowrap; }
.net i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.net.off { color: var(--warn); }
.net.off i { background: var(--warn); }

.d-date, .d-lead { color: var(--muted); margin: var(--s1) 0 var(--s4); }
.d-h { font: 700 18px/1.25 var(--font); margin: var(--s5) 0 var(--s3); letter-spacing: var(--track-tight); }

/* buttons: primary fills, ghost outlines; pressed state shows at once */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: 0 20px; border-radius: var(--r-btn);
  font: 700 17px/1.15 var(--font); text-align: center; transition: transform .12s var(--ease), background-color .2s; touch-action: manipulation; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.huge { min-height: var(--tap-main); width: 100%; font-size: 19px; margin-top: var(--s4); }
.btn.big { width: 100%; min-height: 60px; margin-top: var(--s2); }
.btn.done { box-shadow: inset 0 0 0 2px var(--ok); color: var(--ok); }
.btn.voice.on { color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

/* the bar of actions stays at the thumb */
.actbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: var(--s2); padding: var(--s3) var(--pad) calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--bg); box-shadow: 0 -1px 0 var(--line); }
.actbar .btn { flex: 1; min-height: 60px; }
.actbar .btn.primary { flex: 1.4; }
@media (min-width: 600px) { .actbar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); } }

/* Погрузка: how much of each ice to load, very large */
.loads { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.load { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: baseline; column-gap: var(--s2); padding: var(--s4);
  border-radius: var(--r-panel); background: var(--surface); }
.load-ic { color: var(--accent); align-self: center; }
.load-n { font: 600 15px/1.2 var(--font); color: var(--muted); }
.load-q { grid-column: 1 / -1; font: var(--t-big-num); letter-spacing: -.02em; margin-top: var(--s2); }
.load small { grid-column: 1 / -1; color: var(--muted); font: 500 14px/1 var(--font); }

/* stops */
.stops { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.st { display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: var(--s3) var(--s4); border-radius: var(--r-row); background: var(--surface); touch-action: pan-y; }
.st.dragging { position: relative; z-index: 3; box-shadow: 0 12px 28px -10px rgb(0 0 0 / .45); transition: none; }
.st-no { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font: 700 15px/1 var(--font); }
.st-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.st-main b { font: 650 17px/1.25 var(--font); }
.st-items { color: var(--muted); font-size: 15px; }
.st time { color: var(--muted); font: 600 15px/1 var(--font); }
.st.check { box-shadow: inset 4px 0 0 var(--warn); }
.grip { flex: none; width: 44px; height: var(--tap); margin: -8px 0 -8px -12px; display: grid; place-items: center; color: var(--faint); cursor: grab; touch-action: none; border-radius: 12px; }
.flag { display: inline-flex; align-items: flex-start; gap: 6px; font: 600 15px/1.3 var(--font); }
.flag .ic { width: 20px; height: 20px; }
.flag.warn { color: var(--warn); }
.flag.neg { color: var(--neg); }
.flag.ok { color: var(--ok); }

/* Выезд, Доставлено иначе, Завершить: one card per ice type with a stepper */
.takes { display: grid; gap: var(--s2); }
.takes.muted { opacity: .45; }
.take { padding: var(--s4); border-radius: var(--r-panel); background: var(--surface); display: grid; gap: var(--s3); }
.take-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s1) var(--s3); }
.take-h b { font: 700 18px/1.2 var(--font); }
.take-h span { color: var(--muted); font-size: 15px; }
.stepper { display: flex; align-items: center; gap: var(--s2); }
.stepper .step { width: var(--tap); padding: 0; background: var(--surface-2); color: var(--ink); }
.stepper output { min-width: 76px; text-align: center; font: var(--t-big-num); letter-spacing: -.02em; }
.stepper .quick { min-width: var(--tap); padding: 0 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.stepper .quick:first-of-type { margin-left: auto; }
.reserve { margin: var(--s4) 0 0; padding: var(--s3) var(--s4); border-radius: var(--r-row); background: var(--surface-2); }
.swaps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); color: var(--muted); font-size: 15px; }
.swaps > span { grid-column: 1 / -1; }
.chip-btn { min-height: var(--tap); padding: 0 18px; border-radius: var(--r-chip); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); font: 650 16px/1 var(--font); }
.chip-btn.sm { padding: 0 10px; font-size: 15px; }
.chip-btn.on { background: var(--ink); color: var(--bg); box-shadow: none; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.reasons .chip-btn.on { background: var(--neg); color: #fff; }

/* Рейс: what is in the car, the GPS slot, the next stop */
.stock { position: sticky; top: 56px; z-index: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 calc(var(--pad) * -1) var(--s3);
  padding: 0 var(--pad) var(--s2); background: var(--bg); box-shadow: 0 1px 0 var(--line); }
.stock-t { grid-column: 1 / -1; color: var(--muted); font: 600 13px/1.2 var(--font); }
.stock-i { display: grid; padding: 6px 10px; border-radius: 12px; background: var(--surface); min-width: 0; }
.stock-i b { font: 700 24px/1.1 var(--font); }
.stock-i small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-i b .u { margin-left: 3px; font: 600 13px/1 var(--font); color: var(--muted); }
.pop-acts.flip > :first-child { order: 2; } /* when it does not fit, the second trip is the main answer */
.stock-i.short { box-shadow: inset 0 0 0 2px var(--warn); }
.stock-i.short b { color: var(--warn); }
.stock-i.zero b { color: var(--neg); }
.gps { display: flex; align-items: center; justify-content: center; gap: var(--s2); height: 64px; border-radius: var(--r-row); color: var(--faint);
  border: 2px dashed var(--line); font: 500 14px/1.2 var(--font); }
.next { margin-top: var(--s3); padding: var(--s5) var(--s4) var(--s4); border-radius: 22px; background: var(--surface); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.next-k { color: var(--accent); font: 700 15px/1.2 var(--font); }
.next h2 { font: 750 28px/1.15 var(--font); letter-spacing: -.02em; margin-top: var(--s1); overflow-wrap: anywhere; }
.next-a { color: var(--muted); margin-top: var(--s1); }
.items { list-style: none; margin: var(--s4) 0; padding: 0; display: grid; gap: var(--s2); }
.item { display: flex; align-items: baseline; gap: var(--s2); }
.item-n { flex: 1; }
.item b { font: 700 20px/1 var(--font); }
.item.big b { font-size: 30px; }
.item small { color: var(--muted); font-size: 15px; min-width: 2em; }
.next .flag { margin-bottom: var(--s3); }
.next-tools { display: flex; gap: var(--s2); }
.next-tools .btn { flex: 1; min-width: 0; padding: 0 12px; }
.all-done { text-align: center; }

/* Заправка */
.pick { display: grid; gap: var(--s3); }
.btn.tile { min-height: 120px; flex-direction: column; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); font-size: 19px; }
.btn.tile .ic { width: 40px; height: 40px; color: var(--accent); }
.card-say { padding: var(--s4); border-radius: 22px; background: var(--surface); display: grid; gap: var(--s1); }
.fd { display: grid; grid-template-columns: 6.5em 1fr auto; align-items: baseline; gap: var(--s2); min-height: 52px; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.fd:last-child { border-bottom: 0; }
.fd span { color: var(--muted); }
.fd b { font: 700 22px/1.2 var(--font); }
.fd input { min-height: 48px; font: 700 20px/1 var(--font); color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 0 12px; min-width: 0; }
.fd input:focus { border-color: var(--accent); outline: none; }

/* Завершить */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.kpi { display: grid; gap: var(--s1); padding: var(--s3) var(--s4); border-radius: var(--r-row); background: var(--surface); }
.kpi span { color: var(--muted); font-size: 14px; }
.kpi b { font: 700 22px/1.15 var(--font); }
.kpi.neg b { color: var(--neg); }
.kpi.warn b { color: var(--warn); }

/* Дозаказ: a card over the trip, the answer is two thumbs away */
.scrim { position: fixed; inset: 0; z-index: 8; display: grid; align-items: end; background: rgb(8 16 20 / .5); animation: fade .2s both; }
.pop { margin: 0 auto; width: min(100%, 560px); padding: var(--s5) var(--pad) calc(var(--s4) + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; background: var(--surface);
  animation: rise .28s var(--ease) both; }
.pop h2 { font: 750 24px/1.2 var(--font); margin: var(--s1) 0; }
.pop-ice { color: var(--muted); margin-bottom: var(--s3); }
.pop-acts { display: grid; gap: var(--s2); margin-top: var(--s4); }
.pop-acts .btn { min-height: 64px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40%); opacity: 0; } }

/* the send queue speaks through one toast above the action bar */
.toast { position: fixed; left: 50%; bottom: calc(var(--tap-main) + 34px + env(safe-area-inset-bottom)); z-index: 9; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s2); width: max-content; max-width: min(520px, calc(100vw - 24px)); padding: 12px 16px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font: 600 15px/1.25 var(--font); box-shadow: 0 12px 30px -10px rgb(0 0 0 / .5); }
.toast b { padding: 3px 9px; border-radius: 99px; background: var(--warn); color: #1d1400; white-space: nowrap; }
.toast.sent .ic { color: var(--ok); }
.toast.pending .ic { color: var(--warn); }

/* states: no trip, closed, no access */
.state-box { min-height: 60vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: var(--s3); padding: var(--s5); }
.state-box h2 { font: 700 24px/1.2 var(--font); }
.state-box p { color: var(--muted); max-width: 30ch; }
.state-ic { width: 64px; height: 64px; color: var(--faint); stroke-width: 1.6; }
.state-ic.ok { color: var(--ok); }
.gate-like { min-height: 90vh; }

/* ---------- manager: Сегодня, Рейс, Статистика ---------- */
[data-role="manager"] .d-app { max-width: 1240px; font: var(--t-body); }
.d-top.m { flex-wrap: wrap; row-gap: 0; }
.d-top.m h1 { flex: none; }
.m-tabs { order: 3; flex-basis: 100%; display: flex; gap: var(--s1); padding-bottom: var(--s2); }
.m-tabs .btn { min-height: 44px; padding: 0 16px; font-size: 15px; color: var(--muted); border-radius: 12px; }
.m-tabs .btn[aria-current] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.d-top.m .net { margin-left: auto; }
.m-cols { display: grid; gap: 0 var(--s5); }
.trip-card { display: grid; gap: var(--s2); width: 100%; margin-bottom: var(--s2); padding: var(--s4); border-radius: var(--r-panel); background: var(--surface); text-align: left; }
.trip-card:hover { box-shadow: inset 0 0 0 2px var(--line); }
.tc-h { display: flex; align-items: center; gap: var(--s2); }
.tc-h b { font: 700 18px/1.2 var(--font); }
.tc-v { color: var(--muted); font-size: 14px; flex: 1; }
.tc-p { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); }
.tc-p b { font: 700 24px/1 var(--font); }
.tc-p > span:not(.chip) { color: var(--muted); }
.segs { display: flex; gap: 3px; }
.segs i { flex: 1; height: 8px; border-radius: 3px; background: var(--surface-2); }
.segs i.on { background: var(--accent); }
.segs i.now { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.tc-left { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font: 500 14px/1.3 var(--font); color: var(--muted); }
.tc-left .zero { color: var(--neg); }
.m-feed { list-style: none; margin: 0; padding: 0; }
.m-feed li { display: grid; grid-template-columns: 48px auto 1fr; gap: 2px var(--s2); padding: var(--s3) 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.m-feed time { color: var(--faint); font-weight: 600; }
.m-feed b { font-weight: 650; }
.m-feed .lv-err span { color: var(--neg); }
.m-feed .lv-warn span { color: var(--warn); }
.table-wrap { overflow-x: auto; border-radius: var(--r-panel); background: var(--surface); }
.m-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.m-table th { text-align: left; font: 600 13px/1.2 var(--font); color: var(--muted); padding: var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.m-table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
.m-table td b, .m-table td small { display: block; }
.m-table td small { color: var(--muted); font-size: 13px; }
.m-table .note-i { color: var(--warn); }
.m-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.m-table th:nth-child(n+4) { text-align: right; }
.fact-i { display: block; white-space: nowrap; }
.m-table.stats th:not(:first-child) { text-align: right; }
.m-table tr.diff { background: var(--neg-soft); }
.m-table tr.todo td { color: var(--muted); }
.m-table .neg { color: var(--neg); font-weight: 700; }
.m-table .warn { color: var(--warn); font-weight: 700; }
.period { display: flex; gap: var(--s2); margin: var(--s3) 0; }
.foot-note { color: var(--muted); font-size: 14px; margin-top: var(--s3); }
[data-role="manager"] .stock { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 var(--s3); padding: 0; box-shadow: none; }
.m-table .ok-t { color: var(--ok); }
@media (min-width: 900px) {
  .m-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .m-cols.wide-first { grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); }
  .d-top.m .m-tabs { order: 0; flex-basis: auto; padding: 0; margin-left: var(--s5); }
}

@media (prefers-reduced-motion: reduce) {
  .scrim, .pop { animation: none; }
  .btn { transition: none; }
}
