/* ═══════════════════════════════════════════════════════════
   Pflegedienst Tageskurve – Stylesheet
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --primary:      #1d4ed8;
  --primary-dark: #1e40af;
  --primary-light:#dbeafe;
  --green:        #00B050;
  --green-light:  #dcfce7;
  --red:          #dc2626;
  --red-light:    #fee2e2;
  --yellow:       #d97706;
  --yellow-light: #fef3c7;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-300:     #cbd5e1;
  --gray-400:     #94a3b8;
  --gray-500:     #64748b;
  --gray-600:     #475569;
  --gray-700:     #334155;
  --gray-800:     #1e293b;
  --sidebar-w:    240px;
  --topbar-h:     56px;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-lg:    0 4px 16px rgba(0,0,0,.15);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ─── LOGIN ──────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #0369a1 100%);
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px; height: 60px;
  background: transparent;
  color: #fff;
  border-radius: 50%;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}
.logo-icon.logo-placeholder { background: var(--primary); }

.login-logo h1 { font-size: 22px; color: var(--gray-800); }
.login-logo p  { color: var(--gray-500); font-size: 13px; }

/* ─── APP LAYOUT ─────────────────────────────────────────── */
.app-screen {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-800);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: transform .25s;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--gray-700);
}

.sidebar-logo {
  width: 36px; height: 36px;
  background: transparent;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-logo.logo-placeholder { background: var(--primary); }

.sidebar-title    { color: #fff; font-weight: 600; font-size: 13px; }
.sidebar-subtitle { color: var(--gray-400); font-size: 11px; }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--gray-300);
  text-decoration: none;
  font-size: 13px;
  border-radius: 0;
  transition: background .15s, color .15s;
  cursor: pointer;
}

