/* ═══════════════════════════════════════════════════════════════
   Dienstplan-Manager – Professional Design
   Aesthetic: Refined Institutional — warmes Slate, DM Sans,
   subtile Tiefe, klare Hierarchie. Wirkt wie ein durchdachtes
   Verwaltungstool, nicht wie ein generischer Bootstrap-Klon.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Primärpalette – warmes Schieferblau */
  --primary:        #2d4a7a;
  --primary-mid:    #3a5f9e;
  --primary-light:  #e8eef8;
  --primary-glow:   rgba(45, 74, 122, 0.12);

  /* Akzent – warmes Teal für Erfolg/Aktion */
  --accent:         #0e7c6b;
  --accent-light:   #e6f4f1;

  /* Semantische Farben */
  --success:        #166534;
  --success-bg:     #f0fdf4;
  --success-border: #bbf7d0;
  --warning:        #92400e;
  --warning-bg:     #fffbeb;
  --warning-border: #fde68a;
  --danger:         #991b1b;
  --danger-bg:      #fef2f2;
  --danger-border:  #fecaca;
  --info:           #1e40af;
  --info-bg:        #eff6ff;
  --info-border:    #bfdbfe;

  /* Neutrals – warm getönt, kein reines Grau */
  --ink-900:  #1a1f2e;
  --ink-800:  #252b3b;
  --ink-700:  #374060;
  --ink-600:  #52597a;
  --ink-500:  #7079a0;
  --ink-400:  #9ea5c4;
  --ink-300:  #c5cade;
  --ink-200:  #dfe3f0;
  --ink-100:  #eef0f8;
  --ink-50:   #f5f6fb;
  --white:    #ffffff;

  /* Sidebar */
  --sidebar-bg:      #141926;
  --sidebar-border:  rgba(255,255,255,0.06);
  --sidebar-hover:   rgba(255,255,255,0.07);
  --sidebar-active:  rgba(255,255,255,0.12);
  --sidebar-text:    rgba(255,255,255,0.55);
  --sidebar-active-text: #ffffff;

  /* Bereichsfarben – satt, nicht pastell */
  --kueche-bg:     #fef7e0;
  --kueche-border: #d4960a;
  --kueche-text:   #6b4a05;
  --kueche-dot:    #f59e0b;

  --dkr-bg:        #e8eef8;
  --dkr-border:    #3a5f9e;
  --dkr-text:      #1e3a6e;
  --dkr-dot:       #3a5f9e;

  --sozial-bg:     #e6f4ee;
  --sozial-border: #2a7d52;
  --sozial-text:   #145235;
  --sozial-dot:    #16a34a;

  /* Schatten */
  --shadow-xs: 0 1px 2px rgba(20,25,38,0.06);
  --shadow-sm: 0 1px 4px rgba(20,25,38,0.08), 0 1px 2px rgba(20,25,38,0.04);
  --shadow-md: 0 4px 12px rgba(20,25,38,0.10), 0 1px 3px rgba(20,25,38,0.06);
  --shadow-lg: 0 12px 32px rgba(20,25,38,0.14), 0 2px 8px rgba(20,25,38,0.08);
  --shadow-xl: 0 24px 64px rgba(20,25,38,0.18), 0 4px 16px rgba(20,25,38,0.10);

  /* Radien */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Übergänge */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
  --t-fast:   120ms;
  --t-mid:    200ms;
  --t-slow:   320ms;
}

/* ── Reset & Base ────────────────────────────────────────────── */

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-800);
  background: var(--ink-50);
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.sidebar {
  width: 232px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
}

/* Schicke Textur auf der Sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(45,74,122,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(14,124,107,0.15) 0%, transparent 50%);
  pointer-events: none;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  position: relative;
}

.sidebar-logo h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo h1::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kueche-dot);
  box-shadow: 0 0 8px rgba(245,158,11,0.6);
  flex-shrink: 0;
}

.sidebar-logo p {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 3px;
  margin-left: 16px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  position: relative;
}

/* Abschnittslabel */
.sidebar-nav::before {
  content: 'NAVIGATION';
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: 0.1em;
  padding: 8px 10px 4px;
  opacity: 0.5;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
  user-select: none;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.85);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

