:root {
    --bg: #ffffff;
    --bg-subtle: #f5f7fa;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #e5e9f0;
    --border-strong: #cfd5e0;
    --text: #0f172a;
    --text-muted: #64748b;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-ring: rgba(37, 99, 235, 0.18);
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #fef2f2;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
    --transition-fast: 0.12s ease;
    --transition: 0.18s ease;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    overflow-x: hidden;
    max-width: 100vw;
}

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

h1 { font-size: 1.65rem; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; margin: 0 0 0.6rem; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 1rem; margin: 0 0 0.4rem; font-weight: 600; }

code {
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    color: var(--text);
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* === NAVIGATION === */
.topnav {
    background: #0a1628;
    border-bottom: 1px solid #0a1628;
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-toggle { display: none; }
.nav-burger {
    display: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 8px;
    color: var(--text);
    transition: background var(--transition-fast);
}
.nav-burger:hover { background: var(--bg-subtle); }
.nav-burger .icon-burger,
.nav-burger .icon-close {
    width: 24px;
    height: 24px;
    display: block;
}
.nav-burger .icon-close { display: none; }
.nav-toggle:checked ~ .nav-inner .nav-burger .icon-burger { display: none; }
.nav-toggle:checked ~ .nav-inner .nav-burger .icon-close { display: block; }

.nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.75rem;
    height: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}
.brand {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    height: 100%;
}
.brand:hover { color: inherit; }
.brand-logo {
    height: 64px;
    width: auto;
    display: block;
}
.nav-links { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.nav-links a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-user {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    margin-left: 0.6rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}
.nav-user strong { color: rgba(255, 255, 255, 0.85); }
.nav-logout {
    color: rgba(255, 255, 255, 0.7) !important;
}
.nav-logout:hover { background: rgba(239, 68, 68, 0.18) !important; color: #fca5a5 !important; }
.nav-burger { color: #fff !important; }
.nav-burger:hover { background: rgba(255,255,255,0.1) !important; }

.nav-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
    opacity: 0.85;
}

/* === LAYOUT === */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1.75rem 4rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* === CARDS === */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-xs);
}
.muted-card { background: var(--bg-subtle); border-style: dashed; }

.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
}
.empty-state h2 { margin-bottom: 0.35rem; }
.empty-state p { margin: 0 0 1.5rem; color: var(--muted); }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 550;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 2px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25), inset 0 -1px 0 rgba(0,0,0,0.08);
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--border-strong); color: var(--text); }

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

.btn-small { padding: 0.4rem 0.75rem; font-size: 0.85rem; border-radius: 6px; }
.btn-large { padding: 1rem 1.6rem; font-size: 1.02rem; }
.btn-block { width: 100%; margin-top: 0.25rem; }