.nav-item:hover  { background: var(--gray-700); color: #fff; }
.nav-item.active { background: var(--primary);  color: #fff; }
.nav-item.nav-sub {
  padding-left: 46px;
  font-size: 12px;
  padding-top: 6px;
  padding-bottom: 6px;
  color: var(--gray-400);
  border-left: 2px solid var(--gray-600);
  margin-left: 26px;
  border-radius: 0;
}
.nav-item.nav-sub .nav-icon { font-size: 13px; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 16px 16px 4px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-700);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user { color: var(--gray-300); font-size: 12px; }

/* ─── MAIN CONTENT ───────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 8px; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-600);
  padding: 4px;
}

.view-container { flex: 1; overflow-y: auto; padding: 20px; }

/* ─── VIEWS ──────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.view-header h2 { font-size: 20px; font-weight: 700; flex: 1; }

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-header h3 { font-size: 14px; font-weight: 600; }

.card-body { padding: 16px; }

.profile-card { transition: border-color .15s, box-shadow .15s; border: 2px solid transparent; }
.profile-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(0,123,255,.12); }

.prof-meas-row {
  display: flex; align-items: center; gap: 6px; padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}
.prof-meas-row:last-child { border-bottom: none; }
.measure-config-item[data-measid] { margin-bottom: 4px; padding: 4px 8px; border-radius: var(--radius); background: var(--gray-50); }
.measure-config-item[data-measid]:hover { background: var(--gray-100); }

/* Profil-Editor: Klappbare Kategorien */
.prof-cat-collapsible { border: 1px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.prof-cat-header { cursor: pointer; padding: 12px 16px; background: #fff; user-select: none; transition: background .15s; }
.prof-cat-header:hover { background: var(--gray-50); }
.prof-cat-body { padding: 0 16px 16px; }
.prof-cat-chevron { transition: transform .2s; }
.mb-2 { margin-bottom: 16px; }
.mt-2 { margin-top: 16px; }

/* ─── STATS GRID ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-number { font-size: 36px; font-weight: 700; color: var(--primary); }
.stat-label  { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ─── DASHBOARD GRID ─────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.quick-links { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.quick-link  { text-align: left; }

/* ─── PATIENT LIST ───────────────────────────────────────── */
.patient-list { padding: 8px 0; }

.patient-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  gap: 10px;
  cursor: pointer;
  transition: background .15s;
}

.patient-item:last-child { border-bottom: none; }
.patient-item:hover { background: var(--gray-50); }

.patient-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.patient-name  { font-weight: 600; }
.patient-meta  { font-size: 12px; color: var(--gray-500); }

/* ─── DATA TABLE ─────────────────────────────────────────── */
.data-table-wrapper { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-danger   { background: var(--red);      color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-success  { background: var(--green);    color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover  { background: var(--gray-100); }
.btn-ghost    { background: transparent; color: var(--gray-600); }
.btn-ghost:hover    { background: var(--gray-100); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }
.btn-full     { width: 100%; }
.btn-icon     { padding: 6px; width: 32px; height: 32px; }

/* ─── FORMS ──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-group label { font-size: 12px; font-weight: 600; color: var(--gray-600); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-800);
  transition: border-color .15s;
  background: #fff;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-full { grid-column: 1 / -1; }

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px;
  flex-wrap: wrap;
}

.filter-row .form-group { margin-bottom: 0; min-width: 150px; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }
.badge-success  { background: var(--green-light);   color: #166534; }
.badge-warning  { background: var(--yellow-light);  color: #92400e; }
.badge-danger   { background: var(--red-light);     color: #991b1b; }
.badge-info     { background: #e0f2fe; color: #0369a1; }
.badge-gray     { background: var(--gray-100); color: var(--gray-600); }

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-error   { background: var(--red-light);    color: var(--red); border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light);  color: #166534;    border: 1px solid #86efac; }

/* ─── MODALS ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-sm { max-width: 420px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

/* Wizard Steps */
.wizard-steps {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  background: var(--gray-50);
}
.wizard-step {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  position: relative;
  cursor: default;
}
.wizard-step .wizard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-300);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}
.wizard-step.active {
  color: var(--primary);
  font-weight: 600;
}
.wizard-step.active .wizard-num {
  background: var(--primary);
}
.wizard-step.done {
  color: var(--green);
}
.wizard-step.done .wizard-num {
  background: var(--green);
}
.wizard-cat-block {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.wizard-cat-block label.cat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.wizard-cat-block .cat-comment-input {
  width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 12px;
}
.wizard-meas-block {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.wizard-meas-header {
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}
.wizard-meas-body {
  padding: 8px 12px;
  max-height: 250px;
  overflow-y: auto;
}
.wizard-meas-body label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 12px;
  cursor: pointer;
}
.wizard-meas-actions {
  padding: 4px 12px 8px;
  display: flex;
  gap: 6px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--gray-400);
  padding: 2px;
  border-radius: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }

.modal-body   { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── SIGNATURE ──────────────────────────────────────────── */
.signature-section { margin-top: 16px; }
.signature-section label { font-size: 12px; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 6px; }

.signature-canvas-wrapper {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  cursor: crosshair;
  overflow: hidden;
  display: inline-block;
  width: 100%;
}

.signature-canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.signature-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.sig-status { font-size: 11px; color: var(--gray-500); }

/* Unterschrift-Vorschau in Tabelle */
.sig-preview {
  height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: var(--gray-50);
}

/* ─── TAGESKURVE ─────────────────────────────────────────── */
.curve-meta { font-size: 12px; color: var(--gray-500); display: flex; gap: 12px; }
.curve-date-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.date-input { padding: 6px 8px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 13px; }

.curve-legend { display: flex; gap: 12px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--gray-500); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend-dot.checkbox { background: var(--green); }
.legend-dot.number   { background: var(--primary); }
.legend-dot.text     { background: var(--yellow); }
.legend-dot.mandatory-dot { background: #fff7ed; border: 2px solid #f97316; }

.curve-table-wrapper {
  overflow-x: auto;
  padding-bottom: 8px;
  position: relative;
}

/* Mobiler Scroll-Hinweis */
.curve-scroll-hint {
  display: none;
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--gray-400);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}
@media (max-width: 768px) {
  .curve-scroll-hint { display: block; }
}

.curve-table {
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;           /* ignoriert Inhaltsbreite, nur deklarierte Breiten */
  width: calc(200px + 26 * 44px); /* Namensspalte + 26 Uhrzeitspalten = 1344px */
}

.curve-table th,
.curve-table td {
  border: 1px solid var(--gray-200);
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
}

/* Maßnahmen-Spalte: Breite + Umbruch */
.curve-table th.measure-name-cell,
.curve-table td.measure-name-cell {
  width: 200px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: visible;
}

/* Category header row */
.cat-header-row td {
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Measure name column (sticky) */
.measure-name-cell {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  padding: 4px 8px !important;
  font-size: 12px;
  color: var(--gray-700);
  border-right: 2px solid var(--gray-300) !important;
  vertical-align: middle;
}

/* Innerer Wrapper – max-width auf div ist zuverlässig, auf td nicht.
   overflow-wrap:anywhere (nicht break-word) beeinflusst die min-content-
   Breite, damit der Browser die Spalte nicht auf den längsten unteilbaren
   String aufzieht. */
.measure-name-text {
  width: 200px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  line-height: 1.3;
}

.cat-header-row .measure-name-cell {
  background: var(--green);
  color: #fff;
}

/* Hour header */
.hour-header {
  background: var(--gray-800);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  padding: 5px 4px !important;
  width: 44px;
}

.hour-header.next-day { background: var(--gray-600); }

/* Entry cell */
.entry-cell {
  text-align: center;
  padding: 2px !important;
  width: 44px;
  position: relative;
}

.entry-cell input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--green);
}

.entry-cell input[type="number"],
.entry-cell input[type="text"] {
  width: 42px;
  padding: 2px 3px;
  font-size: 11px;
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  text-align: center;
  background: transparent;
  font-family: inherit;
}

.entry-cell input[type="number"]:focus,
.entry-cell input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--primary-light);
}

.entry-cell.has-value { background: #f0fdf4; }
.entry-cell.has-value input { background: transparent; }

/* Read-only hint for PDL */
.readonly-hint {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Kürzel-Legende in der Tageskurve (PDL) */
.kuerzel-legende {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 12px;
}

.kz-legend-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 4px;
  align-self: center;
}

.kz-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 4px 10px 4px 4px;
  color: var(--gray-700);
}

.kz-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.kz-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

.kz-chip-sig {
  height: 24px;
  max-width: 60px;
  object-fit: contain;
  border-left: 1px solid var(--gray-200);
  padding-left: 8px;
  margin-left: 2px;
}

/* Disabled inputs in curve (PDL read-only) */
.entry-cell input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: transparent;
}
.report-textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: var(--gray-50);
}

