/* Откачка — фирменный стиль: мягкие тона, белые карточки, спокойный зелёный */
:root {
  --bg: #EDF1F6;
  --bg-soft: #F5F8FB;
  --card: #FFFFFF;
  --text: #1B1F23;
  --text-2: #4B5563;
  --muted: #7A8694;
  --line: #E3E9F0;
  --line-2: #EFF3F8;
  --primary: #2E9E62;
  --primary-hover: #278A55;
  --primary-soft: #E8F5EE;
  --blue: #2B7DE1;
  --blue-soft: #E9F1FC;
  --danger: #D2544C;
  --danger-soft: #FCECEB;
  --warn: #C98A16;
  --warn-soft: #FDF4E3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 43, 77, .06), 0 1px 8px rgba(23, 43, 77, .04);
  --nav-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── каркас ─────────────────────────────────────────── */
.app { max-width: 900px; margin: 0 auto; padding: 10px 12px calc(var(--nav-h) + 22px); }
.app--wide { max-width: 1180px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(150deg, #37B072, #2E9E62);
  color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center; letter-spacing: -.4px;
}
.topbar__title { font-weight: 650; font-size: 15px; line-height: 1.1; }
.topbar__sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--blue-soft);
  color: var(--blue); font-weight: 650; font-size: 13px; display: grid; place-items: center;
}

/* ── навигация ─────────────────────────────────────── */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none;
  padding: 6px 2px; font-weight: 500;
}
.bottomnav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bottomnav a.active { color: var(--primary); }
.bottomnav a:hover { text-decoration: none; }

/* ── карточки и секции ─────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 10px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.card__title { font-size: 15px; font-weight: 650; }
.card__link { margin-left: auto; font-size: 13px; }
.card__pad { padding: 14px; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 650; margin: 16px 4px 8px;
}

/* ── плитки показателей ────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .stats--4 { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 11px 12px;
}
.stat__label { font-size: 11.5px; color: var(--muted); letter-spacing: .1px; }
.stat__value { font-size: 19px; font-weight: 650; margin-top: 3px; letter-spacing: -.4px; }
.stat__value small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat--green .stat__value { color: var(--primary); }
.stat--warn .stat__value { color: var(--warn); }
.stat--blue .stat__value { color: var(--blue); }

/* ── кнопки ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; border: 0; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--sec { background: var(--primary-soft); color: var(--primary-hover); }
.btn--sec:hover { background: #DDF0E6; }
.btn--ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--bg-soft); }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--danger:hover { background: #F8DEDC; }
.btn--blue { background: var(--blue-soft); color: var(--blue); }
.btn--blue:hover { background: #DBE9FB; }
.btn--sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn--lg { min-height: 50px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* ── формы ─────────────────────────────────────────── */
.field { margin-bottom: 10px; }
.field__label { display: block; font-size: 12.5px; color: var(--text-2); margin: 0 0 5px 2px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #DCE4ED; border-radius: var(--radius-sm); background: #fff;
  font: inherit; color: var(--text); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 74px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46, 158, 98, .14);
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A8694' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }

/* ── сегменты (тип оплаты) ─────────────────────────── */
.segmented { display: flex; gap: 6px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  flex: 1; text-align: center; padding: 10px 6px; border-radius: var(--radius-sm);
  border: 1px solid #DCE4ED; font-size: 13px; font-weight: 550; color: var(--text-2);
  cursor: pointer; user-select: none; background: #fff;
}
.segmented input:checked + label {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-hover);
}