/* === TABLES === */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th,
.data-table td {
    text-align: left;
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
.data-table thead tr {
    border-bottom: 1px solid var(--border);
}
.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: transparent;
}
.data-table tbody tr {
    transition: background var(--transition-fast);
}
.data-table tbody tr:hover { background: var(--bg-subtle); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.data-table th.actions { text-align: right; }

/* === FORMS === */
form label {
    display: block;
    margin-bottom: 1.1rem;
}
form label > span {
    display: block;
    font-size: 0.82rem;
    font-weight: 550;
    margin-bottom: 0.4rem;
    color: var(--text);
    letter-spacing: 0.005em;
}
form input[type="text"],
form input[type="password"],
form input[type="email"],
form input[type="date"],
form textarea,
form select {
    width: 100%;
    padding: 0.62rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
form input:hover,
form textarea:hover,
form select:hover {
    border-color: var(--border-strong);
}
form input:focus,
form textarea:focus,
form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-actions { display: flex; gap: 0.6rem; margin-top: 0.4rem; }
.form-card { max-width: 520px; }

/* === AUTH === */
.auth-wrap {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    overflow: hidden;
}
.auth-card h1 { margin-bottom: 0.3rem; font-size: 1.45rem; }
.auth-card > p.muted { margin-top: 0; margin-bottom: 1.5rem; }
.auth-card .btn-block {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #0a1628;
    border-color: #0a1628;
    color: #fff;
}
.auth-card .btn-block:hover {
    background: #1a2942;
    border-color: #1a2942;
    color: #fff;
}
.auth-brand {
    background: #0a1628;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -2rem -2rem 1.5rem;
}
.auth-brand-logo {
    height: 72px;
    width: auto;
    display: block;
}

/* === ALERTS === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(220, 38, 38, 0.25); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(22, 163, 74, 0.25); }

/* === QR-KARTE === */
.qr-print-area {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}
.qr-batch {
    display: grid;
    grid-template-columns: repeat(2, 85.6mm);
    gap: 4mm;
    justify-content: center;
    padding: 1rem 0;
}
.qr-card {
    --card-w: 85.6mm;
    --card-h: 53.98mm;
    --card-layout: row;
    --qr-col: 40mm;
    --qr-size: 34mm;
    --label-fs: 2.6mm;
    --name-fs: 4.5mm;
    --hint-fs: 2.4mm;
    --hint-display: block;
    width: var(--card-w);
    height: var(--card-h);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 2mm;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
    box-shadow: var(--shadow-sm);
}

.qr-size-tall .qr-card {
    --card-w: 36mm;
    --card-h: 60mm;
    --card-layout: column;
    --qr-size: 30mm;
    --label-fs: 1.9mm;
    --name-fs: 3.4mm;
    --hint-fs: 1.8mm;
}
.qr-size-square .qr-card {
    --card-w: 36mm;
    --card-h: 36mm;
    --qr-size: 32mm;
}
.qr-size-square .qr-card-inner {
    grid-template-rows: 1fr;
    place-items: center;
}
.qr-size-square .qr-meta { display: none; }
.qr-size-square .qr-code { padding: 1mm; }

.qr-card-inner {
    display: grid;
    grid-template-columns: var(--qr-col) 1fr;
    width: 100%;
    height: 100%;
    align-items: center;
}
.qr-size-tall .qr-card-inner,
.qr-size-square .qr-card-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    justify-items: center;
    align-items: start;
}
.qr-code {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2mm;
}
.qr-code img,
.qr-code canvas {
    width: var(--qr-size) !important;
    height: var(--qr-size) !important;
}
.qr-meta {
    padding: 2mm 3mm 2mm 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5mm;
}
.qr-size-tall .qr-meta,
.qr-size-square .qr-meta {
    padding: 0 1.5mm 1.5mm;
    text-align: center;
    align-items: center;
}
.qr-label {
    font-size: var(--label-fs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
}
.qr-size-square .qr-label { display: none; }
.qr-name {
    font-size: var(--name-fs);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}
.qr-hint {
    font-size: var(--hint-fs);
    color: var(--muted);
    margin-top: 0.6mm;
    display: var(--hint-display);
}

.qr-size-picker {
    display: inline-flex;
    gap: 0.4rem;
    background: #f3f4f6;
    padding: 3px;
    border-radius: 999px;
    margin: 0 0.5rem;
}
.qr-size-picker label {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
}
.qr-size-picker input { display: none; }
.qr-size-picker label:has(input:checked) { background: #111827; color: #fff; font-weight: 600; }
.qr-batch.qr-size-tall {
    grid-template-columns: repeat(5, 36mm);
    gap: 3mm;
}
.qr-batch.qr-size-square {
    grid-template-columns: repeat(5, 36mm);
    gap: 3mm;
}

/* === BEWERTUNGSFORMULAR (öffentlich, mobile) === */
body.bewerten-bg { background: #fdf8f0; }
body.bewerten-bg .question-block { background: #fffdf8; }
body.bewerten-bg form input[type="text"],
body.bewerten-bg form input[type="date"],
body.bewerten-bg form select,
body.bewerten-bg form textarea,
body.bewerten-bg .radio-option { background: #fffdf8; }

.bewerten-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.25rem 0.5rem 3rem;
}
.bewerten-head {
    text-align: center;
    margin-bottom: 1.75rem;
}
.bewerten-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 650;
    margin-bottom: 0.3rem;
}
.bewerten-head h1 { font-size: 1.7rem; margin: 0 0 0.3rem; }
.bewerten-head .muted { margin: 0; font-size: 0.9rem; }

.bewerten-form { display: flex; flex-direction: column; gap: 0.85rem; }

.question-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem 1.25rem;
    margin: 0;
    box-shadow: var(--shadow-xs);
}
.question-block-label {
    display: block;
    font-weight: 600;
    color: var(--text);
    font-size: 0.98rem;
    margin: 0 0 0.6rem;
    line-height: 1.35;
}

.radio-list { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.7rem; }
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.8rem 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.4;
    background: #fff;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.radio-option input {
    margin-top: 0.2rem;
    flex-shrink: 0;
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}
.radio-option:hover { border-color: var(--border-strong); }
.radio-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.radio-skip { border-style: dashed; color: var(--muted); }
.radio-skip:has(input:checked) {
    background: var(--bg-subtle);
    color: var(--text);
    border-style: solid;
    box-shadow: none;
}

.select-wrap { margin-top: 0.6rem; }
.skala-select {
    width: 100%;
    padding: 0.8rem 0.9rem;
    font-size: 1rem;
}

.einsatzdatum-wrap input[type="date"] {
    width: 100%;
    max-width: 280px !important;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    box-sizing: border-box;
}

.question-block textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    resize: vertical;
    margin-top: 0.6rem;
    min-height: 90px;
    line-height: 1.5;
}

/* === DANKE-SEITE === */
.danke-wrap {
    min-height: calc(100vh - 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.danke-card {
    max-width: 460px;
    width: 100%;
    text-align: center;
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.danke-check {
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: center;
}
.danke-card h1 { margin-bottom: 0.4rem; }
.danke-card p { margin: 0.5rem 0; color: var(--muted); }
.danke-card p strong { color: var(--text); }
.danke-card .btn { margin-top: 1.5rem; }

/* === AUSWERTUNG (Admin-Dashboard) === */
.auswertung-form { margin-bottom: 1.25rem; }
.quickbar {
    display: grid;
    grid-template-columns: minmax(200px, 1.2fr) minmax(170px, 1fr) auto auto;
    gap: 0.85rem 1rem;
    align-items: end;
    padding: 1rem 1.25rem;
    position: relative;
}
.quickbar-range {
    display: flex;
    gap: 0.6rem;
    align-items: end;
    flex-wrap: wrap;
}
.quickbar-range[hidden] { display: none !important; }
.quickbar-range .range-input {
    margin: 0;
    flex: 1 1 140px;
    min-width: 130px;
}
.quickbar-range input[type="date"] {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.quickbar-range input[type="date"]:hover { border-color: var(--border-strong); }
.quickbar-range input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.quickbar label { margin: 0; }
.quickbar label > span {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.quickbar select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.quickbar-filters {
    justify-self: end;
    align-self: end;
}
.quickbar-filters summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 550;
    color: var(--text);
    user-select: none;
    list-style: none;
    transition: all var(--transition-fast);
}
.quickbar-filters summary:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.quickbar-filters summary::-webkit-details-marker { display: none; }
.quickbar-filters summary .caret {
    width: 14px;
    height: 14px;
    transition: transform var(--transition-fast);
}
.quickbar-filters[open] summary .caret { transform: rotate(180deg); }
.quickbar-filters[open] summary {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.filter-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-lg);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeSlideIn 0.18s ease;
}
.filter-reset { margin-top: 0.2rem; }

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

@media (max-width: 980px) {
    .quickbar {
        grid-template-columns: 1fr 1fr;
    }
    .quickbar-range {
        grid-column: 1 / -1;
    }
    .quickbar-filters {
        grid-column: 1 / -1;
        justify-self: stretch;
    }
    .quickbar-filters summary { justify-content: center; width: 100%; }
}
@media (max-width: 720px) {
    .quickbar {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }
    .quickbar-range { flex-direction: row; gap: 0.6rem; }
    .quickbar-filters summary { justify-content: center; width: 100%; }
    .filter-panel { padding: 1rem; }
}
@media (max-width: 460px) {
    .quickbar-range { flex-direction: column; }
    .quickbar-range .range-input { flex: 1 1 100%; }
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}
.filter-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 100%;
}
.filter-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: #fff;
    cursor: pointer;
    font-size: 0.87rem;
    line-height: 1;
    transition: all var(--transition-fast);
}
.filter-chip input {
    margin: 0;
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.filter-chip span { line-height: 1; }
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 550;
}

.zeitraum-select {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: #fff;
    max-width: 280px;
    font-family: inherit;
    color: var(--text);
}

.auswertung-meta {
    margin: 0.25rem 0 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.auswertung-meta strong { color: var(--text); font-weight: 650; }

.auswertung-card {
    padding: 0;
    overflow: hidden;
}

/* === TABS === */
.question-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    background: var(--bg-subtle);
    gap: 0;
    padding: 0.35rem 0.35rem 0;
}
.question-tab {
    padding: 0.7rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    font-family: inherit;
    border-radius: 6px 6px 0 0;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.question-tab:hover { background: rgba(255,255,255,0.7); color: var(--text); }
.question-tab.active {
    background: var(--surface);
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.tab-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
}
.question-tab:not(.active) .tab-badge {
    background: var(--border-strong);
    color: var(--muted);
}

.question-panel { display: none; padding: 2rem; }
.question-panel.active { display: block; }
.question-panel h2 {
    margin-bottom: 1.1rem;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 650;
}

.chart-layout {
    display: grid;
    grid-template-columns: minmax(260px, 360px) 1fr;
    gap: 2.5rem;
    align-items: center;
}
.chart-wrap {
    position: relative;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}
.chart-legend { display: flex; flex-direction: column; gap: 0.65rem; }
.legend-item {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    gap: 0.8rem;
    align-items: center;
    font-size: 0.92rem;
}
.legend-swatch {
    width: 14px; height: 14px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}
.legend-label { color: var(--text); }
.legend-count {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-weight: 550;
}

@media (max-width: 820px) {
    .chart-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .question-tab { flex: 1 1 auto; }
    .question-panel { padding: 1.25rem; }
    .container { padding: 1.25rem 1rem 3rem; }
}

/* === KOMPETENZ-KARTEN === */
.kompetenz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.kompetenz-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.3rem;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition);
}
.kompetenz-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--k-color, var(--primary));
}
.kompetenz-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.kompetenz-label {
    font-weight: 650;
    font-size: 0.78rem;
    color: var(--k-color, var(--primary));
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.15rem;
}
.kompetenz-score {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0.1rem 0;
}
.kompetenz-value {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.kompetenz-unit {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
}
.kompetenz-recent {
    font-size: 0.88rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.kompetenz-recent strong { color: var(--text); }
.kompetenz-delta {
    font-variant-numeric: tabular-nums;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.3;
}
.kompetenz-delta.up { color: #15803d; background: #dcfce7; }
.kompetenz-delta.down { color: #b91c1c; background: #fee2e2; }
.kompetenz-delta.flat { color: var(--muted); background: var(--bg-subtle); }
.kompetenz-bar {
    height: 8px;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-top: 0.35rem;
}
.kompetenz-bar-fill {
    height: 100%;
    background: var(--k-color, var(--primary));
    border-radius: var(--radius-pill);
    transition: width 0.6s ease;
}
.kompetenz-desc {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.35rem;
    line-height: 1.45;
}
.kompetenz-section-title {
    font-size: 1.05rem;
    margin: 1.25rem 0 0.9rem;
    color: var(--text);
    font-weight: 650;
}

/* === ENTWICKLUNG === */
.entwicklung-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.toggle-group { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.toggle-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: #fff;
    cursor: pointer;
    font-size: 0.87rem;
    line-height: 1;
    transition: all var(--transition-fast);
}
.toggle-chip input {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.toggle-chip span { line-height: 1; }
.toggle-chip:hover { border-color: var(--border-strong); }
.toggle-chip:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 550;
}

.entwicklung-wrap {
    position: relative;
    width: 100%;
    height: 460px;
    touch-action: pan-y; /* vertikales Seiten-Scrollen bleibt, horizontal = Chart-Pan/Zoom */
}

.zoom-reset {
    padding: 0.35rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
}
.zoom-reset:hover { border-color: #94a3b8; background: #f8fafc; }

.chart-caption {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    line-height: 1.4;
}
.gap-swatch {
    display: inline-block;
    width: 18px;
    height: 11px;
    background: rgba(148, 163, 184, 0.16);
    border: 1px dashed rgba(148, 163, 184, 0.6);
    border-radius: 2px;
    flex: none;
}

/* Festes Hover-Info-Feld unter dem Diagramm (statt schwebendem Tooltip) */
.chart-hoverinfo {
    min-height: 2.5rem;
    margin: 0.7rem 0 0;
    padding: 0.5rem 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.88rem;
    color: #334155;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.1rem;
    line-height: 1.35;
    transition: background 0.12s, border-color 0.12s;
}
.chart-hoverinfo.active { background: #fff; border-color: #cbd5e1; }
.hoverinfo-date { font-weight: 700; color: #0f172a; }
.hoverinfo-line { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.hoverinfo-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.hoverinfo-hint { color: #94a3b8; font-style: italic; }

/* === BEWERTUNGEN TABELLE === */
.bewertungen-table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.bewertungen-table {
    font-size: 0.86rem;
    min-width: 920px;
}
.bewertungen-table th,
.bewertungen-table td { padding: 0.55rem 0.7rem; }
.bewertungen-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 550;
}
.bewertung-freitext {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

/* === COMMENTS === */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-width: 760px;
    margin: 0 auto;
}
.comments-list .comment {
    background: var(--bg-subtle);
    border-left: 3px solid var(--primary);
    padding: 1rem 1.2rem;
    margin: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.comments-list .comment p { margin: 0 0 0.4rem; line-height: 1.55; }
.comments-list .comment footer {
    color: var(--muted);
    font-size: 0.85rem;
}

/* === SELFVIEW === */
.selfview-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1rem 4rem;
}
.selfview-head {
    text-align: center;
    padding: 2rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}
.selfview-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 650;
    margin-bottom: 0.4rem;
}
.selfview-head h1 {
    font-size: 2.1rem;
    margin: 0;
    letter-spacing: -0.02em;
}
.selfview-head p { margin: 0.35rem 0 0; }
.selfview-section-title {
    font-size: 1.1rem;
    margin: 2rem 0 0.9rem;
    color: var(--text);
    font-weight: 650;
}

/* === REPORT (1-Seiten-PDF) === */
.report-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.75rem 2.25rem 2.25rem;
    background: #fff;
    font-size: 0.92rem;
}
.report-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--text);
    padding-bottom: 0.9rem;
    margin-bottom: 1.5rem;
}
.report-eyebrow {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 650;
}
.report-azubi {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.2rem;
    letter-spacing: -0.02em;
}
.report-meta {
    text-align: right;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

.report-section {
    margin-bottom: 1.6rem;
    page-break-inside: avoid;
}
.report-section h2 {
    font-size: 1.05rem;
    margin: 0 0 0.85rem;
}

.report-kompetenz-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
}
.report-kompetenz-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.9rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    position: relative;
    overflow: hidden;
}
.report-kompetenz-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--k-color);
}
.report-k-label {
    font-weight: 650;
    font-size: 0.75rem;
    color: var(--k-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.15rem;
}
.report-k-score { display: flex; align-items: baseline; gap: 0.2rem; }
.report-k-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.report-k-unit { color: var(--muted); font-size: 0.85rem; }
.report-k-recent { font-size: 0.78rem; color: var(--muted); }
.report-k-recent strong { color: var(--text); }
.report-k-gruppe { font-size: 0.76rem; color: var(--muted); }
.report-k-desc {
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 0.15rem;
}

.report-chart-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    display: flex;
    justify-content: center;
}

/* === PRINT-TOOLBAR === */
.print-toolbar {
    position: sticky;
    top: 0;
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.55rem;
    align-items: center;
    z-index: 10;
    box-shadow: var(--shadow-xs);
}
.print-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem 2.5rem;
    background: #fff;
}
.print-head {
    border-bottom: 2px solid var(--text);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.print-head h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
    color: var(--muted);
    font-weight: 500;
}
.print-azubi { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.02em; }
.print-meta {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 0.35rem;
}
.print-question {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.print-question h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }
.print-chart-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
    align-items: center;
}
.print-chart { width: 240px; height: 240px; }
.print-legend {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.88rem;
}