/* Mandatory cell highlighting */
.entry-cell.mandatory {
  background: #fff7ed;
  border: 2px solid #f97316 !important;
  position: relative;
}
.entry-cell.mandatory::after {
  content: '!';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  font-weight: 700;
  color: #f97316;
  line-height: 1;
}
.entry-cell.mandatory.has-value {
  background: #f0fdf4;
  border-color: #22c55e !important;
}
.entry-cell.mandatory.has-value::after {
  content: '\2713';
  color: #22c55e;
}

/* Spacer between categories in curve */
.cat-spacer-row td {
  height: 18px;
  background: var(--gray-100) !important;
  border: none !important;
}

/* Hour labels repeated per category */
.cat-hours-row th {
  background: var(--gray-800);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  padding: 4px 4px !important;
  min-width: 44px;
}

/* Comment row spanning full width below category header */
.cat-comment-row .cat-comment-cell {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 8px 14px !important;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-700);
  white-space: normal;
  word-wrap: break-word;
}
.cat-comment-cell strong {
  color: #b45309;
  margin-right: 4px;
}

/* Measure config items in patient config */
.measure-config-item {
  margin-bottom: 6px;
  padding: 4px 0;
}
.measure-config-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mandatory-hint {
  font-weight: 500;
}
.mh-slot {
  display: inline-block;
  user-select: none;
  text-align: center;
  min-width: 42px;
}
.btn-xs {
  font-size: 11px;
  padding: 2px 6px;
  line-height: 1.4;
}

/* Shift display */
.shift-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
}

.shift-item:last-child { border-bottom: none; }
.shift-name   { font-weight: 600; }
.shift-times       { color: var(--gray-500); font-size: 12px; }
.shift-nurse       { color: var(--primary); font-size: 12px; }
.shift-nurse-block { display: flex; align-items: center; }

/* Pflegebericht */
.report-new-form { padding: 12px 16px; border-bottom: 2px solid var(--gray-200); }
.report-history { padding: 4px 0; }

.report-entry-row { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
.report-entry-row:last-child { border-bottom: none; }

.report-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--gray-500);
}

.report-kuerzel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.report-entry-date { color: var(--gray-400); font-size: 11px; }

.report-entry-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
  padding-left: 36px;
}

.mdk-kuerzel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gray-700);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-right: 4px;
  vertical-align: middle;
}

.report-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s;
}

.report-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ─── PATIENT DETAIL ─────────────────────────────────────── */
.patient-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-row {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.info-label { font-weight: 600; color: var(--gray-500); min-width: 130px; }

/* Patient-Kategorien config */
.category-config-block {
  border-bottom: 1px solid var(--gray-100);
  padding: 12px 16px;
}

.category-config-block:last-child { border-bottom: none; }

.category-config-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.category-dot {
  width: 12px; height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.category-config-header h4 { font-size: 13px; font-weight: 600; flex: 1; }

.measures-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 20px;
  flex-direction: column;
}

.measure-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--gray-100);
  border-radius: 20px;
  font-size: 11px;
}

.measure-tag.active { background: var(--primary-light); color: var(--primary-dark); }

.measure-tag .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
}

.measure-tag .remove-btn:hover { color: var(--red); }

.add-measure-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  padding-left: 20px;
}

.add-measure-row select { font-size: 12px; padding: 4px 8px; flex: 1; }

