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

:root {
  --primary: #2563EB;
  --primary-light: #DBEAFE;
  --success: #16A34A;
  --warning: #F59E0B;
  --error: #DC2626;
  --extern: #7C3AED;
  --extern-light: #EDE9FE;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-sec: #64748B;
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Login Page ──────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #1D4ED8 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 16px; }

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-icon { font-size: 48px; margin-bottom: 8px; }
.login-header h1 { font-size: 24px; color: var(--text); }
.login-header p { color: var(--text-sec); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; color: var(--text-sec); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: 14px; font-family: var(--font);
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.error-msg { color: var(--error); font-size: 13px; padding: 8px 0; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1D4ED8; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803D; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #CBD5E1; }
.btn-extern { background: var(--extern); color: #fff; }
.btn-extern:hover { background: #6D28D9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 16px; }
.btn-icon { padding: 6px 8px; background: none; border: 1px solid var(--border); border-radius: var(--radius-xs); }
.btn-icon:hover { background: var(--primary-light); }

/* ─── App Layout ──────────────────────────────────────────────────────────── */
.app-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.app-header h1 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.app-header .user-info { display: flex; align-items: center; gap: 12px; }
.app-header .user-name { color: var(--text-sec); font-size: 13px; }

.app-tabs {
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; gap: 0; overflow-x: auto; padding: 0 24px;
}
.app-tabs .tab {
  padding: 12px 20px; border: none; background: none;
  font-size: 14px; font-family: var(--font); color: var(--text-sec);
  cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all 0.2s;
}
.app-tabs .tab:hover { color: var(--primary); background: var(--primary-light); }
.app-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.app-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Tour Grid ───────────────────────────────────────────────────────────── */
.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.tour-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  cursor: pointer; transition: all 0.2s;
  box-shadow: var(--shadow);
}
.tour-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,0.15); }
.tour-card.external { border-left: 4px solid var(--extern); }
.tour-card.external:hover { border-color: var(--extern); box-shadow: 0 2px 8px rgba(124,58,237,0.15); }

.tour-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.tour-card-header h3 { font-size: 16px; }
.tour-card-header .badges { display: flex; gap: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
}
.badge-sick { background: #FEE2E2; color: var(--error); }
.badge-extern { background: var(--extern-light); color: var(--extern); }
.badge-full { background: #FEF3C7; color: #92400E; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-approved { background: #D1FAE5; color: #065F46; }

.tour-card-meta { color: var(--text-sec); font-size: 13px; margin-bottom: 12px; }
.tour-card-meta span { display: block; }

.capacity-bar { background: #E2E8F0; border-radius: 4px; height: 8px; overflow: hidden; margin-top: 8px; }
.capacity-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.capacity-bar-fill.green { background: var(--success); }
.capacity-bar-fill.orange { background: var(--warning); }
.capacity-bar-fill.red { background: var(--error); }

.capacity-text { font-size: 13px; color: var(--text-sec); margin-top: 4px; display: flex; justify-content: space-between; }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 800px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--card); z-index: 10;
}
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-sec); padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Tour Detail ─────────────────────────────────────────────────────────── */
.tour-detail-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 24px;
}
.tour-detail-info .form-group { margin-bottom: 0; }

.stop-list { list-style: none; margin-bottom: 24px; }
.stop-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  margin-bottom: 8px; background: var(--card);
}
.stop-item.sortable-ghost { opacity: 0.4; background: var(--primary-light); }
.stop-item .drag-handle { cursor: grab; color: var(--text-sec); font-size: 16px; padding: 4px; user-select: none; }
.stop-item .stop-time { font-weight: 700; font-size: 16px; color: var(--primary); min-width: 50px; }
.stop-item .stop-info { flex: 1; }
.stop-item .stop-name { font-weight: 600; font-size: 14px; }
.stop-item .stop-notes { font-size: 12px; color: var(--text-sec); font-style: italic; }

