/* ==========================================================================
   The driver's Qaytarishlar and Statistika (driver.js). Only theme.css
   tokens, so light and dark follow by themselves. Two state colours, used
   the same way everywhere: amber = in his car, teal = on its way.
   ========================================================================== */

.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;
}

.dr-page { --dr-hand: var(--flag); --dr-hand-bg: var(--flag-bg);
           --dr-sent: var(--teal); --dr-sent-bg: var(--teal-bg); }
:root[data-theme="dark"] .dr-page { --dr-hand-bg: rgba(255, 159, 10, .16);
                                    --dr-sent-bg: rgba(100, 210, 255, .14); }
.dr-page .banner { margin-bottom: var(--s-3); }

/* ---- the car: product totals ------------------------------------------- */
.dr-hero {
  background: var(--card); border-radius: var(--radius-lg);
  padding: var(--s-4) var(--s-4) var(--s-3); margin-bottom: var(--s-3);
}
.dr-eyebrow {
  font-size: var(--fs-footnote); font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .04em;
}
.dr-hero-title { font-size: var(--fs-headline); font-weight: 600; margin-top: 2px; letter-spacing: -.01em; }
.dr-totals { list-style: none; margin: var(--s-3) 0 0; padding: 0; }
.dr-total { padding: 10px 0; border-top: var(--hairline) solid var(--line); }
.dr-total:first-child { border-top: 0; }
.dr-total-top { display: flex; align-items: baseline; gap: var(--s-3); }
.dr-total-name { flex: 1; min-width: 0; font-size: var(--fs-subhead); line-height: 1.3; overflow-wrap: anywhere; }
.dr-total-qty {
  font-size: var(--fs-title); font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.dr-meter {
  display: flex; height: 6px; margin-top: 8px; border-radius: 3px;
  background: var(--fill); overflow: hidden;
}
.dr-meter span { display: block; height: 100%; }
.dr-meter span { background: var(--dr-sent); border-radius: 3px; }
/* «Omborga topshirdim»: the card's one action, full width under the totals
   (18.11.2026) — a hairline above it so it reads as the card's foot. */
.dr-hand { margin-top: var(--s-2); padding-top: var(--s-3); border-top: var(--hairline) solid var(--line); }
.dr-hand-btn { margin-top: 0; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; }
.dr-hand-btn .ico { width: 18px; height: 18px; }
.dr-hand .dr-hint { margin-top: var(--s-2); }
.dr-hero-done .dr-eyebrow { color: var(--ok); }
.dr-hint {
  margin: var(--s-3) 0 0; font-size: var(--fs-caption);
  line-height: 1.4; color: var(--ink-soft);
}

/* ---- filter + sort bar -------------------------------------------------- */
.dr-bar { display: flex; gap: var(--s-2); align-items: center; margin: var(--s-2) 0 var(--s-3); }
.dr-seg { flex: 1; margin-top: 0; min-width: 0; }
.dr-seg button { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dr-sort { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; }
.dr-sort select {
  appearance: none; -webkit-appearance: none; height: 36px; padding: 0 30px 0 12px;
  border: 0; border-radius: 9px; background: var(--seg-bg); color: var(--ink);
  font: 500 var(--fs-footnote) var(--font); cursor: pointer;
}
.dr-sort .ico { position: absolute; right: 9px; width: 14px; height: 14px; pointer-events: none; color: var(--ink-soft); }

/* ---- an order's card ---------------------------------------------------- */
.dr-orders { display: flex; flex-direction: column; gap: var(--s-3); }
.dr-card {
  position: relative; background: var(--card); border-radius: var(--radius);
  padding: var(--s-3) var(--s-4); overflow: hidden;
}
.dr-card-head { display: flex; align-items: flex-start; gap: var(--s-3); }
.dr-card-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dr-client { font-size: var(--fs-headline); font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dr-meta, .dr-when { font-size: var(--fs-footnote); color: var(--ink-soft); }
.dr-state {
  flex: 0 0 auto; padding: 3px 9px; border-radius: 999px;
  font-size: var(--fs-caption); font-weight: 600; white-space: nowrap;
}
.dr-state.hand { background: var(--dr-hand-bg); color: var(--dr-hand); }
.dr-state.sent { background: var(--dr-sent-bg); color: var(--dr-sent); }
.dr-state.short { background: var(--danger-bg); color: var(--danger); }
.dr-state.handed { background: var(--ok-bg); color: var(--ok); }
.dr-card.handed .dr-line-qty { color: var(--ink-soft); }
.dr-card-note { margin: 6px 0 0; font-size: var(--fs-caption); color: var(--ink-soft); line-height: 1.4; }
.dr-lines { list-style: none; margin: var(--s-2) 0 0; padding: 0; }
.dr-lines li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s-3);
  padding: 8px 0; border-top: var(--hairline) solid var(--line);
}
.dr-line-name { font-size: var(--fs-subhead); line-height: 1.3; overflow-wrap: anywhere; }
.dr-line-qty { font-size: var(--fs-headline); font-weight: 700; font-variant-numeric: tabular-nums; }
.dr-line-note { grid-column: 1 / -1; font-size: var(--fs-caption); color: var(--danger); }
.dr-none { color: var(--ink-soft); font-size: var(--fs-subhead); text-align: center; padding: var(--s-6) 0; }

/* ---- empty -------------------------------------------------------------- */
.dr-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px var(--s-6) 40px; color: var(--ink-soft);
}
.dr-empty > .ico { width: 44px; height: 44px; color: var(--ok); margin-bottom: var(--s-3); }
.dr-empty.small { padding: 28px var(--s-4); }
.dr-empty.small > .ico { width: 30px; height: 30px; color: var(--ink-faint); }
.dr-empty-title { font-size: var(--fs-headline); font-weight: 600; color: var(--ink); }
.dr-empty-sub { font-size: var(--fs-footnote); line-height: 1.45; margin-top: 4px; max-width: 300px; }