/* ─── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: slide-in .25s ease;
  max-width: 320px;
}

.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--primary); }

@keyframes slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h4   { font-size: 15px; color: var(--gray-500); margin-bottom: 4px; }
.empty-state p    { font-size: 13px; }

/* ─── ROLE VISIBILITY ────────────────────────────────────── */
.pdl-only           { display: none; }
.admin-only         { display: none; }
.pfleger-only       { display: none; }
.bereitschaft-only  { display: none; }

body.role-pfleger .pfleger-only           { display: initial; }
body.role-pfleger a.pfleger-only          { display: flex; }
body.role-pfleger .card.pfleger-only      { display: block; }

body.role-pdl .pdl-only              { display: initial; }
body.role-pdl .view.pdl-only         { display: none; }
body.role-pdl .view.pdl-only.active  { display: block; }
body.role-pdl a.pdl-only             { display: flex; }
body.role-pdl .card.pdl-only         { display: block; }
body.role-pdl .btn.pdl-only          { display: inline-flex; }

body.role-bereitschaft .bereitschaft-only  { display: block; }
body.role-bereitschaft .pfleger-only       { display: initial; }
body.role-bereitschaft a.pfleger-only      { display: flex; }
body.role-bereitschaft .card.pfleger-only  { display: block; }

/* Admin sieht nur die Admin-View, keine PDL/Pfleger-Elemente */
body.role-admin .pdl-only                        { display: none !important; }
body.role-admin a.nav-item:not(.admin-only)      { display: none !important; }
body.role-admin .admin-only                      { display: initial; }
body.role-admin a.admin-only                     { display: flex; }
/* Views bleiben versteckt bis .active gesetzt wird – auch für admin-only */
body.role-admin .view                            { display: none !important; }
body.role-admin .view.active                     { display: block !important; }

/* Admin-Layout */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
}

/* ─── UTILITIES ──────────────────────────────────────────── */
.text-muted  { color: var(--gray-500); }
.text-sm     { font-size: 12px; }
.fw-bold     { font-weight: 600; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8       { gap: 8px; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */

/* Sidebar-Overlay (Backdrop) wenn Sidebar offen auf Mobil */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .patient-detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .curve-date-nav { width: 100%; }

  /* Topbar kompakter */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 14px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn { padding: 5px 8px; font-size: 11px; }

  /* View Container weniger Padding */
  .view-container { padding: 12px; }

  /* Cards kompakter */
  .card-header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .card-header h3 { font-size: 14px; }

  /* Schicht-Items stacken */
  .shift-item { padding: 8px 12px; gap: 8px; }

  /* Filter-Row stacken */
  .filter-row { padding: 10px 12px; gap: 8px; flex-direction: column; }
  .filter-row .form-group { min-width: 100%; width: 100%; }

  /* Tabellen responsiv */
  .data-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table th { padding: 8px 10px; font-size: 11px; }
  .data-table td { padding: 8px 10px; font-size: 12px; }

  /* Legende wrappen */
  .curve-legend { flex-wrap: wrap; gap: 6px; font-size: 11px; }

  /* Tageskurve: touch-freundliches Scrollen */
  .curve-table-wrapper { -webkit-overflow-scrolling: touch; }
  .curve-table { width: calc(140px + 26 * 40px); } /* 140 + 1040 = 1180px */
  .curve-table th.measure-name-cell,
  .curve-table td.measure-name-cell { width: 140px; font-size: 11px; padding: 3px 6px !important; }
  .measure-name-text { width: auto; }
  .entry-cell { width: 40px; }
  .entry-cell input[type="number"],
  .entry-cell input[type="text"] { font-size: 11px; padding: 2px 1px; width: 36px; }
  .hour-header { font-size: 9px; width: 40px; padding: 4px 2px !important; }
  .cat-hours-row th { font-size: 9px; width: 40px; padding: 3px 2px !important; }

  /* Info-Rows (Patient Detail) */
  .info-row { flex-direction: column; gap: 2px; padding: 6px 12px; }
  .info-label { min-width: unset; font-size: 11px; }

  /* Buttons besser bedienbar (Touch-Targets) */
  .btn { min-height: 40px; padding: 8px 14px; }
  .btn-sm { min-height: 34px; padding: 6px 10px; }
  .btn-icon { min-height: 36px; min-width: 36px; width: 36px; height: 36px; }
  .table-actions .btn-sm { min-height: 32px; }

  /* Toast unten-mittig auf Mobil */
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; text-align: center; }

  /* Pflegebericht Textareas grösser */
  .report-textarea { min-height: 100px; font-size: 14px; }

  /* Searchable Select */
  .searchable-select-wrap select { font-size: 14px; }

  /* Login auf kleinen Screens */
  .login-card { padding: 24px 20px; margin: 0 12px; }

  /* Kategorien Config */
  .category-config-block { padding: 10px 12px; }
  .add-measure-row { padding-left: 12px; flex-wrap: wrap; }
  .measures-grid { padding-left: 12px; }

  /* Wizard auf Mobil */
  .wizard-steps { padding: 0 12px; overflow-x: auto; }
  .wizard-step { font-size: 11px; padding: 10px 6px; white-space: nowrap; }

  /* Patienten-Liste: grössere Touch-Targets */
  .patient-item { padding: 12px; min-height: 52px; }
  .patient-name { font-size: 14px; }

  /* Inputs grösser für Touch */
  .form-group input,
  .form-group select,
  .form-group textarea { font-size: 16px; padding: 10px 12px; }
  .search-input { font-size: 16px; padding: 10px 14px; }

  /* Verhindern iOS-Zoom bei Input-Fokus */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea { font-size: 16px; }

  /* Quick-Config-Bar stacken */
  .quick-config-bar { flex-direction: column; }
  .quick-config-bar > * { width: 100%; }

  /* Signature Canvas volle Breite */
  .signature-pad-wrap canvas { width: 100% !important; }

  /* Schnelleingabe-Modus: optimiert für Mobile */
  .curve-toolbar { padding: 4px 12px; }
  .qe-field { width: 100% !important; }
  .qe-measure { flex-direction: column; align-items: stretch; }
  .qe-input { width: 100%; }
  .qe-input input[type="number"],
  .qe-input input[type="text"] { width: 100% !important; }

  /* Mandatory Progress kompakter */
  .mandatory-progress { padding: 6px 12px; gap: 8px; }
  .mandatory-progress .progress-text { font-size: 12px; }
}

