/* Монитор УСП — современная украинская тема (v3) */

:root {
  color-scheme: dark;
  --bg: #060e1d;
  --bg-2: #0a172e;
  --surface: rgba(14, 28, 52, 0.90);
  --surface-2: rgba(18, 36, 66, 0.94);
  --surface-solid: #0f1f3a;
  --text: #eef4ff;
  --muted: #93a8c8;
  --line: rgba(96, 165, 250, 0.16);
  --soft: rgba(96, 165, 250, 0.09);
  --ua-blue: #0057b7;
  --ua-blue-bright: #2563eb;
  --ua-gold: #ffd700;
  --accent: #4d94ff;
  --accent-bright: #7cb3ff;
  --accent-soft: rgba(77, 148, 255, 0.16);
  --gold: #ffd23f;
  --gold-soft: rgba(255, 210, 63, 0.15);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fb923c;
  --warn-soft: rgba(251, 146, 60, 0.14);
  --danger: #ff7b8a;
  --danger-soft: rgba(255, 123, 138, 0.14);
  --shadow: 0 18px 44px rgba(2, 8, 20, 0.34), 0 2px 10px rgba(2, 8, 20, 0.18);
  --r-lg: 22px;
  --r-md: 15px;
  --r-sm: 11px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  position: relative;
  background:
    radial-gradient(ellipse 90% 50% at 15% -12%, rgba(0, 87, 183, 0.34), transparent 62%),
    radial-gradient(ellipse 70% 42% at 88% -8%, rgba(255, 215, 0, 0.11), transparent 58%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 520px);
  background-color: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "tnum" 1;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.20;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

button, input, select, textarea { font: inherit; }

.ic {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 24px 0;
}

/* ───────────── HERO (УКРАЇНСЬКИЙ БРЕНДИНГ) ───────────── */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 214px;
  padding: 20px 26px 46px;
  border-radius: 26px;
  background: #061328;
  border: 1px solid rgba(110, 168, 254, 0.22);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  isolation: isolate;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: #061328 url("/ui/assets/hero.jpg") center 52% / cover no-repeat;
  opacity: 0.52;
  filter: saturate(0.88) contrast(1.06);
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, rgba(4, 14, 34, 0.94) 0%, rgba(5, 21, 52, 0.72) 48%, rgba(6, 19, 44, 0.36) 100%),
    linear-gradient(0deg, rgba(4, 12, 28, 0.92) 0%, rgba(4, 12, 28, 0.15) 60%);
}

.hero-glow {
  position: absolute;
  right: 4%;
  bottom: -90px;
  width: 460px;
  height: 290px;
  background:
    radial-gradient(closest-side, rgba(0, 102, 214, 0.30), rgba(255, 215, 0, 0.10) 48%, transparent 78%);
  pointer-events: none;
}

.hero-top {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 13px;
}

.mark {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(244, 249, 255, 0.95);
  border: 1.5px solid rgba(255, 215, 0, 0.55);
  box-shadow: 0 4px 20px rgba(0, 87, 183, 0.38);
}

.mark img { width: 100%; height: 100%; object-fit: contain; }
.mark--empty { background: rgba(255, 255, 255, 0.14); }

.hero-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: #fff;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.hero-titles strong {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.hero-ua-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(0, 87, 183, 0.72), rgba(0, 87, 183, 0.48));
  border: 1px solid rgba(255, 215, 0, 0.42);
  color: #ffe46b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.ic-tryzub {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #ffd700;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-titles small {
  font-size: 12.5px;
  color: rgba(226, 238, 255, 0.80);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 10px;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: rgba(6, 24, 34, 0.56);
  color: #a7f3d0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.hero-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}

