/* TotyBike admin panel — single stylesheet, no build step. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --text: #1a1d24;
  --muted: #667085;
  --accent: #d81b60;          /* TotyBike pink */
  --accent-soft: #fce4ec;
  --accent-dark: #ad1457;
  --ok: #12805c;
  --ok-soft: #e6f5f0;
  --warn: #b54708;
  --warn-soft: #fef3e6;
  --bad: #b42318;
  --bad-soft: #fee4e2;
  --live: #175cd3;
  --live-soft: #e5efff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

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

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

/* ── Shell ──────────────────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: #14161c;
  color: #d0d5dd;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; letter-spacing: .04em;
}
.brand .name { font-weight: 600; color: #fff; font-size: 15px; }

.sidebar-alert {
  margin: 0 12px 12px; padding: 9px 11px; border-radius: 8px;
  background: rgba(180, 35, 24, .18); color: #ffb4ab;
  font-size: 12px; line-height: 1.4;
}

.sidebar nav { flex: 1; padding: 0 8px 14px; }
.nav-section {
  padding: 14px 10px 6px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: #667085;
}
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 10px; margin-bottom: 1px;
  border-radius: 7px; color: #d0d5dd; font-size: 13.5px;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; font-weight: 500; }
.sidebar nav a .badge {
  background: rgba(255, 255, 255, .16); color: #fff;
  border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 600;
}
.sidebar nav a.active .badge { background: rgba(0, 0, 0, .25); }

.sidebar-foot {
  padding: 12px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px;
}
.sidebar-foot a { color: #98a2b3; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 18px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.topbar .subtitle { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-actions { display: flex; gap: 8px; margin-right: 6px; }
.who { text-align: right; line-height: 1.25; margin-right: 4px; }
.who-name { display: block; font-weight: 500; font-size: 13px; }
.who-role { display: block; color: var(--muted); font-size: 11.5px; }

.content { padding: 22px 24px 40px; flex: 1; }

.foot {
  padding: 14px 24px 22px; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--line);
}

/* ── Flash ──────────────────────────────────────────────────────────── */