@media (max-width: 480px) {
  .view-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .view-header h2 { font-size: 16px; }
  .modal { max-height: 100vh; border-radius: 0; max-width: 100vw; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-body { padding: 12px 16px; }
  .modal-footer { padding: 10px 16px; }
  .modal-header { padding: 12px 16px; }

  /* Tageskurve-Header kompakter */
  .curve-date-nav { flex-wrap: wrap; justify-content: center; gap: 4px; }
  .curve-meta { flex-wrap: wrap; gap: 6px; font-size: 11px; }

  /* Pfleger-Anweisungen */
  #curve-instructions-body { padding: 0 12px 8px !important; font-size: 13px; }

  /* Noch kompaktere Tabellenzellen */
  .entry-cell { min-width: 36px; max-width: 36px; }
  .hour-header { min-width: 36px; font-size: 8px; }
  .cat-hours-row th { min-width: 36px; font-size: 8px; }
  .curve-table { width: calc(110px + 26 * 36px); } /* 110 + 936 = 1046px */
  .curve-table th.measure-name-cell,
  .curve-table td.measure-name-cell { width: 110px; font-size: 10px; }
  .hour-header { width: 36px; }
  .cat-hours-row th { width: 36px; }
  .entry-cell { width: 36px; }
  .entry-cell input[type="number"],
  .entry-cell input[type="text"] { width: 32px; }

  /* Stats-Grid kleinere Minimum */
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }

  /* Sidebar: grössere Touch-Targets */
  .nav-item { padding: 12px 16px; font-size: 14px; }
  .nav-item.nav-sub { padding: 10px 16px 10px 46px; font-size: 13px; }

  /* Dienst hinzufügen Button voll breit */
  .card-header .btn { font-size: 11px; white-space: nowrap; }
}

/* ─── SEARCH BAR ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.search-input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
  transition: border-color .2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.result-count {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
}

/* ─── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.pagination:empty { display: none; }
.pagination .page-btn {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  padding: 0 8px;
}
.pagination .page-btn:hover { background: var(--gray-100); }
.pagination .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination .page-btn:disabled {
  opacity: .4;
  cursor: default;
}
.pagination .page-info {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0 8px;
}

/* ─── SEARCHABLE SELECT (modals) ──────────────────────────── */
.searchable-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.searchable-select-wrap select {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  padding: 4px;
}
.searchable-select-wrap select option {
  padding: 6px 8px;
}
.searchable-select-wrap .search-input {
  flex: none;
  font-size: 13px;
  padding: 7px 10px;
}

/* ─── SORTABLE TABLE HEADERS ──────────────────────────────── */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
}
.data-table th.sortable:hover { background: var(--gray-100); }
.data-table th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 6px;
  font-size: 11px;
  opacity: .4;
}
.data-table th.sortable.asc::after { content: '▲'; opacity: .8; }
.data-table th.sortable.desc::after { content: '▼'; opacity: .8; }

/* ─── MDK-BERICHT ─────────────────────────────────────────── */
.mdk-report { max-width: 900px; }

/* Firmenkopf */
.mdk-company-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border: 2px solid var(--gray-800);
  border-bottom: none;
  padding: 16px 24px;
  background: #f8f9fa;
}

