/* Визуальный стиль по мотивам mortrast.ru: Open Sans, чёрно-белая основа,
   фирменный красный акцент, тонкие рамки, почти без скруглений и теней. */

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(vendor/fonts/open-sans-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(vendor/fonts/open-sans-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;
}

:root {
  --text: #000;
  --text-2: #444;
  --muted: #999;
  --line: #e8e8e8;
  --line-strong: #bbb;
  --bg: #fff;
  --bg-soft: #f7f7f7;
  --red: #d5000b;
  --red-dark: #a71500;
  --red-darker: #8a1100;
  --red-soft: #fdeceb;
  --dark: #23272d;
  --dark-2: #2e333a;
  --radius: 6px;
  --container: 1140px;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--red-dark); text-decoration: none; }
a:hover { color: var(--red); }
b, strong { font-weight: 700; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .02em; }
.container { max-width: calc(var(--container) + 48px); margin: 0 auto; padding: 0 24px; }

/* ---------- Заголовки: тонкий текст + жирный акцент ---------- */
h1 { font-size: 36px; font-weight: 300; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 b { font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 16px; }
.lead { color: var(--text-2); margin: 10px 0 0; }

/* ---------- Фон рабочей области: танкер под затемнением ---------- */
/* Фиксированный псевдоэлемент вместо background-attachment: fixed — тот не работает на iOS */
.shell { position: relative; min-height: 100vh; isolation: isolate; }
.shell::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(rgba(10, 18, 30, .86), rgba(12, 27, 46, .80) 50%, rgba(10, 18, 30, .90)),
    url(img/login-bg.jpg) 70% 55% / cover no-repeat,
    #111a26;
}
.shell header { position: relative; z-index: 1; }

