/* =============================================
   RWD Mitarbeiter-Portal – Modern Design System
   (Layout-Struktur: BAV-Style, Farben: RWD-CI)
   ============================================= */

:root {
    --sidebar-width: 260px;
    --header-height: 60px;

    /* RWD CI */
    --rwd-blue-900: #14375E;
    --rwd-blue-800: #1B4470;
    --rwd-blue-700: #1F4E7A;
    --rwd-blue-600: #2C5A8E;
    --rwd-teal-700: #1F8F75;
    --rwd-teal-600: #2BA587;
    --rwd-teal-500: #3DBFA0;

    --primary: var(--rwd-blue-700);
    --primary-dark: var(--rwd-blue-900);
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #e0f2fe;
    --purple: #7c3aed;
    --purple-light: #ede9fe;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --card-radius: 10px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;

    /* Sidebar-Hintergrund: solides RWD-Dunkelblau (clean, kein Verlauf) */
    --sidebar-bg: #14375E;
}

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

html, body {
    margin: 0; padding: 0;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    height: 100%;
    /* horizontales Scrollen NIE zulassen (verhindert "verrutschte" Layouts auf Mobile) */
    overflow-x: hidden;
    /* iOS Safari: Auto-Vergrößerung von Text bei Rotation aus */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body { min-width: 320px; }

/* Bilder und Medien nie über Container hinaus */
img, video, svg { max-width: 100%; height: auto; }
table { max-width: 100%; }

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

/* ── App Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    left: 0; top: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    background: var(--sidebar-bg) !important;
    background-image: none !important;
}

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

.sidebar-logo {
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: white;
    border-radius: 6px;
    padding: 6px 8px;
}

.sidebar-brand {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }

.user-name {
    color: white;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: rgba(255,255,255,0.55);
    font-size: 11px;
}

.btn-logout {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.85);
    border-radius: 6px;
    padding: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); color: white; }

/* ── NavMenu ── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    color: rgba(255,255,255,0.78) !important;
    text-decoration: none !important;
    font-size: 13.5px;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: white !important;
}

.nav-link.active {
    background: rgba(255,255,255,0.22);
    color: white !important;
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    display: inline-flex;
    justify-content: center;
    flex-shrink: 0;
}

.nav-divider {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 8px 4px;
}

/* ── Main Wrapper ── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Top Header ── */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.header-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.header-right { display: flex; align-items: center; gap: 12px; }

.header-title {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-username {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    padding: 24px;
    background: var(--bg);
}

/* ── Page Title ── */
h1, .page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}
/* Blazor setzt nach Render automatisch Fokus auf h1 (Accessibility) – Browser-Outline
   und Text-Highlight unterdrücken, damit es nach Refresh nicht „markiert" aussieht. */
h1, h2, h3, .page-title { outline: none !important; }
h1:focus, h2:focus, h3:focus, .page-title:focus { outline: none !important; }

h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0 0 14px 0; }
h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0 0 12px 0; }
h4, h5, h6 { font-weight: 600; color: var(--text-primary); }

/* ── Animations (sparsam – nur wo es Mehrwert bietet) ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-soft { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ── Info-Grid (robustes auto-wrappendes Grid für KPIs / Detail-Sections) ── */
.info-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}
.info-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.info-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.info-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1199px) {
    .info-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .info-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .info-grid-4, .info-grid-3, .info-grid-2 { grid-template-columns: 1fr; }
}

/* Form-Grid: 2 Spalten ab Tablet, 3 ab Desktop, 4 auf großen Screens */
.form-grid {
    display: grid;
    gap: 14px 16px;
}
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

@media (max-width: 767px) {
    .form-grid-2, .form-grid-3, .form-grid-auto { grid-template-columns: 1fr; }
}

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

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-primary);
}

.card-body { padding: 18px; }
.card-body.p-0 { padding: 0; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.card-text { font-size: 13.5px; color: var(--text-secondary); }

/* ── Tables ── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:hover { background: #fafafa; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover > * { background: rgba(31, 78, 122, 0.05); }
.table-sm th { padding: 8px 12px; }
.table-sm td { padding: 8px 12px; }
.table .align-middle td { vertical-align: middle; }

/* ── Badges / Pills ── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.bg-primary { background: var(--primary) !important; color: white !important; }
.bg-success { background: var(--success) !important; color: white !important; }
.bg-warning { background: var(--warning) !important; color: white !important; }
.bg-danger  { background: var(--danger) !important; color: white !important; }
.bg-secondary { background: #6c757d !important; color: white !important; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-success:hover { background: #15803d; border-color: #15803d; color: white; }

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

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

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

.btn-outline-secondary {
    background: white;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-outline-secondary:hover { background: var(--bg); color: var(--text-primary); }

.btn-outline-danger {
    background: white;
    color: var(--danger);
    border-color: #fca5a5;
}
.btn-outline-danger:hover { background: var(--danger-light); }

.btn-link {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 4px 8px;
}
.btn-link:hover { text-decoration: underline; color: var(--primary-dark); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }

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

/* ── Form Controls ── */
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
    color: var(--text-primary);
    background: white;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 122, 0.12);
}