/* === RESPONSIVE ============================================ */

/* Tablet (<= 900px) */
@media (max-width: 900px) {
    .container { padding: 1.5rem 1.25rem 3rem; }

    /* Nav wraps gracefully */
    .nav-inner { padding: 0.7rem 1.1rem; gap: 0.5rem; }
    .nav-links { gap: 0.1rem; }
    .nav-links a .nav-icon { display: none; }

    /* Report grid: 3 -> auto-fit */
    .report-kompetenz-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .report-page { padding: 1.25rem 1.5rem; }
    .report-head { flex-direction: column; gap: 0.4rem; }
    .report-meta { text-align: left; }

    /* Print view chart row */
    .print-chart-row {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .print-chart { margin: 0 auto; }
    .print-legend { text-align: left; }
    .print-page { padding: 1.25rem 1.5rem; }
}

/* Mobile (<= 640px) */
@media (max-width: 640px) {
    body { font-size: 14.5px; }
    .container { padding: 1rem 0.9rem 2.5rem; }

    /* Navigation - Burger Menu */
    .nav-inner {
        padding: 0.6rem 0.9rem;
        gap: 0.5rem;
    }
    .brand-logo { height: 52px; }
    .nav-burger { display: inline-flex; align-items: center; justify-content: center; }

    /* Hide nav-links by default, show as drawer when toggle is checked */
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #0a1628;
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: var(--shadow-lg);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition), transform var(--transition), visibility 0s linear var(--transition);
        pointer-events: none;
    }
    .nav-toggle:checked ~ .nav-inner .nav-links {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity var(--transition), transform var(--transition);
    }
    .nav-links a {
        padding: 0.75rem 0.85rem;
        border-radius: 8px;
        font-size: 0.95rem;
        color: rgba(255, 255, 255, 0.85);
    }
    .nav-links a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
    .nav-links a .nav-icon {
        display: block !important;
        width: 18px;
        height: 18px;
    }
    .nav-user {
        display: block;
        padding: 0.75rem 0.85rem;
        color: rgba(255, 255, 255, 0.55);
        font-size: 0.85rem;
        border-left: none;
        margin-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0.35rem;
        padding-top: 0.65rem;
    }
    .nav-user strong { color: rgba(255, 255, 255, 0.9); }
    .nav-logout {
        color: rgba(255, 255, 255, 0.85) !important;
    }
    .nav-logout:hover {
        background: rgba(239, 68, 68, 0.18) !important;
        color: #fca5a5 !important;
    }

    /* Headings */
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.1rem; }

    /* Page head stacks, action buttons full width */
    .page-head { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; justify-content: center; }

    /* Cards */
    .card { padding: 1.1rem; border-radius: 10px; }
    .empty-state { padding: 2rem 1rem; }

    /* Tables - actions wrap cleanly */
    .data-table td.actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.35rem;
    }

    /* Card with scrollable table (default behaviour) */
    .card-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }
    /* Nur reguläre data-tables sollen scrollen; Card-Layout-Tabellen brauchen das nicht */
    .card-scroll .data-table {
        min-width: 560px;
    }
    .card-scroll .azubi-table,
    .card-scroll .bewertungen-table {
        min-width: 0;
    }

    /* Azubi-Liste: Tabelle → Karten-Layout auf Mobil */
    .azubi-list-card {
        background: transparent;
        border: none;
        padding: 0;
        box-shadow: none;
        overflow: visible;
    }
    .azubi-table {
        display: block;
        min-width: 0;
    }
    .azubi-table thead { display: none; }
    .azubi-table tbody { display: flex; flex-direction: column; gap: 0.7rem; }
    .azubi-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "name count"
            "meta meta"
            "actions actions";
        gap: 0.4rem 0.5rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 1rem 1.1rem;
        box-shadow: var(--shadow-xs);
    }
    .azubi-table tbody tr:hover { background: var(--surface); }
    .azubi-table td {
        display: block;
        padding: 0;
        border: none;
    }
    .azubi-table .cell-name {
        grid-area: name;
        font-size: 1.05rem;
    }
    .azubi-table .cell-name strong { font-weight: 650; }
    .azubi-table .cell-count {
        grid-area: count;
        text-align: right;
        font-variant-numeric: tabular-nums;
        font-weight: 650;
        color: var(--primary);
        font-size: 0.92rem;
    }
    .azubi-table .cell-count::after {
        content: " Bewertungen";
        color: var(--muted);
        font-weight: 500;
        font-size: 0.82rem;
    }
    .azubi-table .cell-meta {
        grid-area: meta;
        font-size: 0.82rem;
        color: var(--muted);
    }
    .azubi-table .cell-meta::before {
        content: "Angelegt am ";
    }
    .azubi-table .cell-actions {
        grid-area: actions;
        margin-top: 0.3rem;
        padding-top: 0.7rem;
        border-top: 1px dashed var(--border);
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        justify-content: flex-start;
    }
    .azubi-table .cell-actions .btn,
    .azubi-table .cell-actions form {
        flex: 1 1 auto;
    }
    .azubi-table .cell-actions form button { width: 100%; }

    /* Tabs - horizontal scroll with snap */
    .question-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        padding: 0.3rem 0.3rem 0;
        -webkit-overflow-scrolling: touch;
    }
    .question-tab {
        flex-shrink: 0;
        scroll-snap-align: start;
        padding: 0.6rem 0.85rem;
        font-size: 0.82rem;
    }
    .question-panel { padding: 1.1rem; }
    .question-panel h2 { font-size: 1.15rem; margin-bottom: 0.9rem; }

    /* Kompetenz cards: single column */
    .kompetenz-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .kompetenz-card { padding: 1rem 1.1rem; }
    .kompetenz-value { font-size: 2.1rem; }

    /* Chart heights smaller */
    .entwicklung-wrap { height: 340px; }
    .chart-wrap { max-width: 280px; }

    /* Quickbar stacks */
    .quickbar { padding: 0.85rem 1rem; gap: 0.7rem; }
    .filter-panel { padding: 1rem; left: 0.5rem; right: 0.5rem; }

    /* Legend more compact */
    .legend-item { font-size: 0.88rem; gap: 0.6rem; }

    /* Buttons - slightly larger touch targets */
    .btn-small { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
    .btn { padding: 0.65rem 1rem; }

    /* Bewerten form */
    .bewerten-wrap { padding: 0.5rem 0.4rem 2rem; }
    .bewerten-head h1 { font-size: 1.4rem; }
    .question-block { padding: 1rem 1.05rem 1.1rem; border-radius: 10px; }
    .question-block-label { font-size: 0.92rem; }
    .radio-option { padding: 0.75rem 0.85rem; font-size: 0.93rem; }
    .skala-select { padding: 0.75rem 0.85rem; font-size: 0.95rem; }

    /* Selfview */
    .selfview-wrap { padding: 0.5rem 0.5rem 3rem; }
    .selfview-head { padding: 1.25rem 0 1rem; }
    .selfview-head h1 { font-size: 1.65rem; }
    .selfview-section-title { margin: 1.5rem 0 0.7rem; }

    /* Danke-Karte */
    .danke-card { padding: 2.25rem 1.5rem; }

    /* Kompetenz-Delta-Pill darf schrumpfen */
    .kompetenz-recent { font-size: 0.85rem; }

    /* Report verdichtet */
    .report-page { padding: 1rem 1rem 1.5rem; font-size: 0.88rem; }
    .report-azubi { font-size: 1.4rem; }
    .report-kompetenz-grid { grid-template-columns: 1fr; }

    /* Toggle-Chips: voller Breite wirken erwachsener */
    .toggle-group { gap: 0.4rem; }
    .toggle-chip { font-size: 0.82rem; padding: 0.4rem 0.75rem; }

    /* Auswertung-Actions nicht mehr als Row sondern als Columns */
    .entwicklung-toolbar { flex-direction: column; align-items: stretch; gap: 0.7rem; }

    /* Azubi-Liste-Aktionen gestackt */
    .data-table td.actions .btn,
    .data-table td.actions form { flex: 1 1 auto; }

    /* Quickbar-Filter-Overlay geht eher zu voller Breite */
    .quickbar-filters { justify-self: stretch; }
    .quickbar-filters summary { width: 100%; justify-content: center; }

    /* Alerts etwas kompakter */
    .alert { padding: 0.65rem 0.85rem; font-size: 0.88rem; }

    /* Filter-Chips: kleiner aber mit mehr Breite */
    .filter-chip { font-size: 0.82rem; padding: 0.38rem 0.75rem; }
}

