:root {
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1d4ed8;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 230px;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --blue: #3b82f6;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --red: #ef4444;
  --red-light: #fef2f2;
  --violet: #7c3aed;
  --violet-light: #f5f3ff;
  --cyan: #0891b2;
  --cyan-light: #ecfeff;
  --slate: #475569;
  --slate-light: #f8fafc;
  --dept-kasse: #10b981;
  --dept-kasse-bg: #ecfdf5;
  --dept-regale: #f59e0b;
  --dept-regale-bg: #fffbeb;
  --dept-metzgerei: #ef4444;
  --dept-metzgerei-bg: #fef2f2;
  --role-marktleitung: #7c3aed;
  --role-marktleitung-bg: #f5f3ff;
  --role-schluessel: #0891b2;
  --role-schluessel-bg: #ecfeff;
  --role-verkaeufer: #475569;
  --role-verkaeufer-bg: #f8fafc;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }

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

/* SIDEBAR */
#sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; color: white; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.sidebar-nav { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--sidebar-text); font-size: 13.5px; font-weight: 500; transition: all 0.15s; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); }
.sidebar-user-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--blue); color: white; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.sidebar-user-name { display: block; color: white; font-size: 13px; font-weight: 600; }
.sidebar-user-role { display: block; color: var(--sidebar-text); font-size: 11px; }

/* MAIN */
#main { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }
.view { padding: 28px 32px; }
.hidden { display: none !important; }

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; transition: all 0.15s; white-space: nowrap; cursor: pointer; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--amber); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-ghost { color: var(--text-muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--border-light); }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); color: var(--text-muted); border: 1px solid var(--border); background: var(--card); display: inline-flex; align-items: center; }
.btn-icon:hover { color: var(--text); background: var(--bg); }
.btn-icon svg { width: 15px; height: 15px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }
.btn-block { width: 100%; justify-content: center; }