.form-control:disabled, .form-select:disabled {
    background: #f9fafb;
    color: var(--text-muted);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-text {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Bootstrap-Defaults überschreiben (float/negative-margin der Inputs entfernen,
   sonst rutschen Checkboxen aus dem Container heraus) */
.form-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 2px 0 !important;
    padding-left: 0 !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
}
.form-check-input {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0 !important;
    float: none !important;
    flex-shrink: 0;
}
.form-check-label {
    font-size: 13.5px;
    cursor: pointer;
    margin: 0 !important;
}

.form-switch .form-check-input {
    width: 32px; height: 16px;
    accent-color: var(--primary);
}

/* ── Tabs ── */
.nav-tabs { border-bottom: 2px solid #d1d5db; display: flex; gap: 2px; flex-wrap: wrap; }
.nav-tabs .nav-link {
    color: #4b5563 !important;
    font-size: 13.5px;
    background: #f9fafb;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    padding: 9px 16px;
    cursor: pointer;
}
.nav-tabs .nav-link:hover { background: #eff6ff; color: var(--primary) !important; }
.nav-tabs .nav-link.active {
    color: var(--primary) !important;
    background: white;
    border-color: #d1d5db;
    border-bottom-color: white;
    font-weight: 600;
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-top: 12px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #86efac; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #7dd3fc; }
.alert.py-2 { padding-top: 8px; padding-bottom: 8px; }

/* ── List groups (Bootstrap-Kompatibilität) ── */
.list-group-flush > .list-group-item {
    background: white;
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
}
.list-group-flush > .list-group-item:last-child { border-bottom: 0; }
.list-group-item-action:hover { background: #f9fafb; }

/* ── Modals (Bootstrap-Kompatibilität) ── */
.modal { display: none; }
.modal.show.d-block { display: block; }
.modal-dialog {
    margin: 5vh auto;
    max-width: 720px;
    width: calc(100% - 24px);
}
.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.btn-close {
    background: transparent;
    border: 0;
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}
.btn-close::before { content: "\00d7"; font-size: 22px; line-height: 1; }
.btn-close:hover { background: var(--bg); }

/* ── Grid (Bootstrap-Kompatibilität) ── */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.col { flex: 1; padding: 0 8px; }
.col-auto { flex: 0 0 auto; padding: 0 8px; }
.col-md-1  { flex: 0 0 8.333%;  max-width: 8.333%;  padding: 0 8px; }
.col-md-2  { flex: 0 0 16.667%; max-width: 16.667%; padding: 0 8px; }
.col-md-3  { flex: 0 0 25%;     max-width: 25%;     padding: 0 8px; }
.col-md-4  { flex: 0 0 33.333%; max-width: 33.333%; padding: 0 8px; }
.col-md-5  { flex: 0 0 41.667%; max-width: 41.667%; padding: 0 8px; }
.col-md-6  { flex: 0 0 50%;     max-width: 50%;     padding: 0 8px; }
.col-md-7  { flex: 0 0 58.333%; max-width: 58.333%; padding: 0 8px; }
.col-md-8  { flex: 0 0 66.667%; max-width: 66.667%; padding: 0 8px; }
.col-md-9  { flex: 0 0 75%;     max-width: 75%;     padding: 0 8px; }
.col-md-10 { flex: 0 0 83.333%; max-width: 83.333%; padding: 0 8px; }
.col-md-12, .col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 8px; }

.g-1 { gap: 4px; }
.g-2 { gap: 8px; }
.g-3 { gap: 16px; }

/* ── Spacing ── */
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-auto { margin-top: auto; }
.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.ms-3 { margin-left: 16px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.me-3 { margin-right: 16px; }

.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }

/* ── Flex helpers ── */
.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }
.flex-column { flex-direction: column; }
.flex-grow-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-start { justify-content: flex-start; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.w-100 { width: 100%; }
.text-nowrap { white-space: nowrap; }

/* ── Text ── */
.text-end { text-align: right; }
.text-center { text-align: center; }
.text-start { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary) !important; }
.text-white { color: white; }
.text-dark { color: var(--text-primary); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-normal { font-weight: 400; }
.small { font-size: 12px; }
.fst-italic { font-style: italic; }

/* ── Bootstrap-bi-Icons (Mitarbeiter-App nutzt eigene SVG-Klassen aus NavMenu.razor.css —
   die alten Klassen .bi-house-door-fill-nav-menu etc. werden weiterhin geladen über _Imports / scoped css) ── */

/* ── Code ── */
code {
    background: #f3f4f6;
    color: #be185d;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

/* ── Misc ── */
.shadow-sm { box-shadow: var(--card-shadow); }
.rounded { border-radius: var(--card-radius); }
.border-top { border-top: 1px solid var(--border); }
.sticky-top { position: sticky; top: 0; z-index: 10; background: white; }
.w-100 { width: 100%; }

.blazor-error-boundary {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 16px;
    color: var(--danger);
    margin: 16px;
}
.blazor-error-boundary::after { content: "Ein Fehler ist aufgetreten. Bitte die Seite neu laden."; }

/* ── Login / Auth-Seiten (EmptyLayout) ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #14375E;
    padding: 16px;
}

.login-card {
    background: white;
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border-top: 4px solid var(--rwd-teal-600);
}

.login-logo {
    display: block;
    max-width: 200px;
    width: 100%;
    height: auto;
    margin: 0 auto 1.5rem;
}

/* ── Loading ── */
.loading-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 12px;
}
.loading-wrapper span { animation: pulse-soft 1.5s ease infinite; }

/* ── Hamburger Button (nur mobil sichtbar) ── */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--bg); }
.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.25s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar Overlay (Mobile-Dimmer) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 190;
    animation: fadeIn 0.2s ease;
}
.sidebar-overlay.visible { display: block; }

/* =============================================
   MOBILE & TABLET – Responsive
   ============================================= */

/* Tablet & Mobile: Sidebar als Drawer */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 200;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }
    .main-wrapper { margin-left: 0; min-width: 0; }
    .hamburger-btn { display: flex; }
    .top-header { padding: 0 14px; }
    .main-content { padding: 16px; }

    /* KPI-Grids und Form-Grids dürfen NIE auseinanderfallen */
    .info-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .info-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Tabellen-Wrapper ohne Wrapper trotzdem horizontal scrollbar */
    .card > .table,
    .card-body > .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Smartphone */
