/* ============================================================
   KITA Zeiterfassung - Main Stylesheet
   ============================================================ */

/* CSS Custom Properties */
:root {
  --primary: #2E7D5E;
  --primary-dark: #1a5c44;
  --primary-light: #4CAF84;
  --accent: #f0a500;
  --accent-dark: #d4900a;
  --error: #c0392b;
  --error-dark: #a93226;
  --error-light: #fdecea;
  --success: #27ae60;
  --success-dark: #229954;
  --success-light: #eafaf1;
  --warning: #f39c12;
  --warning-light: #fef9e7;
  --bg: #f5f7fa;
  --bg-secondary: #f8fafb;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --table-header-bg: #f8f9fb;
  --table-row-hover: #f8fafb;
  --table-footer-bg: #f0f4f8;
  --border: #e0e4ea;
  --text: #2c3e50;
  --text-secondary: #6b7c93;
  --text-light: #95a5a6;
  --badge-green-bg: #d5f5e3;
  --badge-green-text: #1e8449;
  --badge-amber-bg: #fef9e7;
  --badge-amber-border: #f9e27a;
  --badge-amber-text: #9a7d0a;
  --badge-red-bg: #fdedec;
  --badge-red-text: #922b21;
  --badge-blue-bg: #ebf5fb;
  --badge-blue-text: #1a5276;
  --badge-gray-bg: #f2f3f4;
  --badge-gray-text: #626567;
  --badge-purple-bg: #f4ecf7;
  --badge-purple-text: #6c3483;
  --badge-teal-bg: #e8f8f5;
  --badge-teal-text: #117864;
  --badge-edited-bg: #fef3cd;
  --badge-edited-text: #856404;
  --badge-edited-border: #ffc107;
  --alert-error-border: #f1948a;
  --alert-error-text: #922b21;
  --alert-success-border: #82e0aa;
  --alert-success-text: #1e8449;
  --alert-warning-border: #f9e27a;
  --alert-warning-text: #9a7d0a;
  --alert-info-bg: #ebf5fb;
  --alert-info-border: #85c1e9;
  --alert-info-text: #1a5276;
  --audit-update-bg: #fff3cd;
  --audit-update-text: #856404;
  --audit-delete-bg: #fdedec;
  --audit-delete-text: #922b21;
  --clock-inactive-bg: #f2f3f4;
  --dp-weekend-color: #aaa;
  --dp-holiday-bg: #fff8e6;
  --dp-range-bg: rgba(46,125,94,0.12);
  --dp-legend-border: #ccc;
  --sched-cell-today: rgba(46,125,94,0.07);
  --sched-cell-hover: rgba(46,125,94,0.06);
  --sched-cell-holiday: #fdecea;
  --sched-cell-holiday-hover: #fad7d3;
  --sched-month-other: #f9fafb;
  --sched-month-holiday: #fdecea;
  --sched-month-holiday-text: #b94a3c;
  --update-banner-bg: linear-gradient(135deg, #f0fdf4, #dcfce7);
  --update-banner-border: #16a34a;
  --update-banner-tag: #15803d;
  --update-banner-date: #166534;
  --update-banner-title: #14532d;
  --update-banner-body: #166534;
  /* Aliases used in JS inline styles */
  --bg-card: var(--card-bg);
  --bg-primary: var(--bg);
  --bg-secondary: #f8fafb;
  --border-color: var(--border);
  --error-color: var(--error);
  --success-color: var(--success);
  --warning-color: var(--warning);
  --warning-bg: var(--warning-light);
  --warning-border: #ffe58f;
  --info-bg: #e3f2fd;
  --info-border: #90caf9;
  --bg-highlight: #f0f7ff;

  --nav-height: 64px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

[data-theme="dark"] {
  --bg: #111318;
  --bg-secondary: #161b27;
  --card-bg: #1c2030;
  --input-bg: #252c3d;
  --table-header-bg: #161b27;
  --table-row-hover: rgba(255,255,255,0.04);
  --table-footer-bg: #151921;
  --border: #2e3650;
  --text: #e2e8f0;
  --text-secondary: #8b98b0;
  --text-light: #6b7c93;
  --error-light: rgba(192,57,43,0.25);
  --success-light: rgba(39,174,96,0.2);
  --warning-light: rgba(243,156,18,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --badge-green-bg: rgba(39,174,96,0.2);
  --badge-green-text: #6ee7b7;
  --badge-amber-bg: rgba(243,156,18,0.2);
  --badge-amber-border: rgba(243,156,18,0.4);
  --badge-amber-text: #fbbf24;
  --badge-red-bg: rgba(192,57,43,0.2);
  --badge-red-text: #f87171;
  --badge-blue-bg: rgba(52,152,219,0.2);
  --badge-blue-text: #60a5fa;
  --badge-gray-bg: rgba(150,150,150,0.15);
  --badge-gray-text: #9ca3af;
  --badge-purple-bg: rgba(155,89,182,0.2);
  --badge-purple-text: #c39bd3;
  --badge-teal-bg: rgba(23,165,137,0.2);
  --badge-teal-text: #48c9b0;
  --badge-edited-bg: rgba(243,156,18,0.18);
  --badge-edited-text: #fbbf24;
  --badge-edited-border: rgba(243,156,18,0.5);
  --alert-error-border: rgba(192,57,43,0.5);
  --alert-error-text: #f87171;
  --alert-success-border: rgba(39,174,96,0.5);
  --alert-success-text: #6ee7b7;
  --alert-warning-border: rgba(243,156,18,0.5);
  --alert-warning-text: #fbbf24;
  --alert-info-bg: rgba(52,152,219,0.15);
  --alert-info-border: rgba(52,152,219,0.4);
  --alert-info-text: #60a5fa;
  --audit-update-bg: rgba(243,156,18,0.15);
  --audit-update-text: #fbbf24;
  --audit-delete-bg: rgba(192,57,43,0.15);
  --audit-delete-text: #f87171;
  --clock-inactive-bg: rgba(255,255,255,0.08);
  --dp-weekend-color: #6b7c93;
  --dp-holiday-bg: rgba(240,165,0,0.15);
  --dp-range-bg: rgba(46,125,94,0.25);
  --dp-legend-border: #3a4048;
  --sched-cell-today: rgba(46,125,94,0.2);
  --sched-cell-hover: rgba(46,125,94,0.15);
  --sched-cell-holiday: rgba(192,57,43,0.2);
  --sched-cell-holiday-hover: rgba(192,57,43,0.3);
  --sched-month-other: rgba(255,255,255,0.02);
  --sched-month-holiday: rgba(192,57,43,0.2);
  --sched-month-holiday-text: #f87171;
  --update-banner-bg: linear-gradient(135deg, rgba(22,163,74,0.15), rgba(22,163,74,0.1));
  --update-banner-border: #16a34a;
  --update-banner-tag: #4ade80;
  --update-banner-date: #6ee7b7;
  --update-banner-title: #a7f3d0;
  --update-banner-body: #6ee7b7;
  /* Aliases overrides */
  --bg-card: var(--card-bg);
  --bg-primary: var(--bg);
  --bg-secondary: #161b27;
  --border-color: var(--border);
  --warning-bg: rgba(243,156,18,0.2);
  --warning-border: rgba(243,156,18,0.5);
  --info-bg: rgba(52,152,219,0.15);
  --info-border: rgba(52,152,219,0.4);
  --bg-highlight: rgba(96,165,250,0.1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
}

input, select, textarea, button {
  font-family: var(--font);
  font-size: 1rem;
}

/* ============================================================
   Utilities
   ============================================================ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-gap { display: flex; gap: 0.75rem; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-logo {
  font-size: 1.4rem;
}
.nav-logo-img {
  height: 44px;
  width: auto;
}

.nav-title {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  padding-left: 1rem;
}

.nav-link {
  color: rgba(255,255,255,0.85);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
}

.nav-link.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-left: auto;
}

#navUserName {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: auto;
}

/* ============================================================
   Main Content Area
   ============================================================ */
#app {
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
  padding: 2rem 1.5rem;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  margin-top: calc(var(--nav-height) + 0px);
}

/* ============================================================
   Loading Screen
   ============================================================ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 1px solid var(--border);
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  padding: 0.5rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary);
  color: white;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,0.6);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: var(--error-dark);
  border-color: var(--error-dark);
  text-decoration: none;
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  background: var(--success-dark);
  text-decoration: none;
}

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius);
}

.btn-icon {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,125,94,0.12);
}

.form-control.error {
  border-color: var(--error);
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 0.3rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-group label {
  cursor: pointer;
  font-size: 0.9rem;
}

/* ============================================================
   Alert / Messages
   ============================================================ */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-error {
  background: var(--error-light);
  border: 1px solid var(--alert-error-border);
  color: var(--alert-error-text);
}

.alert-success {
  background: var(--success-light);
  border: 1px solid var(--alert-success-border);
  color: var(--alert-success-text);
}

.alert-warning {
  background: var(--warning-light);
  border: 1px solid var(--alert-warning-border);
  color: var(--alert-warning-text);
}

.alert-info {
  background: var(--alert-info-bg);
  border: 1px solid var(--alert-info-border);
  color: var(--alert-info-text);
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.forecast-table-scroll {
  max-height: 65vh;
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.forecast-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-header-bg);
  box-shadow: inset 0 -2px 0 var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--table-header-bg);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--table-row-hover);
}

tbody td {
  padding: 0.75rem 1rem;
  color: var(--text);
  vertical-align: middle;
}

tfoot tr {
  background: var(--table-footer-bg);
  border-top: 2px solid var(--border);
}

tfoot td {
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text);
}

