* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   Veda Track — те же две темы, что у Veda Call:
   light — «Уютный сад»: кремовая, шалфейно-зелёная, тёплая
   dark  — «Ночной автомат»: ночь, латунь, золото
   ============================================================ */

:root, :root[data-theme="light"] {
  --bg: #ece5d3;
  --bg-image:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255, 250, 235, .9), transparent 60%),
    radial-gradient(ellipse 70% 50% at 15% 100%, rgba(178, 190, 150, .25), transparent 60%),
    linear-gradient(180deg, #f0ead9 0%, #e9e1cc 55%, #e2d8bf 100%);
  --card: #faf7ee;
  --card-border: #d9cfb4;
  --card-shadow: 0 24px 70px rgba(110, 98, 70, .28), inset 0 0 0 1px rgba(255,255,255,.6);
  --plaque-bg: linear-gradient(180deg, #f6f1e2, #e7dfc8);
  --plaque-border: #c9bd9c;
  --plaque-text: #5a6b4a;
  --heading: #5a6b4a;
  --text: #4a4636;
  --muted: #8a8574;
  --accent: #96a577;
  --accent-hover: #a3b284;
  --accent-text: #ffffff;
  --secondary: #eae3d1;
  --secondary-hover: #e0d7c0;
  --secondary-text: #5a6b4a;
  --danger: #e08163;
  --danger-hover: #ea937b;
  --input-bg: #f3eee1;
  --input-border: #d9cfb6;
  --ring: #b6c295;
  --live: #6f9f5c;
  --track-line: #5a6b4a;
  --toast-bg: rgba(74, 70, 54, .92);
  --toast-text: #f6f1e5;
  --map-filter: none;
}

:root[data-theme="dark"] {
  --bg: #0b0f16;
  --bg-image:
    radial-gradient(ellipse 80% 55% at 50% -15%, rgba(212, 175, 106, .16), transparent 60%),
    radial-gradient(ellipse 60% 45% at 12% 108%, rgba(64, 96, 128, .18), transparent 65%),
    linear-gradient(180deg, #101722 0%, #0b0f16 60%, #080b10 100%);
  --card: #151b26;
  --card-border: #3d3626;
  --card-shadow: 0 24px 80px rgba(0, 0, 0, .65), inset 0 0 0 1px rgba(212, 175, 106, .08);
  --plaque-bg: linear-gradient(180deg, #453a22 0%, #2b2314 55%, #1e180d 100%);
  --plaque-border: #6b5a33;
  --plaque-text: #ecd18f;
  --heading: #d4af6a;
  --text: #e8e2d4;
  --muted: #8e97a8;
  --accent: #b08d4f;
  --accent-hover: #c29d5c;
  --accent-text: #14100a;
  --secondary: #232b38;
  --secondary-hover: #2c3646;
  --secondary-text: #d8d2c2;
  --danger: #b4494e;
  --danger-hover: #c85a5f;
  --input-bg: #10151d;
  --input-border: #33404f;
  --ring: #d4af6a;
  --live: #7fc26a;
  --track-line: #d4af6a;
  --toast-bg: rgba(23, 29, 38, .95);
  --toast-text: #e8e2d4;
  --map-filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.7);
}

html, body { height: 100%; }

body {
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ---------- Латунная табличка ---------- */

.plaque {
  display: inline-block;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .3em;
  text-indent: .3em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--plaque-text);
  background: var(--plaque-bg);
  border: 1px solid var(--plaque-border);
  border-radius: 10px;
  padding: 8px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 6px rgba(0,0,0,.25),
              0 4px 14px rgba(0,0,0,.25);
}

.theme-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 900;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card); color: var(--heading);
  font-size: 18px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

/* ---------- Кнопки и поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px;
  padding: 13px 20px;
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--secondary); color: var(--secondary-text); }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-big { width: 100%; padding: 17px 20px; font-size: 18px; }
.btn:disabled { opacity: .5; cursor: default; }

input[type="text"] {
  width: 100%; padding: 13px 15px;
  border: 1px solid var(--input-border); border-radius: 12px;
  background: var(--input-bg); color: var(--text);
  font-size: 16px; font-family: inherit;
}
input[type="text"]:focus { outline: none; border-color: var(--ring); }

/* ---------- Карточки ---------- */

.wrap { max-width: 560px; margin: 0 auto; padding: 26px 16px 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  padding: 22px;
  margin-bottom: 16px;
}

h1 { font-size: 26px; color: var(--heading); margin: 14px 0 6px; font-weight: 700; }
h2 { font-size: 17px; color: var(--heading); margin-bottom: 12px; font-weight: 700; }
.subtitle, .hint { color: var(--muted); font-size: 14px; line-height: 1.55; }
.hint { margin-top: 12px; }
.center { text-align: center; }

.link-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 12px; padding: 10px 12px; margin: 8px 0 4px;
}
.link-row code {
  flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text);
}
.link-row button {
  border: none; background: var(--secondary); color: var(--secondary-text);
  border-radius: 9px; padding: 7px 11px; font-size: 14px; cursor: pointer;
}
.label { font-size: 13px; font-weight: 600; color: var(--heading); margin-top: 14px; }

