/* Транспорт — визуальный контур в духе amk-group.org (тёмный фон, акцент #1D9E75) */
:root {
  --bg: #0b1628;
  --bg-elev: #112040;
  --bg-card: #152a4a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f7fb;
  --text-mute: #8899aa;
  --text-dim: #5d6b80;
  --accent: #1d9e75;
  --accent-soft: #5dcaa5;
  --accent-glow: rgba(29, 158, 117, 0.15);
  --warn: #f5a524;
  --err: #ff5d6c;
  --ok: #5dcaa5;
  --r: 10px;
  --r2: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --tap: 44px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font: 15px/1.55 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 90% 50% at 85% -5%, rgba(29, 158, 117, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 40%, rgba(93, 202, 165, 0.05), transparent 55%);
  background-attachment: fixed;
}

a { color: var(--accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top nav (липкий, мобильное меню) ───────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 22, 40, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: env(safe-area-inset-top, 0) 0 0;
}

.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  min-height: var(--tap);
}
.brand:hover { text-decoration: none; color: var(--accent-soft); }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
}

.brand-text { font-size: 14px; letter-spacing: -0.02em; }
.brand-text .logo {
  font-family: 'Unbounded', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-soft);
  margin-right: 4px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.nav-toggle::before,
.nav-toggle::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle::before { top: 16px; box-shadow: 0 6px 0 var(--text); }
.nav-toggle::after { top: 28px; }

.nav-toggle[aria-expanded="true"]::before {
  top: 21px;
  box-shadow: none;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"]::after {
  top: 21px;
  transform: rotate(-45deg);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.nav-links a {
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-mute);
  text-decoration: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-links a.on {
  color: #06241b;
  background: var(--accent);
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-mute);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role-badge.role-admin {
  border-color: rgba(245, 165, 36, 0.4);
  color: #fcd34d;
}
.role-badge.role-meh {
  border-color: rgba(29, 158, 117, 0.45);
  color: var(--accent-soft);
}

.page-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0));
}

h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0.85rem;
  color: var(--text);
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

/* Form */
.fg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0.9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
.span2 { grid-column: 1 / -1; }

label { font-size: 12px; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 88px; }

.row-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1.1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 1.1rem;
  border-radius: var(--r);
  font: 600 13.5px/1 'DM Sans', sans-serif;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: scale(0.98); }

.btn-pri {
  background: var(--accent);
  color: #06241b;
  border-color: var(--accent);
}
.btn-pri:hover { background: var(--accent-soft); }

.btn-sec {
  background: transparent;
  color: var(--text-mute);
  border-color: var(--border-strong);
}
.btn-sec:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--accent-soft);
  border: 1px solid rgba(29, 158, 117, 0.35);
}
.btn-ghost:hover { background: var(--accent-glow); }

.btn-sm { min-height: 38px; padding: 0 12px; font-size: 12.5px; }

.btn-danger {
  color: var(--err);
  border-color: rgba(255, 93, 108, 0.45);
  background: transparent;
}
.btn-danger:hover { background: rgba(255, 93, 108, 0.1); }

/* Table */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
th {
  padding: 10px 12px;
  text-align: left;
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-mute);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(29, 158, 117, 0.04); }

/* Badges */
.bdg {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-wait { background: rgba(245, 165, 36, 0.15); color: #fcd34d; }
.badge-go { background: rgba(29, 158, 117, 0.18); color: var(--accent-soft); }
.badge-done { background: rgba(93, 202, 165, 0.12); color: #86efac; }
.badge-off { background: rgba(255, 93, 108, 0.12); color: #fca5a5; }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 1.15rem;
}
.mc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1rem;
}
.mc-val { font-family: 'Unbounded', sans-serif; font-size: 22px; font-weight: 700; color: var(--accent-soft); line-height: 1.1; }
.mc-lbl { font-size: 11px; color: var(--text-dim); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.05em; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  margin-bottom: 1rem;
  font-size: 13px;
}
.filters label { text-transform: none; letter-spacing: 0; font-weight: 500; }
.filters select, .filters input[type='date'] {
  width: auto;
  min-height: 40px;
  font-size: 13px;
}

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.chart-row.w32 { grid-template-columns: 3fr 2fr; }
.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1rem;
}
.chart-box h2 { font-size: 12px; color: var(--text-mute); margin-bottom: 8px; }
.chart-h200 { position: relative; height: 200px; }

.leg { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-mute); margin-bottom: 6px; }

.alert {
  padding: 12px 14px;
  border-radius: var(--r);
  margin-bottom: 12px;
  font-size: 13.5px;
  border: 1px solid var(--border);
}
.alert-ok { background: rgba(29, 158, 117, 0.12); color: var(--accent-soft); border-color: rgba(29, 158, 117, 0.35); }
.alert-err { background: rgba(255, 93, 108, 0.1); color: #fecaca; border-color: rgba(255, 93, 108, 0.35); }
.alert-inf { background: rgba(59, 130, 246, 0.1); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }

.toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0));
  right: 16px;
  left: 16px;
  max-width: 360px;
  margin-left: auto;
  z-index: 999;
  background: #0a1220;
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 13.5px;
  border: 1px solid var(--border-strong);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.toast.on { opacity: 1; }
.toast.ok { border-color: rgba(29, 158, 117, 0.5); }
.toast.bad { border-color: rgba(255, 93, 108, 0.5); }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-top: calc(24px + env(safe-area-inset-top, 0));
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
}

.login-box h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 0.35rem;
}

.login-sub { text-align: center; font-size: 13px; color: var(--text-mute); margin-bottom: 1.25rem; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-dim); font-size: 14px; }

.list-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-mute);
}
.list-item:last-child { border: none; }
.cnt-badge {
  background: var(--accent-glow);
  color: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(29, 158, 117, 0.35);
}

/* ── Мобильная вёрстка ─────────────────────────────────── */
@media (max-width: 900px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    order: 10;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }
  .nav-links.nav-open { display: flex; }
  .nav-links a { width: 100%; border-radius: var(--r); }

  .nav-right {
    width: 100%;
    justify-content: flex-end;
    order: 11;
    padding-top: 4px;
  }

  .grid2, .grid3, .chart-row, .chart-row.w32, .metrics, .list-grid {
    grid-template-columns: 1fr;
  }
  .span2 { grid-column: auto; }

  .row-actions { justify-content: stretch; }
  .row-actions .btn { flex: 1; }
}

@media (max-width: 480px) {
  .filters select, .filters input[type='date'] { width: 100%; }
}
