@font-face {
  font-family: "Medeo Sans";
  src: url("/fonts/MedeoSansVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Страница промоутера. Текст тёмный, кнопки фиолетовые. Ночь — серый фон, не чёрный. */
:root {
  --live-fg: #1763a6;
  --orange: #c46234;
  --purple: #5f5694;
  --nav: #564c88;
  --purple-soft: #efeaf6;
  --ink: #101828;
  --muted: #5c6778;
  --paper: #f3f5f8;
  --card: #ffffff;
  --line: #dbe1e6;
  --ghost: #eceaf4;
  --ghost-line: #c9c4db;
  --bad: #b3261e;
  --good: #1b7a3d;
  --blue: var(--purple);
  --blue-soft: var(--purple-soft);
  --yellow: var(--orange);
  --action: #5f5694;
}
html[data-theme="night"] {
  --live-fg: #a9d2f5;
  --orange: #d4a07c;
  --purple: #c9c0d8;
  --nav: #3c3458;
  --purple-soft: #3a3548;
  --ink: #f4f6f8;
  --muted: #c5ccd6;
  --paper: #3e4450;
  --card: #545c6a;
  --line: #6e7684;
  --ghost: #6d7584;
  --ghost-line: #8a92a0;
  --bad: #ffb4ae;
  --good: #9ee0b4;
  --action: #6a6198;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Medeo Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.4;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }

.banner { padding: 12px 16px; font-size: 15px; }
.banner.warn { background: #ffe8df; color: #101828; }
.banner.info { background: var(--blue-soft); color: var(--blue); }
.banner button {
  display: block; margin-top: 8px; padding: 8px 14px; font: inherit; font-weight: 600;
  border: 2px solid currentColor; border-radius: 8px; background: transparent; color: inherit;
}

.screen { max-width: 520px; margin: 0 auto; }
.home { padding: 20px 16px 32px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 24px 22px; width: min(400px, 100%);
}
.auth-card h1 { margin: 0 0 20px; text-align: center; }
.auth-card .btn { margin-top: 4px; }
.auth-card .switch-row { margin: 8px 0 4px; }
h1 { font-size: 26px; margin: 0 0 18px; color: var(--ink); }

.field { display: block; margin-bottom: 18px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%; font: inherit; padding: 12px 14px; border: 2px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--blue); }

.stats { display: flex; gap: 12px; margin-bottom: 18px; }
.stat {
  flex: 1; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.stat b { display: block; font-size: 34px; line-height: 1.1; color: var(--blue); }
.stat span { display: block; font-size: 14px; color: var(--muted); }
.stat small { display: block; font-size: 13px; color: var(--muted); min-height: 1em; }

.btn {
  display: block; width: 100%; font: inherit; font-size: 20px; font-weight: 700;
  padding: 16px; border-radius: 12px; border: 2px solid var(--blue); margin-bottom: 12px;
}
.btn.primary { background: var(--action); color: #fff; border-color: var(--action); }
.btn.secondary { background: var(--ghost); color: var(--ink); border-color: var(--ghost-line); }
.btn:disabled { opacity: 0.5; }
.btn:focus-visible, .link:focus-visible, .shutter:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

progress { width: 100%; height: 10px; margin: 4px 0; }
.msg { min-height: 1.4em; margin: 6px 0 12px; color: var(--ink); }
.warn-text { color: var(--bad); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-size: 15px; color: var(--muted); }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; }

.links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-top: 8px; }
.link {
  font: inherit; font-size: 15px; color: var(--blue); background: none; border: none; padding: 6px 0;
  text-decoration: underline; cursor: pointer;
}
.switch-row {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-size: 14px; font-weight: 650; color: var(--muted); cursor: pointer; text-decoration: none;
}
.switch-row .ico { width: 18px; height: 18px; flex: none; color: var(--muted); }
html:not([data-theme="night"]) .ico-sun { color: var(--orange); }
html[data-theme="night"] .ico-moon { color: #c9c0d8; }
.switch-row input {
  appearance: none; width: 48px; height: 28px; margin: 0; padding: 0; flex: none; cursor: pointer;
  border-radius: 999px; background: #e7e4f2; border: 1px solid var(--line); position: relative;
}
html[data-theme="night"] .switch-row input { background: #3c4250; }
.switch-row input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 1px solid rgba(16, 24, 40, .12);
  transition: transform .16s ease;
}
.switch-row input:checked { background: var(--nav); border-color: transparent; }
.switch-row input:checked::after { transform: translateX(20px); }
.switch-row input:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* Камера */
.camera { position: fixed; inset: 0; max-width: none; background: #000; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
}
.cam-top button {
  font: inherit; font-weight: 600; color: #fff; background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.6); border-radius: 999px; padding: 8px 16px;
}
.gps { color: #fff; font-size: 15px; font-weight: 600; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.45); }
.gps.good { background: var(--good); }
.gps.mid { background: #8a6d00; }
.gps.bad { background: var(--bad); }
.cam-count { color: #fff; font-size: 15px; font-weight: 600; min-width: 2.5em; text-align: right; }
.cam-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 20px);
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.55));
}
.shutter {
  font: inherit; font-size: 22px; font-weight: 800; color: #fff; background: var(--action);
  border: 4px solid #fff; border-radius: 999px; padding: 18px 28px; width: min(100%, 360px);
}
.shutter:disabled { opacity: 0.5; }
.shutter:active { transform: scale(0.98); }

.cam-error {
  position: absolute; left: 16px; right: 16px; top: 30%; background: var(--card); color: var(--ink); border-radius: 14px; padding: 18px;
}
.cam-error p { margin: 0 0 14px; }
.cam-error .btn { margin-bottom: 0; }

.review { position: absolute; inset: 0; background: #000; display: flex; flex-direction: column; }
.review img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.review-actions {
  display: flex; gap: 12px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px); background: #000;
}
.review-actions .btn { margin: 0; }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 96px);
  max-width: 496px; margin: 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; background: #1d2433; color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.toast button {
  font: inherit; font-weight: 700; color: #f0a47d; background: none; border: none; padding: 8px 0;
  text-decoration: underline;
}
@media (prefers-reduced-motion: no-preference) { .shutter { transition: transform .08s; } }

.top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.top b { margin-right: auto; }
.card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
.card b { color: var(--ink); font-size: 18px; }
.card span { color: var(--ink); }
.card small { color: var(--muted); }
.card.done { border-color: var(--good); }
.card.done small { color: var(--good); font-weight: 700; }
.card.live { border-color: var(--orange); }
.hint { color: var(--muted); font-size: 14px; }
#zone-view { height: 240px; border-radius: 12px; border: 1px solid var(--line); margin: 0 0 14px; }

/* ---- экран сотрудника: доработки ---- */
html[data-theme="night"] .switch-row input { background: #2f3541; border-color: var(--ghost-line); }
html[data-theme="night"] .switch-row input:checked { background: var(--action); }
.link { min-height: 44px; padding: 10px 4px; }
.top { margin-bottom: 4px; }
.top .link.back { margin-right: auto; padding-left: 0; }
.top .link.back::before { content: "‹"; margin-right: 6px; font-size: 22px; line-height: 1; text-decoration: none; display: inline-block; }

.task-line { margin: -8px 0 14px; font-size: 18px; color: var(--muted); }
.progress-card { margin-bottom: 14px; padding: 12px 14px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; }
.progress-top { display: flex; align-items: baseline; gap: 8px; }
.progress-top b { font-size: 30px; line-height: 1.1; color: var(--blue); }
.progress-top span { font-size: 15px; color: var(--muted); }
.bar { height: 8px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--muted) 22%, var(--card)); }
.bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .4s ease; }

.state {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 5px 12px 5px 10px; border-radius: 999px;
  font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, var(--card));
}
.state::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.live { color: var(--live-fg); background: color-mix(in srgb, var(--live-fg) 14%, var(--card)); }
.state.live::before { animation: pulse 1.8s ease-out infinite; }
.state.done { color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--card)); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }

.stats { gap: 8px; }
.stat { padding: 10px 12px; }
.stat b { font-size: 30px; }
.stat span { font-size: 13px; line-height: 1.25; }

.card { gap: 8px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; width: 100%; }
.card .state { margin: 0; font-size: 13px; padding: 3px 10px 3px 8px; }
.card .bar { width: 100%; margin-top: 0; }
.card.done { border-color: var(--line); }
.card.done small { color: var(--muted); font-weight: 500; }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.on { animation: flash .22s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .flash.on, .state.live::before { animation: none; }
  .bar i { transition: none; }
}