.flash {
  margin: 14px 24px 0; padding: 11px 14px; border-radius: 8px;
  font-size: 13.5px; border: 1px solid transparent;
}
.flash.success { background: var(--ok-soft); color: var(--ok); border-color: #a6e0cd; }
.flash.error   { background: var(--bad-soft); color: var(--bad); border-color: #fda29b; }
.flash.warning { background: var(--warn-soft); color: var(--warn); border-color: #fbc99a; }
.flash.info    { background: var(--live-soft); color: var(--live); border-color: #b2ccff; }
.flash a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ── Cards, panels, grids ───────────────────────────────────────────── */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card > h2, .card > .card-head {
  margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.split  { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

@media (max-width: 900px) {
  .grid.split { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Stat tiles ─────────────────────────────────────────────────────── */

.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
}
.stat .label {
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}
.stat .value { font-size: 25px; font-weight: 650; margin-top: 6px; letter-spacing: -.02em; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--bad); }
.stat.accent { border-color: var(--accent); }
.stat.alarm { border-color: #fda29b; background: var(--bad-soft); }

/* ── Tables ─────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 14px; background: #fafbfc;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
td.tight { white-space: nowrap; }
.table-empty { padding: 34px 16px; text-align: center; color: var(--muted); }

/* ── Pills and badges ───────────────────────────────────────────────── */

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill.ok      { background: var(--ok-soft); color: var(--ok); }
.pill.bad     { background: var(--bad-soft); color: var(--bad); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.live    { background: var(--live-soft); color: var(--live); }
.pill.muted   { background: #f2f4f7; color: var(--muted); }
.pill.accent  { background: var(--accent-soft); color: var(--accent-dark); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.online { background: var(--ok); }
.dot.offline { background: var(--line-strong); }
.dot.busy { background: var(--warn); }

/* ── Forms ──────────────────────────────────────────────────────────── */

label { display: block; font-size: 12px; font-weight: 500; color: #344054; margin-bottom: 5px; }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; line-height: 1.45; }

input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=datetime-local], input[type=time], input[type=search],
input[type=file], select, textarea {
  width: 100%; padding: 8px 11px; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }

.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 180px; margin-bottom: 0; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline label { margin: 0; font-weight: 400; font-size: 13px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong);
  position: relative; transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  white-space: nowrap;
}
.btn:hover, button:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary, button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn.primary:hover, button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger, button.danger { border-color: #fda29b; color: var(--bad); background: #fff; }
.btn.danger:hover, button.danger:hover { background: var(--bad-soft); }
.btn.ok, button.ok { border-color: #a6e0cd; color: var(--ok); }
.btn.ok:hover, button.ok:hover { background: var(--ok-soft); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.small, button.small { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Filters ────────────────────────────────────────────────────────── */

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px;
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field.wide { flex: 1 1 240px; }

/* ── Pagination ─────────────────────────────────────────────────────── */

.pagination {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 13px 16px; border-top: 1px solid var(--line); font-size: 13px;
}
.pagination .count { color: var(--muted); margin-right: auto; }
.pagination a, .pagination .current {
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line);
}
.pagination a:hover { border-color: var(--muted); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ── Definition lists ───────────────────────────────────────────────── */

.dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 0; font-size: 13px; }
.dl dt { padding: 9px 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.dl dd { padding: 9px 0; margin: 0; border-bottom: 1px solid var(--line); }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* ── Timeline ───────────────────────────────────────────────────────── */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 16px 22px;
  border-left: 2px solid var(--line); margin-left: 5px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
}
.timeline .when { color: var(--muted); font-size: 11.5px; }
.timeline .what { font-weight: 500; font-size: 13px; }
.timeline .note { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ── Maps ───────────────────────────────────────────────────────────── */

#map, .map {
  height: 560px; width: 100%;
  border-radius: var(--radius); border: 1px solid var(--line); background: #eaeef2;
}
.map.short { height: 300px; }
.map-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; font-size: 12px; color: var(--muted);
}
.map-legend span { display: flex; align-items: center; gap: 6px; }

/* ── Settings ───────────────────────────────────────────────────────── */

.settings-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.settings-tabs a {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 13px;
}
.settings-tabs a:hover { border-color: var(--muted); text-decoration: none; }
.settings-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }

.setting-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px; padding: 15px 16px; border-bottom: 1px solid var(--line);
  align-items: start;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .meta strong { display: block; font-size: 13.5px; font-weight: 600; }
.setting-row .meta .key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--muted); margin-top: 2px; display: block;
}
.setting-row .meta .desc { color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.setting-row .control { display: flex; flex-direction: column; gap: 5px; }
.setting-row .unit { color: var(--muted); font-size: 11.5px; }
.setting-row.locked { background: #fafbfc; }
.setting-row.locked .control { opacity: .65; }

@media (max-width: 780px) {
  .setting-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ── Sign-in ────────────────────────────────────────────────────────── */

body.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 28px; box-shadow: 0 8px 28px rgba(16, 24, 40, .08);
}
.auth-card .mark {
  width: 42px; height: 42px; border-radius: 11px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 16px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 21px; }
.auth-card p.lede { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.auth-card .field { margin-bottom: 15px; }
.auth-card button { width: 100%; padding: 10px; margin-top: 6px; }
.auth-note { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.auth-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* ── Misc ───────────────────────────────────────────────────────────── */

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); display: inline-grid; place-items: center;
  color: var(--accent-dark); font-weight: 600; font-size: 12px; vertical-align: middle;
}
.doc-thumb {
  max-width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block;
}
.tag {
  display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0;
  background: #f2f4f7; border-radius: 6px; font-size: 11.5px; color: #344054;
}
.scroll-x { overflow-x: auto; }