/* Aktiver Balken links */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--primary-mid);
  border-radius: 0 3px 3px 0;
}

.nav-item .icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar-Legende */
.sidebar-legend {
  padding: 14px 18px;
  border-top: 1px solid var(--sidebar-border);
  position: relative;
}

.sidebar-legend-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: 0.1em;
  opacity: 0.5;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.kueche    { background: var(--kueche-dot); }
.legend-dot.dkr       { background: var(--dkr-dot); }
.legend-dot.sozialdienst { background: var(--sozial-dot); }
.legend-dot.extern    { background: #7c3aed; }
.legend-dot.teamsitzung { background: #475569; }
.legend-dot.psd       { background: #0891b2; }

.legend-label {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

/* ── Main Content ─────────────────────────────────────────────── */

.main-content {
  margin-left: 232px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Wichtig: erlaubt dem Flex-Item, schmaler als sein Inhalt zu werden, damit
     breite Tabellen (z. B. Monatsplan, ~30 Spalten) INNERHALB ihrer Hülle
     scrollen statt die ganze Seite zu verbreitern (sonst werden die Kopfzeilen-
     Buttons wie „Auto-Plan erstellen" aus dem sichtbaren Bereich geschoben). */
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────────── */

.topbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink-200);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

/* ── Pages ───────────────────────────────────────────────────── */

.page {
  flex: 1;
  padding: 28px;
  display: none;
  animation: pageIn var(--t-mid) var(--ease) both;
}

.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ───────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--ink-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--t-mid) var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(to bottom, var(--white), var(--ink-50));
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

.card-body { padding: 22px; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
  white-space: nowrap;
  letter-spacing: 0;
  line-height: 1.4;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(45,74,122,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-mid);
  border-color: var(--primary-mid);
  box-shadow: 0 3px 8px rgba(45,74,122,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-success {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(14,124,107,0.3);
}
.btn-success:hover:not(:disabled) {
  background: #0a6b5c;
  box-shadow: 0 3px 8px rgba(14,124,107,0.35);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
  box-shadow: 0 1px 3px rgba(153,27,27,0.25);
}
.btn-danger:hover:not(:disabled) {
  background: #7f1d1d;
  box-shadow: 0 3px 8px rgba(153,27,27,0.3);
}

.btn-outline {
  background: var(--white);
  color: var(--ink-700);
  border-color: var(--ink-200);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover:not(:disabled) {
  background: var(--ink-50);
  border-color: var(--ink-300);
  color: var(--ink-900);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

.btn-lg {
  padding: 12px 22px;
  font-size: 14px;
  border-radius: var(--r-lg);
}

.btn-group {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Forms ───────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group > label,
.form-group label:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 2px;
}

input:not([type=checkbox]):not([type=radio]),
select,
textarea {
  padding: 9px 13px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-900);
  background: var(--white);
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
  width: 100%;
  -webkit-appearance: none;
}

input:not([type=checkbox]):not([type=radio]):hover,
select:hover { border-color: var(--ink-300); }

input:not([type=checkbox]):not([type=radio]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.checkbox-group { display: flex; flex-direction: column; gap: 7px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-700);
  cursor: pointer;
}

.checkbox-item input[type=checkbox] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
  border-radius: 4px;
}

/* ── Tables ──────────────────────────────────────────────────── */

.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--ink-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--ink-200);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--ink-100);
  transition: background var(--t-fast) var(--ease);
}

tbody tr:nth-child(even) { background: rgba(245,246,251,0.5); }
tbody tr:hover { background: var(--primary-light) !important; }

tbody td {
  padding: 11px 16px;
  color: var(--ink-700);
  vertical-align: middle;
}

/* ── Badges ──────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-blue   { background: var(--primary-light);   color: var(--primary); }
.badge-green  { background: var(--success-bg);       color: var(--success); border: 1px solid var(--success-border); }
.badge-yellow { background: var(--warning-bg);       color: var(--warning); border: 1px solid var(--warning-border); }
.badge-red    { background: var(--danger-bg);        color: var(--danger);  border: 1px solid var(--danger-border); }
.badge-gray   { background: var(--ink-100);          color: var(--ink-600); }

/* ── Alerts ──────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 10px;
  line-height: 1.5;
}

.alert-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info); }

/* ── Stats-Kacheln ───────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Dekorativer Akzent oben */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Dienstplan-Tabelle ──────────────────────────────────────── */

.plan-table {
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 0;
}

.plan-table th {
  background: var(--ink-800);
  color: rgba(255,255,255,0.75);
  padding: 11px 10px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid var(--primary);
  border-right: 1px solid rgba(255,255,255,0.06);
}

.plan-table th.name-col {
  text-align: left;
  min-width: 150px;
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--ink-900);
  border-right: 2px solid var(--primary);
}

.plan-table td {
  padding: 5px 7px;
  border: 1px solid var(--ink-100);
  vertical-align: top;
  min-width: 115px;
  max-width: 165px;
  background: var(--white);
  transition: background var(--t-fast);
}

.plan-table td.name-cell {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-900);
  background: var(--white);
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 2px solid var(--ink-200);
  padding: 8px 12px;
}

.plan-table tr:hover td { background: var(--primary-light) !important; }
.plan-table tr:hover td.name-cell { background: var(--primary-light) !important; }

.day-header { text-align: center; }
.day-header .day-name { font-size: 11px; font-weight: 700; color: var(--white); }
.day-header .day-date { font-size: 9px;  color: rgba(255,255,255,0.45); margin-top: 1px; }

.cell-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 28px;
}