.table-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* ============================================================
   Status Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green, .badge-approved, .badge-active {
  background: var(--badge-green-bg);
  color: var(--badge-green-text);
}

.badge-amber, .badge-pending {
  background: var(--badge-amber-bg);
  color: var(--badge-amber-text);
  border: 1px solid var(--badge-amber-border);
}

.badge-red, .badge-rejected, .badge-inactive {
  background: var(--badge-red-bg);
  color: var(--badge-red-text);
}

.badge-blue {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
}

.badge-gray {
  background: var(--badge-gray-bg);
  color: var(--badge-gray-text);
}

.badge-purple {
  background: var(--badge-purple-bg);
  color: var(--badge-purple-text);
}

.badge-teal {
  background: var(--badge-teal-bg);
  color: var(--badge-teal-text);
}

.badge-edited {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--badge-edited-bg);
  color: var(--badge-edited-text);
  border: 1px solid var(--badge-edited-border);
  vertical-align: middle;
  margin-left: 0.3rem;
}

/* Audit history */
.audit-entry {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.audit-entry:last-child {
  border-bottom: none;
}
.audit-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}
.audit-action {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.audit-update {
  background: var(--audit-update-bg);
  color: var(--audit-update-text);
}
.audit-delete {
  background: var(--audit-delete-bg);
  color: var(--audit-delete-text);
}
.audit-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.audit-changes {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.875rem;
}
.audit-changes li {
  margin: 0.15rem 0;
}
.audit-old {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
}

.modal.modal-lg {
  max-width: 800px;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: color 0.1s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg);
}