.icon-btn {
  margin-left: auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid rgba(147, 197, 253, 0.24);
  background: rgba(11, 29, 58, 0.68);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover { background: rgba(0, 87, 183, 0.45); border-color: rgba(255, 215, 0, 0.45); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn.is-busy .ic { animation: spin 0.9s linear infinite; }

.hero-meta {
  position: relative;
  z-index: 4;
  margin-top: 34px;
}

.hero-city {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 10px;
  background: rgba(7, 20, 44, 0.60);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(224, 238, 255, 0.88);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.03em;
}

.hero-city::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, #0057b7 0 50%, #ffd700 50% 100%);
  flex: none;
}

.hero-car {
  position: absolute;
  right: 28px;
  bottom: 8px;
  height: 150px;
  width: auto;
  z-index: 3;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

/* Геометричний орнамент вишиванки по низу банера */
.hero-ornament {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 10px;
  z-index: 3;
  opacity: 0.38;
  background-image:
    linear-gradient(135deg, rgba(255, 215, 0, 0.55) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255, 215, 0, 0.55) 25%, transparent 25%),
    linear-gradient(45deg, rgba(77, 148, 255, 0.65) 25%, transparent 25%),
    linear-gradient(315deg, rgba(77, 148, 255, 0.65) 25%, transparent 25%);
  background-position: 5px 0, 5px 0, 0 0, 0 0;
  background-size: 10px 10px;
  background-repeat: repeat-x;
}

.hero-flag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  z-index: 4;
  background: linear-gradient(90deg, #0057b7 0%, #1d74e6 49%, #ffd700 51%, #ffe34d 100%);
}

/* ───────────── ВКЛАДКИ ───────────── */
.tabs--top {
  display: flex;
  gap: 8px;
  padding: 18px 2px 12px;
}

.tabs--top .tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.tabs--top .tab .ic { width: 18px; height: 18px; }
.tabs--top .tab:hover { color: var(--text); background: var(--soft); }
.tabs--top .tab.is-on {
  background: linear-gradient(135deg, rgba(0, 87, 183, 0.30), rgba(255, 215, 0, 0.10));
  border-color: rgba(96, 165, 250, 0.30);
  color: #fff;
}

.tabs--bottom { display: none; }

/* ───────────── КОНТЕНТ ───────────── */
main { padding: 6px 0 48px; }
.screen { display: none; padding: 6px 2px 0; }
.screen.is-on { display: block; }

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 2px 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--warn-soft);
  border: 1px solid rgba(251, 146, 60, 0.25);
  color: var(--warn);
  font-size: 13px;
}
.banner[hidden] { display: none; }

/* Быстрые действия */
.quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.qa {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.qa:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 215, 0, 0.38);
}
.qa:active { transform: scale(0.98); }

.qa-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-bright);
  flex: none;
}

