/* ════════════════════════════════════════════════════════════════
   CAREOS – Hauptstylesheet
   Betreuungsdienst Migula
   Ruhig · Modern · Vertrauenswürdig
   ════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  --navy:       #1a2c47;
  --navy-dark:  #0f1c30;
  --teal:       #2a8c82;
  --teal-light: #e8f5f4;
  --teal-mid:   #b2d8d5;
  --sand:       #f5f0e8;
  --sand-dark:  #e8e0d0;
  --white:      #ffffff;
  --grey-50:    #f8f9fa;
  --grey-100:   #f0f2f4;
  --grey-200:   #e2e6ea;
  --grey-400:   #9aa5b0;
  --grey-600:   #5c6b7a;
  --grey-800:   #2d3a47;
  --green:      #2e7d52;
  --green-bg:   #e8f5ed;
  --red:        #c0392b;
  --red-bg:     #fdecea;
  --amber:      #b7610a;
  --amber-bg:   #fef4e5;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  18px;
  --shadow-sm:  0 1px 3px rgba(26,44,71,.08);
  --shadow:     0 2px 12px rgba(26,44,71,.10);
  --shadow-lg:  0 8px 32px rgba(26,44,71,.12);

  --sidebar-w:  240px;
  --font-body:  "Inter", system-ui, sans-serif;
  --font-head:  "Nunito", system-ui, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--grey-50);
  color: var(--grey-800);
  display: flex;
  min-height: 100vh;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  padding: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.sidebar-close {
  display: none;
  margin-left: auto;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}
.sidebar-close:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
}
.brand-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255,255,255,.1);
  padding: 4px;
}
.brand-name {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
}
.brand-sub {
  font-size: .7rem;
  color: var(--teal-mid);
  margin-top: 2px;
  line-height: 1.3;
}

/* Nav – compatible with .nav-list/.nav-item and .nav-links/.nav-link */
.nav-list,
.nav-links {
  list-style: none;
  padding: 12px 10px;
  flex: 1;
}
.nav-list li + li,
.nav-links li + li { margin-top: 2px; }

.nav-item a,
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.72);
  font-size: .88rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item a:hover,
.nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}
.nav-item.active a,
.nav-link.active {
  background: var(--teal);
  color: #fff;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .7;
  flex-shrink: 0;
}
.nav-item.active .nav-icon,
.nav-link.active .nav-icon { opacity: 1; }
.nav-label { flex: 1; }

.sidebar-footer {
  padding: 14px 20px;
  color: rgba(255,255,255,.28);
  font-size: .72rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 100px 32px 40px;
  max-width: 1320px;
  min-width: 0;
  background: #f6f8f9;
  color: #6b7280;
}

/* ── Top Bar ───────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--grey-200);
  box-shadow: var(--shadow-sm);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  padding: 0;
  margin: 0;
  color: #171717;
  -webkit-tap-highlight-color: transparent;
  /* iOS Safari: verhindert grauen System-Button (Pill) */
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  box-shadow: none;
}
.topbar-menu-icon {
  display: block;
  flex-shrink: 0;
}