@media (max-width: 767px) {
    html, body { font-size: 14px; }

    /* Sidebar etwas breiter für Touch */
    .sidebar { width: 280px; }
    .main-wrapper { margin-left: 0; min-width: 0; }
    .main-content { padding: 12px; }

    /* Top-Header kompakter */
    .top-header {
        padding: 0 12px;
        height: 52px;
        gap: 8px;
    }
    .header-username { display: none; } /* Username steht eh im Sidebar-Footer */

    /* Sidebar offen → Body nicht mitscrollen */
    body:has(.sidebar.open) { overflow: hidden; }

    /* Bootstrap-Grid auf Mobile = volle Breite */
    .col-md-1, .col-md-2, .col-md-3, .col-md-4,
    .col-md-5, .col-md-6, .col-md-7, .col-md-8,
    .col-md-9, .col-md-10 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .col { flex: 0 0 100%; max-width: 100%; }
    .row { gap: 10px 0; }
    .g-2, .g-3 { gap: 10px; }

    /* Info-/Form-Grids alle 1-spaltig */
    .info-grid, .info-grid-2, .info-grid-3, .info-grid-4,
    .form-grid, .form-grid-2, .form-grid-3, .form-grid-auto {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    /* Inline-style-Overrides aus ManagerDetail (2fr 1fr 1fr) zurücksetzen */
    .info-grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

    /* Cards kompakter */
    .card-header { padding: 12px 14px; }
    .card-body { padding: 14px; }

    /* Tabellen: horizontal scrollbar */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table th, .table td { padding: 9px 10px; white-space: nowrap; }
    .table-sm th, .table-sm td { padding: 8px 8px; }

    /* Buttons: touch-freundlich (min 40px Hitfläche) */
    .btn {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 40px;
    }
    .btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }

    /* Buttongruppen wrappen automatisch */
    .d-flex.gap-2, .d-flex.gap-3 { flex-wrap: wrap; }

    /* Formulare: 16px verhindert iOS Auto-Zoom; größere Hitfläche */
    .form-control, .form-select {
        font-size: 16px;
        padding: 10px 12px;
        min-height: 42px;
    }
    textarea.form-control { min-height: 80px; }

    /* Header-Bereich von Detail-Seiten (Avatar + Name + Buttons) wrappt sauber */
    .d-flex.justify-content-between.align-items-start,
    .d-flex.justify-content-between.align-items-center { flex-wrap: wrap; gap: 10px; }

    /* Login-Card responsive */
    .login-card {
        padding: 24px 18px;
        border-radius: 10px;
        max-width: calc(100vw - 24px);
    }
    .login-logo { max-width: 160px; }

    /* Modal als Bottom-Sheet auf Mobile (kein versehentliches Skalieren) */
    .modal.show.d-block { padding: 0; }
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        max-height: 92vh;
        animation: slideUpSheet 0.25s ease;
    }
    .modal-content {
        border-radius: 14px 14px 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }
    @keyframes slideUpSheet {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Ranking / Details: keine fixen min-widths sprengen */
    .toggle-pill { width: 100%; justify-content: center; }
    .toggle-pill .btn { flex: 1; }
}