.modal-body {
  padding: 1.5rem;
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-height));
  padding: 2rem 1rem;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.login-logo h1 {
  font-size: 1.5rem;
  color: var(--primary);
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============================================================
   Dashboard
   ============================================================ */
.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-size: 1.6rem;
  color: var(--text);
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
}

.stat-card.accent {
  border-left-color: var(--accent);
}

.stat-card.error {
  border-left-color: var(--error);
}

.stat-card.success {
  border-left-color: var(--success);
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Clock In/Out Button */
.clock-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.clock-section h2 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 1rem;
}

.clock-time {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.5rem;
}

.clock-date {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.clock-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
}

.clock-status.active {
  background: var(--success-light);
  color: var(--success);
}

.clock-status.inactive {
  background: var(--clock-inactive-bg);
  color: var(--text-secondary);
}

.clock-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.clock-status.active .dot {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.btn-clock {
  font-size: 1.1rem;
  padding: 0.85rem 2.5rem;
  border-radius: var(--radius);
  font-weight: 700;
}

.btn-clock-in {
  background: var(--primary);
  color: white;
  border: 2px solid var(--primary);
}

.btn-clock-in:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
  text-decoration: none;
}

.btn-clock-out {
  background: var(--error);
  color: white;
  border: 2px solid var(--error);
}