/* ── Schicht-Chips ───────────────────────────────────────────── */

.shift-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 7px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition:
    filter var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
  border-left: 3px solid transparent;
}

.shift-chip:hover {
  filter: brightness(0.94);
  transform: scale(1.02);
}

.shift-chip.kueche {
  background: var(--kueche-bg);
  border-left-color: var(--kueche-border);
  color: var(--kueche-text);
  border-top: 1px solid rgba(212,150,10,0.2);
  border-right: 1px solid rgba(212,150,10,0.2);
  border-bottom: 1px solid rgba(212,150,10,0.2);
}

.shift-chip.dkr {
  background: var(--dkr-bg);
  border-left-color: var(--dkr-border);
  color: var(--dkr-text);
  border-top: 1px solid rgba(58,95,158,0.2);
  border-right: 1px solid rgba(58,95,158,0.2);
  border-bottom: 1px solid rgba(58,95,158,0.2);
}

.shift-chip.sozialdienst {
  background: var(--sozial-bg);
  border-left-color: var(--sozial-border);
  color: var(--sozial-text);
  border-top: 1px solid rgba(42,125,82,0.2);
  border-right: 1px solid rgba(42,125,82,0.2);
  border-bottom: 1px solid rgba(42,125,82,0.2);
}

.shift-chip.extern {
  background: #ede9fe;
  border-left-color: #7c3aed;
  color: #5b21b6;
  border-top: 1px solid rgba(124,58,237,0.2);
  border-right: 1px solid rgba(124,58,237,0.2);
  border-bottom: 1px solid rgba(124,58,237,0.2);
  font-style: italic;
}

.shift-chip.teamsitzung {
  background: #e2e8f0;
  border-left-color: #475569;
  color: #334155;
  border-top: 1px solid rgba(71,85,105,0.2);
  border-right: 1px solid rgba(71,85,105,0.2);
  border-bottom: 1px solid rgba(71,85,105,0.2);
  font-style: italic;
}

.shift-chip.psd {
  background: #cffafe;
  border-left-color: #0891b2;
  color: #155e75;
  border-top: 1px solid rgba(8,145,178,0.2);
  border-right: 1px solid rgba(8,145,178,0.2);
  border-bottom: 1px solid rgba(8,145,178,0.2);
  font-style: italic;
}