.qa-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.qa-t b { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-t small { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.qa--primary {
  background: linear-gradient(135deg, #0057b7 0%, #0b4494 68%, #0d326d 100%);
  border-color: rgba(255, 215, 0, 0.42);
  box-shadow: 0 10px 28px rgba(0, 87, 183, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.qa--primary .qa-ic {
  background: rgba(255, 215, 0, 0.18);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.34);
}
.qa--primary .qa-t small { color: rgba(226, 239, 255, 0.82); }
.qa[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* KPI */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  position: relative;
  min-height: 112px;
  padding: 16px 17px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kpi .kpi-ic {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-bright);
}
.kpi .kpi-ic .ic { width: 16px; height: 16px; }
.kpi .label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; padding-right: 36px; }
.kpi .value { display: flex; align-items: baseline; gap: 5px; margin: 11px 0 4px; font-size: 31px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.kpi .value small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.kpi .foot { font-size: 11.5px; color: var(--muted); }

.kpi.accent {
  background: linear-gradient(145deg, rgba(0, 87, 183, 0.28), rgba(14, 34, 68, 0.94));
  border-color: rgba(255, 215, 0, 0.32);
}
.kpi.accent .value { color: #ffd700; }
.kpi.accent .kpi-ic { background: var(--gold-soft); color: var(--gold); }

/* Карточки */
.card {
  padding: 18px 20px;
  margin-bottom: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card--tint {
  background: linear-gradient(135deg, rgba(16, 38, 72, 0.94), rgba(13, 25, 46, 0.94));
  border-color: rgba(96, 165, 250, 0.22);
}

.card-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.card-h h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-h h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, #0057b7 0 50%, #ffd700 50% 100%);
  flex: none;
}

.card-h .hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent-bright);
  font-weight: 600;
}

.link {
  margin-left: auto;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid rgba(96, 165, 250, 0.24);
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

/* График */
.chart { display: flex; flex-direction: column; gap: 8px; }
.chart .bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 148px;
  padding: 0 2px;
  background-image: repeating-linear-gradient(to top, rgba(147, 168, 200, 0.12) 0 1px, transparent 1px 25%);
}
.chart .b { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart .b i {
  display: block;
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #60a5fa 0%, #1d64d8 100%);
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.chart .b.t i {
  opacity: 1;
  background: linear-gradient(180deg, #ffe44d 0%, #eab308 100%);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.30);
}
.chart .b:hover i { opacity: 0.96; }
.chart .axis { display: flex; gap: 6px; }
.chart .axis span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); }

/* Прогресс и чипы */
.bar-track {
  height: 9px;
  border-radius: 99px;
  background: var(--soft);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #0057b7 0%, #3b82f6 55%, #ffd700 100%);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(6, 14, 29, 0.35);
  color: var(--muted);
  font-size: 12px;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.chip--ok { border-color: rgba(52, 211, 153, 0.25); background: var(--ok-soft); color: var(--ok); }
.chip--ok .dot { opacity: 1; box-shadow: 0 0 8px var(--ok); }

/* Списки */
.list { display: flex; flex-direction: column; }
.list-sep {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 14px 0 7px;
  border-bottom: 1px solid var(--line);
}
.list-sep:first-child { padding-top: 0; }
.card--flush { padding: 12px 18px 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.14s ease;
}
.row:last-child { border-bottom: 0; }
.row[data-report] { cursor: pointer; }
.row[data-report]:hover { background: rgba(77, 148, 255, 0.07); }
.row[data-report]:active { opacity: 0.7; }

.row .when {
  flex: none;
  width: 46px;
  padding: 6px 0;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(96, 165, 250, 0.18);
  color: var(--accent-bright);
  text-align: center;
  line-height: 1.15;
}
.row .when b { display: block; font-size: 14px; font-weight: 700; }
.row .when small { display: block; font-size: 10px; text-transform: uppercase; opacity: 0.85; }

.row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { width: 16px; height: 16px; color: var(--muted); opacity: 0.65; flex: none; }

.photo-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--gold-soft);
  border: 1px solid rgba(255, 215, 0, 0.25);
  color: var(--gold);
  font-size: 11px;
  font-weight: 650;
}
.photo-pill .ic { width: 13px; height: 13px; }

.crew-row .ava {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid rgba(96, 165, 250, 0.20);
}

.pill {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill--ok { border-color: transparent; background: var(--ok-soft); color: var(--ok); }

/* Районы */
.dist { display: flex; flex-direction: column; gap: 13px; }
.dist-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; align-items: center; font-size: 13px; }
.dist-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.dist-row .val { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dist-bar { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.dist-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #0057b7 0%, #3b82f6 65%, #ffd700 100%);
}

/* Фильтры и поиск */
.toolbar { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 9px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg.is-on { background: linear-gradient(135deg, #0057b7, #1d64d8); color: #fff; }

.search {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
}
.search .ic { width: 17px; height: 17px; opacity: 0.75; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 14px; outline: none; }
.search input::placeholder { color: var(--muted); opacity: 0.8; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.note { margin: 8px 3px 10px; font-size: 12px; color: var(--muted); }
.note:empty { display: none; }

/* Состояния */
.empty { display: grid; place-items: center; gap: 9px; padding: 38px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .ic { width: 28px; height: 28px; opacity: 0.5; }
.empty strong { display: block; color: var(--text); font-size: 14px; font-weight: 650; }
.empty p { margin: 0; max-width: 300px; line-height: 1.45; }

.sk-line { display: block; height: 10px; border-radius: 6px; background: var(--soft); animation: pulse 1.5s ease-in-out infinite; }
.sk-line.tall { height: 22px; margin: 9px 0 8px; }
.w40 { width: 40%; } .w50 { width: 50%; } .w70 { width: 70%; }

@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── СЕТКА ДЕСКТОП ───────────── */
@media (min-width: 820px) {
  .screen#s-home.is-on {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(350px, 0.88fr);
    gap: 0 16px;
    align-items: start;
  }
  #s-home > .quick, #s-home > .kpis { grid-column: 1 / -1; }
  #s-home > .dashboard-chart { grid-column: 1; grid-row: 3; }
  #s-home > .dashboard-recent { grid-column: 2; grid-row: 3; }
  #s-home > .dashboard-attendance { grid-column: 1 / -1; grid-row: 4; }

  .screen#s-crews.is-on {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.72fr);
    gap: 0 16px;
    align-items: start;
  }
  #s-crews > .toolbar, #s-crews > .note, #s-crews > .card--flush { grid-column: 1; }
  #s-crews > .card:not(.card--flush) { grid-column: 2; grid-row: 1 / span 3; }
}

/* ───────────── МОБИЛЬНАЯ ВЕРСИЯ ───────────── */
@media (max-width: 819px) {
  .app { padding: 0; }
  .hero {
    min-height: 186px;
    padding: 15px 15px 40px;
    border-radius: 0 0 24px 24px;
    border-top: 0;
    border-left: 0;
    border-right: 0;
  }
  .mark { width: 40px; height: 40px; border-radius: 12px; }
  .hero-titles strong { font-size: 17px; }
  .hero-titles small { font-size: 11.5px; max-width: 195px; }
  .hero-live { display: none; }
  .hero-meta { margin-top: 22px; }
  .hero-city { font-size: 10.5px; padding: 4px 10px; }
  .hero-car { height: 106px; right: 2px; bottom: 5px; }

  .tabs--top { display: none; }
  .tabs--bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(8, 18, 36, 0.92);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(20px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs--bottom .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 9px 4px 8px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
  }
  .tabs--bottom .tab .ic { width: 21px; height: 21px; }
  .tabs--bottom .tab.is-on { color: #ffd700; }
  .tabs--bottom .tab.is-on::after {
    content: "";
    position: absolute;
    top: 0;
    width: 32px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, #3b82f6, #ffd700);
  }

  main { padding: 11px 0 calc(90px + env(safe-area-inset-bottom)); }
  .screen { padding: 6px 13px 0; }
  .quick { gap: 8px; margin-bottom: 12px; }
  .qa { flex-direction: column; align-items: flex-start; min-height: 78px; gap: 7px; padding: 10px 10px 9px; border-radius: 15px; }
  .qa-ic { width: 32px; height: 32px; border-radius: 10px; }
  .qa-ic .ic { width: 17px; height: 17px; }
  .qa-t b { font-size: 12px; }
  .qa-t small { font-size: 10.5px; }

  .kpis { grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 12px; }
  .kpi { min-height: 100px; padding: 13px 14px; border-radius: 17px; }
  .kpi .value { font-size: 27px; margin: 9px 0 3px; }
  .card { padding: 15px; border-radius: 18px; }
  .card--flush { padding: 11px 14px 7px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { min-width: 0; }
}

@media (max-width: 370px) {
  .screen { padding-left: 10px; padding-right: 10px; }
  .qa-t b { font-size: 11px; }
  .hero-car { height: 94px; }
}

/* ───────────── МОДАЛЬНОЕ ОКНО / ФОРМА ОТЧЁТА ───────────── */
.s-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(3, 9, 22, 0.72);
  backdrop-filter: blur(6px);
}
.s-sheet[hidden] { display: none; }

.s-card {
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 92vh;
  background: #0d1c36;
  border-top: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 24px 24px 0 0;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
}

@media (min-width: 680px) {
  .s-sheet { justify-content: center; align-items: center; padding: 20px; }
  .s-card {
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 24px;
    padding: 20px 22px 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  }
}

.s-flag-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0057b7 0%, #2563eb 50%, #ffd700 50%, #ffe34d 100%);
}

.s-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-top: 4px;
}
.s-head b { font-size: 16px; font-weight: 700; color: #fff; }
.s-ext {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
}
.s-ext .ic { width: 14px; height: 14px; }
.s-ext[hidden] { display: none; }
.s-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.s-ext:not([hidden]) + .s-close { margin-left: 4px; }
.s-close:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

.s-fld { display: block; margin-bottom: 11px; }
.s-fld > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.s-fld select, .s-fld input, .s-fld textarea {
  width: 100%;
  background: #081326;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.s-fld select:focus, .s-fld input:focus, .s-fld textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.s-fld textarea { resize: vertical; }
.s-row { display: flex; gap: 10px; }
.s-row .s-fld { flex: 1; }
.s-fld--sm { max-width: 86px; }

.tpl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  margin-bottom: 6px;
  border-radius: 99px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.tpl-chip .ic { width: 13px; height: 13px; }
.tpl-chip:hover { filter: brightness(1.1); }

/* ───────────── ФОТОГРАФИИ В ФОРМЕ ───────────── */
.photo-box { margin: 12px 0 6px; }
.photo-box-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}
.photo-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1.5px dashed rgba(255, 215, 0, 0.42);
  background: linear-gradient(135deg, rgba(0, 87, 183, 0.14), rgba(255, 215, 0, 0.05));
  color: #e2eeff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.photo-drop:hover, .photo-drop.is-drag {
  border-color: var(--ua-gold);
  background: linear-gradient(135deg, rgba(0, 87, 183, 0.25), rgba(255, 215, 0, 0.12));
}
.photo-drop .ic { width: 20px; height: 20px; color: var(--ua-gold); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.photo-grid:empty { display: none; }

.photo-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #081326;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.photo-cover-tag {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(6, 14, 29, 0.84);
  border: 1px solid rgba(255, 215, 0, 0.45);
  color: var(--ua-gold);
  font-size: 9.5px;
  font-weight: 700;
  pointer-events: none;
}
.photo-rm {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(6, 14, 29, 0.82);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.photo-rm:hover { background: #dc2626; border-color: #ef4444; }
.photo-file-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 6px;
  text-align: center;
  font-size: 10.5px;
  color: var(--accent-bright);
  text-decoration: none;
  word-break: break-word;
}

.s-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.s-btn {
  flex: 1;
  min-width: 104px;
  border: 1px solid var(--line);
  background: #142646;
  color: var(--text);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: filter 0.14s ease, transform 0.1s ease;
}
.s-btn:hover { filter: brightness(1.08); }
.s-btn:active { transform: scale(0.98); }
.s-btn:disabled { opacity: 0.6; cursor: wait; }
.s-btn--primary {
  background: linear-gradient(135deg, #0057b7 0%, #2563eb 100%);
  border-color: rgba(255, 215, 0, 0.35);
  color: #fff;
}
.s-btn--danger { background: rgba(153, 27, 27, 0.35); border-color: rgba(248, 113, 113, 0.45); color: #fca5a5; }
.s-err { color: var(--danger); font-size: 12.5px; margin: 8px 0 0; }

/* ───────────── ЛАЙТБОКС ФОТО ───────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 8, 18, 0.92);
  backdrop-filter: blur(8px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 29, 54, 0.85);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; }
}