/* Sehr kleine Phones (<= 380px) */
@media (max-width: 380px) {
    h1 { font-size: 1.25rem; }
    .brand-logo { height: 44px; }
    .page-actions { flex-direction: column; }
    .page-actions .btn { width: 100%; }
    .auth-card { padding: 1.5rem 1.25rem; }
    .kompetenz-value { font-size: 1.9rem; }
    .data-table { font-size: 0.82rem; }
    .data-table th,
    .data-table td { padding: 0.55rem 0.4rem; }
}

/* Touch-Feedback auf Touch-Geräten: Hover-Effekte weniger aufdringlich */
@media (hover: none) {
    .kompetenz-card:hover { transform: none; box-shadow: var(--shadow-xs); }
    .data-table tbody tr:hover { background: transparent; }
    .btn-primary:hover { background: var(--primary); }
    .btn-secondary:hover { background: var(--surface); }
}

/* === SELFVIEW STATUS-PILL === */
.selfview-pill {
    display: inline-block;
    margin-left: 0.55rem;
    padding: 0.12rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.55;
    vertical-align: middle;
    white-space: nowrap;
}
.selfview-pill.is-active { background: #dcfce7; color: #166534; }
.selfview-pill.is-locked { background: #f1f5f9; color: #64748b; }

/* === SCROLLBARS (Webkit) === */
.bewertungen-table-wrap::-webkit-scrollbar,
.card-scroll::-webkit-scrollbar { height: 8px; }
.bewertungen-table-wrap::-webkit-scrollbar-track,
.card-scroll::-webkit-scrollbar-track { background: var(--bg-subtle); }
.bewertungen-table-wrap::-webkit-scrollbar-thumb,
.card-scroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}
.bewertungen-table-wrap::-webkit-scrollbar-thumb:hover,
.card-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* === ROLE PILLS === */
.role-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.role-pill.role-admin {
    background: var(--primary-soft);
    color: var(--primary-hover);
    border: 1px solid var(--primary-ring);
}
.role-pill.role-ansicht {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* === ASSIGN-GRID (User → Azubi Zuteilung) === */
.assign-controls {
    display: flex;
    gap: 0.4rem;
    margin: 0.5rem 0 0.75rem;
}
.assign-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.assign-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    font-size: 0.92rem;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.assign-item:hover { border-color: var(--border-strong); }
.assign-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.assign-item input {
    accent-color: var(--primary);
    width: 16px; height: 16px;
    flex-shrink: 0;
}

/* === CSV IMPORT === */
.csv-import-row {
    display: none;
    margin-bottom: 1.25rem;
}
.csv-import-row.is-open { display: block; }
.csv-import-form {
    padding: 1.1rem 1.25rem;
    border: 1px dashed var(--primary);
    background: var(--primary-soft);
}
.csv-import-head { margin-bottom: 0.85rem; }
.csv-import-controls {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}
.csv-import-controls input[type="file"] {
    flex: 1 1 280px;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.92rem;
    font-family: inherit;
}
@media (max-width: 640px) {
    .csv-import-controls { flex-direction: column; align-items: stretch; }
    .csv-import-controls input[type="file"] { width: 100%; flex: 1 1 auto; }
    .csv-import-controls .btn { width: 100%; }
}

/* ============================================================ */
/* === RESPONSIVE: VOLLSTÄNDIGES MOBILE-PASS ================== */
/* ============================================================ */

/* --- TABLET-ZONE (820–979px): Padding-Reduktion --- */
@media (min-width: 820px) and (max-width: 979px) {
    .container { padding-left: 1.25rem; padding-right: 1.25rem; }
    .card { padding: 1.1rem 1.2rem; }
    .quickbar { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
    .kompetenz-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

/* --- DESKTOP→TABLET (≤980px): Chart-Layout früher stacken --- */
@media (max-width: 980px) {
    .chart-grid { grid-template-columns: 1fr !important; }
    .entwicklung-wrap { height: auto !important; min-height: 320px; }
}

/* --- MOBILE-PHONE (≤640px): umfassende Anpassungen --- */
@media (max-width: 640px) {

    /* Container & Cards */
    .container { padding-left: 0.85rem; padding-right: 0.85rem; }
    .card { padding: 1rem 1.05rem; }

    /* Headlines */
    h1 { font-size: 1.35rem; line-height: 1.25; }
    h2 { font-size: 1.1rem; }

    /* Quickbar (Auswertung-Filter) → vollständig stacken */
    .quickbar {
        grid-template-columns: 1fr !important;
        gap: 0.55rem;
        padding: 0.75rem;
    }
    .quickbar > * { min-width: 0; }
    .quickbar-range {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }
    .quickbar-range .range-input { flex: 1 1 auto; min-width: 0; }

    /* Filter-Chips & Toggle-Chips */
    .filter-chips, .toggle-chips {
        gap: 0.3rem;
        flex-wrap: wrap;
    }
    .filter-chip, .toggle-chip {
        font-size: 0.78rem;
        padding: 0.32rem 0.6rem;
    }

    /* Filter-Panel als Bottom-Sheet */
    .filter-panel {
        position: fixed !important;
        left: 0.5rem; right: 0.5rem; top: auto;
        bottom: 0.5rem;
        max-height: 75vh;
        overflow-y: auto;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
    }

    /* Forms — alle Inputs Full-Width */
    .form-card, .form-section, form .form-grid { max-width: 100%; }
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem;
    }
    input[type="text"], input[type="email"], input[type="number"],
    input[type="password"], input[type="date"], input[type="search"],
    select, textarea {
        max-width: 100% !important;
        font-size: 16px; /* iOS Zoom-Schutz */
    }
    label { font-size: 0.9rem; }
    .form-actions { flex-direction: column; gap: 0.5rem; }
    .form-actions .btn { width: 100%; }

    /* Buttons in Action-Tabellen-Zellen — Stack statt Reihen */
    .data-table td.actions { flex-wrap: wrap; gap: 0.3rem; }
    .data-table td.actions .btn,
    .data-table td.actions form { flex: 1 1 auto; }
    .data-table td.actions form button { width: 100%; }

    /* ===== BEWERTUNGEN-TABELLE → CARD-LAYOUT ===== */
    .bewertungen-table-wrap {
        overflow-x: visible;
        border: none;
        background: transparent;
        margin-top: 0.85rem;
    }
    .bewertungen-table {
        display: block;
        min-width: 0;
        font-size: 0.88rem;
    }
    .bewertungen-table thead { display: none; }
    .bewertungen-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }
    .bewertungen-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "datum    durch"
            "kategorie rolle"
            "scores   scores"
            "text     text"
            "actions  actions";
        gap: 0.35rem 0.6rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.85rem 1rem;
        box-shadow: var(--shadow-xs);
    }
    .bewertungen-table tbody tr:hover { background: var(--surface); }
    .bewertungen-table td {
        display: block;
        padding: 0;
        border: none;
        position: relative;
        font-size: 0.88rem;
    }
    .bewertungen-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.68rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
        margin-bottom: 2px;
    }
    .bewertungen-table .cell-datum    { grid-area: datum; }
    .bewertungen-table .cell-durch    { grid-area: durch; text-align: right; }
    .bewertungen-table .cell-durch::before { text-align: right; }
    .bewertungen-table .cell-kategorie { grid-area: kategorie; }
    .bewertungen-table .cell-rolle    { grid-area: rolle; text-align: right; }
    .bewertungen-table .cell-rolle::before { text-align: right; }

    /* Scores als kompaktes Grid (5 Pillen) */
    .bewertungen-table .cell-score { display: none; }
    .bewertungen-table tbody tr::after {
        content: "";
        grid-area: scores;
        border-top: 1px dashed var(--border);
        margin-top: 0.25rem;
    }
    .bewertungen-table tbody tr {
        position: relative;
    }
    /* Score-Container per JS-loses CSS-Trick: einen container-Row faken durch flex auf alle scores */
    .bewertungen-table .cell-score {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 0.3rem;
        background: var(--bg-subtle);
        border-radius: 6px;
        font-weight: 600;
        font-size: 0.92rem;
        min-height: 50px;
    }
    .bewertungen-table .cell-score::before {
        font-size: 0.62rem;
        margin-bottom: 4px;
        white-space: nowrap;
        opacity: 0.75;
    }
    /* Container für scores via subgrid-emulation: 5 Spalten unterhalb der Header-Felder */
    .bewertungen-table tbody tr {
        grid-template-columns: repeat(5, 1fr);
        grid-template-areas:
            "datum    datum    durch    durch    durch"
            "kategorie kategorie kategorie rolle    rolle"
            "score1   score2   score3   score4   score5"
            "text     text     text     text     text"
            "actions  actions  actions  actions  actions";
    }
    .bewertungen-table .cell-score:nth-of-type(5) { grid-area: score1; }
    .bewertungen-table .cell-score:nth-of-type(6) { grid-area: score2; }
    .bewertungen-table .cell-score:nth-of-type(7) { grid-area: score3; }
    .bewertungen-table .cell-score:nth-of-type(8) { grid-area: score4; }
    .bewertungen-table .cell-score:nth-of-type(9) { grid-area: score5; }
    .bewertungen-table tbody tr::after { display: none; }

    .bewertungen-table .cell-text {
        grid-area: text;
        white-space: normal !important;
        max-width: 100% !important;
        font-size: 0.85rem;
        line-height: 1.4;
        color: var(--text);
        padding-top: 0.3rem;
        border-top: 1px dashed var(--border);
        margin-top: 0.2rem;
    }
    .bewertungen-table .cell-text:empty,
    .bewertungen-table .cell-text:has(:empty) { display: none; }

    .bewertungen-table .cell-actions {
        grid-area: actions;
        display: flex;
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--border);
        margin-top: 0.25rem;
    }
    .bewertungen-table .cell-actions::before { display: none; }
    .bewertungen-table .cell-actions form { display: inline-block; }

    /* ===== REPORT-VIEW ===== */
    .report-toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }
    .report-toolbar-right { width: 100%; justify-content: stretch; }
    .report-toolbar-right .btn { flex: 1 1 auto; }
    .report-view-toggle { width: 100%; }
    .report-view-toggle button,
    .report-view-toggle .btn { flex: 1; }
    .report-page { padding: 0.85rem 0.85rem 1.25rem; }
    .report-azubi { font-size: 1.3rem; }
    .report-kompetenz-grid,
    .report-chart-grid { grid-template-columns: 1fr !important; gap: 0.85rem; }

    /* ===== QR-BATCH ===== */
    .qr-select-toolbar {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    .qr-select-toolbar .qr-count { margin-left: 0 !important; width: 100%; }
    .qr-select-list {
        grid-template-columns: 1fr !important;
        gap: 0.4rem !important;
    }
    .qr-select-item { padding: 0.65rem 0.85rem !important; }
    .qr-size-picker { flex-wrap: wrap; }
    .qr-size-picker .btn { flex: 1 1 auto; }

    /* ===== SELFVIEW ===== */
    .selfview-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .selfview-meta { font-size: 0.85rem; }
    .comments-list { max-width: 100%; }

    /* ===== BEWERTEN-FORM ===== */
    .bewerten-wrap { max-width: 100%; }
    .radio-list { gap: 0.4rem; }
    .radio-option {
        padding: 0.85rem 0.95rem !important;
        font-size: 0.95rem;
        min-height: 44px;
    }
    .skala-select { font-size: 16px; height: 44px; }
    .bewerten-section { padding: 1rem 1.05rem; }
}

/* --- Sehr kleine Phones (≤420px) --- */
@media (max-width: 420px) {
    .container { padding-left: 0.7rem; padding-right: 0.7rem; }
    .card { padding: 0.85rem 0.9rem; }
    h1 { font-size: 1.2rem; }
    .bewertungen-table tbody tr {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "datum    durch"
            "kategorie rolle"
            "score1   score2"
            "score3   score4"
            "score5   score5"
            "text     text"
            "actions  actions";
        padding: 0.75rem 0.85rem;
    }
    .bewertungen-table .cell-score:nth-of-type(9) { justify-self: stretch; }
}