.btn-clock-out:hover:not(:disabled) {
  background: var(--error-dark);
  border-color: var(--error-dark);
  color: white;
  text-decoration: none;
}

.clock-duration {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 1rem;
}

/* ============================================================
   Time Page
   ============================================================ */
.month-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-selector .form-control {
  width: auto;
}

.hours-worked {
  font-weight: 700;
  color: var(--primary);
}

.hours-overtime-pos {
  color: var(--success);
  font-weight: 600;
}

.hours-overtime-neg {
  color: var(--error);
  font-weight: 600;
}

.entry-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.entry-form h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ============================================================
   Vacation Page
   ============================================================ */
.balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.balance-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.balance-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.balance-number.warning {
  color: var(--warning);
}

.balance-number.error {
  color: var(--error);
}

.balance-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-weight: 500;
}

/* ============================================================
   Users Page
   ============================================================ */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   Section Headers
   ============================================================ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ============================================================
   Desktop Nav Divider (Verwaltungsbereich)
   ============================================================ */
.nav-divider-before {
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(255,255,255,0.3);
}

/* ============================================================
   Bottom Navigation (Mobile)
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--primary);
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
  align-items: stretch;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.75);
  font-size: 0.65rem;
  font-weight: 500;
  gap: 2px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  transition: color 0.15s, background 0.15s;
  font-family: var(--font);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: white;
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

.bottom-nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 0.62rem;
}

/* More Modal */
.more-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
}

.more-modal-overlay.hidden { display: none; }

.more-modal {
  background: var(--card-bg);
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: 60px;
  max-height: 80vh;
  overflow-y: auto;
}

.more-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
}

.more-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
}

.more-modal-body {
  padding: 0.5rem 0;
}

.more-modal-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
}

.more-modal-item:hover { background: var(--bg); text-decoration: none; }
.more-modal-item.active { color: var(--primary); font-weight: 600; }
.more-modal-item-icon { font-size: 1.3rem; width: 1.8rem; text-align: center; }
.more-modal-divider {
  height: 1px;
  background: var(--border);
  margin: 0.4rem 1.25rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
    --bottom-nav-height: 60px;
  }

  .navbar {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    min-height: var(--nav-height);
  }

  .nav-toggle { display: none; }

  .nav-links { display: none !important; }

  .nav-user {
    margin-left: 0;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    justify-content: space-between;
  }

  .bottom-nav { display: flex; }

  #app {
    padding: 1rem;
    padding-bottom: calc(var(--bottom-nav-height) + 1rem);
    margin-top: var(--nav-height);
  }

  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .clock-time {
    font-size: 2rem;
  }

  .modal {
    max-height: 95vh;
  }

  .table-wrapper {
    font-size: 0.82rem;
  }

  thead th, tbody td, tfoot td {
    padding: 0.6rem 0.75rem;
  }

  .balance-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .balance-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .table-actions {
    flex-direction: column;
  }
}

/* ============================================================
   Custom DatePicker
   ============================================================ */

.dp-trigger {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  min-height: 38px;
}

.dp-trigger.dp-placeholder {
  color: var(--text-secondary);
}

.dp-popup {
  display: none;
  position: absolute;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  width: 300px;
  z-index: 999;
  padding: 0.75rem;
}

.dp-popup.dp-open {
  display: block;
}

.dp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.dp-month-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.dp-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.dp-nav-btn:hover {
  background: var(--bg);
  color: var(--text);
}

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

.dp-header-cell {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}

.dp-header-cell.dp-weekend {
  color: var(--dp-weekend-color);
}

