/* =============================================================================
   Tontechnik FECG Tostedt — Einsatzplanung Styles
   ============================================================================= */

:root {
    --primary: #1F4E79;
    --primary-light: #4472C4;
    --primary-lighter: #D6E4F0;
    --primary-bg: #EBF2FA;
    --accent: #ED7D31;
    --accent-light: #FFF3E8;
    --green: #28a745;
    --green-light: #E2EFDA;
    --red: #dc3545;
    --red-light: #FDEAEA;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --transition: 0.2s ease;
}

/* =============================================================================
   DARK MODE
   ============================================================================= */
[data-theme="dark"] {
    --primary: #2563EB;
    --primary-light: #60A5FA;
    --primary-lighter: #1e3a5f;
    --primary-bg: #1e293b;
    --accent: #F59E0B;
    --accent-light: #2d2007;
    --green: #34D399;
    --green-light: #0d2818;
    --red: #F87171;
    --red-light: #2d0e0e;
    --gray-50: #0F172A;
    --gray-100: #1E293B;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748B;
    --gray-500: #94A3B8;
    --gray-600: #CBD5E1;
    --gray-700: #E2E8F0;
    --gray-800: #F1F5F9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5), 0 4px 6px rgba(0,0,0,0.3);
}

[data-theme="dark"] body { background: #0F172A; color: #E2E8F0; }

[data-theme="dark"] .summary-card__sub  { color: #64748B; }
[data-theme="dark"] .summary-card__main { color: #E2E8F0; }
[data-theme="dark"] .summary-card__icon { background: rgba(255,255,255,0.07); }
[data-theme="dark"] .summary-card--highlight.accent .summary-card__icon { background: rgba(255,107,53,0.18); }
[data-theme="dark"] .summary-card--highlight.green  .summary-card__icon { background: rgba(40,167,69,0.18); }

[data-theme="dark"] .card,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .termin-card,
[data-theme="dark"] .termin-card-modern,
[data-theme="dark"] .vorschlag-card,
[data-theme="dark"] .vs-card,
[data-theme="dark"] .mb-next-card,
[data-theme="dark"] .mb-stat-card,
[data-theme="dark"] .aw-item,
[data-theme="dark"] .aw-muster-item,
[data-theme="dark"] .filter-card { background: #1E293B; border-color: #334155; }

[data-theme="dark"] .form-control,
[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-bar input,
[data-theme="dark"] .jahr-select {
    background: #0F172A;
    border-color: #334155;
    color: #E2E8F0;
}

[data-theme="dark"] .btn-outline {
    background: #1E293B;
    border-color: #475569;
    color: #CBD5E1;
}

[data-theme="dark"] .btn-outline:hover { background: #334155; }

[data-theme="dark"] tbody tr:nth-child(even) { background: #1a2437; }
[data-theme="dark"] tbody tr:hover { background: #1e3a5f; }
[data-theme="dark"] tbody td { border-color: #334155; }

[data-theme="dark"] .rolle-box { background: #1a2437; border-color: #334155; }
[data-theme="dark"] .vorschlag-item { background: #2d2007; }
[data-theme="dark"] .doppel-slot { border-color: #334155; }

[data-theme="dark"] .monat-pill { background: #1E293B; color: #CBD5E1; }
[data-theme="dark"] .vs-pill { background: #1E293B; color: #CBD5E1; }

[data-theme="dark"] .vs-stat { background: #0F172A; }
[data-theme="dark"] .vs-overview .vs-ov-bar-wrap { background: #334155; }
[data-theme="dark"] .ranking-bar { background: #334155; }
[data-theme="dark"] .mb-rolle-bar-wrap { background: #334155; }
[data-theme="dark"] .progress-bar { background: #334155; }

[data-theme="dark"] .flash-success { background: #0d2818; color: #86efac; }
[data-theme="dark"] .flash-error { background: #2d0e0e; color: #fca5a5; }

[data-theme="dark"] .mb-absent-none { background: #1E293B; border-color: #334155; }
[data-theme="dark"] .mb-absent-upcoming { background: #2a1f00; border-color: #78350f; }
[data-theme="dark"] .mb-absent-active { background: #2d0e0e; border-color: #7f1d1d; }
[data-theme="dark"] .mb-absent-title { color: #E2E8F0; }

[data-theme="dark"] .aw-wt-btn { background: #0F172A; border-color: #475569; color: #CBD5E1; }
[data-theme="dark"] .termin-leer { color: #64748B; }
[data-theme="dark"] .termin-actions-row { border-color: #334155; }
[data-theme="dark"] .mb-up-row { border-color: #1E293B; }
[data-theme="dark"] .card-header { border-color: #334155; }
[data-theme="dark"] .sidebar { background: #0F172A; }
[data-theme="dark"] .sidebar-header { border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .sidebar-footer { border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .mobile-theme-toggle { background: #334155; color: #F59E0B; }

/* =============================================================================
   END DARK MODE
   ============================================================================= */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-header .logo {
    font-size: 32px;
    margin-bottom: 4px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header .subtitle {
    font-size: 12px;
    opacity: 0.7;
    display: block;
    margin-top: 2px;
}

.nav-links {
    list-style: none;
    padding: 12px 0;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-links li a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-links li.active a {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--accent);
}

.nav-links .icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 8px 0 8px;
    display: flex;
    flex-direction: column;
}

.sidebar-footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-footer-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-footer-label {
    flex: 1;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 24px;
    border: none;
    background: none;
    color: rgba(255,100,100,0.8);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin-top: 2px;
}

.sidebar-logout-btn:hover {
    background: rgba(255,80,80,0.15);
    color: rgba(255,120,120,1);
}

/* Nur auf Mobile sichtbar */
.nav-mobile-only {
    display: none !important;
}

.mobile-theme-toggle {
    display: none;
}

/* Content */
.content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    flex: 1;
    min-height: 100vh;
}

/* Desktop: Inhalt nicht über die volle Breite strecken */
.content-inner {
    max-width: 900px;
    margin: 0 auto;
}

/* Breitere Seiten (Statistiken mit vielen Spalten) */
.content-inner.content-wide {
    max-width: 1100px;
}

/* Flash Messages — Toast Style */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    width: calc(100vw - 40px);
    pointer-events: none;
}

.flash {
    position: relative;
    padding: 14px 44px 18px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
    max-height: 200px;
    border-left: 4px solid transparent;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.flash-text {
    display: block;
    line-height: 1.4;
}

.flash-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    padding: 2px 5px;
    border-radius: 4px;
    transition: opacity 0.2s;
    font-family: inherit;
}
.flash-close:hover { opacity: 1; }

.flash-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    border-radius: 0 0 var(--radius) var(--radius);
    transition: width 5s linear;
}

.flash-success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: var(--green);
}
.flash-success .flash-progress { background: var(--green); }
.flash-success .flash-close { color: #166534; }

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: var(--red);
}
.flash-error .flash-progress { background: var(--red); }
.flash-error .flash-close { color: #991b1b; }

@media (max-width: 768px) {
    .flash-messages {
        top: auto;
        bottom: 80px;
        right: 12px;
        left: 12px;
        max-width: none;
        width: auto;
    }
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.page-header .actions {
    display: flex;
    gap: 8px;
}

/* Modus-Toggle (Statistiken / Fairness) */
.modus-toggle {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.modus-toggle:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.modus-toggle.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.modus-toggle.active:hover {
    background: var(--primary-dark, var(--primary));
    border-color: var(--primary-dark, var(--primary));
    color: white;
}

.modus-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    font-size: 13px;
    cursor: pointer;
}

.modus-hinweis {
    background: var(--primary-bg, #EEF2FF);
    border: 1px solid var(--primary-light, #C7D2FE);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
    margin: -16px 0 20px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
}

/* Summary Cards Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.summary-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
    transition: all var(--transition);
    border-top: 3px solid var(--primary-light);
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-card .number {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.summary-card .label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 4px;
}

.summary-card.accent { border-top-color: var(--accent); }
.summary-card.accent .number { color: var(--accent); }
.summary-card.green { border-top-color: var(--green); }
.summary-card.green .number { color: var(--green); }

/* Moderne Kachel-Variante */
.summary-card--highlight {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    text-align: left;
    padding: 20px;
    border-top: none;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.summary-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 22px;
    line-height: 1;
    margin-bottom: 16px;
    background: var(--primary-bg);
}

.summary-card--highlight.accent .summary-card__icon { background: rgba(255,107,53,0.12); }
.summary-card--highlight.green  .summary-card__icon { background: rgba(40,167,69,0.12); }

.summary-card__body {
    width: 100%;
    min-width: 0;
}

.summary-card__main {
    font-size: 17px;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}

.summary-card__sub {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 500;
    line-height: 1.4;
}

.summary-card--highlight.accent .summary-card__main { color: var(--gray-800); }
.summary-card--highlight.green  .summary-card__main { color: var(--gray-800); }

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background: var(--primary);
    color: white;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius) 0 0; }

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
}

tbody tr:hover { background: var(--primary-bg); }
tbody tr:nth-child(even) { background: var(--gray-50); }
tbody tr:nth-child(even):hover { background: var(--primary-bg); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-400); }
.font-bold { font-weight: 600; }

/* Totals Row */
tbody tr.totals-row {
    background: var(--green-light) !important;
    font-weight: 700;
}

tbody tr.totals-row td {
    border-top: 2px solid var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
}

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

.btn-accent {
    background: var(--accent);
    color: white;
}
.btn-accent:hover { background: #d96a1f; }

.btn-danger {
    background: var(--red);
    color: white;
}
.btn-danger:hover { background: #c82333; }

.btn-outline {
    background: white;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(68,114,196,0.15);
}

select.form-control {
    appearance: auto;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Rolle Boxes */
.rolle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.rolle-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
}

.rolle-box h3 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fd-select-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.fd-select-row select {
    flex: 1;
}

.btn-entfernen {
    width: 32px;
    height: 32px;
    border: 1px solid var(--red);
    background: var(--red-light);
    color: var(--red);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-family: inherit;
    padding: 0;
}

.btn-entfernen:hover {
    background: var(--red);
    color: white;
}

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

.doppel-toggle {
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    background: none;
    border: 1px dashed var(--primary-lighter);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
}

.doppel-toggle:hover {
    background: var(--primary-bg);
    border-color: var(--primary-light);
}

.doppel-slot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--gray-200);
}

.doppel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.doppel-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
}

.doppel-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    font-family: inherit;
}

.doppel-remove:hover {
    color: var(--red, #E53E3E);
}

.rolle-box .vorschlag-list {
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-500);
}

.vorschlag-hint {
    font-style: italic;
    color: var(--gray-400);
}

.vorschlag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin: 2px;
    cursor: pointer;
    transition: all var(--transition);
}

.vorschlag-item small {
    font-weight: 500;
    opacity: 0.8;
}

.vorschlag-rang {
    font-weight: 800;
    margin-right: 1px;
}

.vorschlag-top {
    background: var(--accent);
    color: white;
    box-shadow: 0 1px 4px rgba(237,125,49,0.3);
}

.vorschlag-top small {
    opacity: 0.9;
}

.vorschlag-item:hover {
    background: var(--accent);
    color: white;
}

.vorschlag-absent {
    background: var(--gray-100);
    color: var(--gray-400);
    border: 1px dashed var(--gray-300);
    opacity: 0.7;
}

.vorschlag-absent:hover {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-role {
    background: var(--primary-lighter);
    color: var(--primary);
}

.badge-eingesprungen {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-active {
    background: var(--green-light);
    color: var(--green);
}

.badge-inactive {
    background: var(--gray-200);
    color: var(--gray-500);
}

/* Termin Cards */
.termin-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 14px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
}

.termin-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.termin-datum {
    text-align: center;
    min-width: 60px;
    padding: 8px;
    background: var(--primary-bg);
    border-radius: 6px;
}

.termin-datum .tag {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.termin-datum .monat {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
}

.termin-info { flex: 1; }

.termin-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.termin-info .zeit {
    font-size: 13px;
    color: var(--gray-500);
}

.termin-team {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.termin-actions {
    display: flex;
    gap: 4px;
}

/* Vorschläge */
.vorschlag-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--primary-light);
}

.vorschlag-card .rank {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-light);
    min-width: 40px;
    text-align: center;
}

.vorschlag-card .info { flex: 1; }

.vorschlag-card .info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.vorschlag-card .meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.vorschlag-card:first-child {
    border-left-color: var(--accent);
    background: var(--accent-light);
}

.vorschlag-card:first-child .rank { color: var(--accent); }

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--primary-light);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
}

.filter-bar select,
.filter-bar input {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

/* Two Column Layout */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* Checkbox custom */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* =============================================================================
   RESPONSIVE — Tablet
   ============================================================================= */
@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .rolle-grid { grid-template-columns: 1fr 1fr; }
}

/* =============================================================================
   RESPONSIVE — Mobile (Primary Target)
   ============================================================================= */
@media (max-width: 768px) {
    /* --- Body & Layout --- */
    body {
        flex-direction: column;
        padding-bottom: 64px; /* Platz für Bottom-Nav */
    }

    /* --- Sidebar → Bottom Navigation --- */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        flex-direction: column;
        z-index: 1000;
        overflow: visible;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    }

    .sidebar-header {
        display: none; /* Logo/Titel auf Mobil verstecken */
    }

    .sidebar-footer {
        display: none;
    }

    .nav-links {
        display: flex;
        flex-direction: row;
        flex: 0 0 auto;
        min-height: auto;
        overflow-x: auto;
        overflow-y: visible;
        padding: 0;
        gap: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }

    .nav-links li {
        flex: 1;
        min-width: 56px;
    }

    .nav-scroll li {
        flex: 0 0 auto;
    }

    .nav-links li a {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 8px;
        font-size: 10px;
        text-align: center;
        border-left: none;
        border-top: 3px solid transparent;
        white-space: nowrap;
    }

    .nav-links li.active a {
        border-left-color: transparent;
        border-top-color: var(--accent);
        background: rgba(255,255,255,0.15);
    }

    .nav-links .icon {
        font-size: 18px;
        width: auto;
    }

    /* --- Mobile: Einstellungen & Abmelden in Bottom-Nav --- */
    .nav-mobile-only {
        display: flex !important;
    }

    .nav-mobile-logout a {
        color: rgba(255,100,100,0.85) !important;
    }

    /* --- Mobile Theme Toggle --- */
    .mobile-theme-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        float: right;
        width: 36px;
        height: 36px;
        margin: 0 0 4px 8px;
        border-radius: 50%;
        border: none;
        background: var(--gray-100);
        color: var(--gray-600);
        font-size: 17px;
        cursor: pointer;
        transition: background 0.2s, transform 0.1s;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-theme-toggle:active {
        transform: scale(0.9);
    }

    /* --- Content --- */
    .content {
        margin-left: 0;
        padding: 16px 12px;
        min-height: calc(100vh - 64px);
        overflow-x: hidden;
    }

    /* --- Headings: kein Overflow --- */
    h1, h2, h3 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* --- Page Header --- */
    .page-header {
        margin-bottom: 16px;
    }
    .page-header h1 {
        font-size: 20px;
    }

    /* --- Summary Cards --- */
    .summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        margin-bottom: 16px;
    }
    .summary-card {
        padding: 14px 10px;
    }
    .summary-card .number {
        font-size: 28px;
    }
    .summary-card .label {
        font-size: 11px;
    }

    /* --- Cards --- */
    .card {
        padding: 16px;
        margin-bottom: 14px;
        border-radius: var(--radius);
    }

    /* --- Tables → Horizontal Scroll --- */
    .table-container {
        margin: 0 -12px;
        padding: 0 12px;
    }

    table {
        font-size: 13px;
    }

    thead th {
        padding: 10px 8px;
        font-size: 11px;
    }

    tbody td {
        padding: 8px;
        font-size: 13px;
    }

    /* --- Buttons → Touch-Friendly --- */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px; /* iOS Touch Target */
    }
    .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }
    .btn-xs {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }

    /* --- Forms → Full Width, Touch Friendly --- */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-control {
        padding: 12px 14px;
        font-size: 16px; /* Verhindert iOS Zoom */
        min-height: 48px;
    }

    select.form-control {
        font-size: 16px;
        min-height: 48px;
    }

    .form-group label {
        font-size: 14px;
    }

    /* --- Rolle Boxes → Stack --- */
    .rolle-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rolle-box {
        padding: 14px;
    }

    .rolle-box h3 {
        font-size: 15px;
    }

    .vorschlag-item {
        padding: 6px 12px;
        font-size: 13px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    /* --- Termin Cards → Stack --- */
    .termin-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
    }

    .termin-datum {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        min-width: auto;
    }

    .termin-datum .tag {
        font-size: 18px;
    }

    .termin-info {
        width: 100%;
    }

    .termin-info h3 {
        font-size: 14px;
    }

    .termin-team {
        margin-top: 8px;
    }

    .termin-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--gray-200);
    }

    /* --- Vorschlag Cards → Stack --- */
    .vorschlag-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px;
    }

    .vorschlag-card .rank {
        font-size: 20px;
        min-width: auto;
    }

    .vorschlag-card .meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
    }

    /* --- Filter Bar → Wrap & Stack --- */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-bar select,
    .filter-bar input {
        padding: 10px 14px;
        font-size: 16px;
        min-height: 44px;
    }

    /* Typ-Buttons nebeneinander, aber wrap */
    .filter-bar .btn {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    /* --- Grid Layouts → Stack --- */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* --- Hilfe-Seite --- */
    .card h2 {
        font-size: 17px;
    }
    .card h3 {
        font-size: 15px;
    }
    .card table {
        font-size: 12px;
    }

    /* --- Checkbox Touch Targets --- */
    .checkbox-label {
        min-height: 44px;
        font-size: 14px;
    }
    .checkbox-label input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    /* --- Hinweis-Boxen --- */
    #termin-typ-hinweis,
    #doppel-hinweis,
    #punkte-hinweis {
        font-size: 13px;
        line-height: 1.5;
    }

    /* --- Personen-Seite Rollen-Badges --- */
    .badge {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* --- Statistiken --- */
    .progress-bar {
        height: 12px;
    }

    /* --- Empty State --- */
    .empty-state {
        padding: 32px 16px;
    }
    .empty-state .icon { font-size: 36px; }
    .empty-state h3 { font-size: 16px; }
}

/* =============================================================================
   RESPONSIVE — Sehr kleine Screens (< 380px)
   ============================================================================= */
@media (max-width: 380px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    .summary-card .number {
        font-size: 24px;
    }
    .nav-links li a {
        font-size: 9px;
        padding: 6px 2px;
    }
    .nav-links .icon {
        font-size: 16px;
    }
    .page-header h1 {
        font-size: 18px;
    }
    .content {
        padding: 12px 8px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-400);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }


/* =============================================================================
   MOBILE-FIRST PWA-Polish
   - iPhone Safe-Area (Notch + Home-Indicator)
   - 100dvh statt 100vh (iOS Safari URL-Bar)
   - Tap-Highlight & Touch-Action (kein 300ms-Delay)
   ============================================================================= */

/* Globale Touch-Optimierungen */
html {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
a, button, input[type="submit"], input[type="button"],
.btn, .nav-links li a, .clickable {
    touch-action: manipulation;
}
/* Buttons sollen Active-State zeigen statt 300ms-Delay-Wartezeit */
.btn:active, .nav-links li a:active {
    transform: scale(0.98);
}

/* iOS / Standalone-Mode (PWA installiert): Safe-Area beachten */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        body {
            /* 64px Bottom-Nav + Home-Indicator */
            padding-bottom: calc(64px + env(safe-area-inset-bottom));
        }
        .sidebar {
            /* Sidebar reicht bis ans Display, Inhalt aber respektiert Safe-Area */
            padding-bottom: env(safe-area-inset-bottom);
        }
        .content {
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }
    }
}

/* Dynamic Viewport Height fuer iOS Safari (URL-Bar verschwindet beim Scrollen) */
@supports (height: 100dvh) {
    @media (max-width: 768px) {
        .content {
            min-height: calc(100dvh - 64px);
        }
    }
}

/* Body-Overscroll auf iOS: kein Bounce ueber Bottom-Nav hinaus */
body {
    overscroll-behavior-y: contain;
}

/* Bottom-Nav: Mobile-Only "Mehr"-Drawer-Trigger */
.nav-mehr-toggle {
    display: none;
}
@media (max-width: 768px) {
    /* Bei Admin (8+ Items): "Mehr"-Button zeigen, ueberzaehlige verstecken */
    body.has-mehr-drawer .nav-links li.nav-overflow {
        display: none;
    }
    body.has-mehr-drawer .nav-mehr-toggle {
        display: flex;
        flex: 1;
        min-width: 56px;
    }
    body.has-mehr-drawer .nav-mehr-toggle a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px;
        font-size: 10px;
        color: rgba(255,255,255,0.85);
        text-decoration: none;
        cursor: pointer;
        border-top: 3px solid transparent;
    }
    body.has-mehr-drawer .nav-mehr-toggle.active a {
        border-top-color: var(--accent);
        background: rgba(255,255,255,0.15);
    }
    body.has-mehr-drawer .nav-mehr-toggle .icon {
        font-size: 18px;
    }
}

/* Mehr-Drawer: Bottom-Sheet mit Restlichen Links (Mobile-only) */
.mehr-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1500;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.2s;
}
.mehr-drawer-backdrop.open {
    display: block;
    opacity: 1;
}

.mehr-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--gray-50);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    z-index: 1600;
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
    max-height: 80vh;
    overflow-y: auto;
}
.mehr-drawer.open {
    transform: translateY(0);
}

.mehr-drawer-handle {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 8px auto 12px;
}

.mehr-drawer-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px;
}

.mehr-drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 2px;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}
.mehr-drawer-link:active {
    background: var(--gray-200);
}
.mehr-drawer-link.danger {
    color: var(--red);
}
.mehr-drawer-link .icon {
    font-size: 22px;
    width: 28px;
    text-align: center;
}

/* Sticky Mobile-Header mit Logo — Standard versteckt, Mobile sichtbar */
.mobile-header {
    display: none;
}
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
        background: var(--primary);
        color: white;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    .mobile-header-logo {
        width: 32px;
        height: 32px;
        border-radius: 7px;
        flex-shrink: 0;
    }
    .mobile-header-title {
        font-size: 16px;
        font-weight: 700;
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-header-action {
        background: rgba(255,255,255,0.15);
        border: none;
        color: white;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-header-action:active {
        background: rgba(255,255,255,0.25);
    }
    /* Existierender Mobile-Theme-Toggle nicht mehr noetig */
    .mobile-theme-toggle {
        display: none !important;
    }
    /* Bei has-mehr-drawer: nav-mobile-only-Items (Einstellungen, Abmelden)
       NICHT in Bottom-Nav zeigen — sind im Drawer */
    body.has-mehr-drawer .nav-links li.nav-mobile-only {
        display: none !important;
    }
}

/* Kleine Polish-Tweaks fuer Mobile */
@media (max-width: 768px) {
    /* Smooth scrolling */
    html { scroll-behavior: smooth; }

    /* Cards bekommen mehr Atemraum */
    .card {
        margin-bottom: 12px;
    }

    /* Lange Worte umbrechen statt overflow */
    body, p, div, span, a {
        word-break: break-word;
    }

    /* Inputs: Auto-Fokus-Outline auf iOS angenehmer */
    input:focus, select:focus, textarea:focus {
        outline: 2px solid var(--primary-light);
        outline-offset: 1px;
    }
}
