:root {
  --c-bg: #f4f6fa;
  --c-card: #ffffff;
  --c-sidebar: #16202e;
  --c-sidebar-text: #c7d2e2;
  --c-sidebar-active: #223146;
  --c-text: #1f2937;
  --c-text-dim: #64748b;
  --c-border: #e2e8f0;
  --c-accent: #4f46e5;
  --c-accent-hover: #4338ca;
  --c-accent-soft: #eef2ff;
  --c-success: #16a34a;
  --c-success-soft: #dcfce7;
  --c-danger: #dc2626;
  --c-danger-soft: #fee2e2;
  --c-warn: #d97706;
  --c-warn-soft: #fef3c7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
}
[hidden] { display: none !important; }

/* ---------- App-Geruest ---------- */
.app-shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--c-sidebar);
  color: var(--c-sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  color: #fff; font-size: 18px; font-weight: 700;
}
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.25);
}
.sidebar-nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: 8px; color: inherit; text-decoration: none;
  font-size: 13.5px;
}
.sidebar-nav a:hover { background: var(--c-sidebar-active); color: #fff; }
.sidebar-nav a.active { background: var(--c-accent); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; text-align: center; opacity: 0.9; }
.sidebar-user {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px;
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }

.view { padding: 22px; max-width: 1280px; width: 100%; }

/* ---------- Karten & Layout ---------- */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--c-text-dim); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--c-border); border-radius: 8px;
  background: var(--c-card); color: var(--c-text);
  padding: 8px 14px; cursor: pointer;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-hover); }
.btn-success { background: var(--c-success); border-color: var(--c-success); color: #fff; }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: inherit; }
.btn-ghost:hover { background: rgba(148, 163, 184, 0.15); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Formulare ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--c-text-dim); }
label > input, label > select, label > textarea, .input {
  display: block; width: 100%;
  margin-top: 4px; padding: 8px 10px;
  font: inherit; color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 8px;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--c-accent-soft); border-color: var(--c-accent);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-error { color: var(--c-danger); font-size: 13px; margin: 8px 0 0; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--c-border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-dim); }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; }
tfoot td { font-weight: 700; border-top: 2px solid var(--c-border); }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge-accent { background: var(--c-accent-soft); color: var(--c-accent); }

/* ---------- Stechuhr ---------- */
.clock-face { text-align: center; padding: 28px 18px; }
.clock-time { font-size: 46px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-state { margin: 6px 0 18px; font-size: 14px; }
.clock-btn {
  width: 190px; height: 190px; border-radius: 50%;
  font-size: 19px; font-weight: 700; color: #fff;
  border: none; cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.clock-btn:active { transform: scale(0.97); }
.clock-btn.in { background: var(--c-danger); }
.clock-btn.out { background: var(--c-success); }
.clock-btn:disabled { background: #94a3b8; cursor: not-allowed; }

/* ---------- Kalender ---------- */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.calendar-day {
  min-height: 96px; border: 1px solid var(--c-border); border-radius: 8px;
  padding: 6px; background: #fff; font-size: 12px;
}
.calendar-day.other { background: #fbfdff; color: var(--c-text-dim); }
.calendar-day.today { border-color: var(--c-accent); border-width: 2px; }
.calendar-head { font-weight: 700; text-align: center; padding: 4px 0; font-size: 12px; color: var(--c-text-dim); }

/* ---------- Login ---------- */
.login-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #16202e 0%, #1e293b 60%, #312e81 100%);
}
.login-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--c-card); border-radius: 14px; padding: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.login-card h1 { font-size: 19px; margin: 14px 0 16px; }
.login-card h2 { font-size: 14px; margin: 18px 0 10px; }
.login-card label { margin-bottom: 12px; }
.login-brand { padding: 0; color: var(--c-text); }
.login-brand .brand-name { color: var(--c-text); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--c-sidebar); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow); max-width: 340px;
}
.toast.error { background: var(--c-danger); }


/* Seiten-Erweiterungen */
.modal-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--c-card); border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  width: 660px; max-width: 100%; padding: 18px;
}
.modal h2 { margin: 0 0 12px; font-size: 15px; }
.modal-sep { border-top: 1px solid var(--c-border); margin: 16px 0; }

.clickable { cursor: pointer; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.table-wrap { overflow-x: auto; }

.tk-running { background: var(--c-warn-soft); }
tbody tr.tk-running:hover { background: var(--c-warn-soft); }
.diff-pos { color: var(--c-success); }
.diff-neg { color: var(--c-danger); }

.seg { display: inline-flex; gap: 4px; }
.input-inline { width: auto; margin-top: 0; padding: 4px 8px; font-size: 12.5px; }

.clock-actions { justify-content: center; }
.clock-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.clock-meta-item { display: flex; flex-direction: column; gap: 2px; align-items: center; }

.calendar-weekdays { margin-bottom: 6px; }
.day-num { font-weight: 700; margin-bottom: 2px; }
.cal-block {
  border-left: 3px solid var(--c-accent); background: var(--c-accent-soft);
  border-radius: 4px; padding: 2px 5px; margin-top: 3px;
  font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-block.break { border-left-color: var(--c-warn); background: var(--c-warn-soft); }

.badge-muted { background: #e2e8f0; color: var(--c-text-dim); }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--c-text-dim); }
.check-inline input { width: auto; margin: 0; }
.field-hint { margin: 12px 0 6px; }
.sched-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 700px) { .sched-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