/* Всё, что лежит прямо на фото (вне белых карточек), — светлое */
.page-head h1 { color: #fff; }
.page-head .lead { color: rgba(255,255,255,.72); }
.page-head .lead .badge.off { border-color: rgba(255,160,150,.6); color: #ffb4ab; }
.back { color: rgba(255,255,255,.6); }
.back:hover { color: #fff; }
.page-head button:not(.cta) { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.page-head button:not(.cta):hover { background: rgba(255,255,255,.08); border-color: #fff; }
.page-head button.danger { color: #ffb4ab; border-color: rgba(255,140,130,.55); }
.page-head button.danger:hover { background: rgba(213,0,11,.18); border-color: #ff8a80; }
.page-head .cta .cta-arrow { border-color: rgba(255,255,255,.5); color: #fff; }
.page-head .cta:hover .cta-arrow { background: rgba(255,255,255,.08); }

/* ---------- Шапка ---------- */
.topbar { border-bottom: 1px solid var(--line); font-size: 13px; background: var(--bg); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-logo { display: block; height: 36px; width: auto; }
.brand-sep { width: 1px; height: 30px; background: var(--line-strong); }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.clock b { font-weight: 700; }
.user-chip { text-align: right; line-height: 1.25; }
.user-chip .role { color: var(--muted); font-size: 12px; }
.logout { border: none; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.logout:hover { color: var(--red); }

.navbar { background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.navbar .container { display: flex; gap: 4px; overflow-x: auto; }
.navbar a {
  color: var(--text); padding: 17px 10px 15px; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 15px;
}
.navbar a:hover { color: var(--red); }
.navbar a.active { border-bottom-color: var(--red); font-weight: 600; }

.page { padding: 48px 0 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 36px; flex-wrap: wrap; }
.back { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--red); }

/* ---------- Карточки и сетки ---------- */
.card { border: 1px solid var(--line); padding: 30px; margin-bottom: 30px; background: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.card.flush { padding: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.card-head h2 { margin: 0; }
.card.flush .card-head { padding: 24px 30px 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; margin-bottom: 30px; }
.grid-2 > .card { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 28px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }

/* «В цифрах»: плитки-счётчики, стыкуются рамками; первая/выбранная — красная */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid rgba(255,255,255,.28); margin-bottom: 30px; }
.stat {
  display: flex; align-items: center; gap: 16px; padding: 34px 30px; border: none; border-right: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.03); text-align: left; font: inherit; color: #fff; cursor: pointer; border-radius: 0;
}
.stat:last-child { border-right: none; }
.stat:hover { background: rgba(255,255,255,.09); }
.stat .num { font-size: 64px; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.stat .cap { font-size: 14px; line-height: 1.35; color: rgba(255,255,255,.8); }
.stat.on { background: var(--red); color: #fff; }
.stat.on .cap { color: #fff; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--bg-soft); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding-top: 12px; padding-bottom: 12px; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg-soft); }
tr.clickable:hover td:first-child { box-shadow: inset 2px 0 0 var(--red); }
td .sub { color: var(--muted); font-size: 13px; }

/* ---------- Кнопки ---------- */
button, .btn {
  font: inherit; font-size: 14px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  height: 42px; padding: 0 20px; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; transition: background .15s, border-color .15s, color .15s;
}
button:hover { border-color: var(--text); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--red-dark); border-color: var(--red-dark); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--red); border-color: var(--red); }
button.danger { color: var(--red-dark); border-color: #e7b9b3; }
button.danger:hover { background: var(--red-soft); border-color: var(--red-dark); }
button.small, .btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
button.icon { width: 34px; padding: 0; justify-content: center; }
button.link { border: none; height: auto; padding: 0; background: none; color: var(--muted); }
button.link:hover { color: var(--red); }

/* Фирменная кнопка: красная часть + квадратный сегмент со стрелкой */
.cta { display: inline-flex; height: 58px; padding: 0; border: none; background: none; gap: 0; border-radius: var(--radius); }
.cta:hover { border: none; }
.cta .cta-label {
  height: 100%; display: flex; align-items: center; padding: 0 30px; background: var(--red-dark); color: #fff;
  font-weight: 600; border-radius: var(--radius) 0 0 var(--radius); transition: background .15s;
}
.cta .cta-arrow {
  height: 100%; width: 58px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-2); transition: background .15s;
}
.cta:hover .cta-label { background: var(--red); }
.cta:hover .cta-arrow { background: var(--bg-soft); }
.cta:disabled .cta-label { background: var(--muted); }
.cta.compact { height: 46px; }
.cta.compact .cta-label { padding: 0 22px; }
.cta.compact .cta-arrow { width: 46px; }
.cta.on-dark .cta-arrow { border-color: rgba(255,255,255,.5); color: #fff; }
.cta.on-dark:hover .cta-arrow { background: rgba(255,255,255,.08); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Формы ---------- */
label.field { display: block; margin-bottom: 18px; }
label.field > span, .field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  font: inherit; width: 100%; height: 50px; padding: 0 18px; border: 1px solid #7f7f7f; border-radius: var(--radius);
  background: #fff; color: var(--text);
}
textarea { height: auto; padding: 12px 18px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red-dark); box-shadow: 0 0 0 3px rgba(167,21,0,.12); }
input:disabled { background: var(--bg-soft); color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red-dark); }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; cursor: pointer; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
.row > .no-grow { flex: none; }
select.inline { width: auto; height: 42px; }
.hint { color: var(--muted); font-size: 13px; margin: -10px 0 18px; }

/* ---------- Статусы ---------- */
.badge {
  display: inline-block; padding: 3px 12px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text-2); white-space: nowrap;
}
.badge.active, .badge.in_progress { background: var(--red); border-color: var(--red); color: #fff; }
.badge.planned { border-color: var(--text); color: var(--text); }
.badge.completed { background: var(--bg-soft); border-color: var(--line); color: var(--muted); }
.badge.cancelled { border-color: var(--line); color: var(--muted); text-decoration: line-through; }
.badge.off { border-color: #e7b9b3; color: var(--red-dark); }

/* ---------- Прохождение маршрута ---------- */
.progress-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.progress-head .num { font-size: 44px; font-weight: 300; line-height: 1; }
.progress-head .cap { color: var(--text-2); font-size: 14px; }
.progress { height: 4px; background: var(--line); margin-bottom: 18px; }
.progress > div { height: 100%; background: var(--red); transition: width .3s; }
.points { list-style: none; padding: 0; margin: 0; }
.points li { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.points li:last-child { border-bottom: none; }
.dot {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-strong); color: var(--text-2); flex-shrink: 0; background: #fff;
}
.dot.done { background: var(--red); border-color: var(--red); color: #fff; }
.points .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.points .time { font-weight: 600; }

/* ---------- Фото точек ---------- */
.thumb { display: block; width: 56px; height: 56px; padding: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
button.thumb:hover { border-color: var(--red-dark); }
button.thumb:hover img { transform: scale(1.06); }
.thumb-empty { display: grid; place-items: center; color: var(--line-strong); }
.photo-field { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 6px; }
.photo-preview { width: 120px; height: 120px; flex-shrink: 0; border: 1px solid var(--line); background: var(--bg-soft); display: grid; place-items: center; overflow: hidden; font-size: 13px; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
label.btn { cursor: pointer; }
.hint-inline { color: var(--muted); font-size: 12px; }
.lightbox-img { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--bg-soft); }
.badge.free { border-color: var(--line-strong); color: var(--text-2); margin-bottom: 6px; }

/* ---------- Лента окон расписания ---------- */
.rounds-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.round-cell {
  width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--text-2);
}
.round-cell.done { background: var(--red); border-color: var(--red); color: #fff; }
.round-cell.current { border: 2px solid var(--text); color: var(--text); }
.round-cell.missed { background: repeating-linear-gradient(135deg, #fff 0 4px, var(--red-soft) 4px 8px); border-color: #e7b9b3; color: var(--red-dark); }
.round-cell.upcoming { background: var(--bg-soft); border-color: var(--line); color: var(--muted); }
.round-cell.sel { outline: 2px solid var(--red-dark); outline-offset: 2px; }
.rounds-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.rounds-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rounds-legend .round-cell { width: 14px; height: 14px; display: inline-block; border-radius: 3px; }
.rounds-legend .round-cell.current { border-width: 2px; }

/* ---------- Нарушения, расписание, выбор маршрутов ---------- */
.text-red { color: var(--red-dark); }
.issues { color: var(--red-dark); font-size: 12px; margin-top: 4px; }
select.on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
select.on-dark option { color: var(--text); }
.schedule-route { padding: 14px 0; border-bottom: 1px solid var(--line); }
.schedule-route:first-of-type { padding-top: 0; }
.schedule-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.schedule-score { margin-left: auto; font-size: 13px; }
.round-cell.window { width: 30px; height: 30px; font-size: 11px; font-weight: 500; }
.round-cell.window.upcoming, .round-cell.window.missed { cursor: default; }
.route-group { border: 1px solid var(--line); padding: 12px 14px 2px; margin-top: 6px; }
.route-group-name { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.route-group .check { margin-bottom: 10px; align-items: flex-start; }

/* ---------- Чтение меток телефоном (Web NFC) ---------- */
.nfc-btn { height: 50px; }
.nfc-btn.on { border-color: var(--red-dark); color: var(--red-dark); }
/* Крутящийся индикатор — только пока телефон ждёт метку */
.nfc-btn.on::before {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%;
  border-right-color: transparent; animation: nfc-spin 1s linear infinite;
}
.uid-row { flex-wrap: wrap; }
.uid-row input { flex: 1 1 220px; }
@keyframes nfc-spin { to { transform: rotate(315deg); } }
.scan-msg { padding: 10px 14px; margin: -6px 0 16px; font-size: 14px; border-left: 3px solid var(--line-strong); background: var(--bg-soft); }
.scan-msg.wait { border-left-color: var(--text); }
.scan-msg.ok { border-left-color: #1f9d55; background: #e9f7ef; color: #146c3a; }
.scan-msg.warn { border-left-color: #d69e2e; background: #fdf6e7; color: #8a5a00; }
.scan-msg.bad { border-left-color: var(--red); background: var(--red-soft); color: var(--red-dark); }

/* ---------- Редактор маршрута ---------- */
.route-list { list-style: none; padding: 0; margin: 0 0 12px; border: 1px solid var(--line); }
.route-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.route-list li:last-child { border-bottom: none; }
.route-list .grow { flex: 1; }
.chain { color: var(--text-2); font-size: 14px; }
.chain .arrow { color: var(--red); margin: 0 6px; }

/* ---------- Модальное окно ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 22, 26, .6); display: flex; align-items: flex-start; justify-content: center;
  padding: 70px 16px; z-index: 10; overflow-y: auto;
}
.modal { background: var(--bg); width: 100%; max-width: 560px; padding: 36px 40px 32px; border-top: 3px solid var(--red); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 26px; }
.modal-head h2 { margin: 0; font-size: 26px; font-weight: 300; }
.modal-head h2 b { font-weight: 700; }
.modal-close { border: none; background: none; height: 32px; width: 32px; padding: 0; font-size: 22px; color: var(--muted); justify-content: center; }
.modal-close:hover { color: var(--red); }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 10px; }

/* ---------- Сообщения ---------- */
.error { background: var(--red-soft); color: var(--red-dark); border-left: 3px solid var(--red); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--dark); color: #fff; padding: 14px 20px; z-index: 20;
  border-left: 3px solid #fff; max-width: 420px; font-size: 14px;
}
.toast.error-toast { border-left-color: var(--red); }

/* ---------- Вход: тёмный экран, как блок «Оставьте свои контакты» ---------- */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; color: #fff;
  /* Танкер «Кастор» (фото с mortrast.ru); слева темнее под форму, справа — лёгкий морской синий */
  background:
    linear-gradient(90deg, rgba(10, 18, 30, .94) 0%, rgba(12, 27, 46, .82) 40%, rgba(16, 40, 68, .48) 100%),
    url(img/login-bg.jpg) 70% 55% / cover no-repeat,
    #111a26;
}
.login-screen .container { width: 100%; }
.login-top { padding: 34px 0; }
.login-top .brand, .login-top .brand:hover { color: #fff; }
.login-top .brand-sep { background: rgba(255,255,255,.35); }
.login-top .brand-logo { height: 32px; }
.login-body { flex: 1; display: flex; align-items: center; padding: 30px 0 80px; }
.login-body h1 { font-size: 44px; margin-bottom: 32px; }
.login-body .lead { color: rgba(255,255,255,.75); margin: 0 0 40px; max-width: 460px; }
.login-form { max-width: 460px; }
.login-form input {
  background: transparent; color: #fff; border-color: rgba(255,255,255,.5); height: 58px; padding: 0 24px; margin-bottom: 14px;
}
.login-form input::placeholder { color: rgba(255,255,255,.6); }
.login-form input:focus { border-color: #fff; box-shadow: none; }
.login-form .error { background: rgba(213,0,11,.15); color: #fff; }
.login-form .cta { margin-top: 10px; }
.login-foot { padding: 24px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; color: rgba(255,255,255,.5); }

/* Таблица, которая на телефоне превращается в список карточек */
@media (max-width: 640px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 14px 20px; border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: none; }
  .table-stack td { border: none; padding: 3px 0; display: flex; gap: 12px; }
  .table-stack td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-size: 13px; width: 96px; flex-shrink: 0;
    font-family: "Open Sans", Arial, sans-serif; letter-spacing: normal;
  }
  .table-stack td.hide-sm { display: none; }
  tr.clickable:hover td:first-child { box-shadow: none; }
}

/* ---------- Адаптив ---------- */
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.28); }
}
@media (max-width: 640px) {
  :root { font-size: 14px; }
  h1 { font-size: 28px; }
  .page { padding: 28px 0 60px; }
  .page-head { margin-bottom: 24px; }
  .card { padding: 20px; }
  .card.flush .card-head { padding: 18px 20px 0; }
  .card-head { flex-wrap: wrap; }
  .brand-sep, .brand-name, .clock, .user-chip .role { display: none; }
  .brand-logo { height: 30px; }
  .stat { padding: 20px 18px; gap: 12px; }
  .stat .num { font-size: 44px; }
  .modal { padding: 26px 22px; }
  .login-body h1 { font-size: 32px; }
  /* Кнопка ручной отметки уходит на отдельную строку, чтобы не сжимать название точки */
  .points li { flex-wrap: wrap; }
  .points li > button { margin-left: 48px; }
  /* На узком экране танкер оказывается под формой — затемняем равномерно */
  .login-screen {
    background:
      linear-gradient(rgba(10, 18, 30, .88), rgba(12, 27, 46, .80) 55%, rgba(10, 18, 30, .92)),
      url(img/login-bg.jpg) 80% 60% / cover no-repeat,
      #111a26;
  }
  th, td { padding: 12px; }
}

/* ==========================================================================
   Интерфейс обходчика (телефон поста): тёмный фон, крупные кнопки, цветной отклик на сканирование
   ========================================================================== */
.g-shell { position: relative; min-height: 100vh; color: #fff; isolation: isolate; --ok: #1f9d55; --warn: #d69e2e; }
.g-shell::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(rgba(10, 18, 30, .90), rgba(12, 27, 46, .86) 50%, rgba(10, 18, 30, .94)),
    url(img/login-bg.jpg) 75% 60% / cover no-repeat,
    #111a26;
}
.g-header {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: rgba(10, 16, 26, .92); border-bottom: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(6px);
}
.g-logo { height: 26px; }
.g-conn { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 13px; color: rgba(255,255,255,.85); }
.g-conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,157,85,.25); }
.g-conn.off .g-conn-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(214,158,46,.25); }
.g-link { color: rgba(255,255,255,.6); font-size: 13px; background: none; border: none; height: auto; padding: 0; }
.g-link:hover { color: #fff; border: none; }

.g-page { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.g-page h1 { font-size: 26px; font-weight: 300; color: #fff; }
.g-empty { text-align: center; color: rgba(255,255,255,.7); padding: 60px 10px; line-height: 1.6; }

.g-note {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 14px;
  background: rgba(255,255,255,.08); border-left: 3px solid rgba(255,255,255,.4); font-size: 14px;
}
.g-note.warn { border-left-color: var(--warn); }
.g-note button { flex-shrink: 0; background: #fff; }
.g-rejected { margin: 12px 16px 0; }
.g-banner {
  margin: 12px 16px 0; padding: 14px 16px; background: var(--red); color: #fff; cursor: pointer;
  animation: g-pulse 1.4s ease-in-out 3;
}
@keyframes g-pulse { 50% { background: var(--red-dark); } }

.g-resume {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; margin-bottom: 16px;
  background: var(--red); cursor: pointer;
}
.g-resume span { color: rgba(255,255,255,.85); font-size: 14px; }
.g-resume .g-arrow { font-size: 26px; }

.g-shift { margin-bottom: 26px; }
.g-shift-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.g-hours { color: rgba(255,255,255,.65); font-size: 14px; }

.g-route { background: #fff; color: var(--text); padding: 18px; margin-bottom: 12px; border-left: 4px solid var(--line-strong); }
.g-route.due { border-left-color: var(--red); }
.g-route.ok { border-left-color: var(--ok); }
.g-route-name { font-size: 18px; font-weight: 700; }
.g-route-status { margin-top: 4px; font-size: 15px; color: var(--text-2); }
.g-route.due .g-route-status { color: var(--red-dark); font-weight: 600; }
.g-route-meta { margin-top: 4px; font-size: 13px; color: var(--muted); }

.g-start {
  width: 100%; height: 56px; margin-top: 14px; justify-content: center; font-size: 17px; font-weight: 700;
  background: var(--red-dark); border-color: var(--red-dark); color: #fff;
}
.g-start:hover { background: var(--red); border-color: var(--red); }
.g-start.danger { background: #fff; color: var(--red-dark); border-color: #fff; }
.g-start:disabled { background: #6b7280; border-color: #6b7280; opacity: .6; }
.g-cancel { width: 100%; height: 48px; margin-top: 10px; justify-content: center; background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }

/* Экран обхода */
.g-round-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.g-label { font-size: 13px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .08em; }
.g-timer { text-align: right; font-size: 30px; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1; }
.g-timer span { display: block; font-size: 12px; color: rgba(255,255,255,.6); margin-top: 6px; }
.g-timer.over { color: #ff8a80; }

.g-scan {
  min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 22px 18px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.05); transition: background .2s;
}
.g-scan .g-start { max-width: 320px; }
.g-scan-icon { font-size: 34px; letter-spacing: -2px; color: rgba(255,255,255,.7); animation: g-breathe 2s ease-in-out infinite; }
@keyframes g-breathe { 50% { opacity: .35; transform: scale(.92); } }
.g-scan-title { font-size: 22px; font-weight: 700; margin-top: 6px; }
.g-scan-text { margin-top: 6px; color: rgba(255,255,255,.8); font-size: 15px; }
.g-scan.ok { background: var(--ok); border-color: var(--ok); }
.g-scan.warn { background: var(--warn); border-color: var(--warn); }
.g-scan.bad { background: var(--red); border-color: var(--red); }
.g-scan.ok .g-scan-text, .g-scan.warn .g-scan-text, .g-scan.bad .g-scan-text { color: #fff; }

.g-progress { display: flex; align-items: center; gap: 16px; margin: 20px 0 6px; }
.g-progress-num { font-size: 34px; font-weight: 300; white-space: nowrap; }
.g-progress-num span { color: rgba(255,255,255,.5); }
.g-progress .progress { flex: 1; margin: 0; background: rgba(255,255,255,.15); }

.g-points { list-style: none; margin: 10px 0 0; padding: 0; background: #fff; color: var(--text); }
.g-points li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); min-height: 60px; }
.g-points li:last-child { border-bottom: none; }
.g-points li.next { background: #fff7e6; box-shadow: inset 4px 0 0 var(--warn); }
.g-points li.done .g-point-name { color: var(--muted); }
.g-point-name { flex: 1; font-size: 16px; }
.g-point-time { font-weight: 600; font-variant-numeric: tabular-nums; }

.g-finish { margin-top: 22px; }
.g-warn-text { text-align: center; margin: 0 0 4px; color: #ffd38a; }

/* ---------- Тревоги ---------- */
.nav-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; vertical-align: 1px;
}
.page-head button.tab-on { background: #fff; color: var(--text); border-color: #fff; }
.alert-list { display: flex; flex-direction: column; }
.alert-item { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 18px 30px; border-bottom: 1px solid var(--line); }
.alert-item:last-child { border-bottom: none; }
.alert-item.open { box-shadow: inset 4px 0 0 var(--red); background: #fffafa; }
.alert-item.resolved, .alert-item.cancelled { opacity: .65; }
.alert-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.alert-type { font-weight: 700; }
.alert-time { font-size: 13px; }
.alert-msg { margin-top: 6px; color: var(--text-2); }
.alert-links { display: flex; gap: 16px; margin-top: 6px; font-size: 14px; }
.badge.al-open { background: var(--red); border-color: var(--red); color: #fff; }
.badge.al-acknowledged { border-color: var(--text); color: var(--text); }
.badge.al-resolved { border-color: var(--line); color: var(--muted); }
.badge.al-cancelled { border-color: #9fd6b4; color: #146c3a; background: #e9f7ef; }
@media (max-width: 640px) {
  .alert-item { flex-direction: column; align-items: flex-start; padding: 16px 20px; }
}

/* ---------- Скачать Android-приложение (экран входа) ---------- */
.app-download {
  display: flex; align-items: center; gap: 16px; max-width: 460px; margin-top: 44px; padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06);
}
.app-download-icon { width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0; }
.app-download-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: rgba(255,255,255,.8); flex: 1; min-width: 0; }
.app-download-text b { font-size: 15px; color: #fff; }
.muted-light { color: rgba(255,255,255,.5); }
.app-download-btn {
  flex-shrink: 0; padding: 11px 16px; background: #fff; color: var(--text); font-weight: 600; font-size: 14px; border-radius: var(--radius);
}
.app-download-btn:hover { background: var(--bg-soft); color: var(--text); }
@media (max-width: 640px) {
  .app-download { flex-wrap: wrap; }
  .app-download-btn { width: 100%; text-align: center; }
}

/* ---------- Диагностика напоминаний (Android-приложение) ---------- */
.g-diag { margin-bottom: 14px; background: rgba(255,255,255,.08); }
.g-diag-head {
  width: 100%; height: auto; padding: 12px 14px; justify-content: space-between; border: none; background: none;
  color: #fff; font-size: 14px; text-align: left; white-space: normal;
}
.g-diag-head:hover { border: none; background: rgba(255,255,255,.05); }
.g-diag-body { padding: 0 14px 14px; }
.g-diag-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; color: rgba(255,255,255,.85); border-top: 1px solid rgba(255,255,255,.08); }
.g-diag-row.bad { color: #ffb4ab; }
.g-diag-row button { flex-shrink: 0; background: #fff; }
.g-test { width: 100%; justify-content: center; margin-top: 12px; background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.g-diag-hint { margin: 10px 0 0; font-size: 13px; color: #ffd38a; text-align: center; }
.sub-text { color: var(--text-2); font-size: 14px; }

/* Тревоги в Android-приложении: состояние фонового слежения */
.native-card { padding: 0; }
.native-head {
  width: 100%; height: auto; padding: 16px 30px; justify-content: space-between; border: none; background: none;
  font-weight: 600; text-align: left; white-space: normal;
}
.native-head:hover { border: none; background: var(--bg-soft); }
.native-card > div { padding: 0 30px 18px; }
.native-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.native-row.bad { color: var(--red-dark); }
@media (max-width: 640px) { .native-head { padding: 14px 20px; } .native-card > div { padding: 0 20px 16px; } }

/* ==========================================================================
   Отчёты
   ========================================================================== */
.reports { position: relative; }
.report-tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.report-tabs button { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.report-tabs button:hover { background: rgba(255,255,255,.1); border-color: #fff; }
.report-tabs button.on { background: #fff; color: var(--text); border-color: #fff; font-weight: 600; }
.report-filters { display: flex; flex-wrap: wrap; gap: 0 14px; padding: 20px 24px 4px; align-items: flex-end; }
.report-filters .field { flex: 1 1 150px; margin-bottom: 16px; }
.report-filters select, .report-filters input { height: 44px; }
.report-filters .export-field { flex: 0 0 auto; }
.report-filters .export-field button { height: 44px; }
.stat.static { cursor: default; }
.stat .num small { font-size: 22px; opacity: .7; }
.report-stats { margin-bottom: 24px; }

/* Статусная шкала выполнения (с подписью-легендой: цвет никогда не единственный носитель смысла) */
:root { --pct-good: #1f8a4c; --pct-warn: #c98500; --pct-bad: #c41a00; }
.pct-good { color: var(--pct-good); } .pct-warn { color: var(--pct-warn); } .pct-bad { color: var(--pct-bad); }
.bar.pct-good, .mini-bar .pct-good, .bar-legend .pct-good { background: var(--pct-good); }
.bar.pct-warn, .mini-bar .pct-warn, .bar-legend .pct-warn { background: var(--pct-warn); }
.bar.pct-bad, .mini-bar .pct-bad, .bar-legend .pct-bad { background: var(--pct-bad); }

.bar-chart { position: relative; display: flex; gap: 10px; height: 220px; }
.bar-grid { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); padding-bottom: 22px; text-align: right; width: 34px; }
.bars { flex: 1; display: flex; gap: 4px; align-items: stretch; min-width: 0;
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% calc((100% - 22px) / 2); }
.bar-col { flex: 1 1 0; min-width: 6px; display: flex; flex-direction: column; cursor: pointer; }
.bar-track { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 100%; max-width: 28px; min-height: 2px; border-radius: 4px 4px 0 0; transition: opacity .15s; }
.bar-col:hover .bar { opacity: .75; }
.bar-label { height: 22px; line-height: 22px; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.bar-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.bar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bar-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.pct-cell { min-width: 120px; }
.pct-cell b { font-size: 16px; margin-right: 6px; }
.mini-bar { height: 4px; background: var(--line); margin-top: 6px; border-radius: 2px; overflow: hidden; }
.mini-bar div { height: 100%; border-radius: 2px; }

/* Карта пропусков: одна шкала красного — чем темнее, тем больше пропущено */
.heat-wrap { overflow-x: auto; }
.heat { display: inline-flex; flex-direction: column; gap: 2px; min-width: 100%; }
.heat-row { display: flex; gap: 2px; align-items: center; }
.heat-day { width: 46px; flex-shrink: 0; font-size: 12px; color: var(--text-2); }
.heat-hour { width: 26px; flex: 1 0 26px; text-align: center; font-size: 10px; color: var(--muted); }
.heat-cell { width: 26px; flex: 1 0 26px; height: 26px; border-radius: 3px; display: inline-block; cursor: pointer; }
.heat-0 { background: #eef0f3; }
.heat-1 { background: #fbe9e7; } .heat-2 { background: #f5b8b0; } .heat-3 { background: #ea7a6d; }
.heat-4 { background: #d03b2c; } .heat-5 { background: #9e1a0f; }
.heat-none { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.heat-cell:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-legend { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px; font-size: 12px; color: var(--muted); }
.heat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat-legend .heat-cell { width: 16px; height: 16px; flex: none; cursor: default; }
.heat-scale { gap: 2px !important; }

.kind-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.kind-chips button { height: 34px; font-size: 13px; background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.kind-chips button.on { background: #fff; color: var(--text); border-color: #fff; }
.badge.kind { white-space: nowrap; }
.badge.k-missed, .badge.k-incomplete { border-color: #e7b9b3; color: var(--red-dark); background: var(--red-soft); }
.badge.k-late, .badge.k-overdue { border-color: #ecd29b; color: #8a5a00; background: #fdf6e7; }
.badge.k-order { border-color: var(--line-strong); color: var(--text-2); }
.type-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }

.chart-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 8px)); z-index: 6; pointer-events: none;
  background: var(--dark); color: #fff; font-size: 13px; padding: 7px 11px; border-radius: 4px; white-space: nowrap;
}
@media (max-width: 640px) {
  .report-filters { padding: 16px 16px 2px; }
  .bar-chart { height: 180px; }
  .heat-cell, .heat-hour { width: 22px; flex-basis: 22px; height: 22px; }
}

.report-stats .stat { min-width: 0; }
.report-stats .cap { min-width: 0; }
@media (max-width: 640px) {
  .report-stats .stat { padding: 16px 14px; gap: 10px; }
  .report-stats .stat .num { font-size: 34px; }
  .report-stats .stat .num small { font-size: 16px; }
  .report-stats .cap { font-size: 12px; }
}

/* ---------- Кнопка «Инструкция» (правый нижний угол, на всех экранах) ---------- */
.help-fab {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 15;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px 0 6px; border-radius: 22px;
  background: #fff; color: var(--text); font-weight: 600; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.help-fab:hover { color: var(--red-dark); }
.help-fab-icon {
  width: 32px; height: 32px; border-radius: 50%; background: var(--red-dark); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
}
/* Всплывающие сообщения — над кнопкой */
.toast { bottom: 80px; }
/* На телефоне — только значок, чтобы не закрывать кнопки */
@media (max-width: 640px) {
  .help-fab { padding: 0 6px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .help-fab-text { display: none; }
  .g-page, .page { padding-bottom: 90px; }
}

/* Внеплановый обход */
.g-extra { width: 100%; height: 48px; margin-top: 10px; justify-content: center; background: #fff; color: var(--text); border-color: var(--line-strong); font-weight: 600; }
.g-extra.confirm { background: #fff7e6; border-color: #d69e2e; color: #8a5a00; }
.g-extra-hint { margin: 8px 0 0; font-size: 13px; color: var(--text-2); text-align: center; }
.badge.extra { margin-left: 6px; border-color: #ecd29b; color: #8a5a00; background: #fdf6e7; }