.student-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; margin: 4px 4px 0 0;
  border-radius: 16px; font-size: 12px;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid transparent;
}
.student-chip.sick { background: #FEE2E2; color: var(--error); border-color: #FECACA; text-decoration: line-through; }
.student-chip .phone-link { color: inherit; text-decoration: none; font-size: 14px; }
.student-chip .phone-link:hover { opacity: 0.7; }
.student-chip .sick-toggle { cursor: pointer; padding: 2px; background: none; border: none; font-size: 12px; }

/* ─── Waitlist Table ──────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 12px; font-weight: 600; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.5px; background: #F8FAFC; }
.data-table tr:hover { background: var(--primary-light); }
.data-table .external-badge { color: var(--extern); font-weight: 600; }

/* ─── Search & Filter ─────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: 14px; font-family: var(--font);
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); }
.search-input { min-width: 250px; }

/* ─── Sick Banner ─────────────────────────────────────────────────────────── */
.sick-banner {
  background: #FEF2F2; border: 1px solid #FECACA; border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--error);
}

/* ─── Map ─────────────────────────────────────────────────────────────────── */
.map-container { display: flex; gap: 16px; height: calc(100vh - 200px); }
.map-sidebar {
  width: 260px; flex-shrink: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; overflow-y: auto;
}
.map-sidebar h3 { font-size: 14px; margin-bottom: 12px; }
.map-sidebar label { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.map-sidebar .color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
#map { flex: 1; border-radius: var(--radius); border: 1px solid var(--border); min-height: 400px; }
.mini-map { height: 250px; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 16px; }

/* ─── Driver View ─────────────────────────────────────────────────────────── */
.driver-header {
  background: var(--primary); color: #fff; padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.driver-header h1 { font-size: 20px; font-weight: 700; }
.driver-header .btn { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.3); }

.driver-tabs {
  background: var(--card); border-bottom: 2px solid var(--border);
  display: flex; overflow-x: auto;
}
.driver-tab {
  flex: 1; padding: 12px 16px; border: none; background: none;
  font-size: 14px; font-family: var(--font); color: var(--text-sec);
  cursor: pointer; border-bottom: 3px solid transparent;
  white-space: nowrap; transition: all 0.2s; text-align: center;
}
.driver-tab:hover { color: var(--primary); background: var(--primary-light); }
.driver-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; background: var(--primary-light); }

.driver-tab-panel { display: none; }
.driver-tab-panel.active { display: block; }

.driver-content { padding: 16px; max-width: 600px; margin: 0 auto; }
.driver-loading { text-align: center; padding: 40px; color: var(--text-sec); }

.driver-tour-select {
  width: 100%; padding: 12px; font-size: 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px; font-family: var(--font);
}

.driver-tour-info {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.driver-tour-info h2 { font-size: 20px; margin-bottom: 4px; }
.driver-tour-info .meta { color: var(--text-sec); font-size: 14px; }

.driver-stop-card {
  background: var(--card); border-radius: var(--radius);
  margin-bottom: 12px; overflow: hidden;
  box-shadow: var(--shadow); border-left: 4px solid var(--primary);
}
.driver-stop-header { display: flex; padding: 12px 16px; gap: 16px; align-items: baseline; }
.driver-stop-time { font-size: 22px; font-weight: 700; color: var(--primary); min-width: 60px; }
.driver-stop-name { font-size: 16px; font-weight: 600; }
.driver-stop-notes { font-size: 12px; color: var(--text-sec); font-style: italic; }

.driver-student {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 16px;
}
.driver-student.sick { background: #FEF2F2; }
.driver-student .name { font-weight: 500; font-size: 18px; }
.driver-student .name.sick-name { color: var(--error); text-decoration: line-through; }
.driver-student .sick-badge { color: var(--error); font-weight: 700; font-size: 12px; margin-left: 8px; }
.driver-student .phone-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  text-decoration: none; font-size: 20px;
}
.driver-student .phone-btn:hover { background: var(--primary); color: #fff; }

/* ─── Driver Vehicle Card ─────────────────────────────────────────────────── */
.vehicle-info-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.vehicle-info-card .plate {
  font-size: 28px; font-weight: 800; letter-spacing: 2px;
  background: #FEF3C7; border: 2px solid #D97706;
  border-radius: var(--radius-sm); padding: 8px 16px;
  text-align: center; margin-bottom: 16px;
}
.vehicle-info-card .info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.vehicle-info-card .info-item { font-size: 14px; }
.vehicle-info-card .info-label { color: var(--text-sec); font-size: 12px; font-weight: 600; }

.driver-section {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.driver-section h3 { font-size: 16px; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }

.service-entry {
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.service-entry:last-child { border-bottom: none; }
.service-entry .service-date { color: var(--text-sec); font-size: 12px; }
.service-entry .service-type { font-weight: 600; }

/* ─── Driver Work Hours ───────────────────────────────────────────────────── */
.wh-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wh-form .full-width { grid-column: 1 / -1; }

.wh-entry {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.wh-entry:last-child { border-bottom: none; }
.wh-entry .wh-date { font-weight: 600; min-width: 90px; }
.wh-entry .wh-times { color: var(--text-sec); }
.wh-entry .wh-net { font-weight: 600; color: var(--primary); }
.wh-entry .wh-status { font-size: 11px; }

.wh-summary {
  background: var(--primary-light); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
  display: flex; justify-content: space-around; text-align: center;
}
.wh-summary .wh-stat { }
.wh-summary .wh-stat-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.wh-summary .wh-stat-label { font-size: 12px; color: var(--text-sec); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-content { padding: 12px; }
  .tour-grid { grid-template-columns: 1fr; }
  .tour-detail-info { grid-template-columns: 1fr; }
  .map-container { flex-direction: column; height: auto; }
  .map-sidebar { width: 100%; }
  #map { min-height: 300px; }
  .app-tabs { padding: 0 8px; }
  .app-tabs .tab { padding: 10px 12px; font-size: 13px; }
  .modal { max-height: 95vh; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px; }
  .wh-form { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .toolbar { flex-direction: column; }
  .search-input { min-width: 100%; width: 100%; }
  .app-header { padding: 12px 16px; }
  .app-header h1 { font-size: 16px; }
  .driver-tab { font-size: 12px; padding: 10px 8px; }
}

/* ─── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .app-header, .app-tabs, .toolbar, .btn, .modal-overlay, .driver-header, .driver-tabs { display: none !important; }
  .app-content { padding: 0; }
  .tour-card { break-inside: avoid; }
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* ─── Vehicle badges ──────────────────────────────────────────────────────── */
.vehicle-type { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.vehicle-type-schulbus { background: var(--primary-light); color: var(--primary); }
.vehicle-type-tesla { background: #D1FAE5; color: #065F46; }
.vehicle-type-handwerkerauto { background: #FEF3C7; color: #92400E; }
.vehicle-type-anhaenger { background: #F1F5F9; color: #475569; }
.vehicle-type-landrover { background: #FDE8CD; color: #78350F; }
.vehicle-type-sonstige { background: #F1F5F9; color: #475569; }

.tuev-ok { color: var(--success); }
.tuev-warning { color: var(--warning); font-weight: 600; }
.tuev-expired { color: var(--error); font-weight: 700; }

.warning-banner {
  background: #FEF3C7; border: 1px solid #FDE68A; border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: #92400E;
}

.filter-buttons { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-buttons .filter-active { background: var(--primary); color: #fff; }

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { background: #E2E8F0; }
.data-table th .sort-arrow { font-size: 10px; margin-left: 4px; }

/* ─── Map missing stops banner ────────────────────────────────────────────── */
.map-missing-banner {
  background: #FEF3C7; border: 1px solid #FDE68A; border-radius: var(--radius);
  padding: 8px 12px; margin-bottom: 8px; font-size: 12px; color: #92400E;
}
.map-missing-list { font-size: 12px; color: var(--text-sec); margin-top: 8px; }
.map-missing-list div { padding: 2px 0; }

/* Sortable drag styles */
.sortable-chosen { opacity: 0.8; }
.sortable-drag { opacity: 0.9; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }

/* ─── Work Hours Admin Table ──────────────────────────────────────────────── */
.wh-admin-row.pending td { background: #FFFBEB; }
.wh-admin-row.approved td { background: #F0FDF4; }

.no-vehicle-message {
  text-align: center; padding: 60px 20px; color: var(--text-sec);
}
.no-vehicle-message .icon { font-size: 48px; margin-bottom: 16px; }

/* ─── Toggle Switch ──────────────────────────────────────────────────────── */
.toggle-group {
  display: flex; border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.toggle-group .toggle-option {
  flex: 1; padding: 10px 16px; text-align: center;
  cursor: pointer; font-size: 14px; font-weight: 500;
  background: var(--card); border: none; font-family: var(--font);
  transition: all 0.2s;
}
.toggle-group .toggle-option.active {
  background: var(--primary); color: #fff;
}
.toggle-group .toggle-option.active-extern {
  background: var(--extern); color: #fff;
}

/* ─── Status Badges ──────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.status-dot.active { background-color: #16A34A; }
.status-dot.sick { background-color: #DC2626; }

.status-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 500;
}
.status-badge.active { background-color: #DCFCE7; color: #166534; }
.status-badge.sick { background-color: #FEE2E2; color: #991B1B; }

/* ─── Global Radio Card Pattern ──────────────────────────────────────────── */
.radio-card-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.radio-card {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.radio-card input[type="radio"] {
  display: none;
}
.radio-card-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid #E2E8F0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1E293B;
  transition: all 0.2s;
}
.radio-card-content:hover {
  border-color: #CBD5E1;
  background-color: #F8FAFC;
}
.radio-card input[type="radio"]:checked + .radio-card-content {
  border-color: var(--primary);
  background-color: #EFF6FF;
  color: var(--primary);
}
/* Color variants for status cards */
.radio-card input[type="radio"]:checked + .radio-card-content.rc-green {
  border-color: #16A34A;
  background-color: #F0FDF4;
  color: #16A34A;
}
.radio-card input[type="radio"]:checked + .radio-card-content.rc-red {
  border-color: #DC2626;
  background-color: #FEF2F2;
  color: #DC2626;
}
.radio-card-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.radio-card-dot.green { background-color: #16A34A; }
.radio-card-dot.red { background-color: #DC2626; }

/* ─── Global Checkbox Option Pattern ─────────────────────────────────────── */
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}
.checkbox-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-label {
  font-size: 14px;
  color: #1E293B;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ─── Waitlist Sort Icons ────────────────────────────────────────────────── */
.sort-icon { font-size: 11px; margin-left: 4px; opacity: 0.7; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { background: #E2E8F0; }

/* ─── Sick Reports ───────────────────────────────────────────────────────── */
.sick-report-today { background: #FEE2E2; }
.sick-report-future { background: #FEF3C7; }
.quick-btn { padding: 6px 12px; font-size: 12px; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--card); font-family: var(--font); }
.quick-btn:hover { background: var(--primary-light); }

/* ─── Email Notification ─────────────────────────────────────────────────── */
.recipient-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-xs); }
.recipient-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.recipient-item:last-child { border-bottom: none; }
.recipient-item.no-email { background: #FEF3C7; color: #92400E; }

/* ─── Dashboard ──────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.stat-card .stat-icon { font-size: 24px; margin-bottom: 4px; }
.stat-card .stat-number { font-size: 32px; font-weight: 700; color: #1E293B; }
.stat-card .stat-label { font-size: 13px; color: #64748B; margin-top: 2px; }
.stat-card.sick .stat-number { color: #DC2626; }
.stat-card.tours .stat-number { color: #2563EB; }
.stat-card.students .stat-number { color: #16A34A; }
.stat-card.waitlist .stat-number { color: #F59E0B; }

.dashboard-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.dashboard-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #E2E8F0;
}

.warning-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  font-size: 13px;
}
.warning-item:last-child { border-bottom: none; }
.warning-item.high { color: #DC2626; }
.warning-item.medium { color: #D97706; }
.warning-item.low { color: #64748B; }
.warning-item:hover { background: #F8FAFC; border-radius: 4px; }

.occupancy-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.occupancy-bar .occ-name { min-width: 100px; font-size: 13px; font-weight: 500; }
.occupancy-bar-track {
  flex: 1;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}
.occupancy-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.occupancy-bar-fill.green { background: #16A34A; }
.occupancy-bar-fill.orange { background: #F59E0B; }
.occupancy-bar-fill.red { background: #DC2626; }
.occupancy-bar .occ-label { min-width: 50px; font-size: 12px; color: var(--text-sec); text-align: right; }

.dashboard-date {
  font-size: 14px;
  color: var(--text-sec);
  margin-bottom: 4px;
}

.sick-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
  cursor: pointer;
}
.sick-list-item:last-child { border-bottom: none; }
.sick-list-item:hover { background: #FEF2F2; border-radius: 4px; }

.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-item .activity-time { color: var(--text-sec); font-size: 11px; }

.forecast-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
}
.forecast-item:last-child { border-bottom: none; }
.forecast-item .forecast-count { font-weight: 600; }
.forecast-item .forecast-count.warn { color: #DC2626; }

.substitution-item {
  padding: 10px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
}
.substitution-item:last-child { border-bottom: none; }
.substitution-item .sub-tour { font-weight: 600; }
.substitution-item .sub-driver { color: var(--text-sec); }
.substitution-item .sub-status { font-size: 11px; padding: 2px 6px; border-radius: 8px; }
.substitution-item .sub-status.open { background: #FEF3C7; color: #92400E; }
.substitution-item .sub-status.assigned { background: #D1FAE5; color: #065F46; }

.dashboard-link {
  display: block;
  text-align: right;
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
}
.dashboard-link:hover { text-decoration: underline; }

/* ─── Substitution Banner (Driver) ───────────────────────────────────────── */
.substitution-banner {
  background: #FFF7ED;
  border: 2px solid #F59E0B;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.substitution-banner .sub-icon { font-size: 24px; }
.substitution-banner .sub-title { font-weight: 700; color: #92400E; }
.substitution-banner .sub-detail { color: #B45309; }

/* ─── Substitution Modal ─────────────────────────────────────────────────── */
.available-driver-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.available-driver-card.busy { background: #FEF3C7; border-color: #FDE68A; }
.available-driver-card .driver-info { flex: 1; }
.available-driver-card .driver-name { font-weight: 600; font-size: 14px; }
.available-driver-card .driver-tours { font-size: 12px; color: var(--text-sec); }
.available-driver-card .driver-conflict { font-size: 12px; color: #D97706; }

/* ─── Absence Reporting (Driver) ─────────────────────────────────────────── */
.btn-absent {
  padding: 4px 10px;
  font-size: 12px;
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-absent:hover { background: #FEE2E2; border-color: #F87171; }

.driver-student.absent { background-color: #F1F5F9; opacity: 0.7; }
.driver-student.absent .name { text-decoration: line-through; color: #94A3B8; }
.driver-student.absent .btn-absent { display: none; }
.driver-student.absent .sick-badge { display: none; }

.absent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  font-size: 12px;
  color: #64748B;
}

/* ─── Absence Confirm Modal (Driver) ─────────────────────────────────────── */
.absence-confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 16px;
}
.absence-confirm-dialog {
  background: white;
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}
.absence-confirm-dialog .dialog-header {
  padding: 20px 24px 12px;
  font-size: 16px;
  font-weight: 700;
}
.absence-confirm-dialog .dialog-body {
  padding: 0 24px 16px;
  font-size: 14px;
  color: var(--text-sec);
  line-height: 1.5;
}
.absence-confirm-dialog .dialog-body input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 8px;
  font-size: 14px;
  font-family: var(--font);
}
.absence-confirm-dialog .dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
}

/* Activity Log (Protokoll Tab) */
.activity-log-entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.activity-log-entry .al-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sec);
  margin-bottom: 4px;
}
.activity-log-entry .al-action {
  font-weight: 600;
  font-size: 14px;
}
.activity-log-entry .al-details {
  font-size: 13px;
  color: var(--text-sec);
  margin-top: 2px;
}

/* Substitution delete button */
.sub-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.6;
}
.sub-delete-btn:hover { opacity: 1; background: #FEE2E2; }

/* Year Calendar Grid */
.year-cal { overflow-x: auto; margin-bottom: 12px; }
.year-cal-header, .year-cal-row { display: flex; gap: 0; }
.year-cal-month-label { width: 36px; min-width: 36px; font-size: 11px; font-weight: 600; padding: 2px 4px; display: flex; align-items: center; }
.year-cal-day-header { width: 22px; min-width: 22px; text-align: center; font-size: 10px; font-weight: 600; color: var(--text-sec); padding: 2px 0; }
.year-cal-cell { width: 22px; min-width: 22px; height: 20px; text-align: center; font-size: 10px; line-height: 20px; border: 1px solid transparent; cursor: default; }
.year-cal-cell.empty { background: none; }
.year-cal-cell.cal-weekend { background: #F1F5F9; }
.year-cal-cell.cal-school-holiday { background: #DCFCE7; }
.year-cal-cell.cal-public-holiday { background: #16A34A; color: white; font-weight: 600; }
.year-cal-cell.cal-bridge-day { background: #BBF7D0; }
.year-cal-cell.cal-vac-approved { background: #DBEAFE !important; }
.year-cal-cell.cal-vac-pending { background: #FEF9C3 !important; }
.year-cal-cell.cal-today { border: 2px solid #2563EB; border-radius: 3px; }
.year-cal-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-sec); margin-top: 8px; }
.cal-legend-item { display: flex; align-items: center; gap: 4px; }
.cal-dot { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.cal-dot.cal-weekend { background: #F1F5F9; border: 1px solid var(--border); }
.cal-dot.cal-school-holiday { background: #DCFCE7; border: 1px solid #BBF7D0; }
.cal-dot.cal-public-holiday { background: #16A34A; }
.cal-dot.cal-bridge-day { background: #BBF7D0; border: 1px solid #86EFAC; }
.cal-dot.cal-vac-approved { background: #DBEAFE; border: 1px solid #93C5FD; }
.cal-dot.cal-vac-pending { background: #FEF9C3; border: 1px solid #FDE68A; }

/* Holiday list items */
.holiday-list-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 6px; background: var(--card);
}

/* Vacation request cards */
.vacation-request-card {
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; background: var(--card);
}