.shift-chip.manual {
  box-shadow: inset 0 0 0 2px var(--ink-700);
  font-weight: 700;
}

.shift-chip.conflict {
  background: var(--danger-bg) !important;
  border-left-color: var(--danger) !important;
  color: var(--danger) !important;
}

.shift-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 1px;
  font-size: 12px;
  color: inherit;
  opacity: 0.4;
  line-height: 1;
  transition: opacity var(--t-fast);
  flex-shrink: 0;
}
.shift-delete:hover { opacity: 1; }

.add-shift-btn {
  width: 100%;
  text-align: center;
  padding: 3px;
  color: var(--ink-400);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  border-radius: var(--r-sm);
  transition: all var(--t-fast) var(--ease);
  display: none;
  background: none;
  border: 1px dashed transparent;
}

td:hover .add-shift-btn { display: block; }
.add-shift-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary-mid);
}

/* „＋" im dunklen Header der Bereiche-Ansicht */
.area-add-btn {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  border-radius: 99px;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background var(--t-fast) var(--ease);
}
.area-add-btn:hover { background: rgba(255,255,255,0.4); }

.closed-cell {
  background: repeating-linear-gradient(
    135deg,
    var(--ink-50) 0px,
    var(--ink-50) 3px,
    rgba(200,205,220,0.25) 3px,
    rgba(200,205,220,0.25) 6px
  ) !important;
  cursor: not-allowed;
}

/* ── Konflikte ───────────────────────────────────────────────── */

.conflict-list { display: flex; flex-direction: column; gap: 8px; }

.conflict-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 13px;
  line-height: 1.5;
}

.conflict-item.hard {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
  border-left: 4px solid var(--danger);
}

.conflict-item.soft {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
  border-left: 4px solid #f59e0b;
}

.conflict-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.conflict-body strong { display: block; font-weight: 600; margin-bottom: 2px; }

.conflict-group {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-left: 4px solid #f59e0b;
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.conflict-group > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--warning);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.conflict-group > summary::-webkit-details-marker { display: none; }
.conflict-group > summary::before {
  content: '▸';
  font-size: 11px;
  transition: transform 0.15s;
}
.conflict-group[open] > summary::before { transform: rotate(90deg); }

/* ── Ausgleichstage ──────────────────────────────────────────── */
.comp-list { display: flex; flex-direction: column; gap: 8px; }
.comp-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 12px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  font-size: 13px;
}
.comp-name { flex-shrink: 0; min-width: 130px; }
.comp-pairs { display: flex; flex-wrap: wrap; gap: 6px; }
.comp-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: var(--card);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  font-size: 12px;
}
.comp-from { font-weight: 600; }
.comp-arrow { color: var(--ink-400); font-size: 11px; }
.comp-to { font-weight: 600; color: var(--sozial-text, #2a7d52); }

/* ── Regelübersicht (Einstellungen, read-only) ───────────────── */
.rules-head { margin-bottom: 14px; }
.rules-head h3 { font-size: 18px; font-weight: 800; margin: 0 0 4px; }
.rules-head p { color: var(--ink-400); font-size: 13px; margin: 0 0 10px; }
.rules-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-400); }

.rules-group {
  background: var(--card);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin-bottom: 12px;
}
.rules-group h4 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.rules-sub { font-weight: 400; color: var(--ink-400); font-size: 12px; }

.rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rule-item {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-100, #eef0f3);
}
.rule-item:last-child { border-bottom: none; padding-bottom: 0; }
.rule-item > span:last-child { flex: 1; min-width: 220px; }