/* ---- received in the last 7 days ---------------------------------------- */
.dr-got { margin-top: var(--s-5); background: var(--card); border-radius: var(--radius); overflow: hidden; }
.dr-got-head {
  display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: var(--tap);
  padding: 0 var(--s-4); border: 0; background: none; color: var(--ink);
  font: 500 var(--fs-subhead) var(--font); text-align: left; cursor: pointer;
}
.dr-got-head span:first-child { flex: 1; }
.dr-got-n { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dr-got-head .ico { width: 16px; height: 16px; color: var(--ink-soft); transition: transform var(--t-fast) var(--ease); }
.dr-got.open .dr-got-head .ico { transform: rotate(180deg); }
.dr-got-list { list-style: none; margin: 0; padding: 0 var(--s-4) var(--s-2); }
.dr-got-list li { padding: 10px 0; border-top: var(--hairline) solid var(--line); }
.dr-got-top { display: flex; align-items: baseline; gap: var(--s-2); }
.dr-got-top .dr-client { flex: 1; font-size: var(--fs-subhead); }
.dr-got-sub { font-size: var(--fs-footnote); color: var(--ink-soft); margin-top: 2px; line-height: 1.4; }
.dr-got-sub em { font-style: normal; color: var(--danger); }

/* ---- loading ------------------------------------------------------------ */
.dr-skel > div { background: var(--card); border-radius: var(--radius); margin-bottom: var(--s-3); }
.dr-skel-hero { height: 168px; }
.dr-skel-row { height: 88px; }
.dr-skel > div { animation: dr-pulse 1.2s var(--ease) infinite alternate; }
@keyframes dr-pulse { from { opacity: 1; } to { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .dr-skel > div { animation: none; }
}

/* ==========================================================================
   Statistika
   ========================================================================== */
.ds-ranges {
  display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(-1 * var(--s-4)) var(--s-3);
  padding: 2px var(--s-4); scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.ds-ranges::-webkit-scrollbar { display: none; }
.ds-chip {
  flex: 0 0 auto; height: 34px; padding: 0 14px; border: 0; border-radius: 17px;
  background: var(--fill); color: var(--ink); font: 500 var(--fs-footnote) var(--font);
  cursor: pointer; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ds-chip.active { background: var(--ink); color: var(--paper); }
.ds-custom { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-bottom: var(--s-3); }
.ds-custom label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-caption); color: var(--ink-soft); }
.ds-custom input {
  height: 40px; padding: 0 10px; border: 0; border-radius: var(--radius-field);
  background: var(--field); color: var(--ink); font: 16px var(--font); min-width: 0;
}
.ds-body { transition: opacity var(--t-fast) var(--ease); }
.ds-body.loading { opacity: .5; pointer-events: none; }

.ds-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.ds-kpi {
  background: var(--card); border-radius: var(--radius-lg); padding: var(--s-4);
  display: flex; flex-direction: column; gap: 6px;
}
.ds-kpi.lead:first-child { background: var(--hero); color: #fff; }
.ds-kpi.lead:first-child .ds-kpi-l { color: rgba(255, 255, 255, .78); }
.ds-kpi-n {
  font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ds-kpi-l { font-size: var(--fs-footnote); color: var(--ink-soft); font-weight: 500; }
.ds-span {
  margin: var(--s-5) var(--s-1) var(--s-2); font-size: var(--fs-footnote); font-weight: 600;
  color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em;
}
.ds-card { background: var(--card); border-radius: var(--radius); padding: var(--s-4); margin-bottom: var(--s-3); }
.ds-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4) var(--s-2); }
.ds-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-stat b { font-size: var(--fs-title); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ds-stat span { font-size: var(--fs-caption); color: var(--ink-soft); line-height: 1.25; }

.ds-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.ds-chart-title { font-size: var(--fs-subhead); font-weight: 600; }
.ds-chart-pick { font-size: var(--fs-footnote); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.ds-chart-pick.on { color: var(--ink); font-weight: 600; }
.ds-chart { display: block; width: 100%; height: 132px; overflow: visible; }
.ds-chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.ds-chart .hit { fill: transparent; cursor: pointer; }
.ds-chart .bar { fill: var(--accent); opacity: .42; transition: opacity var(--t-fast) var(--ease); }
.ds-chart .zero .bar { fill: var(--ink-faint); opacity: .5; }
.ds-chart .today .bar { opacity: 1; }
.ds-chart .picked .bar { opacity: 1; fill: var(--ink); }
.ds-axis {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: var(--fs-caption); color: var(--ink-soft); font-variant-numeric: tabular-nums;
}

.ds-tabs { margin: var(--s-5) 0 var(--s-3); }
.ds-tools { display: flex; gap: var(--s-2); margin-bottom: var(--s-3); }
.ds-search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 36px;
  padding: 0 10px; border-radius: var(--radius-field); background: var(--field); color: var(--ink-soft);
}
.ds-search .ico { width: 16px; height: 16px; flex: 0 0 auto; }
.ds-search input {
  flex: 1; min-width: 0; border: 0; background: none; color: var(--ink);
  font: 16px var(--font); outline: none; padding: 0;
}
.ds-count { font-size: var(--fs-caption); color: var(--ink-soft); margin: 0 var(--s-1) var(--s-2); }
.ds-rkind { margin: 0 0 var(--s-3); }
.ds-list { list-style: none; margin: 0; padding: 0 var(--s-4); background: var(--card); border-radius: var(--radius); }
.ds-row { display: flex; gap: var(--s-3); padding: 12px 0; border-top: var(--hairline) solid var(--line); }
.ds-row:first-child { border-top: 0; }
.ds-rank {
  flex: 0 0 22px; height: 22px; border-radius: 11px; background: var(--fill);
  font-size: var(--fs-caption); font-weight: 600; line-height: 22px; text-align: center;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.ds-row-main { flex: 1; min-width: 0; }
.ds-row-top { display: flex; align-items: baseline; gap: var(--s-2); }
.ds-name { flex: 1; min-width: 0; font-size: var(--fs-subhead); font-weight: 500; overflow-wrap: anywhere; line-height: 1.3; }
.ds-num { font-size: var(--fs-headline); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ds-num small { font-size: var(--fs-caption); font-weight: 500; color: var(--ink-soft); }
.ds-track { height: 4px; margin-top: 7px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.ds-track span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.ds-row-sub { font-size: var(--fs-caption); color: var(--ink-soft); margin-top: 5px; }
.ds-ret { color: var(--dr-hand); font-weight: 600; }
.ds-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ds-items span {
  padding: 4px 9px; border-radius: 8px; background: var(--fill);
  font-size: var(--fs-caption); color: var(--ink);
}
.ds-items b { font-variant-numeric: tabular-nums; }
.ds-ret-row .dr-state { align-self: flex-start; }

/* A computer: the totals and the orders side by side, stats in columns. */
@media (min-width: 980px) and (min-height: 600px), (min-width: 980px) and (pointer: fine) {
  .dr-page { max-width: 1040px; }
  #page-returns.dr-split:not(.hidden) {
    display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0 var(--s-5); align-items: start;
  }
  #page-returns.dr-split .dr-left { position: sticky; top: var(--s-4); }
  #page-returns.dr-split > .banner { grid-column: 1 / -1; }
  #page-returns.dr-split .dr-right > .dr-bar { margin-top: 0; }
  .ds-kpis { grid-template-columns: repeat(2, minmax(0, 260px)); }
  .ds-sum { grid-template-columns: repeat(6, 1fr); }
  .ds-chip:hover:not(.active) { background: var(--pressed); }
}
