:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #d9dce1;
  --text: #16191d;
  --muted: #626873;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --danger: #c0392b;
  --ok: #1e8e4e;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1d2126;
    --border: #2e343c;
    --text: #e8eaed;
    --muted: #98a0ad;
    --accent: #4d8ff5;
    --accent-text: #0d1117;
    --danger: #e5695b;
    --ok: #4cc27d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

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

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.muted { color: var(--muted); font-size: 13px; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 6px 12px;
}

.notice, .error {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.notice { background: rgba(30, 142, 78, 0.12); color: var(--ok); }
.error  { background: rgba(192, 57, 43, 0.12); color: var(--danger); }

.code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 30px;
  letter-spacing: 3px;
  padding: 14px 0;
  text-align: center;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin: 12px 0;
  user-select: all;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

.tag { font-size: 12px; padding: 2px 8px; border-radius: 20px; }
.tag-live { background: rgba(30, 142, 78, 0.15); color: var(--ok); }
.tag-off  { background: var(--bg); color: var(--muted); }

/* Инлайн-стили запрещены CSP, поэтому вся раскладка — только классами. */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.topbar h1 { margin: 0; }
td.right { text-align: right; }

.row { display: flex; gap: 12px; align-items: flex-end; }
.row > * { flex: 1; }
.row > button { flex: 0 0 auto; margin-bottom: 12px; }

/* --- страница поездки --- */

.track-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

#map { flex: 1; min-height: 0; background: var(--bg); }

.track-header {
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.track-header h1 { font-size: 17px; }

.track-status {
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
}

.stat b { display: block; font-size: 15px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-live { background: var(--ok); }
.dot-off { background: var(--muted); }

.center-box { max-width: 420px; margin: 12vh auto; padding: 0 16px; text-align: center; }

.track-actions { display: flex; gap: 8px; }

a.button-link {
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