.rule-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.b-fix    { background: #e2e8f0; color: #334155; }
.b-edit   { background: #dbeafe; color: #1e40af; }
.b-person { background: #ede9fe; color: #5b21b6; }

/* ── Verfügbarkeiten ─────────────────────────────────────────── */

/* ── Verfügbarkeiten: Zeilen-Layout ─────────────────────────── */
.avail-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--white);
}

.avail-row-weekend {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.avail-row-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  min-width: 90px;
  flex-shrink: 0;
}

.avail-row-weekend .avail-row-label { color: var(--warning); }

.avail-row-slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.avail-empty {
  font-size: 12px;
  color: var(--danger);
  font-style: italic;
}

.avail-time-row {
  display: flex;
  align-items: center;
}

.avail-time-row .time-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.avail-time-row .time-sep {
  font-size: 14px;
  color: var(--ink-400);
  flex-shrink: 0;
}

.avail-time-row input[type=time] {
  font-size: 15px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  width: 115px;
  border: 1px solid var(--ink-300);
  background: var(--ink-50);
  color: var(--ink-900);
  box-sizing: border-box;
}

.avail-time-row input[type=time]:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 2px var(--primary-glow);
  background: var(--white);
}

.avail-remove-btn {
  background: none;
  color: var(--ink-400);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  transition: color var(--t-fast), background var(--t-fast);
  line-height: 1;
  margin-left: 2px;
}
.avail-remove-btn:hover { color: var(--danger); background: var(--danger-bg); }

.avail-add-btn {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px dashed var(--primary-mid);
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.avail-add-btn:hover { background: #dbe5f4; }

/* ── Modal ───────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: overlayIn var(--t-mid) var(--ease) both;
}

@keyframes overlayIn {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to   { opacity: 1; backdrop-filter: blur(6px); }
}

.modal {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn var(--t-slow) var(--ease) both;
  border: 1px solid var(--ink-200);
}

@keyframes modalIn {
  from { transform: translateY(24px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, var(--white), var(--ink-50));
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}

.modal-close {
  background: var(--ink-100);
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-500);
  padding: 6px;
  line-height: 1;
  border-radius: var(--r-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--ink-200); color: var(--ink-900); }

.modal-body { padding: 22px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--ink-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--ink-50);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ── Solver-Overlay ──────────────────────────────────────────── */

.solver-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  gap: 20px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--white);
  border-right-color: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tooltip ─────────────────────────────────────────────────── */

[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  z-index: 100;
  box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Utility ─────────────────────────────────────────────────── */

.hidden       { display: none !important; }
.mt-4         { margin-top: 16px; }
.mb-4         { margin-bottom: 16px; }
.gap-4        { gap: 16px; }
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-sm      { font-size: 12px; }
.text-gray    { color: var(--ink-500); }
.font-bold    { font-weight: 700; }

/* Mono-Zahlen in Tabellen */
.tabular { font-family: 'DM Mono', monospace; font-size: 12.5px; }

/* ── Scrollbar ───────────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ── Sidebar-Legende (HTML override) ─────────────────────────── */
/* Ersetzt den alten inline style-Block in index.html */

.sidebar > div:last-child {
  padding: 16px 18px;
  border-top: 1px solid var(--sidebar-border);
}

/* ── Einstellungen (neu, laienfreundlich) ─────────────────────── */

.settings-intro {
  font-size: 14px;
  color: var(--ink-500);
  margin-bottom: 20px;
}

/* Constraint-Karte */
.constraint-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border-left: 4px solid var(--ink-300);
  overflow: hidden;
}
.constraint-card.kueche-card { border-left-color: var(--kueche-border); }
.constraint-card.dkr-card    { border-left-color: var(--dkr-border); }
.constraint-card.sozial-card { border-left-color: var(--sozial-border); }

.constraint-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--ink-100);
}
.cc-icon { font-size: 26px; line-height: 1; margin-top: 1px; }
.constraint-card-header h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.constraint-card-header p  { margin: 0; font-size: 13px; color: var(--ink-500); }

/* Zeilen */
.cc-rows { padding: 2px 0; }

.cc-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 22px;
  cursor: pointer;
}
.cc-toggle input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; cursor: pointer; }
.cc-toggle-text { display: flex; flex-direction: column; gap: 3px; }
.cc-toggle-hint { font-size: 12px; color: var(--ink-400); line-height: 1.4; }

.cc-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--ink-50);
  flex-wrap: wrap;
}
.cc-row:last-child { border-bottom: none; }
.cc-row-priority   { align-items: flex-start; }