/* Smartphone-Feintuning (greift zusätzlich zum 767px-Block oben) */
@media (max-width: 767px) {
    /* Page-Header kompakter, mehr Platz für Inhalt */
    h1, .page-title { font-size: 20px; margin: 0 0 14px 0; }
    h2 { font-size: 17px; }
    h3 { font-size: 15px; margin-bottom: 10px; }

    /* Big-Number-Kacheln (bAV, KPI) auf Mobile kleiner damit nichts überläuft */
    .card-body div[style*="font-size:32px"],
    .card-body div[style*="font-size: 32px"] {
        font-size: 24px !important;
    }

    /* Date/Time-Inputs: gleiche Touch-Größe wie andere Inputs */
    input[type="date"], input[type="time"], input[type="datetime-local"] {
        min-height: 44px;
        font-size: 16px;
        padding: 10px 12px;
    }

    /* Toggle-Pills sollen volle Breite + Buttons gleich groß */
    .toggle-pill {
        width: 100%;
        display: flex;
    }
    .toggle-pill .btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 13.5px;
    }

    /* Header-Zeilen mit Titel + Toggle/Button immer voll-breit umbrechen */
    .d-flex.justify-content-between.align-items-center.flex-wrap > * {
        min-width: 0;
    }

    /* Sticky-Footer-Bars: einheitliche Mobile-Behandlung mit Safe-Area */
    .ds-sticky-bar, .pflicht-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    /* Kalender-Tabelle (admin/urlaub) muss horizontal scrollen können */
    .kal-wrap { -webkit-overflow-scrolling: touch; }
    .kal-table th, .kal-table td { min-width: 22px; height: 26px; font-size: 11px; }
    .kal-table th.kal-name, .kal-table td.kal-name { min-width: 130px; font-size: 12px; }

    /* Card-Inhalt etwas engerer */
    .card-body { padding: 12px; }
    .card-header { padding: 10px 12px; font-size: 13px; }

    /* Badges in Tabellenzellen sollen nicht expandieren */
    .table td .badge { white-space: nowrap; }

    /* Avatar im Sidebar-Footer kleiner damit Name nicht abgeschnitten wird */
    .user-avatar { width: 30px; height: 30px; font-size: 13px; }
}

/* Sehr kleine Phones (≤400px) */
@media (max-width: 400px) {
    .info-grid, .info-grid-2, .info-grid-3, .info-grid-4 { grid-template-columns: 1fr !important; }
    .login-card { padding: 20px 14px; }
    h1, .page-title { font-size: 18px; }
    .kpi-tile .kpi-num, .kpi-num { font-size: 22px; }
    .main-content { padding: 10px 8px; }
    .card-body div[style*="font-size:32px"],
    .card-body div[style*="font-size: 32px"] {
        font-size: 20px !important;
    }
    .toggle-pill .btn { padding: 8px 4px; font-size: 12.5px; }
}

/* === Shell-Tool-spezifische Ergänzungen (Collapse-Sections, Status-Bar) === */
.sidebar .nav-section-header {
    color: rgba(255,255,255,0.55);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
    cursor: pointer;
    user-select: none;
    text-decoration: none !important;
}
.sidebar .nav-section-header:hover { color: rgba(255,255,255,0.85); }
.sidebar .nav-section-header .chevron { font-size: 10px; opacity: 0.6; transition: transform 0.2s; }
.sidebar-sub .nav-link { padding-left: 30px !important; font-size: 12.5px !important; }

.status-bar {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    height: 32px;
    padding: 0 16px;
    background: #fff;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-secondary);
    z-index: 90;
    display: flex;
    align-items: center;
}
@media (max-width: 1023px) {
    .status-bar { left: 0; }
}

.main-content { padding-bottom: 48px; } /* Platz für Status-Bar */

/* === Compat-Layer: Shell-eigene Klassen auf RWD-Look mappen ============ */
/* Pages nutzen `.card-modern`, `.kpi-card`, `.btn-shell` etc. — diese hier   */
/* in RWD-Stil definieren, ohne 23 Pages umschreiben zu müssen.              */

.card-modern {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}
.card-modern > .card-body { padding: 18px; }
.card-modern > .card-body.py-2 { padding-top: 10px; padding-bottom: 10px; }

