/* ===================================================
   angel-central — Shared Stylesheet
   Primärfarbe: #3B0A0A (bordeaux)
   Sidebar: #1c0404
   =================================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
}

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px; flex-shrink: 0; background: #1c0404;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.sidebar-logo img { height: 32px; display: block; filter: brightness(0) invert(1); margin-bottom: 0.25rem; }
.sidebar-logo-sub { font-size: 0.65rem; color: #9a7a7a; letter-spacing: 0.04em; }

.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-section { padding: 0 0.6rem; margin-bottom: 0.25rem; }
.nav-section-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #9a7a7a; padding: 0.5rem 0.6rem 0.2rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.65rem; border-radius: 7px;
  color: #c4b0b0; text-decoration: none; font-size: 0.87rem; font-weight: 500;
  transition: background 0.15s, color 0.15s; margin-bottom: 0.1rem;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.nav-link.aktiv { background: rgba(59,10,10,0.35); color: #e8c4c4; }
.nav-link i { width: 16px; flex-shrink: 0; }

.sidebar-footer { padding: 0.9rem 1rem; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.user-email { font-size: 0.78rem; color: #c4b0b0; word-break: break-all; margin-bottom: 0.3rem; }
.role-badge {
  display: inline-block; font-size: 0.65rem; font-weight: 700;
  padding: 0.15rem 0.45rem; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.65rem;
}
.role-admin    { background: rgba(34,197,94,0.2);  color: #4ade80; }
.role-family   { background: rgba(59,10,10,0.2);   color: #c9a0a0; }
.role-caregiver{ background: rgba(168,85,247,0.2); color: #c084fc; }

.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.45rem;
  background: rgba(239,68,68,0.12); color: #fca5a5;
  border: none; border-radius: 6px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; text-align: center; text-decoration: none; transition: background 0.15s;
}
.btn-logout:hover { background: rgba(239,68,68,0.22); }

/* ===== MAIN ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid #e2e8f0;
  padding: 0 2rem; height: 56px;
  display: flex; align-items: center; gap: 1rem; flex-shrink: 0;
}
.topbar h1 { font-size: 1.2rem; font-weight: 700; color: #0f172a; }
.topbar-back {
  font-size: 0.85rem; color: #3B0A0A; text-decoration: none; font-weight: 600;
  display: flex; align-items: center; gap: 0.3rem;
  transition: opacity 0.15s; white-space: nowrap;
}
.topbar-back:hover { opacity: 0.75; }
.content { padding: 1.75rem 2rem; flex: 1; }

/* ===== ALERT BANNER ===== */
.alert-banner { background: #450A0A; border-bottom: 2px solid #7f1d1d; padding: 0.75rem 2rem; display: none; }
.alert-banner.sichtbar { display: block; }
.alert-banner-kopf {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; font-weight: 700; color: #fca5a5;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem;
}
.alert-banner-kopf i { color: #f87171; }
.alert-eintrag {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.06); border-radius: 6px;
  padding: 0.5rem 0.75rem; margin-bottom: 0.35rem;
  font-size: 0.84rem; color: #fecaca;
}
.alert-eintrag:last-child { margin-bottom: 0; }
.alert-eintrag-info { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.alert-patient { font-weight: 700; color: #fff; white-space: nowrap; }
.alert-typ { color: #fca5a5; }
.alert-zeit { font-size: 0.75rem; color: #9a7a7a; white-space: nowrap; margin-left: auto; padding: 0 0.75rem; }
.btn-alert-ack {
  background: none; border: 1px solid rgba(255,255,255,0.2); border-radius: 4px;
  color: #fca5a5; cursor: pointer; padding: 0.2rem 0.4rem;
  line-height: 1; transition: background 0.15s; flex-shrink: 0;
  display: flex; align-items: center;
}
.btn-alert-ack:hover { background: rgba(255,255,255,0.1); }
.btn-alert-ack i { width: 14px; height: 14px; }

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 0.55rem 1.25rem; background: #3B0A0A; color: #fff;
  border: none; border-radius: 8px; font-size: 0.88rem; font-family: inherit;
  font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 38px;
  transition: background 0.15s; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary:hover { background: #2a0606; }
.btn-primary:disabled { background: #c4b0b0; cursor: not-allowed; }

.btn-danger {
  padding: 0.25rem 0.65rem; background: rgba(239,68,68,0.1); color: #ef4444;
  border: none; border-radius: 6px; font-size: 0.8rem; font-family: inherit;
  font-weight: 600; cursor: pointer; min-height: 30px; transition: background 0.15s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-ghost {
  padding: 0.45rem 1rem; background: #f1f5f9; color: #64748b;
  border: none; border-radius: 8px; font-size: 0.88rem; font-family: inherit;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-ghost:hover { background: #e2e8f0; }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: 12px; border: 1.5px solid #e2e8f0; margin-bottom: 1.5rem; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9;
}
.card-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 0.5rem; }
.card-title i { color: #3B0A0A; width: 18px; height: 18px; }
.card-body { padding: 1.25rem; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 12px; border: 1.5px solid #e2e8f0; padding: 1.1rem 1.25rem; }
.stat-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #64748b; margin-bottom: 0.4rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: #0f172a; margin-bottom: 0.2rem; }
.stat-value.gruen { color: #16a34a; }
.stat-value.gelb  { color: #d97706; }
.stat-value.rot   { color: #dc2626; }
.stat-sub { font-size: 0.78rem; color: #64748b; line-height: 1.4; }
.stat-progress { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 0.6rem; }
.stat-progress-bar { height: 100%; border-radius: 999px; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 0.18rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.badge-aktiv      { background: #dcfce7; color: #166534; }
.badge-gesperrt   { background: #fee2e2; color: #dc2626; }
.badge-abgelaufen { background: #f1f5f9; color: #64748b; }
.badge-sync       { background: #f1f5f9; color: #64748b; }
.badge-alert      { background: #fee2e2; color: #dc2626; }
.badge-erledigt   { background: #dcfce7; color: #166534; }
.badge-pending    { background: #fff7ed; color: #c2410c; }

/* ===== TABELLEN ===== */
.tabellen-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 500px; }
thead th {
  text-align: left; padding: 0.6rem 0.9rem;
  background: #f8fafc; border-bottom: 2px solid #e2e8f0;
  color: #64748b; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
tbody td { padding: 0.75rem 0.9rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: #0f172a; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
.lizenz-key {
  font-family: 'Courier New', monospace; font-size: 0.82rem;
  background: #f1f5f9; padding: 0.15rem 0.5rem;
  border-radius: 5px; border: 1px solid #e2e8f0; white-space: nowrap;
}

/* ===== FORMULARE ===== */
.form-row { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: flex-end; }
.form-field { flex: 1; min-width: 180px; }
.form-field label { display: block; font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 0.3rem; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="datetime-local"],
.form-field select {
  width: 100%; padding: 0.55rem 0.85rem;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 0.9rem; font-family: inherit; color: #0f172a;
  background: #f8fafc; outline: none; transition: border-color 0.15s;
}
.form-field input:focus, .form-field select:focus { border-color: #3B0A0A; background: #fff; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.55); z-index: 100;
  align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-overlay.aktiv { display: flex; }
.modal-card {
  background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  padding: 2rem; width: 100%; max-width: 460px; position: relative;
}
.modal-titel { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; color: #0f172a; }
.modal-schliessen {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; cursor: pointer; color: #c4b0b0;
  padding: 0.2rem; border-radius: 4px; transition: color 0.15s, background 0.15s;
  display: flex; align-items: center;
}
.modal-schliessen:hover { color: #0f172a; background: #f1f5f9; }
.modal-feld { margin-bottom: 1rem; }
.modal-feld label { display: block; font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 0.3rem; }
.modal-feld input, .modal-feld select {
  width: 100%; padding: 0.6rem 0.85rem; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 0.9rem; font-family: inherit; color: #0f172a;
  background: #f8fafc; outline: none; transition: border-color 0.15s;
}
.modal-feld input:focus, .modal-feld select:focus { border-color: #3B0A0A; background: #fff; }
.modal-btn-reihe { display: flex; gap: 0.75rem; margin-top: 1.25rem; justify-content: flex-end; }

/* ===== TABS ===== */
.tab-nav { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 1.5rem; gap: 0; }
.tab-btn {
  padding: 0.65rem 1.1rem; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-size: 0.88rem; font-weight: 600; color: #64748b; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  display: flex; align-items: center; gap: 0.4rem; white-space: nowrap;
}
.tab-btn:hover { color: #3B0A0A; }
.tab-btn.aktiv { color: #3B0A0A; border-bottom-color: #3B0A0A; }
.tab-btn i { width: 15px; height: 15px; }
.tab-inhalt { display: none; }
.tab-inhalt.aktiv { display: block; }

/* ===== PATIENTEN-KACHELN ===== */
.karten-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.patient-kachel {
  background: #fff; border-radius: 12px; border: 1.5px solid #e2e8f0;
  padding: 1.35rem; text-decoration: none; color: inherit; display: block;
  transition: box-shadow 0.18s, border-color 0.15s, transform 0.15s;
}
.patient-kachel:hover { box-shadow: 0 6px 20px rgba(59,10,10,0.1); border-color: #c9a0a0; transform: translateY(-2px); }
.kachel-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.kachel-kopf h2 { font-size: 1rem; font-weight: 700; color: #0f172a; }
.befinden-ampel { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.befinden-ampel.gruen { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.18); }
.befinden-ampel.gelb  { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,0.18); }
.befinden-ampel.rot   { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,0.18); }
.befinden-ampel.grau  { background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,0.18); }
.kachel-meta { font-size: 0.8rem; color: #64748b; line-height: 1.7; }
.kachel-alert-hinweis { margin-top: 0.6rem; font-size: 0.78rem; color: #dc2626; font-weight: 600; display: flex; align-items: center; gap: 0.3rem; }
.kachel-link-hinweis { margin-top: 0.85rem; font-size: 0.78rem; color: #3B0A0A; font-weight: 600; }

/* ===== NEUE-LIZENZ-BANNER ===== */
.neue-lizenz {
  background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 10px;
  padding: 1rem 1.25rem; margin-bottom: 1.5rem; font-size: 0.88rem; color: #166534; line-height: 1.6;
}
.neue-lizenz .key {
  font-family: 'Courier New', monospace; font-weight: 700; font-size: 1rem; color: #15803d;
  background: #dcfce7; padding: 0.2rem 0.55rem; border-radius: 5px;
  display: inline-block; letter-spacing: 0.05em;
}

/* ===== LEER-ZUSTAENDE ===== */
.leer { color: #c4b0b0; font-size: 0.88rem; padding: 1.5rem 0; text-align: center; }
.leer-hinweis {
  grid-column: 1/-1; text-align: center; padding: 3.5rem 2rem;
  background: #fff; border-radius: 12px; border: 1.5px dashed #e2e8f0; color: #c4b0b0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 1.25rem; }
  .topbar { padding: 0 1.25rem; }
  .alert-banner { padding: 0.75rem 1.25rem; }
}
