:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --sidebar-w: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: inherit; }

/* ===== LOGIN ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); }
.login-box { background: var(--card); border-radius: 16px; padding: 40px; width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-box .logo { text-align: center; margin-bottom: 28px; }
.login-box .logo h1 { font-size: 22px; font-weight: 700; color: var(--primary); }
.login-box .logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text); background: #f8fafc; transition: border-color .2s; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); background: #fff; }
.form-group textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  transition: all .2s; font-family: inherit; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #15803d; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover  { background: #b45309; }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover  { background: var(--primary); color: #fff; }
.btn-sm       { padding: 6px 12px; font-size: 12px; }
.btn-full     { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-start { background: #22c55e; color: #fff; padding: 14px 40px; font-size: 18px;
  font-weight: 700; border-radius: 50px; border: none; cursor: pointer; transition: background .2s; }
.btn-start:hover { background: #16a34a; }
.btn-stop  { background: #ef4444; color: #fff; padding: 14px 40px; font-size: 18px;
  font-weight: 700; border-radius: 50px; border: none; cursor: pointer; transition: background .2s; }
.btn-stop:hover { background: #dc2626; }

/* ===== APP LAYOUT ===== */
.app-wrap { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #0f172a; color: #e2e8f0;
  display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; overflow-y: auto; }
.sidebar-header { padding: 20px; border-bottom: 1px solid #1e293b; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-header p  { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.sidebar nav  { flex: 1; padding: 12px 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  font-size: 14px; color: #94a3b8; cursor: pointer; transition: all .2s;
  border-left: 3px solid transparent; }
.nav-item:hover  { background: #1e293b; color: #e2e8f0; }
.nav-item.active { background: #1e293b; color: #fff; border-left-color: var(--primary); }
.nav-item .icon  { font-size: 16px; width: 22px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid #1e293b; }
.user-pill { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-pill .info { flex: 1; min-width: 0; }
.user-pill .name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.user-pill .role { font-size: 11px; color: #64748b; }
.logout-btn { background: none; border: none; color: #64748b; cursor: pointer;
  font-size: 18px; padding: 4px; transition: color .2s; display: flex; align-items: center; }
.logout-btn:hover { color: #ef4444; }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 60px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 28px; flex: 1; }

/* ===== CARDS ===== */
.card { background: var(--card); border-radius: 12px; padding: 20px; border: 1px solid var(--border); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 15px; font-weight: 700; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 20px; border: 1px solid var(--border); }
.stat-card .label { font-size: 11px; color: var(--text-muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; }
.stat-card .value { font-size: 28px; font-weight: 800; margin-top: 6px; }
.stat-card .sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.pos .value { color: var(--success); }
.stat-card.neg .value { color: var(--danger); }
.stat-card.blue .value { color: var(--primary); }

/* ===== TRACKER ===== */
.tracker-box { background: linear-gradient(135deg, #1e3a8a, #2563eb); border-radius: 16px;
  padding: 36px; text-align: center; color: #fff; margin-bottom: 24px; }
.clock-label   { font-size: 14px; opacity: .8; letter-spacing: .05em; }
.clock-display { font-size: 64px; font-weight: 800; letter-spacing: 6px;
  font-variant-numeric: tabular-nums; margin: 16px 0; }
.tracker-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
tr.subtotal td { background: #f8fafc; font-weight: 700; border-top: 2px solid var(--border); }
tr.totals td   { background: #eff6ff; font-weight: 700; border-top: 2px solid var(--primary); }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-info    { background: #dbeafe; color: #2563eb; }
.badge-muted   { background: #f1f5f9; color: #64748b; }

/* ===== SALDO ===== */
.saldo-pos { color: var(--success); font-weight: 700; }
.saldo-neg { color: var(--danger);  font-weight: 700; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 3px solid var(--primary); }
.alert-success { background: #dcfce7; color: #166534; border-left: 3px solid var(--success); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 3px solid var(--warning); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--danger); }

/* ===== GRID HELPERS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.mb-20  { margin-bottom: 20px; }

/* ===== PROGRESS ===== */
.progress-bar  { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.pf-green  { background: var(--success); }
.pf-yellow { background: var(--warning); }
.pf-red    { background: var(--danger); }
.pf-blue   { background: var(--primary); }

/* ===== VACATION CALENDAR ===== */
.cal-wrap { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.cal-controls { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--primary); color: #fff; }
.cal-controls h3 { font-size: 14px; font-weight: 700; }
.cal-btn { background: rgba(255,255,255,.2); border: none; color: #fff; cursor: pointer;
  font-size: 18px; padding: 4px 10px; border-radius: 6px; transition: background .2s; }
.cal-btn:hover { background: rgba(255,255,255,.35); }
.cal-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.cal-panel { border-right: 1px solid var(--border); }
.cal-panel:last-child { border-right: none; }
.cal-panel-header { text-align: center; padding: 10px; font-size: 13px; font-weight: 700;
  background: #f8fafc; border-bottom: 1px solid var(--border); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day-name { text-align: center; padding: 8px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; color: var(--text-muted); background: #f8fafc;
  border-bottom: 1px solid var(--border); }
.cal-cell { text-align: center; padding: 8px 4px; font-size: 13px;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  min-height: 48px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; transition: background .15s; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.cal-empty { background: transparent; }
.cal-cell.cal-weekend { color: #94a3b8; }
.cal-cell.cal-past    { color: #cbd5e1; }
.cal-cell.cal-today   { background: #eff6ff; font-weight: 700; }
.cal-cell.cal-vacation       { background: #dcfce7; }
.cal-cell.cal-vacation-pending { background: #fef3c7; }
.cal-cell.cal-sick    { background: #fee2e2; }
.cal-cell.cal-sel-start, .cal-cell.cal-sel-end { background: var(--primary); color: #fff; border-radius: 6px; }
.cal-cell.cal-in-range { background: #dbeafe; }
.cal-cell.cal-hover   { background: #bfdbfe; cursor: pointer; }
.cal-cell:not(.cal-weekend):not(.cal-past):not(.cal-vacation):not(.cal-vacation-pending):not(.cal-sick):hover {
  background: #e0f2fe; cursor: pointer; }
.cal-day-num { font-size: 13px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.cal-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: 16px; padding: 28px; width: 480px;
  max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== MISC ===== */
.select-inline { padding: 8px 12px; border-radius: 8px; border: 1.5px solid var(--border);
  font-size: 13px; background: #fff; color: var(--text); cursor: pointer; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.fw-bold { font-weight: 700; }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600; }

/* ===== DAY CHECKBOXES ===== */
.day-checkbox { display:flex; align-items:center; gap:5px; cursor:pointer;
  padding:7px 14px; border:1.5px solid var(--border); border-radius:8px;
  font-size:13px; font-weight:600; user-select:none; transition:all .15s; }
.day-checkbox input { display:none; }
.day-checkbox span  { color:var(--text-muted); }
.day-checkbox:has(input:checked) { border-color:var(--primary); background:#eff6ff; }
.day-checkbox:has(input:checked) span { color:var(--primary); }
.day-checkbox:hover { border-color:var(--primary); }

/* Nicht-Arbeitstag in Berichten */
tr.offday td { color:#94a3b8; background:#fafafa; }

@media (max-width: 900px) {
  .cal-panels { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .content { padding: 16px; }
  .clock-display { font-size: 44px; }
}
