:root {
  --bg: #0f0e17;
  --surface: #1a1826;
  --surface2: #221f30;
  --border: #2e2a40;
  --accent: #5b8dee;
  --accent2: #a78bfa;
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #ef4444;
  --montage: #f97316;
  --text: #e8e8f5;
  --muted: #6b6b8f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  height: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-bottom: 90px;
}

.hidden { display: none !important; }

h1 { font-size: 20px; margin: 8px 0 16px; }
h2 { font-size: 14px; color: var(--accent); margin: 20px 0 8px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 4px;
  text-transform: uppercase;
}

input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: white;
}

.btn-primary { background: var(--accent); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); color: #1a1400; }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-block { width: 100%; margin-top: 10px; }
.btn-row { display: flex; gap: 8px; }
.btn-row button { flex: 1; }

.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 16px; }
.success { color: var(--success); font-size: 13px; margin-top: 8px; }
.muted { color: var(--muted); font-size: 12px; }

.timer-display {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0;
  color: var(--accent);
}

.entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.entry-row:last-child { border-bottom: none; }
.entry-row .type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface2);
}
.entry-row .del { color: var(--muted); background: none; padding: 4px 8px; font-size: 16px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar .logout { background: none; color: var(--muted); font-size: 13px; padding: 4px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-grid .card { margin-bottom: 0; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; }

#offline-banner {
  background: var(--warning);
  color: #1a1400;
  text-align: center;
  font-size: 13px;
  padding: 6px;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* ── Farbschemen (identisch zu app/core/config.py THEMES) ────────────── */
body[data-theme="dark_petrol"] {
  --bg: #0b1615; --surface: #122320; --surface2: #172d29; --border: #1f3a35;
  --accent: #2dd4bf; --accent2: #5eead4; --success: #34d399; --warning: #f59e0b;
  --danger: #f87171; --montage: #fb923c; --text: #e5f5f2; --muted: #5f8b83;
}
body[data-theme="light"] {
  --bg: #f4f5f9; --surface: #ffffff; --surface2: #eef0f6; --border: #dbe0ea;
  --accent: #3b6fe0; --accent2: #7c5cf0; --success: #159a6c; --warning: #c8790a;
  --danger: #d1424b; --montage: #d2610f; --text: #1c1e26; --muted: #6b7280;
}
body[data-theme="high_contrast"] {
  --bg: #000000; --surface: #111111; --surface2: #1e1e1e; --border: #444444;
  --accent: #00e5ff; --accent2: #ffea00; --success: #00ff6a; --warning: #ffb300;
  --danger: #ff3b30; --montage: #ff8c00; --text: #ffffff; --muted: #bbbbbb;
}

/* ── Tab-Leiste ───────────────────────────────────────────────────────── */
#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab-btn {
  flex: 1;
  background: none;
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 2px;
  font-size: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tab-btn span { font-size: 10px; font-weight: 600; }
.tab-btn.active { color: var(--accent); }

.page { display: block; }
.page.hidden { display: none; }

/* ── Kalender ─────────────────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  position: relative;
}
.cal-cell.today { outline: 2px solid var(--accent); }
.cal-cell.selected { outline: 2px solid var(--accent2); }
.cal-cell .day-num { font-weight: 700; }
.cal-cell .hrs { font-size: 8px; }
.cal-weekday {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 4px;
}

/* ── Berichtsheft ─────────────────────────────────────────────────────── */
.journal-entry {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.journal-entry .je-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.journal-entry .je-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.journal-entry .je-content { font-size: 13px; white-space: pre-wrap; }
.journal-entry .je-tags { margin-top: 6px; }
.journal-entry .je-tags span {
  display: inline-block;
  background: var(--surface2);
  color: var(--accent);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.journal-entry .je-actions { margin-top: 8px; display: flex; gap: 8px; }
.journal-entry .je-actions button {
  background: none; color: var(--muted); padding: 2px 6px; font-size: 12px;
}

/* ── Diagramme (SVG, siehe charts.js) ─────────────────────────────────── */
.chart-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 0; }
svg.chart text { fill: var(--muted); font-size: 9px; }
