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

/* Тёмная тема (по умолчанию) */
:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --border:   #2a2d3a;
  --text:     #e2e4ed;
  --muted:    #7b8099;
  --accent:   #4f7ef7;
  --danger:   #e05353;
  --row-hover:#232637;

  --status-wait:      #7b8099;
  --status-moving:    #4f7ef7;
  --status-loading:   #f0a30a;
  --status-unloading: #f0a30a;
  --status-docs:      #c084fc;
  --status-nodocs:    #e05353;
  --status-done:      #22c55e;
}

/* Светлая тема */
[data-theme="light"] {
  --bg:       #f4f5f7;
  --surface:  #ffffff;
  --border:   #dde1ea;
  --text:     #1a1d27;
  --muted:    #8b90a0;
  --accent:   #3b6ef5;
  --danger:   #d94444;
  --row-hover:#f0f2f7;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

#last-update {
  font-size: 12px;
  color: var(--muted);
}

/* ── Public main ─────────────────────────────────────────── */
main {
  padding: 24px;
}

/* ── Tabulator overrides ─────────────────────────────────── */
.tabulator {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px;
  overflow: hidden;
}

.tabulator .tabulator-header {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
}

.tabulator .tabulator-header .tabulator-col {
  background: transparent !important;
  border-right: 1px solid var(--border) !important;
  color: var(--muted) !important;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tabulator .tabulator-row {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.tabulator .tabulator-row:hover {
  background: var(--row-hover) !important;
}

.tabulator .tabulator-cell {
  border-right: 1px solid var(--border) !important;
}

/* ── Status badges ───────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-wait      { background: #7b809922; color: var(--status-wait); }
.status-moving    { background: #4f7ef722; color: var(--status-moving); }
.status-loading   { background: #f0a30a22; color: var(--status-loading); }
.status-unloading { background: #f0a30a22; color: var(--status-unloading); }
.status-docs      { background: #c084fc22; color: var(--status-docs); }
.status-nodocs    { background: #e0535322; color: var(--status-nodocs); }
.status-done      { background: #22c55e22; color: var(--status-done); }

/* ── Admin ───────────────────────────────────────────────── */
.admin-body { background: var(--bg); }

.admin-main {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1400px;
}

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

.card h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-grid input,
.form-grid select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}

.btn:hover { opacity: .85; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
}
.btn-ghost:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

/* Routes table */
.table-wrap { overflow-x: auto; }

.routes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.routes-table th,
.routes-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.routes-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.routes-table tr:hover td { background: var(--row-hover); }

.time-cell { color: #f0a30a; font-weight: 600; }
.plate     { font-weight: 700; letter-spacing: .04em; }
.upd-cell  { color: var(--muted); font-size: 12px; }

/* Status select in admin */
.status-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
}

.inline-form { display: inline; }

.empty-msg {
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
  font-size: 14px;
}
