:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1f2937; --muted: #6b7280;
  --line: #e5e7eb; --brand: #1d4ed8; --brand-dk: #1e3a8a;
  --drive: #2563eb; --work: #f59e0b; --avail: #10b981; --rest: #9ca3af;
  --ok: #16a34a; --warn: #d97706; --crit: #dc2626;
  --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 24px; background: var(--brand-dk);
  color: #fff; padding: 0 22px; height: 56px; box-shadow: var(--shadow); }
.topbar .brand a { color: #fff; font-weight: 700; font-size: 18px; }
.mainnav { display: flex; gap: 18px; flex: 1; }
.mainnav a { color: #dbeafe; font-weight: 500; }
.mainnav a:hover { color: #fff; text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #c7d2fe; }
.btn-logout { background: rgba(255,255,255,.15); color: #fff; padding: 6px 12px;
  border-radius: 8px; }

/* Layout */
.content { max-width: 1180px; margin: 24px auto; padding: 0 18px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.card h2 { font-size: 16px; margin: 0 0 14px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #f9fafb; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 600; }
.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-warn { background: #fef3c7; color: var(--warn); }
.badge-crit { background: #fee2e2; color: var(--crit); }
.sev-minor { background:#fef3c7; color:var(--warn); }
.sev-serious { background:#ffedd5; color:#c2410c; }
.sev-very_serious { background:#fee2e2; color:var(--crit); }

/* Buttons & Forms */
.btn { display: inline-block; background: var(--brand); color: #fff; padding: 9px 16px;
  border: 0; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-dk); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; }

/* Auth */
.auth-wrap { max-width: 380px; margin: 8vh auto; }
.auth-wrap .card { padding: 28px; }
.auth-wrap h1 { font-size: 20px; margin: 0 0 18px; text-align: center; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #dcfce7; color: var(--ok); }
.flash-danger, .flash-error { background: #fee2e2; color: var(--crit); }
.flash-info { background: #dbeafe; color: var(--brand-dk); }

/* Activity timeline bar (24h) */
.tl { display: flex; height: 22px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.tl-seg { height: 100%; }
.tl-DRIVING { background: var(--drive); }
.tl-WORK { background: var(--work); }
.tl-AVAILABLE { background: var(--avail); }
.tl-BREAK_REST { background: var(--rest); }
.legend { display:flex; gap:14px; font-size:12px; color:var(--muted); margin-top:8px; flex-wrap:wrap; }
.legend i { display:inline-block; width:11px; height:11px; border-radius:3px; margin-right:5px; vertical-align:middle; }

.muted { color: var(--muted); }
.right { text-align: right; }
#map { height: 420px; border-radius: var(--radius); }