.mdk-company-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.mdk-company-slogan {
  font-size: 12px;
  color: var(--gray-500);
  font-style: italic;
  margin-bottom: 6px;
}

.mdk-company-detail {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 3px;
}

.mdk-company-contacts {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}

/* Druckkopf auf der Tageskurven-Seite — nur beim Drucken sichtbar */
.curve-print-only { display: none; }
@media print {
  .curve-print-only {
    display: flex !important;
    border: 2px solid #000;
    border-bottom: none;
    margin-bottom: 0;
  }
}

.mdk-header {
  border: 2px solid var(--gray-800);
  padding: 20px 24px;
  margin-bottom: 20px;
  background: #fff;
}
.mdk-header h2 {
  font-size: 20px;
  margin-bottom: 2px;
  letter-spacing: .5px;
}
.mdk-header h3 {
  font-size: 15px;
  font-weight: 400;
  color: var(--gray-600);
  margin-bottom: 14px;
}
.mdk-info-table {
  width: 100%;
  border-collapse: collapse;
}
.mdk-info-table td {
  padding: 3px 10px 3px 0;
  font-size: 14px;
  vertical-align: top;
}
.mdk-info-table td:first-child { white-space: nowrap; width: 120px; }

.mdk-section {
  margin-bottom: 12px;
}
.mdk-section h4 {
  font-size: 15px;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--gray-100);
  border-left: 4px solid var(--primary);
}
.mdk-section h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.mdk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
  background: #fff;
}
.mdk-table th, .mdk-table td {
  border: 1px solid var(--gray-300);
  padding: 5px 8px;
  text-align: left;
}
.mdk-table th {
  background: var(--gray-100);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mdk-table td.mdk-hz, .mdk-table th.mdk-hz { text-align: center; width: 50px; }
.mdk-table td.mdk-sig, .mdk-table th.mdk-sig { text-align: center; width: 50px; padding: 2px; }
.mdk-table td.mdk-sig img { max-width: 46px; max-height: 24px; display: block; margin: 0 auto; }

/* Kürzel-Legende im MDK-Bericht */
.mdk-kuerzel-table td { vertical-align: middle; padding: 6px 10px; }
.mdk-sig-cell { text-align: left; }
.mdk-kuerzel-sig {
  max-height: 40px;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.mdk-day {
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--radius);
  page-break-inside: avoid;
}
.mdk-day-title {
  font-size: 15px;
  font-weight: 700;
  padding: 6px 0 10px;
  border-bottom: 2px solid var(--gray-800);
  margin-bottom: 12px;
}

.mdk-cat-block { margin-bottom: 10px; }
.mdk-cat-label {
  font-weight: 600;
  font-size: 13px;
  padding: 4px 10px;
  margin-bottom: 4px;
  background: var(--gray-50);
}

.mdk-report-entry { margin-bottom: 10px; }
.mdk-report-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}
.mdk-report-text {
  font-size: 13px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-left: 3px solid var(--gray-300);
  white-space: pre-wrap;
}

.mdk-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--gray-800);
}
.mdk-footer p { font-size: 13px; color: var(--gray-500); margin-bottom: 30px; }
.mdk-sign-row {
  display: flex;
  gap: 60px;
}
.mdk-sign-box {
  flex: 1;
  text-align: center;
}
.mdk-sign-line {
  border-bottom: 1px solid var(--gray-800);
  height: 50px;
  margin-bottom: 6px;
}
.mdk-sign-box span { font-size: 12px; color: var(--gray-500); }

/* ─── Prio 1: Fortschrittsanzeige ────────────────────────── */
.mandatory-progress {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.mandatory-progress .progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
}
.mandatory-progress .progress-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.mandatory-progress .progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width .3s ease;
}
.mandatory-progress .progress-fill.complete {
  background: var(--green);
}