/* CARDS */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-body { padding: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: -1.5px; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stat-icon { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.amber { background: var(--amber-light); color: var(--amber); }
.stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-icon.violet { background: var(--violet-light); color: var(--violet); }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-kasse { background: var(--dept-kasse-bg); color: #065f46; }
.badge-regale { background: var(--dept-regale-bg); color: #78350f; }
.badge-metzgerei { background: var(--dept-metzgerei-bg); color: #991b1b; }
.badge-marktleitung { background: var(--role-marktleitung-bg); color: var(--role-marktleitung); }
.badge-schluessel { background: var(--role-schluessel-bg); color: var(--role-schluessel); }
.badge-verkaeufer { background: var(--role-verkaeufer-bg); color: var(--role-verkaeufer); }
.badge-success { background: var(--green-light); color: #065f46; }
.badge-warning { background: var(--amber-light); color: #78350f; }
.badge-danger { background: var(--red-light); color: #991b1b; }
.badge-neutral { background: var(--slate-light); color: var(--slate); }
.badge-blue { background: var(--blue-light); color: var(--blue-dark); }

/* ALERTS */
.alert { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 13px; align-items: flex-start; }
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 700; margin-bottom: 1px; font-size: 13px; }
.alert-error { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--amber-light); color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* WARNING CARDS GRID */
.warnings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-bottom: 16px; }
.warning-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 4px solid #d97706;
  background: var(--card);
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  box-shadow: var(--shadow);
}
.warning-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-1px); }
.warning-card.wc-error   { border-left-color: #dc2626; }
.warning-card.wc-warning { border-left-color: #d97706; }
.warning-card-header { display: flex; align-items: center; gap: 6px; }
.warning-card-icon { width: 16px; height: 16px; flex-shrink: 0; }
.wc-error   .warning-card-icon { color: #dc2626; }
.wc-warning .warning-card-icon { color: #d97706; }
.warning-card-date { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.warning-card-msg  { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.warning-card-hint { font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 2px; }

/* Highlight-Flash beim Navigieren */
@keyframes warnFlash { 0%,100%{background:transparent} 20%,60%{background:rgba(59,130,246,.18)} }
.warn-flash { animation: warnFlash 1.6s ease; }

/* PIN LOGIN */
.pin-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.pin-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 36px 36px; box-shadow: 0 20px 60px rgba(0,0,0,.12); text-align: center; min-width: 320px; }
.pin-logo { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.pin-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 24px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 10px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); transition: background .15s, border-color .15s; }
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-error { font-size: 12px; color: #dc2626; margin-bottom: 12px; min-height: 18px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.pin-key { aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); font-size: 20px; font-weight: 600; cursor: pointer; transition: background .1s, transform .08s; }
.pin-key:hover { background: var(--border); }
.pin-key:active { transform: scale(.93); }
.pin-key-empty { background: transparent; border-color: transparent; pointer-events: none; cursor: default; }
.pin-key-del { font-size: 16px; }

/* SCHICHTWÜNSCHE GRID */
.pref-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pref-day { display: flex; flex-direction: column; gap: 4px; }
.pref-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); text-align: center; }
.pref-select { font-size: 12px; padding: 5px 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); background-color: var(--bg); color: var(--text); text-align: center; cursor: pointer; }

/* MINIJOB FELDER */
.minijob-section { background: var(--blue-light); border: 1px solid var(--primary); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; }
.avail-days-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 6px; }
.avail-day-tag { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.avail-day-tag input { accent-color: var(--primary); width: 16px; height: 16px; }

/* TEMPLATE OVERRIDES (MA-Profil) */
.tmpl-override-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 6px; background: var(--bg); }
.tmpl-override-row .tmpl-name { font-size: 13px; font-weight: 600; }
.tmpl-override-row .tmpl-times { font-size: 11px; color: var(--text-muted); }
.tmpl-ovr-btns { display: flex; gap: 4px; flex-shrink: 0; }
.tmpl-ovr-btn { font-size: 11px; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--card); color: var(--text-muted); cursor: pointer; transition: all .12s; white-space: nowrap; }
.tmpl-ovr-btn.sel-inherit { background: var(--slate-light); color: var(--slate); border-color: var(--slate-light); font-weight: 600; }
.tmpl-ovr-btn.sel-on  { background: var(--green-light); color: #065f46; border-color: #6ee7b7; font-weight: 600; }
.tmpl-ovr-btn.sel-off { background: var(--red-light);   color: #991b1b; border-color: #fca5a5; font-weight: 600; }

/* DIENSTPLAN SORT */
.schedule-sort-select { font-size: 12px; padding: 5px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background-color: var(--bg); color: var(--text); cursor: pointer; }

/* TABLE */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); background: var(--bg); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.table-actions { display: flex; gap: 6px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="email"], select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: 13.5px; transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 12px 12px; background-position: right 10px center; padding-right: 32px; }
select option { background-color: var(--card); background-image: none; }
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-tag { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1.5px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s; user-select: none; }
.checkbox-tag input { display: none; }
.checkbox-tag:hover { border-color: var(--blue); color: var(--blue); }
.checkbox-tag.checked-kasse { border-color: var(--dept-kasse); background: var(--dept-kasse-bg); color: #065f46; }
.checkbox-tag.checked-regale { border-color: var(--dept-regale); background: var(--dept-regale-bg); color: #78350f; }
.checkbox-tag.checked-metzgerei { border-color: var(--dept-metzgerei); background: var(--dept-metzgerei-bg); color: #991b1b; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.55); backdrop-filter: blur(3px); z-index: 200; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 540px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); overflow-y: auto; z-index: 201; animation: modalIn 0.18s ease; }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -47%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close { color: var(--text-muted); padding: 5px; border-radius: 6px; display: flex; }
.modal-close:hover { color: var(--text); background: var(--bg); }
#modal-body { padding: 22px 24px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* EMPLOYEE CARDS */
.employee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.employee-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: box-shadow 0.15s, transform 0.15s; }
.employee-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.employee-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.employee-avatar { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: white; flex-shrink: 0; }
.employee-name { font-size: 14.5px; font-weight: 700; line-height: 1.2; }
.employee-role-badge { margin-top: 4px; }
.employee-quals { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.employee-hours-row { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.employee-hours-row strong { color: var(--text); }
.employee-card-footer { display: flex; justify-content: flex-end; gap: 6px; border-top: 1px solid var(--border-light); padding-top: 12px; }

/* SEARCH BAR */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; }
.search-input-wrap { position: relative; flex: 1; max-width: 360px; }
.search-input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-input-wrap input { padding-left: 34px; }

/* SCHEDULE */
.schedule-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.week-label { font-size: 15px; font-weight: 700; min-width: 200px; text-align: center; color: var(--text); }
.schedule-grid-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.schedule-grid { min-width: 900px; background: var(--card); overflow: hidden; }
.schedule-header { display: grid; grid-template-columns: 195px repeat(6, 1fr); border-bottom: 2px solid var(--border); }
.schedule-header-cell { padding: 12px 8px; text-align: center; border-right: 1px solid var(--border); background: var(--bg); }
.schedule-header-cell:first-child { text-align: left; padding-left: 14px; border-right: 2px solid var(--border); background: var(--bg); }
.schedule-header-cell:last-child { border-right: none; }
.schedule-header-date { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; display: block; line-height: 1; }
.schedule-header-day { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; display: block; margin-top: 3px; }
.schedule-header-cell.today-col .schedule-header-date { color: var(--blue); }
.schedule-header-cell.today-col .schedule-header-day { color: var(--blue); }
.schedule-header-cell.today-col { background: var(--blue-light); }
.col-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; height: 100%; }

.schedule-row { display: grid; grid-template-columns: 195px repeat(6, 1fr); border-bottom: 1px solid var(--border-light); min-height: 72px; }
.schedule-row:last-child { border-bottom: none; }
.schedule-employee-cell { padding: 10px 10px 10px 14px; display: flex; align-items: center; gap: 10px; border-right: 2px solid var(--border); background: var(--card); }
.schedule-row:hover .schedule-employee-cell { background: #fafbfc; }
.sched-emp-avatar { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; flex-shrink: 0; }
.sched-emp-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.sched-emp-sub { font-size: 11px; color: var(--text-muted); }
.sched-hours { font-size: 10.5px; margin-top: 3px; font-weight: 600; }
.sched-hours.ok { color: var(--green); }
.sched-hours.warn { color: var(--amber); }
.sched-hours.over { color: var(--red); }

.schedule-day-cell { padding: 5px; border-right: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: background 0.1s; position: relative; }
.schedule-day-cell:last-child { border-right: none; }
.schedule-day-cell:hover { background: #f8fafc; }
.schedule-day-cell.today-col { background: rgba(59,130,246,0.04); }
.schedule-day-cell.vacation-day { background: repeating-linear-gradient(135deg, transparent, transparent 5px, rgba(239,68,68,0.05) 5px, rgba(239,68,68,0.05) 10px); cursor: not-allowed; }
.vacation-label { font-size: 10px; color: var(--red); font-weight: 600; text-align: center; padding: 2px 0; opacity: 0.8; }

.shift-block { border-radius: 6px; padding: 4px 7px; font-size: 11.5px; font-weight: 700; cursor: pointer; position: relative; transition: opacity 0.15s, transform 0.1s; border: 1.5px solid transparent; }
.shift-block:hover { opacity: 0.85; transform: scale(1.02); }
.shift-block:active { transform: scale(0.98); }
.shift-block.kasse     { background: #bbf7e0; color: #064e3b; border-color: #34d399; }
.shift-block.regale    { background: #fde68a; color: #78350f; border-color: #f59e0b; }
.shift-block.metzgerei { background: #fecaca; color: #7f1d1d; border-color: #f87171; }
.shift-block-time { font-size: 10.5px; font-weight: 500; opacity: 0.8; }
.shift-block-break { font-size: 9.5px; font-weight: 500; opacity: 0.6; }
.shift-delete-btn { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 3px; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.2); color: currentColor; font-size: 10px; font-weight: 900; cursor: pointer; line-height: 1; }
.shift-block:hover .shift-delete-btn { display: flex; }

/* Schichtblock Top-Row: Bereich + Icons */
.shift-block-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.shift-block-icons { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

/* Wunsch-Schicht-Indikator */
.shift-wish-icon { font-size: 11px; cursor: default; color: #d97706; line-height: 1; text-shadow: 0 0 4px rgba(217,119,6,0.5); }
.shift-block.has-wish { box-shadow: 0 0 0 2px #d97706 inset; }
body.dark .shift-wish-icon { color: #fbbf24; text-shadow: 0 0 5px rgba(251,191,36,0.6); }
body.dark .shift-block.has-wish { box-shadow: 0 0 0 2px #fbbf24 inset; }

/* Notiz-Icon + Tooltip */
.shift-note-icon { font-size: 9px; opacity: 0.7; cursor: default; }
.shift-block.has-note::after {
  content: attr(data-note);
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  padding: 7px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  max-width: 220px;
  min-width: 100px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  z-index: 500;
  pointer-events: none;
  text-align: left;
}
.shift-block.has-note::before {
  content: '';
  display: none;
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  z-index: 501;
  pointer-events: none;
}
.shift-block.has-note:hover::after,
.shift-block.has-note:hover::before { display: block; }
.add-shift-hint { display: flex; align-items: center; justify-content: center; width: 100%; padding: 4px; color: transparent; font-size: 18px; border-radius: 5px; border: 1.5px dashed transparent; transition: all 0.1s; font-weight: 300; }
.schedule-day-cell:hover .add-shift-hint { color: var(--text-light); border-color: var(--border); }
.add-shift-hint:hover { background: var(--border); color: var(--text-muted) !important; }

/* SHIFT BLOCK – ohne Bereich */
.shift-block.no-dept { background: var(--bg); border-color: var(--border); color: var(--text-muted); }
body.dark .shift-block.no-dept { background: #1c2128; border-color: #30363d; color: #8b949e; }

/* QUICK-ENTRY POPOVER */
.qe-popover {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding: 14px;
  z-index: 2000;
  min-width: 230px;
  animation: qeFadeIn .1s ease;
}
@keyframes qeFadeIn { from { opacity:0; transform:translateY(-6px) } to { opacity:1; transform:translateY(0) } }
.qe-label { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.qe-input {
  width: 100%; padding: 8px 10px; font-size: 20px; font-family: monospace; letter-spacing: 3px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); outline: none; box-sizing: border-box;
}
.qe-input:focus { border-color: var(--primary); }
.qe-input.qe-error { border-color: #dc2626; animation: qeShake .3s; }
@keyframes qeShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.qe-hint { font-size: 10px; color: var(--text-muted); margin-top: 7px; }
.qe-preview { font-size: 14px; font-weight: 700; font-family: monospace; color: var(--primary); margin-bottom: 10px; letter-spacing: 1px; }
.qe-dept-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.qe-dept-btn {
  padding: 6px 13px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .1s; white-space: nowrap;
}
.qe-dept-btn:hover { border-color: var(--primary); color: var(--primary); }
.qe-dept-btn.qe-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.qe-dept-none { font-size: 12px; font-weight: 400; color: var(--text-muted); border-style: dashed; }
.qe-dept-none:hover { border-color: var(--text-muted); color: var(--text); }
body.dark .qe-popover { background: #161b22; border-color: #30363d; }
body.dark .qe-input { background: #0d1117; }
body.dark .qe-dept-btn { background: #1c2128; }

/* VACATION */
/* SCHICHTWÜNSCHE */
.wishes-table { width: 100%; border-collapse: collapse; }
.wishes-table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg); }
.wishes-table td { padding: 8px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.wishes-table tbody tr:last-child td { border-bottom: none; }
.wishes-table tbody tr:hover td { background: var(--bg); }
.wish-sel { border: 1.5px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 12px; font-weight: 600; background-color: var(--card); color: var(--text-muted); cursor: pointer; min-width: 70px; }
.wish-sel.wish-early { background-color: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.wish-sel.wish-late  { background-color: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.wish-sel.wish-free  { background-color: #fef9c3; color: #713f12; border-color: #fde047; }
body.dark .wish-sel               { background-color: #21262d; border-color: #30363d; color: #8b949e; }
body.dark .wish-sel.wish-early    { background-color: #1e3a5f; color: #93c5fd; border-color: #2563eb; }
body.dark .wish-sel.wish-late     { background-color: #2e1065; color: #c4b5fd; border-color: #7c3aed; }
body.dark .wish-sel.wish-free     { background-color: #3d2e00; color: #fde047; border-color: #ca8a04; }
body.dark .wishes-table th        { background: #0d1117; }
body.dark .wishes-table tbody tr:hover td { background: #1c2128; }

.wish-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.wish-badge.wish-early { background: #dbeafe; color: #1e40af; }
.wish-badge.wish-late  { background: #ede9fe; color: #5b21b6; }
.wish-badge.wish-free  { background: #fef9c3; color: #713f12; }
body.dark .wish-badge.wish-early { background: #1e3a5f; color: #93c5fd; }
body.dark .wish-badge.wish-late  { background: #2e1065; color: #c4b5fd; }
body.dark .wish-badge.wish-free  { background: #3d2e00; color: #fde047; }

.vacation-list { display: flex; flex-direction: column; gap: 8px; }
.vacation-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); gap: 12px; }
.vacation-emp { font-size: 14px; font-weight: 700; }
.vacation-dates { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.vacation-days { font-size: 12px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.vacation-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* TODAY DASHBOARD */
.today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.today-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.today-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.today-name { font-size: 13px; font-weight: 700; }
.today-time { font-size: 11.5px; color: var(--text-muted); }
.today-dept { margin-top: 2px; }

/* SETTINGS */
.settings-section { margin-bottom: 28px; }
.settings-section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.shift-template-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; box-shadow: var(--shadow); }
.shift-template-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.shift-template-name { font-size: 13.5px; font-weight: 700; flex: 1; }
.shift-template-time { font-size: 13px; color: var(--text-muted); }

/* SECTION */
.section { margin-bottom: 28px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 15px; font-weight: 700; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 56px 20px; }
.empty-state svg { width: 52px; height: 52px; color: var(--text-light); margin: 0 auto 14px; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-muted); max-width: 280px; margin: 0 auto 18px; line-height: 1.6; }

/* TOAST */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 400; }
.toast { padding: 13px 18px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn 0.2s ease; display: flex; align-items: center; gap: 10px; max-width: 340px; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.default { background: #1e293b; color: white; }
.toast.success { background: #065f46; color: white; }
.toast.error { background: #991b1b; color: white; }
.toast.warning { background: #78350f; color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* DRAG DROP */
.schedule-day-cell.drag-over { background: var(--blue-light) !important; outline: 2px dashed var(--blue); outline-offset: -3px; }
.shift-block[draggable="true"] { cursor: grab; }
.shift-block[draggable="true"]:active { cursor: grabbing; }
.dragging { opacity: 0.4; }

/* PROGRESS */
.progress-wrap { margin-top: 4px; }
.progress-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }

/* COLOR SWATCH */
.color-swatch { width: 22px; height: 22px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; }
.color-swatch.selected { border-color: var(--text); }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }

/* SEPARATOR */
.sep { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

@media (max-width: 900px) {
  :root { --sidebar-width: 64px; }
  .sidebar-logo span, .nav-item span, .sidebar-user-info, .darkmode-label { display: none; }
  .sidebar-logo { justify-content: center; padding: 20px 0 16px; }
  .nav-item { justify-content: center; padding: 10px; }
  .sidebar-footer { padding: 10px 6px; }
  .sidebar-user { justify-content: center; }
  .darkmode-toggle { justify-content: center; }
  .view { padding: 20px 16px; }
}

/* ===== DARK MODE TOGGLE BUTTON ===== */
.darkmode-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 6px;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
}
.darkmode-toggle:hover {
  background: var(--sidebar-hover);
  color: white;
}
.darkmode-label { white-space: nowrap; }

/* ===== DARK MODE ===== */
body.dark {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --border-light: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-light: #484f58;

  --blue-light: #0d1f40;
  --green-light: #0d2a1f;
  --amber-light: #2a1a00;
  --red-light: #2a0d0d;
  --violet-light: #1a0f2e;
  --cyan-light: #0a1f2a;
  --slate-light: #161b22;

  --dept-kasse-bg: #0d2a1f;
  --dept-regale-bg: #2a1a00;
  --dept-metzgerei-bg: #2a0d0d;
  --role-marktleitung-bg: #1a0f2e;
  --role-schluessel-bg: #0a1f2a;
  --role-verkaeufer-bg: #1c2128;

  --sidebar-bg: #010409;
  --sidebar-hover: #0d1117;
}

body.dark .schedule-header-cell { background: #0d1117; }
body.dark th { background: #0d1117; }
body.dark tr:hover td { background: #1c2128; }
body.dark .employee-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
body.dark input[type="text"],
body.dark input[type="number"],
body.dark input[type="date"],
body.dark input[type="time"],
body.dark input[type="email"],
body.dark select,
body.dark textarea {
  background: #0d1117;
  border-color: #30363d;
  color: var(--text);
  color-scheme: dark;
}
body.dark input:focus,
body.dark select:focus,
body.dark textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
body.dark .btn-secondary {
  background: #21262d;
  border-color: #30363d;
  color: var(--text);
}
body.dark .btn-secondary:hover { background: #2d333b; }
body.dark .btn-icon { background: #21262d; border-color: #30363d; color: var(--text-muted); }
body.dark .btn-icon:hover { background: #2d333b; color: var(--text); }
body.dark .modal { background: #161b22; border: 1px solid #30363d; }
body.dark .modal-header { background: #161b22; border-color: #30363d; }
body.dark .modal-overlay { background: rgba(1,4,9,0.75); }
body.dark .schedule-grid-wrap { border-color: #30363d; }
body.dark .schedule-grid { background: #161b22; }
body.dark .schedule-header { border-color: #30363d; }
body.dark .schedule-employee-cell { background: #161b22; }
body.dark .schedule-row:hover .schedule-employee-cell { background: #1c2128; }
body.dark .schedule-day-cell:hover { background: #1c2128; }
body.dark .schedule-day-cell.today-col { background: rgba(59,130,246,0.08); }
body.dark .schedule-header-cell.today-col { background: rgba(59,130,246,0.12); }
body.dark .add-shift-hint:hover { background: #30363d; }
body.dark .shift-block.kasse { background: #0d2a1f; border-color: #065f46; color: #6ee7b7; }
body.dark .shift-block.regale { background: #2a1a00; border-color: #78350f; color: #fcd34d; }
body.dark .shift-block.metzgerei { background: #2a0d0d; border-color: #7f1d1d; color: #fca5a5; }
body.dark .toast.default { background: #2d333b; }
body.dark .stat-card { background: #161b22; border-color: #30363d; }
body.dark .today-item { background: #161b22; border-color: #30363d; }
body.dark .vacation-item { background: #161b22; border-color: #30363d; }
body.dark .shift-template-item { background: #161b22; border-color: #30363d; }
body.dark .table-wrapper { border-color: #30363d; }
body.dark .warning-card { background: #161b22; border-color: #30363d; }
body.dark .pin-box { background: #161b22; border-color: #30363d; }
body.dark .pin-key { background: #21262d; border-color: #30363d; color: var(--text); }
body.dark .pin-key:hover { background: #2d333b; }
body.dark .pref-select { background-color: #21262d; border-color: #30363d; color: var(--text); }
body.dark .minijob-section { background: rgba(59,130,246,0.08); border-color: #1d4ed8; }
body.dark .schedule-sort-select { background-color: #21262d; border-color: #30363d; color: var(--text); }
body.dark .tmpl-override-row { background: #161b22; border-color: #30363d; }
body.dark .tmpl-ovr-btn               { background: #21262d; border-color: #30363d; color: #8b949e; }
body.dark .tmpl-ovr-btn.sel-inherit   { background: #2d333b; border-color: #6e7681; color: #cdd9e5; }
body.dark .tmpl-ovr-btn.sel-on        { background: #0d2a1f; border-color: #2ea043; color: #56d364; }
body.dark .tmpl-ovr-btn.sel-off       { background: #2a0d0d; border-color: #b91c1c; color: #f87171; }
body.dark table { background: #161b22; }
body.dark td { border-color: #21262d; }
body.dark .card { background: #161b22; border-color: #30363d; }
body.dark .checkbox-tag { border-color: #30363d; color: var(--text-muted); }
body.dark .checkbox-tag:hover { border-color: var(--blue); color: var(--blue); }
body.dark select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%238b949e'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 12px 12px; background-position: right 10px center; }
body.dark select option { background-color: #21262d; background-image: none; }

/* transition for smooth dark mode switch */
body, body * {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}
/* disable transition on page load */
body.no-transition, body.no-transition * { transition: none !important; }