.overlay {
  display: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand-mark {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-user-btn,
.logout-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid #d9dee7;
  background: #ffffff;
  color: #24324a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.topbar-user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  flex-shrink: 0;
}

.topbar-user-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.topbar-user-text {
  min-width: 0;
  max-width: min(120px, 38vw);
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-btn:hover,
.logout-btn:hover {
  background: #f7f9fc;
  border-color: #cfd6e2;
  color: #24324a;
  text-decoration: none;
}

.topbar-action-btn {
  background: #2f7f73; /* Teal */
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.topbar-action-btn:hover {
  background: #27695f; /* etwas dunkler */
}

@media (max-width: 480px) {
  .topbar-action-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.page-header h1 {
  font-family: var(--font-head);
  font-size: 1.85rem;
  color: #1f2937;
  font-weight: 700;
  line-height: 1.2;
}
.page-subtitle {
  color: #6b7280;
  font-size: .88rem;
  margin-top: 4px;
}
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.04);
  border: 1px solid rgba(31,41,55,0.06);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  color: #1f2937;
  font-weight: 600;
  margin-bottom: 16px;
}
.card-desc { color: #6b7280; font-size: .875rem; margin-bottom: 20px; }

/* ── Stats Grid ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

/* ── Dashboard Stats (2 Rows) ──────────────────────────────────── */
.stats-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.stats-row {
  display: grid;
  gap: 14px;
}

.stats-row-primary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-row-secondary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat-card {
  border-radius: 16px;
  padding: 20px 18px;
  background: #ffffff;
  border: 1px solid rgba(31, 41, 55, 0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.stat-label { font-size: 12px; font-weight: 500; opacity: 1; color: #9ca3af; margin-bottom: 6px; letter-spacing: 0.3px; }
.stat-value {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  letter-spacing: 0;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.stat-green  { background: #ffffff;  color: var(--green); }
.stat-muted  { background: #ffffff;  color: var(--grey-600); }
.stat-blue   { background: #ffffff;  color: #1a56c4; }
.stat-teal   { background: #ffffff;  color: var(--teal); }
.stat-sand   { background: #ffffff;  color: var(--amber); }
.stat-navy   { background: #ffffff;  color: var(--navy); }
.stat-profit { background: #ffffff;  color: var(--green); }
.stat-loss   { background: #ffffff;  color: var(--red); }

.stat-green .stat-value,
.stat-profit .stat-value {
  color: #2f7f5f;
  font-weight: 600;
}

.stat-card:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* ── Two-Column Layout ─────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-primary   { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-primary:hover { background: #236f66; border-color: #236f66; color: #fff; }

.btn-secondary { background: var(--grey-100); color: var(--grey-800); border-color: var(--grey-200); }
.btn-secondary:hover { background: var(--grey-200); }

.btn-outline   { background: transparent; color: var(--grey-800); border-color: var(--grey-200); }
.btn-outline:hover { background: var(--grey-100); }

.btn-danger    { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-large { padding: 13px 26px; font-size: .95rem; }

/* Small buttons */
.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm.btn-primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-sm.btn-outline { background: transparent; color: var(--grey-800); border-color: var(--grey-200); }
.btn-sm.btn-outline:hover { background: var(--grey-100); text-decoration: none; }
.btn-sm.btn-danger  { background: transparent; color: var(--red); border-color: var(--red); }
.btn-sm.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm:hover { transform: translateY(-1px); text-decoration: none; }

/* ── Delete Buttons (Löschen) ────────────────────────────────────── */
/* Tourenplan / Rechnungen Löschen: gezielt nur Buttons in *loeschen*-Formen */
form[action*="/loeschen"] button.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 999px;
  white-space: nowrap;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

form[action*="/loeschen"] button.btn-sm:hover {
  background: rgba(0,0,0,0.04);
  border-color: #9ca3af;
}

/* Notizen-Löschen (localStorage MVP): nur Buttons mit data-note-id */
button.btn-sm.btn-outline[data-note-id] {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 999px;
  white-space: nowrap;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.btn-sm.btn-outline[data-note-id]:hover {
  background: rgba(0,0,0,0.04);
  border-color: #9ca3af;
}

.quick-actions { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .73rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green      { background: var(--green-bg);  color: var(--green); }
.badge-grey       { background: var(--grey-100);  color: var(--grey-600); }
.badge-pflegegrad { background: var(--teal-light); color: var(--teal); border: 1px solid var(--teal-mid); }
.status-entwurf   { background: var(--amber-bg);  color: var(--amber); }
.status-final     { background: var(--green-bg);  color: var(--green); }
.status-versendet { background: #e8f0fe;           color: #1a56c4; }
.ml-1 { margin-left: 8px; }

/* ── Simple List ───────────────────────────────────────────────── */
.simple-list { list-style: none; }
.simple-list li + li { border-top: 1px solid var(--grey-100); }
.list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--grey-800);
  text-decoration: none;
}
.list-link:hover { color: var(--teal); text-decoration: none; }
.list-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 55%; }
.list-meta { font-size: .78rem; color: var(--grey-400); white-space: nowrap; flex-shrink: 0; }
.link-small { font-size: .82rem; color: var(--teal); }
.link-inline { color: var(--teal); }

/* ── Filter Bar ────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Inputs ────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--grey-800);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42,140,130,.12); }
.input[readonly] { background: var(--grey-100); color: var(--grey-600); cursor: default; }
input[type="month"].input { width: auto; max-width: 200px; }
.input-search { flex: 1; min-width: 180px; max-width: 300px; }
.input-select  { width: auto; }
.input-sm { padding: 5px 8px; font-size: .82rem; }
.textarea { resize: vertical; min-height: 90px; }

/* ── Table ─────────────────────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: .76rem;
  font-weight: 600;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  font-size: .87rem;
  border-bottom: 1px solid var(--grey-100);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--grey-50); }
.table-footer td {
  background: var(--grey-50);
  border-top: 2px solid var(--grey-200);
  border-bottom: none;
  font-size: .87rem;
}
.td-mono { font-variant-numeric: tabular-nums; color: var(--grey-600); font-size: .8rem; white-space: nowrap; }
.td-sub { display: block; font-size: .73rem; color: var(--grey-400); margin-top: 2px; }
.td-actions { display: flex; gap: 5px; justify-content: flex-end; white-space: nowrap; align-items: center; }

/* Tourenplan: runde Icon-Aktionen */
.tourenplan-action-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  vertical-align: middle;
}
.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  color: #374151;
  text-decoration: none;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
.action-btn:hover {
  transform: scale(1.05);
}
.action-btn.edit:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
.action-btn.done {
  color: #22c55e;
  border-color: #22c55e;
}
.action-btn.done:hover {
  background: #ecfdf5;
}
.action-btn.delete {
  color: #ef4444;
  border-color: #ef4444;
}
.action-btn.delete:hover {
  background: #fef2f2;
}
.action-btn--state {
  cursor: default;
  opacity: 0.65;
  pointer-events: none;
}
.action-btn--state:hover {
  transform: none;
  background: #fff;
}
.data-table tbody tr.tourenplan-row-done td {
  background: rgba(236, 253, 245, 0.45);
}
.data-table tbody tr.tourenplan-row-done:hover td {
  background: rgba(220, 252, 231, 0.55);
}

/* Kunden-Tabelle: nur leichte Spezialfälle, kein hartes Abschneiden mehr */
.kunden-table .col-phone { white-space: nowrap; }

/* Kundenliste – nur Mobile (≤768px): Nr., Name, Pflegegrad, Krankenkasse | Tap → Detail */
@media (max-width: 768px) {
  .kunden-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .kunden-table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
  }
  .kunden-table th,
  .kunden-table td {
    padding: 11px 12px;
    vertical-align: middle;
    line-height: 1.45;
  }
  .kunden-table th:nth-child(1),
  .kunden-table td:nth-child(1) {
    padding-left: 12px;
    padding-right: 10px;
    font-size: 0.68rem;
    color: var(--grey-500);
    white-space: nowrap;
    width: 1%;
  }
  .kunden-table th:nth-child(2),
  .kunden-table td:nth-child(2) {
    min-width: 10.5rem;
    padding-right: 18px;
  }
  .kunden-table td:nth-child(2) strong {
    font-weight: 600;
    font-size: 0.88rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
  }
  .kunden-table th:nth-child(3),
  .kunden-table td:nth-child(3) {
    text-align: center;
    white-space: nowrap;
    padding-left: 14px;
    padding-right: 18px;
  }
  .kunden-table td:nth-child(3) .badge-pflegegrad {
    font-size: 0.72rem;
    padding: 4px 8px;
  }
  /* Wie Spalte 3 (Pflegegrad): mittig unter der Überschrift */
  .kunden-table th:nth-child(4),
  .kunden-table td:nth-child(4) {
    text-align: center;
    font-size: 0.78rem;
    color: var(--grey-700);
    white-space: nowrap;
    padding-left: 14px;
    padding-right: 18px;
    min-width: 8rem;
  }
  .kunden-table th:nth-child(5),
  .kunden-table td:nth-child(5),
  .kunden-table th:nth-child(6),
  .kunden-table td:nth-child(6),
  .kunden-table th:nth-child(7),
  .kunden-table td:nth-child(7) {
    display: none;
  }
  .kunden-table tbody tr[data-detail-href] {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(42, 140, 130, 0.15);
  }
  .kunden-table tbody tr[data-detail-href]:active td {
    background: var(--grey-100);
  }
}

/* Einsätze-Übersicht – nur Mobile (≤768px): horizontal scrollen / wischen */
@media (max-width: 768px) {
  .einsaetze-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .einsaetze-table-card .data-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }
}

/* Tourenplan – nur Mobile (≤768px): wie Einsätze horizontal scrollen / wischen */
@media (max-width: 768px) {
  .tourenplan-table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .tourenplan-table-card .data-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-layout { max-width: 780px; }
.form-card { display: flex; flex-direction: column; gap: 24px; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.section-title {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--grey-400);
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--grey-100);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .83rem; font-weight: 500; color: var(--grey-800); }
.form-group-full { grid-column: 1 / -1; }
.required { color: var(--red); }
.field-hint { font-size: .75rem; color: var(--grey-400); margin-top: 3px; }

.form-group-checkbox { justify-content: flex-end; padding-bottom: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }
.checkbox-text { font-size: .88rem; font-weight: 500; }

.form-actions { display: flex; gap: 12px; padding-top: 8px; flex-wrap: wrap; }

.form-actions--einsatz-bearbeiten {
  justify-content: space-between;
  align-items: center;
}
.form-actions--einsatz-bearbeiten .form-actions-start {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.einsatz-delete-dialog {
  max-width: 440px;
  width: calc(100% - 32px);
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 16px 48px rgba(15, 28, 48, 0.22);
}
.einsatz-delete-dialog::backdrop {
  background: rgba(15, 28, 48, 0.45);
}
.einsatz-delete-dialog__inner {
  padding: 24px 24px 22px;
}
.einsatz-delete-dialog__title {
  margin: 0 0 12px;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
}
.einsatz-delete-dialog__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--grey-600);
}
.einsatz-delete-dialog__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.inline-form { display: flex; flex-direction: column; gap: 14px; }

/* ── Pflegegrad Info Box ───────────────────────────────────────── */
.pg-infobox {
  background: var(--teal-light);
  border: 1.5px solid var(--teal-mid);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.pg-infobox h4 { font-family: var(--font-head); color: var(--navy); font-size: .95rem; margin-bottom: 14px; font-weight: 600; }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 10px; }
.pg-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: rgba(255,255,255,.7); border-radius: var(--radius-sm); }
.pg-label { font-size: .72rem; color: var(--teal); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.pg-value { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.pg-note { font-size: .8rem; color: var(--teal); line-height: 1.5; }

/* ── Calculation Box ───────────────────────────────────────────── */
.calc-box { background: var(--sand); border-radius: var(--radius); padding: 18px 22px; border: 1.5px solid var(--sand-dark); }
.calc-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--sand-dark); font-size: .87rem; }
.calc-row:last-child { border-bottom: none; }
.calc-label { color: var(--grey-600); }
.calc-value { font-weight: 700; color: var(--grey-800); }
.calc-total { padding-top: 10px; }
.calc-total .calc-label { font-weight: 700; color: var(--navy); font-size: .95rem; }
.calc-total .calc-value { font-size: 1.25rem; color: var(--teal); }

/* ── Info List ─────────────────────────────────────────────────── */
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: baseline; }
.info-list dt { font-size: .8rem; color: var(--grey-400); font-weight: 500; white-space: nowrap; }
.info-list dd { font-size: .9rem; color: var(--grey-800); font-weight: 500; }

/* ── Mini Stats ────────────────────────────────────────────────── */
.stat-summary { margin-bottom: 16px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-stat { text-align: center; }
.mini-stat-label { font-size: .73rem; color: var(--grey-400); display: block; margin-bottom: 3px; }
.mini-stat-value { font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; color: var(--navy); }

/* ── Price Total ───────────────────────────────────────────────── */
.price-total { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--grey-200); font-size: .88rem; font-weight: 600; color: var(--grey-600); }
.price-big { font-family: var(--font-head); font-size: 1.7rem; color: var(--teal); }

/* ── Documentation ─────────────────────────────────────────────── */
.doc-text { line-height: 1.7; color: var(--grey-800); font-size: .9rem; background: var(--grey-50); padding: 14px; border-radius: var(--radius-sm); border-left: 3px solid var(--teal); }

/* ── Formula Box ───────────────────────────────────────────────── */
.formula-box { display: flex; align-items: center; gap: 14px; background: var(--white); padding: 18px 24px; border-radius: var(--radius); border: 1px solid var(--grey-200); box-shadow: var(--shadow-sm); margin-top: 20px; font-size: 1.05rem; font-weight: 600; color: var(--navy); flex-wrap: wrap; }
.formula-op { color: var(--grey-400); font-size: 1.3rem; }
.formula-result { font-family: var(--font-head); font-size: 1.25rem; }
.formula-result.positive { color: var(--green); }
.formula-result.negative { color: var(--red); }

/* ── Result Box ────────────────────────────────────────────────── */
.result-box { background: var(--teal-light); border-radius: var(--radius); padding: 18px; margin-top: 18px; border: 1.5px solid var(--teal-mid); }
.result-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: .9rem; border-bottom: 1px solid var(--teal-mid); }
.result-row:last-child { border-bottom: none; }
.result-row strong { font-size: 1.05rem; color: var(--teal); }

/* ── Summen Card ───────────────────────────────────────────────── */
.summen-card { padding: 20px 24px; }
.summen-grid { display: flex; gap: 32px; flex-wrap: wrap; }
.summe-item { display: flex; flex-direction: column; gap: 4px; }
.summe-label { font-size: .76rem; color: var(--grey-400); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.summe-value { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.summe-total .summe-value { color: var(--teal); font-size: 1.5rem; }

/* ── Empty States ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 20px; color: var(--grey-400); }
.empty-icon { font-size: 2.5rem; margin-bottom: 14px; }
.empty-state p { margin-bottom: 18px; font-size: .92rem; }
.empty-hint { color: var(--grey-400); font-size: .85rem; padding: 10px 0; }

/* ── Utilities ─────────────────────────────────────────────────── */
.mt-1 { margin-top: 16px; }
.mt-2 { margin-top: 24px; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-header { flex-direction: column; gap: 12px; }
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-row-primary { grid-template-columns: 1fr 1fr; }
  .stats-row-secondary { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group-full { grid-column: 1; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
}

/* Mobile Drawer: Sidebar + Hamburger (≤768px) – Desktop bleibt unverändert */
@media (max-width: 768px) {
  /*
   * Sidebar hat z-index 100, Topbar nur 80 – die Nav liegt als Layer über der Topbar.
   * Safari/WebKit kann Taps trotzdem am Sidebar-Layer „verschlucken“, wenn die
   * Sidebar geschlossen ist. pointer-events: none schließt das aus.
   */
  /* Klickfläche über Padding; kein iOS-Grau, keine System-Optik */
  .topbar-menu-toggle {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    margin: 0 -4px 0 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    touch-action: manipulation;
  }
  .topbar-menu-toggle:hover,
  .topbar-menu-toggle:active,
  .topbar-menu-toggle:focus {
    background: transparent !important;
    box-shadow: none !important;
  }
  .topbar-menu-toggle:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /*
   * Overlay geschlossen: unter der Topbar (z-index 80), damit der Hamburger
   * zuverlässig klickbar ist (sonst liegt ein Vollflächen-Overlay darüber).
   */
  .overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 28, 48, 0.48);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }
  body.sidebar-open .overlay {
    z-index: 90;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar {
    width: min(82vw, 300px);
    min-width: 0;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100;
    /* z-index 100 > Topbar 80: ohne pointer-events blockiert Safari Taps auf der Topbar */
    pointer-events: none;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .main-content {
    margin-left: 0;
    padding: 84px 16px 24px;
  }
  .topbar {
    left: 0;
    padding: 0 16px;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .topbar {
    z-index: 95;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stats-row-primary { grid-template-columns: 1fr; }
  .stats-row-secondary { grid-template-columns: 1fr; }
  .header-actions { flex-direction: column; width: 100%; }
}
