/* ============================================
   ZEITNACHWEIS — Design-Tokens
   Konzept: Fahrer-Cockpit / Bordcomputer bei Nacht.
   Dunkles Asphalt-Blau als Basis, Amber als Warnfarbe
   für Diskrepanzen (wie eine Warnleuchte am Armaturenbrett).
   ============================================ */

:root {
  /* Farben */
  --c-bg: #0b0f14;
  --c-bg-panel: #121820;
  --c-bg-panel-raised: #171f2a;
  --c-line: #263041;
  --c-line-soft: #1b232f;
  --c-text: #e8ecf1;
  --c-text-dim: #8996a8;
  --c-text-faint: #4d5868;
  --c-amber: #ffb020;
  --c-amber-dim: #7a5b1e;
  --c-blue-gps: #3b82f6;
  --c-grey-gps: #5b6472;
  --c-green: #34d399;
  --c-red: #f2545b;

  /* Typografie */
  --f-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', 'Consolas', monospace;
  --f-body: 'Inter', 'Segoe UI', sans-serif;

  /* Layout */
  --radius: 10px;
  --radius-lg: 18px;
  --shadow-panel: 0 20px 60px -20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.03);
  --header-h: 72px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--c-bg);
  background-image:
    radial-gradient(ellipse 1200px 600px at 50% -10%, rgba(255,176,32,0.06), transparent),
    radial-gradient(ellipse 800px 500px at 90% 20%, rgba(59,130,246,0.05), transparent);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

::selection { background: var(--c-amber); color: #1a1204; }

:focus-visible {
  outline: 2px solid var(--c-amber);
  outline-offset: 2px;
}

/* ---------- Layout shell ---------- */

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

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--c-line-soft);
  background: rgba(11,15,20,0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--c-amber), #e08a00);
  display: flex; align-items: center; justify-content: center;
  color: #1a1204;
  font-weight: 800;
  box-shadow: 0 4px 14px -4px rgba(255,176,32,0.5);
}