/* ---------- Список поездок ---------- */

.trip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 6px; border-top: 1px solid var(--card-border);
  cursor: pointer;
}
.trip:first-child { border-top: none; }
.trip-name { font-weight: 600; color: var(--heading); }
.trip-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.trip-main { flex: 1; min-width: 0; }
.trip-del {
  border: none; background: none; color: var(--muted);
  font-size: 17px; cursor: pointer; padding: 6px;
}

/* ---------- Значок «в эфире» ---------- */

.dot { display: inline-block; vertical-align: 1px; width: 10px; height: 10px;
       border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--live); box-shadow: 0 0 0 0 rgba(127, 194, 106, .6);
          animation: pulse 1.8s infinite; }
.dot.warn { background: var(--danger); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(127, 194, 106, .55); }
  70%  { box-shadow: 0 0 0 12px rgba(127, 194, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(127, 194, 106, 0); }
}

/* ---------- Экран водителя ---------- */

.speed { text-align: center; padding: 10px 0 2px; }
.speed-value {
  font-size: 96px; line-height: 1; font-weight: 700;
  color: var(--heading); font-variant-numeric: tabular-nums;
}
.speed-unit { font-size: 16px; color: var(--muted); letter-spacing: .18em; text-transform: uppercase; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.stat { background: var(--input-bg); border: 1px solid var(--input-border);
        border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--heading);
              font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.status-row { display: flex; align-items: center; gap: 10px; justify-content: center;
              margin-top: 16px; font-size: 14px; color: var(--muted); }

.warn-box {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: rgba(224, 129, 99, .14); border: 1px solid var(--danger);
  color: var(--text); font-size: 14px; line-height: 1.5;
}

.consent { font-size: 15px; line-height: 1.6; }
.consent li { margin: 8px 0 8px 18px; }

/* ---------- Экран наблюдателя ---------- */

.watch-page { height: 100%; display: flex; flex-direction: column; }
#map { flex: 1; min-height: 0; background: var(--bg); }
#map .leaflet-tile-pane { filter: var(--map-filter); }
.leaflet-container { font-family: inherit; background: var(--bg); }

.hud {
  background: var(--card); border-top: 1px solid var(--card-border);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(0,0,0,.18);
}
.hud-top { display: flex; align-items: center; gap: 12px; }
.hud-speed { font-size: 46px; font-weight: 700; color: var(--heading);
             font-variant-numeric: tabular-nums; line-height: 1; }
.hud-speed { display: flex; align-items: baseline; gap: 4px; flex: none; }
.hud-speed small { font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.hud-where { flex: 1; min-width: 0; }
.hud-name { font-weight: 600; color: var(--heading); font-size: 15px; }
.hud-addr { font-size: 13px; color: var(--muted); margin-top: 2px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px;
             font-size: 13px; color: var(--muted); }
.hud-stats b { color: var(--text); font-variant-numeric: tabular-nums; }

.map-btns { position: absolute; right: 12px; bottom: 12px; z-index: 500;
            display: flex; flex-direction: column; gap: 8px; }
.map-btn {
  width: 44px; height: 44px; border-radius: 12px; font-size: 18px; cursor: pointer;
  background: var(--card); color: var(--heading); border: 1px solid var(--card-border);
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.map-btn.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.map-wrap { position: relative; flex: 1; min-height: 0; display: flex; }

.car-marker {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--card);
  box-shadow: 0 0 0 2px var(--accent), 0 3px 10px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.car-arrow { width: 0; height: 0; border-left: 5px solid transparent;
             border-right: 5px solid transparent; border-bottom: 10px solid var(--accent-text); }

.stop-marker { background: var(--card); border: 2px solid var(--track-line);
               border-radius: 50%; width: 12px; height: 12px; }

/* ---------- Всплывающая подсказка ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-text);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; z-index: 1000;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- Код для фонового приложения ---------- */

.qr {
  background: #ffffff;           /* всегда светлый, иначе камера не прочитает */
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  margin: 14px auto 4px;
  width: fit-content;
  line-height: 0;
}
.qr svg { width: 200px; height: 200px; display: block; }