.dp-cell {
  position: relative;
  text-align: center;
  padding: 5px 2px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  min-height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.dp-cell:not(.dp-empty):hover {
  background: var(--bg);
}

.dp-cell.dp-empty {
  cursor: default;
}

.dp-day-num {
  line-height: 1;
}

.dp-cell.dp-weekend .dp-day-num {
  color: var(--dp-weekend-color);
}

.dp-cell.dp-holiday {
  background: var(--dp-holiday-bg);
}

.dp-cell.dp-holiday .dp-day-num {
  color: var(--accent-dark);
  font-weight: 600;
}

.dp-holiday-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 2px;
  display: block;
}

.dp-cell.dp-today .dp-day-num {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dp-cell.dp-selected,
.dp-cell.dp-range-start,
.dp-cell.dp-range-end {
  background: var(--primary) !important;
  border-radius: 4px;
}

.dp-cell.dp-selected .dp-day-num,
.dp-cell.dp-range-start .dp-day-num,
.dp-cell.dp-range-end .dp-day-num {
  color: #fff !important;
  font-weight: 600;
}

.dp-cell.dp-selected .dp-holiday-dot,
.dp-cell.dp-range-start .dp-holiday-dot,
.dp-cell.dp-range-end .dp-holiday-dot {
  background: rgba(255,255,255,0.7);
}

.dp-cell.dp-in-range {
  background: var(--dp-range-bg);
  border-radius: 0;
}

.dp-cell.dp-in-range .dp-day-num {
  color: var(--primary-dark);
}

.dp-cell.dp-range-start {
  border-radius: 4px 0 0 4px;
}

.dp-cell.dp-range-end {
  border-radius: 0 4px 4px 0;
}

.dp-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dp-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.dp-legend-holiday {
  background: var(--dp-holiday-bg);
  border: 1px solid var(--accent);
}

.dp-legend-weekend {
  background: var(--bg);
  border: 1px solid var(--dp-legend-border);
}

/* ============================================================
   Print styles
   ============================================================ */
@media print {
  .navbar, .btn, .form-actions, .table-actions {
    display: none !important;
  }

  #app {
    margin-top: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ============================================================
   Dienstplan / Schedule
   ============================================================ */
.schedule-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.86rem;
  table-layout: fixed;
}
.schedule-table th {
  background: var(--primary);
  color: white;
  padding: 0.5rem 0.5rem;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}
.schedule-table th.col-employee {
  text-align: left;
  width: 100px;
  position: sticky;
  left: 0;
  z-index: 3;
}
.schedule-table td {
  border: 1px solid var(--border);
  padding: 0.3rem;
  vertical-align: top;
  min-width: 120px;
  min-height: 54px;
}
.schedule-table td.cell-employee {
  background: var(--card-bg);
  font-weight: 500;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 2px solid var(--border);
  overflow: hidden;
  width: 100px;
  max-width: 100px;
}
.schedule-table td.cell-day {
  cursor: pointer;
  transition: background 0.1s;
}
.schedule-table td.cell-day:hover {
  background: var(--sched-cell-hover);
}
.schedule-table td.cell-conflict {
  background: var(--error-light);
}
.schedule-table td.cell-today {
  background: var(--sched-cell-today);
}
.shift-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}
.shift-chip.substitute {
  background: var(--accent);
}
.shift-chip-time { flex: 1; }
.shift-chip-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  padding: 0 0.1rem;
  font-size: 0.75rem;
  line-height: 1;
}
.shift-chip-btn:hover { color: white; }
.shift-actual {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.conflict-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--error);
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.week-nav-label {
  font-weight: 600;
  min-width: 200px;
  text-align: center;
  font-size: 0.95rem;
}
.schedule-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.schedule-status.draft { background: var(--warning-light); color: var(--warning); }
.schedule-status.published { background: var(--success-light); color: var(--success); }

/* Shift editor panel */
.shift-editor {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-md);
}