/* ─── Prio 2: Speicher-Bestätigung ──────────────────────── */
@keyframes save-pulse {
  0%   { background-color: var(--green-light); box-shadow: inset 0 0 0 2px var(--green); }
  60%  { background-color: rgba(0,176,80,.12); box-shadow: inset 0 0 4px 1px rgba(0,176,80,.2); }
  100% { background-color: transparent; box-shadow: none; }
}
.save-flash {
  animation: save-pulse 1s ease-out !important;
}
/* Kurzzeit-Checkmark nach dem Speichern */
.save-flash::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -2px;
  font-size: 10px;
  color: var(--green);
  font-weight: 700;
  animation: save-check-fade 1s ease-out forwards;
  pointer-events: none;
}
@keyframes save-check-fade {
  0%   { opacity: 1; transform: scale(1.2); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}

/* ─── Prio 4: Schnelleingabe ────────────────────────────── */
.curve-toolbar { padding: 4px 16px; display: flex; gap: 8px; }
#btn-quick-entry.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.quick-entry-panel { padding: 0 12px 16px; }
.qe-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 8px;
}
.qe-current-slot {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.qe-measures { display: flex; flex-direction: column; gap: 8px; }
.qe-category {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.qe-cat-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.qe-measure {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}
.qe-measure:last-child { border-bottom: none; }
.qe-mandatory { background: rgba(249,115,22,.06); border-radius: 4px; padding: 6px 4px; }
.qe-label { font-size: 14px; flex: 1; min-width: 120px; }
.qe-pflicht { font-size: 10px; color: var(--yellow); font-weight: 700; text-transform: uppercase; }
.qe-prev { font-size: 11px; color: var(--gray-400); }
.qe-input { flex-shrink: 0; }
.qe-field {
  width: 80px !important;
  height: 40px;
  font-size: 16px !important;
  text-align: center;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
}
.qe-field:focus { border-color: var(--primary); outline: none; }
.qe-checkbox { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.qe-checkbox input[type="checkbox"] { width: 24px; height: 24px; }

/* ─── Prio 6: Offline-Badge ─────────────────────────────── */
.offline-badge {
  display: inline-block;
  padding: 2px 10px;
  margin: 0 16px;
  background: var(--yellow-light);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
}


/* ─── Prio 8: Unvollständig-Warnung ─────────────────────── */
.mandatory-warning {
  padding: 10px 16px;
  margin: 8px 0;
  background: var(--red-light);
  color: var(--red);
  border-radius: var(--radius);
  border-left: 4px solid var(--red);
  font-size: 13px;
}

/* ─── Prio 3: Pfleger-Dashboard ──────────────────────────── */
.stat-card.stat-warning {
  border-left: 4px solid var(--yellow);
}
.stat-card.stat-warning .stat-number { color: var(--yellow); }
.pfleger-patient-item { transition: background .15s; }
.pfleger-patient-item:hover { background: var(--primary-light); }
.patient-item-info { flex: 1; min-width: 0; }
.mini-progress {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 4px;
}
.mini-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width .3s;
}
.mini-progress-text { font-size: 11px; color: var(--gray-500); }

/* ─── MODUL: SETUP-WIZARD ────────────────────────────────── */
.setup-wizard-steps {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.setup-step {
  padding: 8px 20px;
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 600;
  position: relative;
}
.setup-step::after {
  content: '→';
  position: absolute;
  right: -4px;
  color: var(--gray-300);
}
.setup-step:last-child::after { content: ''; }
.setup-step.active { color: var(--primary); }
.setup-step.done { color: var(--green); }

.setup-info-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.setup-icon { font-size: 40px; }
.setup-details {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 12px;
}
.setup-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.setup-detail-row:last-child { border-bottom: none; }
.setup-detail-label { font-weight: 600; color: var(--gray-600); }
.setup-warn {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--yellow-light);
  border-left: 4px solid var(--yellow);
  border-radius: 4px;
  font-size: 13px;
  color: var(--yellow);
}

/* DB-Vorschau */
.setup-tables { margin-bottom: 12px; font-size: 13px; }
.setup-tables ul { margin: 6px 0 0 20px; }
.setup-tables li { padding: 3px 0; }
.setup-new { color: var(--green); font-size: 12px; font-weight: 600; }
.setup-exists { color: var(--yellow); font-size: 12px; }
.setup-sql-block {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
}
.setup-sql-header {
  background: var(--gray-800);
  color: var(--gray-300);
  padding: 6px 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}
.setup-sql-size { color: var(--gray-400); }
.setup-sql-code {
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--gray-50);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'Consolas', 'Monaco', monospace;
  margin: 0;
}
.setup-backup-info {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--primary-light);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--primary);
}
.setup-no-migration {
  padding: 24px;
  text-align: center;
  color: var(--green);
  font-size: 14px;
}

/* Installation Fortschritt */
.setup-progress { display: flex; flex-direction: column; gap: 12px; }
.setup-progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 14px;
}
.setup-step-icon { font-size: 18px; flex-shrink: 0; }
.setup-step-detail { font-size: 12px; color: var(--gray-500); margin-left: 4px; }
.setup-step-error { font-size: 12px; color: var(--red); margin-left: 4px; }

/* Ergebnis */
.setup-success, .setup-error { text-align: center; padding: 20px 0; }
.setup-success-icon, .setup-error-icon { font-size: 48px; margin-bottom: 12px; }
.setup-result-steps {
  margin: 16px auto;
  max-width: 400px;
  text-align: left;
}
.setup-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.setup-hint {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--primary-light);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--primary);
  text-align: left;
}

