:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #283548;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-h: #4f46e5;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --cat-geburtstag: #f43f5e;
  --cat-feiertag: #3b82f6;
  --cat-veranstaltung: #a855f7;
  --cat-erinnerung: #f59e0b;
  --cat-sonstiges: #6b7280;
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

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

/* ── Nav ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  margin-right: 16px;
}
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  transition: all .15s;
}
.nav-link:hover, .nav-link.active { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-user { color: var(--muted); font-size: 0.85rem; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.page-header { margin-bottom: 28px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; font-weight: 700; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); text-decoration: none; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.92rem;
  transition: border-color .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 400;
}
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.reminder-grid { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.alert-error { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.alert-info { background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; }

/* ── Calendar ── */
.calendar-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .calendar-wrap { grid-template-columns: 1fr; } }

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.cal-title { font-size: 1.3rem; font-weight: 700; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cal-header-cell {
  background: var(--surface2);
  text-align: center;
  padding: 10px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cal-cell {
  background: var(--surface);
  min-height: 80px;
  padding: 8px;
  position: relative;
  transition: background .12s;
}
.cal-cell:hover { background: var(--surface2); }
.cal-cell.empty { background: var(--bg); }
.cal-cell.today { background: rgba(99,102,241,.08); }
.cal-day-num {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}
.cal-cell.today .cal-day-num { color: var(--accent); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-event-label {
  display: block;
  font-size: 0.72rem;
  padding: 1px 5px;
  border-radius: 4px;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  max-width: 100%;
}

/* ── Upcoming ── */
.upcoming-list { display: flex; flex-direction: column; gap: 8px; }
.upcoming-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  font-size: 0.87rem;
}
.upcoming-date { color: var(--muted); font-size: 0.78rem; white-space: nowrap; margin-top: 2px; }
.upcoming-title { font-weight: 500; }

/* ── Event List ── */
.events-list { display: flex; flex-direction: column; gap: 10px; }
.event-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.event-card:hover { border-color: var(--accent); }
.event-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.event-info { flex: 1; min-width: 0; }
.event-title { font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.event-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.event-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
}
.event-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Category filters ── */
.cat-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.cat-filter {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.cat-filter:hover, .cat-filter.active { color: #fff; border-color: transparent; text-decoration: none; }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 2rem; font-weight: 800; }
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--muted); margin-top: 4px; font-size: 0.9rem; }

/* ── Profile ── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .profile-grid { grid-template-columns: 1fr; } }
.section-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* ── TOTP ── */
.totp-qr { text-align: center; margin: 16px 0; }
.totp-qr img { width: 200px; height: 200px; border-radius: var(--radius); background: #fff; padding: 8px; }
.totp-secret { font-family: monospace; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: 0.9rem; text-align: center; letter-spacing: .1em; word-break: break-all; }

/* ── OTP Input ── */
.otp-input { font-size: 1.8rem; font-family: monospace; letter-spacing: .3em; text-align: center; }

/* ── Misc ── */
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