.nav-user { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--c-text-dim); }
.nav-user .role-badge {
  font-family: var(--f-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--c-bg-panel-raised);
  border: 1px solid var(--c-line);
  color: var(--c-amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--c-line);
  background: var(--c-bg-panel-raised);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--c-text-faint); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(145deg, var(--c-amber), #e08a00);
  border-color: transparent;
  color: #1a1204;
  font-weight: 700;
}
.btn-primary:hover { box-shadow: 0 8px 20px -6px rgba(255,176,32,0.55); }
.btn-ghost { background: transparent; border-color: var(--c-line); color: var(--c-text-dim); }
.btn-danger { color: var(--c-red); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

main { flex: 1; padding: 40px 28px 80px; max-width: 1180px; margin: 0 auto; width: 100%; }

/* ---------- Auth pages ---------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 880px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

.auth-visual {
  position: relative;
  background: radial-gradient(ellipse at 30% 30%, #151d29, var(--c-bg) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--c-line-soft);
}

.auth-visual .caption {
  position: absolute;
  bottom: 48px;
  left: 48px;
  right: 48px;
  z-index: 2;
}
.auth-visual .caption .eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--c-amber);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.auth-visual .caption h2 {
  font-size: 26px;
  line-height: 1.25;
  color: var(--c-text);
  max-width: 380px;
}

.auth-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}

.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { margin-bottom: 36px; }
.auth-card h1 { font-size: 26px; margin-bottom: 8px; }
.auth-card .sub { color: var(--c-text-dim); font-size: 14px; margin-bottom: 32px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-dim);
  margin-bottom: 8px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--c-bg-panel);
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--c-amber);
  box-shadow: 0 0 0 3px rgba(255,176,32,0.12);
  outline: none;
}
.field textarea { resize: vertical; min-height: 70px; font-family: var(--f-body); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.error-box {
  background: rgba(242,84,91,0.08);
  border: 1px solid rgba(242,84,91,0.3);
  color: #ff9195;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}
.success-box {
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.3);
  color: var(--c-green);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}

.auth-link { text-align: center; margin-top: 24px; font-size: 13px; color: var(--c-text-dim); }
.auth-link a { color: var(--c-amber); text-decoration: none; font-weight: 600; }

/* ---------- Dashboard: stat strip ---------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}
.page-head .eyebrow {
  font-family: var(--f-mono); font-size: 12px; color: var(--c-amber);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px;
}
.page-head h1 { font-size: 30px; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}
@media (max-width: 760px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--c-bg-panel);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card .label {
  font-family: var(--f-mono); font-size: 11px; color: var(--c-text-dim);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.stat-card .value {
  font-family: var(--f-display); font-size: 28px; font-weight: 700;
}
.stat-card .value.amber { color: var(--c-amber); }
.stat-card .value.red { color: var(--c-red); }
.stat-card .value.green { color: var(--c-green); }
.stat-card .sub { font-size: 12px; color: var(--c-text-faint); margin-top: 4px; }

/* ---------- 3D clock hero ---------- */

.clock-hero {
  background: var(--c-bg-panel);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  padding: 0;
  margin-bottom: 36px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 280px;
}
@media (max-width: 820px) { .clock-hero { grid-template-columns: 1fr; } }

#clock3d-mount {
  position: relative;
  background: radial-gradient(circle at 50% 40%, #1a2230, #0d1219 75%);
  border-right: 1px solid var(--c-line-soft);
}
@media (max-width: 820px) { #clock3d-mount { border-right: none; border-bottom: 1px solid var(--c-line-soft); height: 260px; } }

.clock-hero-copy { padding: 32px 34px; display: flex; flex-direction: column; justify-content: center; }
.clock-hero-copy .eyebrow {
  font-family: var(--f-mono); font-size: 12px; color: var(--c-amber);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px;
}
.clock-hero-copy h2 { font-size: 24px; line-height: 1.3; margin-bottom: 12px; max-width: 480px; }
.clock-hero-copy p { color: var(--c-text-dim); font-size: 14px; max-width: 480px; margin: 0 0 20px; }

/* ---------- Entries table ---------- */

.panel {
  background: var(--c-bg-panel);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--c-line-soft);
}
.panel-head h3 { font-size: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-dim);
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-line-soft);
  white-space: nowrap;
}
tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-line-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.015); }

.mono { font-family: var(--f-mono); }

.pin {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 12px;
}
.pin-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pin-dot.blau { background: var(--c-blue-gps); box-shadow: 0 0 8px rgba(59,130,246,0.6); }
.pin-dot.grau { background: var(--c-grey-gps); box-shadow: 0 0 8px rgba(91,100,114,0.4); }
.pin-dot.unbekannt { background: var(--c-text-faint); }

.diff-badge {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 600;
}
.diff-badge.neg { background: rgba(242,84,91,0.12); color: var(--c-red); }
.diff-badge.pos { background: rgba(52,211,153,0.12); color: var(--c-green); }
.diff-badge.zero { background: var(--c-bg-panel-raised); color: var(--c-text-faint); }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--c-line); background: transparent; color: var(--c-text-dim);
  cursor: pointer; text-decoration: none;
}
.icon-btn:hover { border-color: var(--c-text-faint); color: var(--c-text); }

.empty-state {
  padding: 70px 30px; text-align: center; color: var(--c-text-dim);
}
.empty-state .glyph { font-size: 40px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { color: var(--c-text); margin-bottom: 8px; font-size: 17px; }
.empty-state p { font-size: 13.5px; max-width: 360px; margin: 0 auto 20px; }

/* ---------- Form page ---------- */

.form-panel { max-width: 640px; padding: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; justify-content: flex-end; }

.hint { font-size: 12px; color: var(--c-text-faint); margin-top: 6px; }

/* ---------- Footer ---------- */
.footer-note {
  text-align: center; color: var(--c-text-faint); font-size: 12px;
  padding: 30px 0 10px;
}