/* KPI-Kacheln (Shell-Variant ohne BEM) */
.kpi-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 18px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 6px 18px rgba(20,55,94,0.10);
}
.kpi-card .kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.kpi-card .kpi-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.1;
    margin-bottom: 4px;
    word-break: break-word;
}
.kpi-card .kpi-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Shell-spezifische Buttons */
.btn-shell, button.btn-shell {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    border-radius: 7px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-shell:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-shell:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary-shell, button.btn-secondary-shell {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-secondary-shell:hover { background: var(--bg); }
.btn-secondary-shell:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-green, button.btn-green, .btn.btn-green {
    background: var(--rwd-teal-600, #2BA587) !important;
    color: white !important;
    border: 1px solid var(--rwd-teal-600, #2BA587) !important;
    border-radius: 7px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-green:hover { background: var(--rwd-teal-700, #1F8F75) !important; border-color: var(--rwd-teal-700, #1F8F75) !important; }
.btn-green:disabled { opacity: 0.5; cursor: not-allowed; }

/* Shell-Alerts */
.alert-shell-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}
.alert-shell-info {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}
.alert-shell-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

.text-slate { color: var(--text-primary); }

/* Stat-/Warn-Boxen (kommen in einigen Übergabeprotokoll-Pages vor) */
.stat-block {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.warn-card {
    background: var(--warning-light);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 12px 14px;
}

/* === Floating "Zum Dashboard"-Button (tool-übergreifende UI-Konvention) === */
.back-to-dashboard {
    position: fixed;
    bottom: 46px;
    right: 18px;
    z-index: 1500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--rwd-blue-700, #1F4E7A);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(20,55,94,0.25);
    opacity: 0.9;
    transition: transform 0.25s cubic-bezier(.2,.9,.3,1.2),
                background 0.25s ease,
                box-shadow 0.25s ease,
                opacity 0.25s ease;
}
.back-to-dashboard svg { display: block; flex-shrink: 0; }
.back-to-dashboard:hover {
    opacity: 1;
    transform: translateY(-3px) scale(1.03);
    background: var(--rwd-teal-600, #2BA587);
    box-shadow: 0 14px 28px rgba(20,55,94,0.32);
    color: #fff !important;
}
@media (max-width: 600px) {
    .back-to-dashboard { bottom: 40px; right: 12px; padding: 9px 14px; font-size: 12px; }
    .back-to-dashboard span { display: none; }
}

/* === Page-Transition (Dashboard <-> Tool — wirken wie eine App) === */
html { background: var(--rwd-blue-900, #14375E); }
@keyframes rwdPageEnter { from { opacity: 0; } to { opacity: 1; } }
@keyframes rwdPageLeave { from { opacity: 1; } to { opacity: 0; } }
body { animation: rwdPageEnter 0.28s ease-out both; }
body.rwd-leaving { animation: rwdPageLeave 0.18s ease-in both; }

/* ════════════════════════════════════════════════════════════════
   MOBILE-LAYOUT — Smartphones + Tablets (Viewport < 1200px)
   Desktop ab 1200px bleibt unverändert.
   Greift auch auf größeren Tablets im Hochformat. Querformat-Tablets
   ab 1200px (iPad Pro 11/13" landscape) zählen als Desktop.
   ════════════════════════════════════════════════════════════════ */
:root {
    --mobile-tab-bar-h: 72px;
    --mobile-header-h:  56px;
}

/* ── Mobile-Elemente standardmäßig versteckt — werden nur unter 1200 px sichtbar */
.mobile-tab-bar,
.mobile-fab { display: none; }

@media (max-width: 1199.98px) {

    /* Desktop-Sidebar + Hamburger auf Mobile komplett ausblenden.
       Die Mobile-Navigation läuft via Bottom-Tab-Bar + Mehr-Sheet.
       Der "Zum Dashboard"-Floating-Button erscheint stattdessen
       als Tile im Mehr-Sheet (siehe MainLayout.razor). */
    .sidebar,
    .sidebar-overlay,
    .hamburger-btn,
    .back-to-dashboard {
        display: none !important;
    }

    /* Hauptinhalt nimmt volle Breite — kein Sidebar-Offset mehr */
    .main-wrapper {
        margin-left: 0 !important;
        padding-bottom: var(--mobile-tab-bar-h);
    }
    .main-content {
        padding: 12px;
    }

    /* Top-Header kompakter auf Mobile */
    .top-header {
        height: var(--mobile-header-h);
        padding: 0 10px;
    }
    .header-title { font-size: 0.95rem; }
    .header-username { display: none; }

    /* ────────── Bottom-Tab-Bar (Daumen-erreichbar) ────────── */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: var(--mobile-tab-bar-h);
        background: var(--card, #FFFFFF);
        border-top: 1px solid var(--border, #E5E7EB);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom)) 4px;
        z-index: 1030;
        box-shadow: 0 -2px 10px rgba(15,23,42,0.06);
    }
    .mobile-tab-item {
        flex: 1;
        border: none;
        background: transparent;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted, #6B7280);
        font-size: 0.68rem;
        font-weight: 600;
        text-decoration: none;
        border-radius: 12px;
        padding: 4px;
        transition: color 0.15s;
        position: relative;
    }
    .mobile-tab-item i {
        font-size: 1.4rem;
        line-height: 1;
        transition: transform 0.12s;
    }
    .mobile-tab-item:active { background: rgba(15,23,42,0.04); }
    .mobile-tab-item.active {
        color: var(--primary, #1F4E7A);
    }
    .mobile-tab-item.active i {
        transform: scale(1.06);
    }
    .mobile-tab-item .tab-badge-dot {
        position: absolute;
        top: 8px;
        right: 30%;
        width: 8px; height: 8px;
        border-radius: 50%;
        background: var(--rwd-teal-500, #3DBFA0);
    }
    .mobile-tab-item.has-badge .tab-badge-dot { display: block; }
    .mobile-tab-item .tab-badge-count {
        position: absolute;
        top: 4px;
        right: 24%;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 9px;
        background: #DC2626;
        color: white;
        font-size: 0.62rem;
        font-weight: 700;
        line-height: 18px;
        text-align: center;
    }

    /* ────────── FAB (Floating Action Button) ────────── */
    .mobile-fab {
        display: flex;
        position: fixed;
        right: 16px;
        bottom: calc(var(--mobile-tab-bar-h) + 16px + env(safe-area-inset-bottom));
        width: 56px; height: 56px;
        border-radius: 50%;
        background: var(--primary, #1F4E7A);
        color: white;
        border: none;
        box-shadow: 0 8px 20px rgba(31,78,122,0.35);
        z-index: 1020;
        font-size: 1.4rem;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: transform 0.1s, box-shadow 0.15s;
    }
    .mobile-fab:active { transform: scale(0.93); }
    .mobile-fab:hover { color: white; }
    .mobile-fab.success { background: var(--rwd-teal-700, #1F8F75); box-shadow: 0 8px 20px rgba(31,143,117,0.35); }

    /* ────────── Statusbar auf Mobile ausblenden ──────────
       Die Status-Bar (mit Status-Text + Excel-Export-Link) ist auf Desktop
       sinnvoll, kollidiert aber auf Mobile mit der Bottom-Tab-Bar.
       Excel-Export ist im Mehr-Sheet als Menu-Tile erreichbar (siehe MainLayout.razor). */
    .status-bar { display: none !important; }

    /* "Zum Dashboard"-Floating-Button verlagern, damit er nicht mit FAB kollidiert */
    .back-to-dashboard {
        bottom: calc(var(--mobile-tab-bar-h) + 80px + env(safe-area-inset-bottom));
        right: 16px;
        left: auto;
    }

    /* ────────── KPI-Cards (Übersicht etc.) ────────── */
    .mobile-kpi-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }
    .mobile-kpi-card {
        background: var(--card, #FFFFFF);
        border-radius: 16px;
        padding: 14px;
        border: 1px solid var(--border, #E5E7EB);
        position: relative;
    }
    .mobile-kpi-card .kpi-icon {
        position: absolute;
        top: 12px; right: 12px;
        width: 32px; height: 32px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
    }
    .mobile-kpi-card .kpi-icon.primary { background: #DBEAFE; color: var(--primary, #1F4E7A); }
    .mobile-kpi-card .kpi-icon.success { background: #DCFCE7; color: #16A34A; }
    .mobile-kpi-card .kpi-icon.warn    { background: #FEF3C7; color: #F59E0B; }
    .mobile-kpi-card .kpi-icon.danger  { background: #FEE2E2; color: #DC2626; }
    .mobile-kpi-card .kpi-icon.teal    { background: rgba(61,191,160,0.18); color: var(--rwd-teal-700, #1F8F75); }
    .mobile-kpi-card .kpi-label {
        font-size: 0.72rem;
        color: var(--text-muted, #6B7280);
        font-weight: 600;
        margin-bottom: 4px;
    }
    .mobile-kpi-card .kpi-value {
        font-size: 1.35rem;
        font-weight: 700;
        color: var(--text-primary, #111827);
        line-height: 1.1;
        word-break: break-all;
    }
    .mobile-kpi-card .kpi-delta {
        font-size: 0.72rem;
        margin-top: 4px;
        font-weight: 600;
    }
    .mobile-kpi-card .kpi-delta.up   { color: #DC2626; }
    .mobile-kpi-card .kpi-delta.down { color: #16A34A; }

    /* ────────── List-Card (für Tabellen-Ersatz) ────────── */
    .mobile-list-card {
        background: var(--card, #FFFFFF);
        border-radius: 14px;
        padding: 12px 14px;
        border: 1px solid var(--border, #E5E7EB);
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .mobile-list-card-thumb {
        width: 44px; height: 44px;
        border-radius: 12px;
        background: var(--bg, #F3F4F6);
        color: var(--text-muted, #6B7280);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        flex-shrink: 0;
    }
    .mobile-list-card-thumb.primary { background: #DBEAFE; color: var(--primary, #1F4E7A); }
    .mobile-list-card-thumb.success { background: #DCFCE7; color: #16A34A; }
    .mobile-list-card-thumb.warn    { background: #FEF3C7; color: #F59E0B; }
    .mobile-list-card-thumb.danger  { background: #FEE2E2; color: #DC2626; }
    .mobile-list-card-thumb.teal    { background: rgba(61,191,160,0.18); color: var(--rwd-teal-700, #1F8F75); }

    /* ────────── Filter-Chip (horizontal scrollbar) ────────── */
    .mobile-filter-row {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 8px 0;
        margin: -8px -12px 8px -12px;
        padding-left: 12px;
        padding-right: 12px;
        scrollbar-width: none;
    }
    .mobile-filter-row::-webkit-scrollbar { display: none; }
    .mobile-filter-chip {
        white-space: nowrap;
        background: var(--card, #FFFFFF);
        border: 1px solid var(--border, #E5E7EB);
        border-radius: 999px;
        padding: 8px 14px;
        font-size: 0.82rem;
        font-weight: 600;
        color: var(--text-primary, #111827);
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .mobile-filter-chip.active {
        background: var(--primary, #1F4E7A);
        color: white;
        border-color: var(--primary, #1F4E7A);
    }

    /* ────────── Bottom-Sheet (statt Modal) ────────── */
    .mobile-sheet-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,0.55);
        z-index: 1060;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }
    .mobile-sheet-backdrop.visible { opacity: 1; pointer-events: auto; }
    .mobile-sheet {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        background: var(--card, #FFFFFF);
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
        padding: 8px 16px 16px 16px;
        max-height: 85%;
        overflow-y: auto;
        z-index: 1061;
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }
    .mobile-sheet.open { transform: translateY(0); }
    .mobile-sheet::before {
        content: '';
        display: block;
        width: 40px; height: 4px;
        background: #CBD5E1;
        border-radius: 999px;
        margin: 0 auto 12px auto;
    }

    /* ────────── Inputs auf Mobile großzügiger ────────── */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 1rem;
    }
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }

    /* Bootstrap-Tabellen horizontal scrollbar (Fallback bis Mobile-Karten-Layout fertig) */
    .table-responsive-shell {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Blazor-Reconnect-Banner darüber legen (über tab-bar) */
    #components-reconnect-modal.components-reconnect-show,
    #components-reconnect-modal.components-reconnect-failed,
    #components-reconnect-modal.components-reconnect-rejected {
        top: var(--mobile-header-h);
    }

    /* ────────── Mobile-Mehr-Sheet (statt Sidebar) ────────── */
    .mobile-more-sheet {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        background: var(--card, #FFFFFF);
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
        padding: 8px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
        max-height: 85vh;
        overflow-y: auto;
        z-index: 1061;
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }
    .mobile-more-sheet.open { transform: translateY(0); }
    .mobile-more-sheet::before {
        content: '';
        display: block;
        width: 40px; height: 4px;
        background: #CBD5E1;
        border-radius: 999px;
        margin: 0 auto 14px auto;
    }
    .mobile-more-sheet-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,0.55);
        z-index: 1060;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }
    .mobile-more-sheet-backdrop.visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* User-Card oben im Sheet */
    .mobile-more-user {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px;
        background: var(--bg, #F3F4F6);
        border-radius: 14px;
        margin-bottom: 16px;
    }
    .mobile-more-user-avatar {
        width: 48px; height: 48px;
        border-radius: 50%;
        background: var(--primary, #1F4E7A);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 1.05rem;
        flex-shrink: 0;
    }
    .mobile-more-user-name {
        font-weight: 700;
        color: var(--text-primary, #111827);
        font-size: 1rem;
    }
    .mobile-more-user-role {
        font-size: 0.78rem;
        color: var(--text-muted, #6B7280);
    }

    /* Menü-Tiles im Sheet — große Touch-Targets */
    .mobile-more-section-label {
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--text-muted, #6B7280);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        padding: 4px 4px 6px 4px;
        margin-top: 6px;
    }
    .mobile-more-tile {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px;
        background: var(--card, #FFFFFF);
        border-radius: 14px;
        border: 1px solid var(--border, #E5E7EB);
        margin-bottom: 8px;
        color: var(--text-primary, #111827);
        text-decoration: none;
        font-weight: 600;
        cursor: pointer;
        min-height: 64px;
    }
    .mobile-more-tile:active { background: var(--bg, #F3F4F6); }
    .mobile-more-tile i.tile-icon {
        font-size: 1.35rem;
        color: var(--primary, #1F4E7A);
        width: 28px;
        text-align: center;
    }
    .mobile-more-tile .tile-text { flex: 1; min-width: 0; }
    .mobile-more-tile .tile-sub {
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text-muted, #6B7280);
        margin-top: 1px;
    }
    .mobile-more-tile .tile-trail i {
        color: var(--text-muted, #6B7280);
        font-size: 1.1rem;
    }
    .mobile-more-tile.danger { color: #B91C1C; }
    .mobile-more-tile.danger i.tile-icon { color: #B91C1C; }

    /* ────────── Quick-Tiles (Sub-Nav auf Tab-Hauptseiten) ────────── */
    .mobile-quick-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }
    .mobile-quick-tile {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px;
        background: var(--card, #FFFFFF);
        border-radius: 14px;
        border: 1px solid var(--border, #E5E7EB);
        text-decoration: none;
        color: var(--text-primary, #111827);
        min-height: 96px;
        position: relative;
    }
    .mobile-quick-tile:active { background: var(--bg, #F3F4F6); }
    .mobile-quick-tile i.quick-icon {
        font-size: 1.35rem;
        color: var(--primary, #1F4E7A);
        background: #DBEAFE;
        width: 40px; height: 40px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-quick-tile .quick-title {
        font-weight: 700;
        font-size: 0.92rem;
    }
    .mobile-quick-tile .quick-sub {
        font-size: 0.74rem;
        color: var(--text-muted, #6B7280);
        font-weight: 500;
    }
    .mobile-quick-tile .quick-badge {
        position: absolute;
        top: 10px; right: 10px;
        min-width: 22px; height: 22px;
        padding: 0 7px;
        border-radius: 11px;
        background: #DC2626;
        color: white;
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 22px;
        text-align: center;
    }

    /* ────────── Section-Header (für Mobile-Inhaltsseiten) ────────── */
    .mobile-section-label {
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--text-muted, #6B7280);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin: 14px 4px 8px 4px;
    }
    .mobile-section-label.first { margin-top: 0; }

    /* ────────── Expand-Card (Aufsplittung-Items) ────────── */
    .mobile-expand-card {
        background: var(--card, #FFFFFF);
        border-radius: 16px;
        border: 1px solid var(--border, #E5E7EB);
        margin-bottom: 10px;
        overflow: hidden;
    }
    .mobile-expand-card .expand-head {
        padding: 12px 14px;
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;
    }
    .mobile-expand-card .expand-body {
        padding: 0 14px 14px 14px;
        border-top: 1px solid var(--border, #E5E7EB);
        padding-top: 12px;
    }

    /* ────────── Mini-Badges ────────── */
    .mobile-badge {
        font-size: 0.66rem;
        padding: 2px 8px;
        border-radius: 999px;
        font-weight: 700;
        white-space: nowrap;
    }
    .mobile-badge.primary { background: #DBEAFE; color: var(--primary, #1F4E7A); }
    .mobile-badge.success { background: #DCFCE7; color: #166534; }
    .mobile-badge.warn    { background: #FEF3C7; color: #92400E; }
    .mobile-badge.danger  { background: #FEE2E2; color: #991B1B; }
    .mobile-badge.muted   { background: var(--bg, #F3F4F6); color: var(--text-muted, #6B7280); }
    .mobile-badge.info    { background: rgba(61,191,160,0.18); color: var(--rwd-teal-700, #1F8F75); }

    /* ────────── Übergabe-Workflow: eigene Bottom-Bar ──────────
       Beim 4-Schritt-Wizard ist die Tab-Bar verwirrend — der Workflow
       hat eine eigene "Zurück / Weiter"-Bottom-Bar, fix unten, mit
       großem Hauptbutton rechts (Daumen-Sweet-Spot). Während der
       Workflow läuft, ist body.uebergabe-active gesetzt (toggled von
       UebergabeNeu.razor) und blendet die Tab-Bar aus. */
    body.uebergabe-active .mobile-tab-bar {
        display: none !important;
    }
    body.uebergabe-active .main-wrapper {
        padding-bottom: 96px;
    }

    .uebergabe-bottom-nav {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--card, #FFFFFF);
        border-top: 1px solid var(--border, #E5E7EB);
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) 16px;
        z-index: 1030;
        gap: 10px;
        margin: 0;
        box-shadow: 0 -2px 10px rgba(15,23,42,0.06);
        display: flex !important;
        align-items: center;
    }
    .uebergabe-bottom-nav hr,
    .uebergabe-bottom-nav-wrapper > hr { display: none; }
    .uebergabe-bottom-nav .btn-back-mobile {
        flex: 0 0 56px;
        width: 56px;
        min-height: 56px;
        padding: 0;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
    }
    .uebergabe-bottom-nav .btn-back-mobile .label-text { display: none; }
    .uebergabe-bottom-nav .btn-next-mobile,
    .uebergabe-bottom-nav .btn-submit-mobile {
        flex: 1;
        min-height: 56px;
        border-radius: 16px;
        font-size: 1.05rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    .uebergabe-bottom-nav .btn-submit-mobile {
        box-shadow: 0 4px 16px rgba(22,163,74,0.3);
    }

    /* Auf Mobile: Mobile-only Inhalte zeigen, Desktop-Tabellen verstecken */
    .desktop-only { display: none !important; }
}

/* Desktop: Bottom-Nav bleibt im normalen Layout-Flow (kein fixed) */
@media (min-width: 1200px) {
    .uebergabe-bottom-nav {
        /* Desktop: original Bootstrap-Layout via vorhandene Klassen */
    }
    .uebergabe-bottom-nav .btn-back-mobile .label-text {
        display: inline;
        margin-left: 4px;
    }
}

@media (min-width: 1200px) {
    .mobile-only { display: none !important; }
}

@media (min-width: 1200px) {
    /* Desktop: Mobile-Elemente NIE anzeigen, auch wenn DOM sie enthält */
    .mobile-tab-bar,
    .mobile-fab,
    .mobile-sheet,
    .mobile-sheet-backdrop,
    .mobile-more-sheet,
    .mobile-more-sheet-backdrop {
        display: none !important;
    }
}