.cc-label {
  flex: 0 0 200px;
}
.cc-label strong { font-size: 13.5px; color: var(--ink-700); display: block; }
.cc-sublabel {
  display: block;
  font-size: 12px;
  color: var(--ink-400);
  margin-top: 3px;
  line-height: 1.35;
  font-weight: 400;
}

.cc-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--ink-600);
}

/* Stepper */
.stepper {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--ink-200);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .15s;
}
.stepper:focus-within { border-color: var(--primary); }

.stepper button {
  width: 34px;
  background: var(--ink-50);
  border: none;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-600);
  transition: background .1s, color .1s;
  padding: 0;
  line-height: 1;
}
.stepper button:hover { background: var(--ink-200); color: var(--ink-800); }

.stepper input[type="number"] {
  width: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-left: 1px solid var(--ink-200);
  border-right: 1px solid var(--ink-200);
  padding: 7px 0;
  background: var(--white);
  color: var(--ink-800);
  -moz-appearance: textfield;
}
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.stepper input[type="number"]:focus { outline: none; }

/* Prioritätsauswahl */
.priority-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.priority-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--ink-200);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 150px;
  flex: 1;
  max-width: 220px;
}
.priority-option:hover {
  border-color: var(--primary-mid);
  background: var(--primary-light);
}
.priority-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.priority-option input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.priority-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.priority-body strong { font-size: 13.5px; color: var(--ink-700); }
.priority-body span   { font-size: 12px; color: var(--ink-400); line-height: 1.35; }

/* ═══ PERSONENÜBERSICHT ════════════════════════════════════════════ */

.emp-name-link {
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.emp-name-link:hover { color: var(--primary-dark, #1a56db); }

.empov-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.empov-weekday-header {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-400);
  padding: 4px 0 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.empov-cell {
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  padding: 8px 7px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.empov-cell-empty {
  background: transparent;
  border-color: transparent;
  min-height: 90px;
}

.empov-cell-today {
  border-color: var(--primary);
  background: var(--primary-light, #eff6ff);
}

.empov-day-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-600, #4b5563);
  margin-bottom: 2px;
}

.empov-free {
  font-size: 12px;
  color: var(--ink-300, #9ca3af);
  margin-top: auto;
}

.empov-shift {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.empov-time {
  font-size: 11px;
  color: var(--ink-500, #6b7280);
  font-variant-numeric: tabular-nums;
}

.empov-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.5;
}
.empov-badge-kueche  { background: #fef3c7; color: #92400e; }
.empov-badge-dkr     { background: #fee2e2; color: #991b1b; }
.empov-badge-sozial  { background: #d1fae5; color: #065f46; }
.empov-badge-meeting { background: #e2e8f0; color: #334155; }
.empov-badge-extern  { background: #ede9fe; color: #5b21b6; }

.empov-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--gray-50, #f9fafb);
  border-radius: 8px;
  border: 1px solid var(--gray-200, #e5e7eb);
  font-size: 14px;
  color: var(--ink-700);
}

/* ═══ LOGIN-SCREEN ═════════════════════════════════════════════════ */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg, #1f2d44);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-700, #1f2937);
  text-align: center;
}

.login-sub {
  text-align: center;
  color: var(--ink-400, #9ca3af);
  font-size: 13px;
  margin: 4px 0 28px;
}

.login-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-600, #4b5563);
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 74, 122, .12);
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 4px;
}

.login-error {
  color: var(--danger, #991b1b);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 6px;
}

/* ═══ SIDEBAR-BENUTZERBOX ══════════════════════════════════════════ */

.sidebar-user {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px;
}

.sidebar-user-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-user-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-user-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ═══ MEIN DIENSTPLAN – TAGESANSICHT ═══════════════════════════════ */

.myday-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.myday-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 10px;
}

.myday-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-700, #1f2937);
  font-variant-numeric: tabular-nums;
}
.myday-time span { color: var(--ink-300, #9ca3af); margin: 0 4px; }

.myday-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-400, #9ca3af);
  font-size: 16px;
}
