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

:root {
  --primary: #2A9D8F;
  --primary-dark: #1f7a6e;
  --secondary: #8B6F47;
  --accent: #D4AF37;
  --danger: #e63946;
  --success: #2a9d5c;
  --warning: #e9c46a;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* LAYOUT */
#app { display: flex; height: 100vh; overflow: hidden; }
#sidebar { width: 220px; background: #1a3a35; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
#content { flex: 1; overflow-y: auto; padding: 24px; }

/* SIDEBAR */
.sidebar-logo { padding: 20px 16px 12px; font-size: 15px; font-weight: 700; letter-spacing: 0.5px; color: var(--accent); border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo small { display: block; font-size: 10px; font-weight: 400; color: rgba(255,255,255,0.5); margin-top: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: rgba(255,255,255,0.75); cursor: pointer; border: none; background: none; width: 100%; text-align: left; font-size: 13.5px; transition: background 0.15s, color 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

/* TOPBAR */
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
#logout-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 5px 12px; cursor: pointer; font-size: 13px; color: var(--text-muted); }
#logout-btn:hover { background: var(--bg); }

/* LOGIN */
#login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 40px; width: 360px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-card .brand { color: var(--primary); font-weight: 700; }

/* CARDS & SECTIONS */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.section-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* FORMS */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: #fff; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42,157,143,0.15); }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13.5px; font-weight: 500; border: none; cursor: pointer; transition: opacity 0.15s, background 0.15s; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #333; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 7px; font-size: 11px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { background: var(--bg); padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px; color: var(--text-muted); border-bottom: 2px solid var(--border); }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8f9fa; }
tbody tr:last-child td { border-bottom: none; }

/* BADGES */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* TAGS */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: var(--bg); border: 1px solid var(--border); margin: 2px; }

/* PLANNING GRID */
.planning-header { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.day-tab { padding: 8px 16px; border-radius: 6px; cursor: pointer; border: 2px solid var(--border); background: var(--surface); font-size: 13px; transition: all 0.15s; }
.day-tab:hover { border-color: var(--primary); color: var(--primary); }
.day-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.day-tab.setup { border-style: dashed; }

.area-section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.area-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.area-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.area-name { font-weight: 700; font-size: 15px; }
.area-body { padding: 16px 20px; }

.shift-card { border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
.shift-card:last-child { margin-bottom: 0; }
.shift-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.shift-name { font-weight: 600; font-size: 13.5px; }
.shift-time { color: var(--text-muted); font-size: 12px; }
.shift-count { margin-left: auto; font-size: 12px; }
.shift-count.ok { color: var(--success); }
.shift-count.low { color: var(--danger); }
.shift-count.full { color: var(--warning); }
.helper-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.helper-chip { display: inline-flex; align-items: center; gap: 5px; background: #e8f5f3; border-radius: 20px; padding: 3px 10px 3px 8px; font-size: 12px; color: #1a5c54; }
.helper-chip .remove-chip { cursor: pointer; color: #999; font-size: 14px; line-height: 1; }
.helper-chip .remove-chip:hover { color: var(--danger); }
.no-shifts { color: var(--text-muted); font-size: 13px; padding: 8px 0; }

/* AVAILABILITY INDICATOR */
.avail-yes { color: var(--success); font-size: 11px; }
.avail-no { color: var(--danger); font-size: 11px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* HELPER SEARCH */
.helper-search-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; margin-bottom: 10px; }
.helper-list { max-height: 320px; overflow-y: auto; }
.helper-list-item { display: flex; align-items: center; padding: 8px 10px; border-radius: 6px; cursor: pointer; transition: background 0.1s; }
.helper-list-item:hover { background: var(--bg); }
.helper-list-item .hname { font-weight: 500; font-size: 13.5px; }
.helper-list-item .hinfo { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.helper-list-item .avail-badge { margin-left: auto; }
.helper-list-item.assigned { opacity: 0.4; cursor: not-allowed; }
.helper-list-item.unavail .hname::after { content: ' (nicht verfügbar)'; font-size: 11px; color: var(--warning); font-weight: 400; }

/* SEARCH BAR */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar .form-control { flex: 1; }

/* ALERT */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* SPINNER */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* COLOR PICKER ROW */
.color-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.color-option { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: border-color 0.15s; }
.color-option.selected { border-color: #333; }

/* MISC */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.hidden { display: none !important; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* AG BADGE */
.ag-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  #sidebar { width: 60px; }
  .nav-item span { display: none; }
  .sidebar-logo small { display: none; }
  #content { padding: 16px; }
}