/* ── таблицы ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); padding: 9px 8px; background: var(--bg-soft);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFCFE; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--muted); }
.table--dense td { padding: 7px 6px; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--line); background: var(--bg-soft); }

/* ── значки ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--bg-soft); color: var(--text-2);
}
.badge--green { background: var(--primary-soft); color: var(--primary-hover); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--red { background: var(--danger-soft); color: var(--danger); }
.badge--gray { background: #F1F4F8; color: var(--muted); }

/* ── точки маршрута ────────────────────────────────── */
.point { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.point:last-child { border-bottom: 0; }
.point__num {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  background: var(--bg-soft); color: var(--muted); font-size: 12.5px; font-weight: 700;
  display: grid; place-items: center; margin-top: 1px;
}
.point--done .point__num { background: var(--primary-soft); color: var(--primary-hover); }
.point--skipped .point__num { background: #F1F4F8; color: var(--muted); }
.point__body { flex: 1; min-width: 0; }
.point__addr { font-weight: 600; font-size: 14.5px; }
.point__meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.point__money { font-weight: 650; margin-top: 5px; font-size: 14px; }
.point__side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.point__actions { display: flex; gap: 6px; margin-top: 8px; }
.point__actions .btn { flex: 1; }

/* ── прогресс ──────────────────────────────────────── */
.progress { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s ease; }
.bar { height: 8px; border-radius: 4px; background: var(--blue-soft); position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 4px; }

/* ── список «ещё» ──────────────────────────────────── */
.menu { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 13px 14px; border-bottom: 1px solid var(--line-2);
  color: var(--text); font: inherit; background: none; border-left: 0; border-right: 0; border-top: 0;
  text-align: left; cursor: pointer; text-decoration: none;
}
.menu a:last-child, .menu button:last-child { border-bottom: 0; }
.menu a:hover, .menu button:hover { background: var(--bg-soft); text-decoration: none; }
.menu__chev { margin-left: auto; color: #C3CBD6; font-size: 17px; }
.menu__icon { width: 30px; height: 30px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 15px; }

/* ── логин ─────────────────────────────────────────── */
.auth {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 20px 16px; background:
    radial-gradient(1200px 500px at 20% -10%, #DCEBFB 0%, transparent 60%),
    radial-gradient(900px 420px at 90% 10%, #E3F5EA 0%, transparent 55%),
    var(--bg);
}
.auth__box { width: 100%; max-width: 380px; }
.auth__brand { text-align: center; margin-bottom: 18px; }
.auth__logo {
  width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 10px;
  background: linear-gradient(150deg, #37B072, #2E9E62);
  display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(46, 158, 98, .28);
}
.auth__title { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.auth__sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth__card { background: var(--card); border-radius: 16px; box-shadow: 0 4px 24px rgba(23, 43, 77, .09); padding: 20px; }

/* ── уведомления ───────────────────────────────────── */
.alert { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; margin-bottom: 10px; }
.alert--error { background: var(--danger-soft); color: #A63A33; }
.alert--ok { background: var(--primary-soft); color: var(--primary-hover); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }
.alert--info { background: var(--blue-soft); color: #1F5FA8; }

/* ── мелочи ────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mt6 { margin-top: 6px; } .mt10 { margin-top: 10px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb6 { margin-bottom: 6px; } .mb10 { margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--line-2); margin: 10px 0; }
.pill-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tabs a {
  padding: 7px 13px; border-radius: 20px; background: #fff; color: var(--text-2);
  font-size: 13px; font-weight: 550; white-space: nowrap; border: 1px solid var(--line);
  text-decoration: none;
}
.pill-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv__k { color: var(--text-2); }
.kv__v { font-weight: 600; font-variant-numeric: tabular-nums; }
.total-line { display: flex; justify-content: space-between; font-weight: 700; padding: 10px 0 2px; }

dialog::backdrop { background: rgba(23, 43, 77, .35); }
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(480px, 92vw);
  box-shadow: 0 20px 60px rgba(23, 43, 77, .25);
}
dialog .card { margin: 0; box-shadow: none; }

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .app { padding: 8px 8px calc(var(--nav-h) + 18px); }
  .card { padding: 12px; border-radius: 12px; }
  .table { font-size: 12.5px; }
  .table th, .table td { padding: 8px 6px; }
  .stat__value { font-size: 17px; }
  .topbar { padding: 8px 10px; }
}
@media (min-width: 900px) {
  .bottomnav { border-radius: 16px 16px 0 0; left: 50%; right: auto; transform: translateX(-50%); width: 900px; border: 1px solid var(--line); border-bottom: 0; }
}

/* ── дополнения после дизайн-ревью ─────────────────── */
.app { padding-bottom: calc(var(--nav-h) + 34px); }

/* компактные метрики в одну строку (для диспетчера) */
.stats--compact { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats--compact .stat { padding: 8px 9px; border-radius: 10px; }
.stats--compact .stat__label { font-size: 10.5px; }
.stats--compact .stat__value { font-size: 15px; letter-spacing: -.2px; }
@media (max-width: 400px) {
  .stats--compact { grid-template-columns: repeat(2, 1fr); }
}

/* подсказка о горизонтальной прокрутке таблиц */
.scroll-hint { display: none; }
@media (max-width: 700px) {
  .scroll-hint { display: block; font-size: 11.5px; color: var(--muted); margin: 6px 2px 0; }
  .table-wrap { position: relative;
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%); }
}

/* затухание у ленты периодов */
.pill-tabs { mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent 100%); }

/* главная карточка «текущая точка» у водителя */
.hero {
  background: linear-gradient(150deg, #34A96A, #2E9E62);
  color: #fff; border-radius: 16px; padding: 16px; margin-bottom: 10px;
  box-shadow: 0 8px 22px rgba(46, 158, 98, .22);
}
.hero__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; opacity: .82; }
.hero__addr { font-size: 19px; font-weight: 700; margin: 6px 0 3px; line-height: 1.25; }
.hero__meta { font-size: 13px; opacity: .9; }
.hero__actions { display: flex; gap: 8px; margin-top: 12px; }
.hero__actions .btn { flex: 1; }
.hero .btn--on-green { background: #fff; color: var(--primary-hover); }
.hero .btn--on-green:hover { background: #F2FBF6; }
.hero .btn--ghost-on { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.hero .btn--ghost-on:hover { background: rgba(255,255,255,.24); }

/* кнопка «позвонить» */
.call {
  display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
  color: var(--blue); background: var(--blue-soft); border-radius: 8px; padding: 3px 8px;
}
.call:hover { text-decoration: none; background: #DEEBFB; }

/* крупнее зоны нажатия на телефоне */
@media (max-width: 560px) {
  .btn--sm { min-height: 38px; padding: 0 12px; }
  .btn--ghost.btn--sm { min-height: 38px; }
  .table .btn--sm { min-height: 34px; }
}
