:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --line: #d8dee9;
  --text: #1f2937;
  --muted: #6b7280;
  --passed: #9ca3af;
  --accent: #2563eb;
  --input: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;

  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;

  background: var(--bg);
  color: var(--text);
}

body.dark {
  --bg: #0b1120;
  --card: #111827;
  --line: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --passed: #64748b;
  --accent: #60a5fa;
  --input: #0f172a;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.subtitle {
  margin: 0 0 18px;
  color: var(--muted);
}

/* Верхняя правая панель */
.top-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;

  width: 100%;
  min-height: 42px;
  margin-bottom: 14px;
  padding: 4px 0;
}

/* Кнопка входа */
.login-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 34px;
  padding: 0 11px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--card);
  color: var(--text);

  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.login-control:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Переключатель темы */
.theme-control {
  position: static;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;

  border: 0;
  border-radius: 0;

  background: transparent;
  color: var(--text);

  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.theme-control:hover {
  transform: scale(1.12);
}

.topbar,
.tabs,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.btn {
  padding: 10px 14px;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: var(--card);
  color: var(--text);

  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.btn:hover {
  filter: brightness(0.96);
}

.btn.active,
.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.btn.danger {
  color: #dc2626;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card,
.panel {
  padding: 16px;

  border: 1px solid var(--line);
  border-radius: 18px;

  background: var(--card);
}

.title {
  display: flex;
  justify-content: space-between;
  gap: 10px;

  margin-bottom: 12px;
}

.title h2 {
  margin: 0;
  font-size: 18px;
}

.badge {
  height: max-content;
  padding: 4px 10px;

  border-radius: 99px;

  background: #dbeafe;
  color: #1d4ed8;

  font-size: 12px;
  font-weight: 800;
}

.dark .badge {
  background: #1e3a5f;
  color: #bfdbfe;
}

.times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 8px;
}

.time {
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 48px;

  border: 1px solid var(--line);
  border-radius: 11px;

  background: var(--input);

  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.time.passed {
  background: color-mix(in srgb, var(--card) 75%, var(--bg));
  color: var(--passed);

  opacity: 0.72;
  text-decoration: line-through;
}

.time.next {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.time.bigbus {
  border: 3px solid #111111 !important;
  font-weight: 900 !important;
}

.dark .time.bigbus {
  border-color: #ffffff !important;
}

.time.bigbus.passed {
  border-color: var(--passed) !important;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;

  margin-top: 16px;

  color: var(--muted);
  font-size: 14px;
}

.form-card {
  max-width: 420px;
  margin: 8vh auto;
}

.field {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.field label {
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  padding: 10px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--input);
  color: var(--text);

  font: inherit;
}

.error {
  padding: 10px;

  border-radius: 10px;

  background: #fee2e2;
  color: #991b1b;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-weight: 600;
}

.status.ok {
  color: #16a34a;
}

.status.error {
  color: #dc2626;
}

.trip-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 12px;

  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.trip-row:last-child {
  border-bottom: 0;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted {
  color: var(--muted);
}

/* Главная страница администрирования */
.admin-menu {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.admin-menu-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;

  padding: 18px;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: var(--card);
  color: var(--text);
  text-decoration: none;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}

.admin-menu-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.admin-menu-icon {
  display: grid;
  place-items: center;

  width: 52px;
  height: 52px;

  border-radius: 14px;

  background: #dbeafe;
  font-size: 25px;
}

.dark .admin-menu-icon {
  background: #1e3a5f;
}

.admin-menu-item strong {
  display: block;
  font-size: 16px;
}

.admin-menu-item small {
  display: block;
  margin-top: 4px;

  color: var(--muted);
  line-height: 1.35;
}

.admin-menu-arrow {
  color: var(--muted);
  font-size: 32px;
  line-height: 1;
}

@media (max-width: 800px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .trip-row {
    grid-template-columns: 110px 1fr auto;
  }

  .wrap {
    padding: 16px;
  }
}