/* ─── MODUL: ÜBERGABEPROTOKOLL ───────────────────────────── */
.handover-list { display: flex; flex-direction: column; gap: 8px; padding: 0 0 16px; }
.ho-entry {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  border-left: 4px solid var(--gray-300);
}
.ho-entry.ho-prio-wichtig { border-left-color: var(--yellow); }
.ho-entry.ho-prio-dringend { border-left-color: var(--red); background: #fff5f5; }
.ho-entry.ho-acknowledged { opacity: .7; }
.ho-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ho-prio-icon { font-size: 16px; }
.ho-entry-patient { font-weight: 600; font-size: 14px; }
.ho-entry-cat { font-size: 11px; }
.ho-entry-time { font-size: 12px; color: var(--gray-400); margin-left: auto; }
.ho-entry-body { margin-bottom: 8px; }
.ho-entry-author { font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 2px; }
.ho-entry-message { font-size: 14px; line-height: 1.5; white-space: pre-line; }
.ho-entry-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ho-ack-info { font-size: 12px; color: var(--green); }

/* Prioritäts-Auswahl im Modal */
.ho-priority-select { display: flex; gap: 8px; flex-wrap: wrap; }
.ho-prio-option { cursor: pointer; }
.ho-prio-option input { display: none; }
.ho-prio-badge {
  display: inline-block;
  padding: 6px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.ho-prio-option input:checked + .ho-prio-badge.ho-prio-normal { border-color: var(--gray-500); background: var(--gray-50); }
.ho-prio-option input:checked + .ho-prio-badge.ho-prio-wichtig { border-color: var(--yellow); background: var(--yellow-light); }
.ho-prio-option input:checked + .ho-prio-badge.ho-prio-dringend { border-color: var(--red); background: var(--red-light); }

/* Tageskurve-Banner */
.ho-curve-banner {
  background: var(--yellow-light);
  border: 1px solid var(--yellow);
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 12px;
}
.ho-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}
.ho-banner-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(217,119,6,.15);
  font-size: 13px;
}
.ho-banner-entry.ho-prio-dringend { color: var(--red); font-weight: 600; }
.ho-banner-author { font-weight: 600; flex-shrink: 0; }
.ho-banner-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ─── DIENSTPLAN ─────────────────────────────────────────── */
.dp-table th, .dp-table td { font-size: 13px; }
.dp-add-btn:hover { border-color: var(--primary) !important; color: var(--primary) !important; }
.dp-chip button:hover { opacity: 1 !important; }

/* ─── DURCHFÜHRUNGSNACHWEIS (Tageskurven-Grid) ───────────── */
.cr-scroll-wrap { overflow-x: auto; }
.cr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
  table-layout: fixed;
}
.cr-table th, .cr-table td {
  border: 1px solid #ccc;
  padding: 2px 1px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}
.cr-table .cr-name-col {
  width: 110px;
  text-align: left;
  padding-left: 4px;
  font-size: 9px;
  white-space: normal;
  word-break: break-word;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}
.cr-table .cr-h { min-width: 28px; font-size: 8px; }
.cr-table .cr-nd { background: #f5f5f5; }
.cr-cat-row .cr-cat-cell { font-size: 10px; font-weight: 700; text-align: left; padding-left: 6px; }
.cr-cell { min-width: 28px; height: 32px; vertical-align: middle; }
.cr-filled { background: #eef7ee; }
.cr-val { display: block; font-weight: 700; font-size: 9px; line-height: 1.2; }
.cr-who { display: block; font-size: 7px; color: #555; line-height: 1.1; }
.cr-day { margin-bottom: 24px; }

/* ─── PRINT ───────────────────────────────────────────────── */
@media print {
  body { background: #fff !important; font-size: 11px; }
  .sidebar, .topbar, .mdk-no-print,
  .search-bar, .pagination, .filter-row,
  .view-header, .sidebar-toggle,
  #btn-load-reports, #btn-mdk-report, #btn-curve-report { display: none !important; }
  .cr-report { max-width: 100%; }
  .cr-scroll-wrap { overflow: visible; }
  .cr-table { font-size: 8px; }
  .cr-table .cr-name-col { position: static; width: 90px; }
  .cr-day { page-break-inside: avoid; page-break-after: always; }
  @page { size: A4 landscape; margin: 10mm; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .view-container { padding: 0 !important; }
  .mdk-report { max-width: 100%; }
  .mdk-header { border-width: 1px; }
  .mdk-day { border: 1px solid #999; page-break-inside: avoid; }
  .mdk-table th, .mdk-table td { padding: 3px 5px; font-size: 11px; }
  .mdk-table td.mdk-sig img { max-width: 44px; max-height: 20px; }
  .mdk-kuerzel-sig { max-height: 36px; max-width: 130px; }
  .mdk-sign-line { height: 40px; }
}