/* Month view */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.82rem;
}
.month-day-header {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 0.4rem;
  font-weight: 600;
}
.month-day {
  background: var(--card-bg);
  border: 1px solid var(--border);
  min-height: 70px;
  padding: 0.3rem;
  cursor: pointer;
  transition: background 0.1s;
}
.month-day:hover { background: var(--sched-cell-hover); }
.month-day.other-month { background: var(--sched-month-other); color: var(--text-secondary); }
.month-day.today { border-color: var(--primary); }
.month-day.month-day-holiday { background: var(--sched-month-holiday); }
.month-holiday-label { font-size: 0.68rem; color: var(--sched-month-holiday-text); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-day-num { font-weight: 600; font-size: 0.8rem; color: var(--text-secondary); }
.month-shift-dot {
  font-size: 0.72rem;
  background: var(--primary-light);
  color: white;
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media print {
  .no-print { display: none !important; }
  nav, #navLinks, .page-header p { display: none !important; }
  .schedule-table { font-size: 0.75rem; }
  .shift-chip { background: #555 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .schedule-table th { background: #555 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 768px) {
  .schedule-table { font-size: 0.76rem; }
  .schedule-table td { min-width: 80px; }
}
.schedule-table td.cell-holiday {
  background: var(--sched-cell-holiday);
  cursor: not-allowed;
}
.schedule-table td.cell-holiday:hover {
  background: var(--sched-cell-holiday-hover);
}

/* Schedule timeline bars */
.schedule-table {
  width: 100%;
  table-layout: fixed;
}
.schedule-table td.cell-day {
  padding: 0.3rem 0.3rem 0.4rem;
}
/* Update Banner */
.update-banner {
  background: var(--update-banner-bg);
  border: 1px solid var(--update-banner-border);
  border-left: 4px solid var(--update-banner-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.update-banner-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.update-banner-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--update-banner-tag);
}
.update-banner-date {
  font-size: 0.8rem;
  color: var(--update-banner-date);
}
.update-banner-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--update-banner-title);
}
.update-banner-body {
  font-size: 0.9rem;
  color: var(--update-banner-body);
  line-height: 1.5;
}
.reply-banner {
  background: var(--update-banner-bg);
  border-color: var(--update-banner-border);
  border-left-color: var(--update-banner-border);
}
.reply-banner .update-banner-tag { color: var(--update-banner-tag); }
.reply-banner .update-banner-date { color: var(--update-banner-date); }
.reply-banner .update-banner-title { color: var(--update-banner-title); }
.reply-banner .update-banner-body { color: var(--update-banner-body); }

.shift-timeline {
  position: relative;
  height: 28px;
  margin-top: 2px;
}
.shift-bar {
  position: absolute;
  height: 22px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  top: 0;
  transition: filter 0.1s;
  min-width: 4px;
}
.shift-bar:hover {
  filter: brightness(1.1);
  min-width: 64px;
  overflow: visible;
  z-index: 5;
}
.shift-bar.substitute { background: var(--accent); }
.shift-bar.shift-bar-overtime { background: #b45309; }
.shift-bar-label {
  color: white;
  font-size: 0.72rem;
  padding: 0 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  line-height: 1;
}
.shift-bar-actions {
  display: none;
  gap: 2px;
  padding-right: 3px;
  flex-shrink: 0;
}
.shift-bar:hover .shift-bar-actions { display: flex; }
.shift-bar-actions button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0 1px;
  line-height: 1;
}
.shift-bar-actions button:hover { color: white; }
.shift-bar-note-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
  flex-shrink: 0;
  pointer-events: none;
}
.shift-bar:hover .shift-bar-note-dot { display: none; }
.shift-actual-bar {
  position: absolute;
  height: 4px;
  bottom: 0;
  background: var(--text-secondary);
  border-radius: 2px;
  opacity: 0.5;
}

.se-user-opt:hover { background: var(--primary-light, rgba(46,125,94,0.1)); }

/* ============================================================
   Dark Mode Toggle
   ============================================================ */
.theme-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.15);
}

.more-modal-item.theme-item {
  justify-content: space-between;
}

/* Dark mode: inputs show correct text color */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color-scheme: dark;
}
