:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --text-strong: #0f172a;
    --muted: #667085;
    --line: #dde4ee;
    --line-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eaf1ff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #15803d;
    --success-soft: #ecfdf3;
    --warning: #b45309;
    --warning-soft: #fff7ed;
    --info: #1d4ed8;
    --info-soft: #eff6ff;
    --violet: #7c3aed;
    --violet-soft: #f3e8ff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.055);
    --transition: 160ms ease;
}

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

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 0%, rgba(37, 99, 235, 0.055), transparent 30rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--primary);
}

/* Kopfzeile und Navigation */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(221, 228, 238, 0.9);
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(14px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    width: min(1180px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: max-content;
    color: var(--text-strong);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #ffffff;
    border-radius: 11px;
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    box-shadow: 0 7px 16px rgba(37, 99, 235, 0.2);
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-title {
    font-size: 15px;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.brand-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 11px;
    color: #475467;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
}

.nav-link:hover {
    color: var(--text-strong);
    background: #f1f5f9;
}

.nav-link.is-active {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-link-logout:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.nav-divider {
    width: 1px;
    height: 24px;
    margin: 0 4px;
    background: var(--line);
}

/* Allgemeines Seitenlayout */

.page-container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 46px 0 64px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.page-heading h1 {
    margin: 4px 0 6px;
    color: var(--text-strong);
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.page-heading p,
.section-heading p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.role-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 999px;
    background: #eff6ff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0 0 3px;
    color: var(--text-strong);
    font-size: 18px;
    letter-spacing: -0.015em;
}

.section-heading p {
    font-size: 13px;
}

.card {
    border: 1px solid rgba(221, 228, 238, 0.9);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

/* Dashboard */

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.dashboard-main {
    min-width: 0;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.app-card {
    display: flex;
    min-height: 300px;
    padding: 24px;
    flex-direction: column;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.app-card:hover {
    border-color: var(--line-strong);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.app-card-header,
.account-header,
.admin-card-copy {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-card h3,
.admin-card h3 {
    margin: 0;
    color: var(--text-strong);
    font-size: 17px;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.app-label,
.account-kicker {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.app-icon {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: var(--radius-md);
}

.app-icon svg {
    width: 23px;
    height: 23px;
}

.app-icon-blue {
    color: var(--primary);
    background: var(--primary-soft);
}

.app-icon-amber {
    color: var(--warning);
    background: var(--warning-soft);
}

.app-icon-violet {
    color: var(--violet);
    background: var(--violet-soft);
}

.app-description {
    margin: 22px 0 26px;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: auto;
}

.btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    transform: translateY(-1px);
}

.btn-primary,
button,
input[type="submit"] {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.16);
}

.btn-primary:hover,
button:hover,
input[type="submit"]:hover {
    color: #ffffff;
    background: var(--primary-hover);
}

.btn-secondary {
    color: #344054;
    border-color: var(--line);
    background: var(--surface);
}

.btn-secondary:hover {
    color: var(--text-strong);
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

.btn-danger {
    color: #ffffff;
    background: var(--danger);
}

.admin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 18px;
    padding: 20px 22px;
}

.admin-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.admin-actions {
    flex: 0 0 auto;
    margin-top: 0;
}

.account-card {
    position: sticky;
    top: 96px;
    padding: 24px;
}

.account-header {
    align-items: flex-start;
}

.account-avatar {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    color: #ffffff;
    border-radius: 14px;
    background: linear-gradient(145deg, #334155, #0f172a);
    font-size: 15px;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.account-header h2 {
    margin: 2px 0 0;
    color: var(--text-strong);
    font-size: 17px;
    line-height: 1.3;
}

.account-role {
    min-height: 23px;
    margin-top: 9px;
    padding: 2px 8px;
    font-size: 10px;
}

.account-details {
    margin: 22px 0;
    border-top: 1px solid #edf1f6;
}

.account-details > div {
    display: block;
    min-width: 0;
    padding: 13px 0;
    border-bottom: 1px solid #edf1f6;
}

.account-detail-wide {
    grid-column: auto;
}

.account-details dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.account-details dd {
    min-width: 0;
    margin: 0;
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 700;
}

.account-detail-email dd,
.account-details > div:nth-child(3) dd {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--text-strong);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Absicherung, falls auf dem Server noch das ältere Dashboard-Template liegt. */
.app-card .actions a[href$="/fahrzeugdatenbank/neu"],
.page-heading > .role-badge {
    display: none !important;
}

.status-pill {
    min-height: 23px;
    padding: 2px 8px;
    color: var(--muted);
    border-color: var(--line);
    background: var(--surface-soft);
    font-size: 10px;
}

.status-pill.is-positive {
    color: var(--success);
    border-color: #bbf7d0;
    background: var(--success-soft);
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

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

/* Formulare und Tabellen für die übrigen Templates */

form {
    max-width: 720px;
}

label {
    display: inline-block;
    margin-bottom: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    margin: 0 0 16px;
    padding: 9px 11px;
    color: var(--text-strong);
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: 0;
    margin: 0;
}

table {
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #475467;
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 750;
}

td {
    font-size: 13px;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fafcff;
}

table select,
table input {
    width: auto;
    min-height: 34px;
    margin: 0;
    padding: 5px 8px;
}

/* Meldungen */

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 22px;
}

.msg {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
}

.msg.success {
    color: var(--success);
    border-color: #bbf7d0;
    background: var(--success-soft);
}

.msg.danger,
.msg.error {
    color: #b91c1c;
    border-color: #fecaca;
    background: var(--danger-soft);
}

.msg.info {
    color: var(--info);
    border-color: #bfdbfe;
    background: var(--info-soft);
}

:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

@media (max-width: 1120px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .account-card {
        position: static;
    }
}

@media (max-width: 1020px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 14px 0 12px;
    }

    .main-nav {
        justify-content: flex-start;
        width: 100%;
        padding-bottom: 2px;
        overflow-x: auto;
    }

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

    .account-card {
        position: static;
    }
}

@media (max-width: 720px) {
    .topbar-inner,
    .page-container {
        width: min(100% - 28px, 1180px);
    }

    .brand-subtitle,
    .nav-divider {
        display: none;
    }

    .page-container {
        padding-top: 32px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 24px;
    }

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

    .app-card {
        min-height: 0;
    }

    .admin-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-actions,
    .actions {
        width: 100%;
    }

    .admin-actions .btn,
    .app-card .btn {
        flex: 1 1 auto;
    }

    .account-details > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}

/* Status-Badge in der allgemeinen Störungsliste */

.table-status {
    width: max-content;
    min-width: max-content;
    justify-self: start;
    white-space: nowrap;
}

.general-incident-summary > .table-status {
    grid-column: 5;
    grid-row: 1;
    justify-self: end;
}

@media (max-width: 900px) {
    .general-incident-summary > .table-status {
        grid-column: 4;
        grid-row: 2;
        justify-self: start;
    }
}

@media (max-width: 720px) {
    .general-incident-summary > .table-status {
        grid-column: 3;
        grid-row: 2;
    }
}

/* Ausklappbare Einträge der allgemeinen Störungsdatenbank */

.general-incident-summary {
    grid-template-columns: 18px 105px 48px minmax(0, 1fr) auto;
}

.general-incident-summary > .incident-chevron {
    grid-column: 1;
    grid-row: 1;
}

.general-incident-summary > .summary-date {
    grid-column: 2;
    grid-row: 1;
}

.general-incident-summary > .line-badge {
    grid-column: 3;
    grid-row: 1;
}

.general-incident-summary > .summary-content {
    grid-column: 4;
    grid-row: 1;
}

.general-incident-summary .line-badge {
    width: 42px;
    height: 42px;
}

.boolean-fact-list {
    display: grid;
    gap: 8px;
}

.boolean-fact-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.boolean-fact-list span {
    color: var(--muted);
    font-size: 10px;
}

.boolean-value {
    display: inline-flex;
    padding: 2px 7px;
    color: #475467;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    font-size: 9px;
    font-weight: 800;
}

.boolean-value.is-yes {
    color: var(--warning);
    border-color: #fed7aa;
    background: var(--warning-soft);
}

.repair-detail-panel {
    border-color: #fed7aa;
    background: var(--warning-soft);
}

.repair-data-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.repair-report-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: var(--surface);
}

.repair-report-box strong,
.repair-report-box span {
    display: block;
}

.repair-report-box strong {
    color: var(--text-strong);
    font-size: 12px;
}

.repair-report-box span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.repair-report-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
}

.repair-report-actions .btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10px;
}

.activity-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.activity-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 31px;
    padding: 5px 9px 5px 6px;
    color: #344054;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    font-size: 10px;
    font-weight: 700;
}

.activity-tag small {
    display: grid;
    width: 19px;
    height: 19px;
    place-items: center;
    color: var(--primary);
    border-radius: 6px;
    background: var(--primary-soft);
    font-size: 8px;
    font-weight: 800;
}

@media (max-width: 900px) {
    .general-incident-summary {
        grid-template-columns: 18px 90px 44px minmax(0, 1fr);
    }

    .general-incident-summary > .table-status {
        grid-column: 4;
        justify-self: start;
    }

    .general-incident-summary > .summary-content {
        grid-column: 4;
    }
}

@media (max-width: 720px) {
    .general-incident-summary {
        grid-template-columns: 16px 40px minmax(0, 1fr);
    }

    .general-incident-summary .summary-date {
        display: none;
    }

    .general-incident-summary > .line-badge {
        grid-column: 2;
    }

    .general-incident-summary > .summary-content {
        grid-column: 3;
    }

    .general-incident-summary > .table-status {
        grid-column: 3;
    }

    .repair-data-list {
        grid-template-columns: 1fr;
    }

    .repair-report-box,
    .repair-report-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .repair-report-actions .btn {
        width: 100%;
    }
}

/* Allgemeine Störungsdatenbank */

.choice-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.choice-fieldset legend {
    margin-bottom: 8px;
    color: #344054;
    font-size: 13px;
    font-weight: 650;
}

.top-gap {
    margin-top: 20px;
}

.radio-tile-grid {
    display: grid;
    gap: 8px;
}

.radio-tile-grid-lines {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.radio-tile-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.radio-tile {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.radio-tile input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.radio-tile span {
    display: grid;
    min-height: 44px;
    padding: 8px;
    place-items: center;
    color: #475467;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 750;
    transition: color var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.radio-tile:hover span {
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

.radio-tile input:checked + span {
    color: var(--primary);
    border-color: #93b4f4;
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.09);
}

.radio-tile input:focus-visible + span {
    outline: 3px solid rgba(37, 99, 235, 0.24);
    outline-offset: 2px;
}

.activity-choice-list {
    max-height: 360px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-choice-list .choice-item:nth-child(odd) {
    border-right: 1px solid #edf1f6;
}

.assessment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.assessment-item {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.assessment-item legend {
    min-height: 42px;
    line-height: 1.4;
}

.yes-no-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.yes-no-group label {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.yes-no-group input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.yes-no-group span {
    display: grid;
    min-height: 38px;
    place-items: center;
    color: #475467;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 11px;
    font-weight: 750;
}

.yes-no-group input:checked + span {
    color: var(--primary);
    border-color: #93b4f4;
    background: var(--primary-soft);
}

.conditional-panel {
    margin-top: 16px;
    padding: 18px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #f6f9ff;
}

.conditional-panel[hidden] {
    display: none;
}

.switch-row {
    display: flex !important;
    align-items: center;
    gap: 9px;
    width: fit-content;
    margin: 0;
    cursor: pointer;
}

.switch-row input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.time-grid {
    align-content: start;
}

.general-incidents-card {
    padding: 24px;
}

.general-incident-list {
    display: grid;
    gap: 9px;
}

.general-incident-row {
    display: grid;
    grid-template-columns: 105px 48px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 92px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.general-incident-row:hover {
    border-color: var(--line-strong);
    background: #fafcff;
}

.general-incident-date strong,
.general-incident-date small {
    display: block;
    white-space: nowrap;
}

.general-incident-date strong {
    color: var(--text-strong);
    font-size: 12px;
}

.general-incident-date small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.line-badge {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 800;
}

.general-incident-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.general-incident-location {
    color: var(--primary);
    font-size: 10px;
    font-weight: 750;
}

.general-incident-main > strong {
    margin-top: 3px;
    overflow: hidden;
    color: var(--text-strong);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-status.is-open {
    color: #b91c1c;
    border-color: #fecaca;
    background: var(--danger-soft);
}

@media (max-width: 900px) {
    .radio-tile-grid-lines {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

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

    .assessment-item legend {
        min-height: 0;
    }

    .general-incident-row {
        grid-template-columns: 90px 42px minmax(0, 1fr);
    }

    .general-incident-row > .table-status {
        grid-column: 3;
        justify-self: start;
    }
}

@media (max-width: 720px) {
    .radio-tile-grid-lines {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .activity-choice-list {
        grid-template-columns: 1fr;
    }

    .activity-choice-list .choice-item:nth-child(odd) {
        border-right: 0;
    }

    .general-incidents-card {
        padding: 18px;
    }

    .general-incident-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .general-incident-date {
        display: none;
    }

    .general-incident-row > .table-status {
        grid-column: 2;
    }
}

/* Ausklappbare Fahrzeugstörungen */

.incident-list {
    display: grid;
    gap: 10px;
}

.incident-entry {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.incident-entry:hover,
.incident-entry[open] {
    border-color: var(--line-strong);
}

.incident-entry[open] {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.incident-summary {
    display: grid;
    grid-template-columns: 18px 105px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 86px;
    padding: 14px 16px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.incident-summary::-webkit-details-marker {
    display: none;
}

.incident-summary:hover {
    background: #fafcff;
}

.incident-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(-45deg);
    transition: transform var(--transition);
}

.incident-entry[open] .incident-chevron {
    transform: rotate(45deg) translate(-2px, -2px);
}

.summary-date strong,
.summary-date small {
    display: block;
    white-space: nowrap;
}

.summary-date strong {
    color: var(--text-strong);
    font-size: 12px;
}

.summary-date small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.summary-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.summary-topline {
    display: flex;
    align-items: center;
    gap: 7px;
}

.summary-kind {
    color: var(--primary);
    font-size: 10px;
    font-weight: 750;
}

.summary-title {
    margin-top: 3px;
    overflow: hidden;
    color: var(--text-strong);
    font-size: 13px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.incident-expanded {
    padding: 0 16px 16px;
    border-top: 1px solid var(--line);
    background: #fbfcfe;
}

.incident-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 16px;
}

.incident-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid #e7ecf3;
    border-radius: 11px;
    background: var(--surface);
}

.incident-panel-wide {
    grid-column: span 2;
}

.incident-panel h3 {
    margin: 0 0 13px;
    color: var(--text-strong);
    font-size: 12px;
    letter-spacing: 0.01em;
}

.incident-panel > p {
    margin: 0;
    color: var(--text);
    font-size: 12px;
}

.incident-data-list {
    display: grid;
    gap: 13px;
    margin: 0;
}

.incident-data-list.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.incident-data-list dt {
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.incident-data-list dd {
    margin: 3px 0 0;
    color: var(--text-strong);
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.person-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.person-chip {
    display: inline-flex;
    padding: 6px 9px;
    flex-direction: column;
    color: #344054;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    font-size: 11px;
    font-weight: 700;
}

.person-chip small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
}

.preserve-lines {
    white-space: pre-wrap;
}

.empty-value {
    color: var(--muted) !important;
    font-style: italic;
}

.remedy-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.remedy-item {
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
}

.remedy-item > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.remedy-item strong {
    color: var(--text-strong);
    font-size: 11px;
}

.remedy-item span {
    color: var(--primary);
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.remedy-item p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 11px;
    white-space: pre-wrap;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.thumbnail-button {
    position: relative;
    display: block;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #e8edf4;
    box-shadow: none;
    aspect-ratio: 4 / 3;
}

.thumbnail-button:hover {
    background: #e8edf4;
    transform: translateY(-1px);
}

.thumbnail-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 220ms ease;
}

.thumbnail-button:hover img {
    transform: scale(1.035);
}

.thumbnail-button span {
    position: absolute;
    right: 7px;
    bottom: 7px;
    padding: 3px 7px;
    color: #ffffff;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.78);
    font-size: 9px;
    font-weight: 700;
}

.image-lightbox {
    width: min(94vw, 1200px);
    max-width: none;
    height: min(92vh, 900px);
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #0b1220;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.image-lightbox::backdrop {
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(3px);
}

.lightbox-content {
    position: relative;
    display: grid;
    width: 100%;
    height: 100%;
    padding: 18px;
    grid-template-rows: minmax(0, 1fr) auto;
    place-items: center;
}

.lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-content p {
    margin: 10px 48px 0;
    color: #cbd5e1;
    font-size: 11px;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: none;
    font-size: 24px;
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(30, 41, 59, 0.95);
}

.incident-empty-state {
    padding: 30px;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    background: var(--surface-soft);
    text-align: center;
}

@media (max-width: 720px) {
    .incident-summary {
        grid-template-columns: 16px minmax(0, 1fr) auto;
        gap: 10px;
    }

    .summary-date {
        display: none;
    }

    .summary-meta {
        flex-wrap: wrap;
    }

    .incident-info-grid {
        grid-template-columns: 1fr;
    }

    .incident-panel-wide {
        grid-column: auto;
    }

    .incident-data-list.compact,
    .remedy-list {
        grid-template-columns: 1fr;
    }

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

    .image-lightbox {
        width: 96vw;
        height: 88vh;
    }
}

/* Fahrzeugdetail */

.page-actions {
    margin-top: 0;
}

.vehicle-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: 18px;
}

.vehicle-summary-card,
.revision-card,
.vehicle-note-card,
.incidents-card {
    padding: 24px;
}

.vehicle-card-heading,
.incidents-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.vehicle-number {
    display: block;
    color: var(--text-strong);
    font-size: 27px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.vehicle-type {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.detail-list,
.revision-list {
    display: grid;
    margin: 24px 0 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-list > div,
.revision-list > div {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.detail-list dt,
.revision-list dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.detail-list dd,
.revision-list dd {
    margin: 4px 0 0;
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 750;
}

.card-section-title h2,
.vehicle-note-card h2 {
    margin: 0;
    color: var(--text-strong);
    font-size: 17px;
    letter-spacing: -0.015em;
}

.card-section-title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.revision-list {
    grid-template-columns: 1fr;
}

.vehicle-note-card {
    margin-top: 18px;
}

.vehicle-note-card p {
    margin: 10px 0 0;
    color: var(--muted);
    white-space: pre-wrap;
}

.incidents-card {
    margin-top: 18px;
}

.incidents-heading {
    margin-bottom: 18px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.incidents-table {
    min-width: 760px;
    box-shadow: none;
}

.date-cell strong,
.date-cell small {
    display: block;
    white-space: nowrap;
}

.date-cell small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.incident-description {
    min-width: 260px;
    max-width: 520px;
}

.incident-id {
    margin-right: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.table-status {
    display: inline-flex;
    padding: 3px 8px;
    color: var(--warning);
    border: 1px solid #fed7aa;
    border-radius: 999px;
    background: var(--warning-soft);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.table-status.is-done {
    color: var(--success);
    border-color: #bbf7d0;
    background: var(--success-soft);
}

.table-empty {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 820px) {
    .vehicle-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .page-actions,
    .incidents-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-actions .btn,
    .incidents-heading .btn {
        width: 100%;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Formular: Fahrzeugstörung erfassen */

.page-heading-form {
    align-items: center;
}

.incident-form {
    display: grid;
    max-width: none;
    gap: 18px;
}

.form-section {
    padding: 26px;
}

.form-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.form-section-heading h2 {
    margin: 0;
    color: var(--text-strong);
    font-size: 17px;
    letter-spacing: -0.015em;
}

.form-section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.section-number {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    color: var(--primary);
    border-radius: 8px;
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.form-grid-wide-gap {
    gap: 28px;
}

.field {
    min-width: 0;
}

.field-span-2 {
    grid-column: span 2;
}

.field label {
    display: inline-block;
}

.field input,
.field select,
.field textarea {
    margin-bottom: 0;
}

.field textarea {
    display: block;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

.required {
    color: var(--danger);
}

.choice-search {
    margin-bottom: 9px !important;
}

.choice-list {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.choice-list-scroll {
    max-height: 330px;
    overflow-y: auto;
}

.choice-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin: 0;
    padding: 9px 11px;
    border-bottom: 1px solid #edf1f6;
    cursor: pointer;
}

.choice-item:last-child {
    border-bottom: 0;
}

.choice-item:hover {
    background: var(--surface-soft);
}

.choice-item[hidden] {
    display: none;
}

.choice-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    accent-color: var(--primary);
}

.choice-item span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.choice-item strong {
    color: var(--text-strong);
    font-size: 12px;
    font-weight: 700;
}

.choice-item small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}

.choice-item-with-comment {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(140px, 0.8fr);
    cursor: default;
}

.choice-item-with-comment > label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin: 0;
    cursor: pointer;
}

.choice-comment {
    min-height: 34px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
}

.choice-comment:disabled {
    color: #98a2b3;
    background: #f8fafc;
    cursor: not-allowed;
}

.upload-box {
    position: relative;
    display: grid;
    min-height: 150px;
    padding: 24px;
    place-items: center;
    text-align: center;
    border: 1px dashed #9db4d2;
    border-radius: 14px;
    background: #f8fbff;
    transition: border-color var(--transition), background var(--transition);
}

.upload-box:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.upload-box input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.upload-box label {
    display: flex;
    align-items: center;
    margin: 0;
    flex-direction: column;
    color: var(--primary);
    cursor: pointer;
}

.upload-box label span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.selected-files {
    min-height: 18px;
    margin-top: 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.permission-note {
    padding: 14px;
    color: var(--warning);
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: var(--warning-soft);
    font-size: 13px;
    font-weight: 600;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

@media (max-width: 720px) {
    .page-heading-form {
        align-items: stretch;
    }

    .form-section {
        padding: 20px;
    }

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

    .field-span-2 {
        grid-column: auto;
    }

    .choice-item-with-comment {
        grid-template-columns: 1fr;
    }

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

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

/* Suche und Filter der allgemeinen Störungsdatenbank */

.page-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-toggle-button {
    position: relative;
}

.filter-toggle-button.is-active {
    color: var(--primary);
    border-color: #bfdbfe;
    background: var(--primary-soft);
}

.filter-active-dot {
    width: 7px;
    height: 7px;
    margin-left: 2px;
    border-radius: 999px;
    background: var(--primary);
}

.incident-filter-card {
    margin-bottom: 18px;
    padding: 24px;
}

.filter-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.filter-card-heading h2 {
    margin: 4px 0 0;
    color: var(--text-strong);
    font-size: 18px;
    letter-spacing: -0.02em;
}

.filter-reset-link {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.filter-reset-link:hover {
    color: var(--primary);
}

.incident-filter-form {
    display: grid;
    max-width: none;
    gap: 20px;
}

.incident-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px 18px;
}

.filter-keyword-field {
    grid-column: span 2;
}

.filter-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 2px;
}

.incident-empty-state a {
    margin-left: 5px;
    font-weight: 700;
}

@media (max-width: 1000px) {
    .incident-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .page-heading-actions {
        justify-content: stretch;
    }

    .page-heading-actions .btn {
        flex: 1 1 auto;
    }

    .incident-filter-card {
        padding: 20px;
    }

    .filter-card-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .incident-filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-keyword-field {
        grid-column: auto;
    }

    .filter-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

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

/* Moderne Fahrzeugübersicht */

.vehicle-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.vehicle-stat-card {
    position: relative;
    min-height: 126px;
    padding: 20px 22px;
    overflow: hidden;
}

.vehicle-stat-card::after {
    position: absolute;
    right: -24px;
    bottom: -34px;
    width: 90px;
    height: 90px;
    border-radius: 999px;
    background: var(--primary-soft);
    content: "";
    opacity: 0.8;
}

.vehicle-stat-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.vehicle-stat-card > strong {
    display: block;
    position: relative;
    z-index: 1;
    color: var(--text-strong);
    font-size: 27px;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.vehicle-stat-card > small {
    display: block;
    position: relative;
    z-index: 1;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
}

.vehicle-stat-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform var(--transition),
        border-color var(--transition),
        box-shadow var(--transition);
}

.vehicle-stat-link:hover {
    color: inherit;
    border-color: #bfdbfe;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
    transform: translateY(-2px);
}

.vehicle-stat-link.is-active {
    border-color: #93c5fd;
    background: #f8fbff;
}

.vehicle-stat-link-label {
    position: absolute;
    z-index: 1;
    top: 20px;
    right: 22px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
}

.vehicle-filter-card {
    margin-bottom: 18px;
}

.vehicle-list-card {
    padding: 0;
    overflow: hidden;
}

.vehicle-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.vehicle-table-scroll {
    overflow-x: auto;
}

.vehicle-overview-table {
    min-width: 980px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.vehicle-overview-table th {
    padding: 11px 18px;
    color: var(--muted);
    background: #fbfcfe;
    font-size: 10px;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.vehicle-overview-table td {
    padding: 15px 18px;
}

.vehicle-overview-table tbody tr {
    transition: background var(--transition);
}

.vehicle-overview-table tbody tr:hover {
    background: #f8fbff;
}

.vehicle-identity,
.vehicle-incident-counts,
.vehicle-revision-cell {
    display: grid;
    gap: 4px;
}

.vehicle-list-number {
    color: var(--text-strong);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.vehicle-identity small,
.vehicle-incident-counts small {
    color: var(--muted);
    font-size: 10px;
}

.vehicle-badge-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.vehicle-type-badge,
.vehicle-lzb-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 800;
}

.vehicle-type-badge {
    color: var(--primary);
    border: 1px solid #bfdbfe;
    background: var(--primary-soft);
}

.vehicle-lzb-badge {
    color: #475467;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.vehicle-station {
    color: #344054;
    font-size: 12px;
}

.vehicle-revision-cell span {
    color: #344054;
    font-size: 11px;
    white-space: nowrap;
}

.vehicle-revision-cell small {
    display: inline-flex;
    min-width: 27px;
    margin-right: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
}

.vehicle-action-count {
    color: #344054;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.vehicle-problem-badge {
    display: inline-flex;
    width: max-content;
    margin-top: 2px;
    padding: 3px 7px;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: var(--danger-soft);
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.vehicle-activity-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.vehicle-activity-status > span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 3px var(--success-soft);
}

.vehicle-activity-status.is-inactive {
    color: var(--muted);
}

.vehicle-activity-status.is-inactive > span {
    box-shadow: 0 0 0 3px var(--surface-soft);
}

.vehicle-action-cell {
    width: 1%;
    white-space: nowrap;
}

.vehicle-detail-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10px;
}

.vehicle-empty-state {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 54px 24px;
    color: var(--muted);
    text-align: center;
}

.vehicle-empty-state strong {
    color: var(--text-strong);
    font-size: 16px;
}

.vehicle-empty-state .btn {
    margin-top: 6px;
}

.vehicle-overview-table .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1000px) {
    .vehicle-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .vehicle-stat-grid {
        gap: 10px;
    }

    .vehicle-stat-card {
        min-height: 112px;
        padding: 17px;
    }

    .vehicle-stat-card > strong {
        font-size: 23px;
    }

    .vehicle-list-heading {
        padding: 19px 20px;
    }
}

/* Finale Grid-Ausrichtung der allgemeinen Störungsliste.
   Muss nach den Basisregeln für .incident-summary stehen. */

.incident-summary.general-incident-summary {
    grid-template-areas: "chevron date line content status";
    grid-template-columns: 18px 105px 48px minmax(0, 1fr) auto;
}

.general-incident-summary > .incident-chevron {
    grid-area: chevron;
}

.general-incident-summary > .summary-date {
    grid-area: date;
}

.general-incident-summary > .line-badge {
    grid-area: line;
}

.general-incident-summary > .summary-content {
    grid-area: content;
}

.general-incident-summary > .table-status {
    grid-area: status;
    justify-self: end;
}

@media (max-width: 900px) {
    .incident-summary.general-incident-summary {
        grid-template-areas:
            "chevron date line content"
            ". . . status";
        grid-template-columns: 18px 90px 44px minmax(0, 1fr);
    }

    .general-incident-summary > .table-status {
        justify-self: start;
    }
}

@media (max-width: 720px) {
    .incident-summary.general-incident-summary {
        grid-template-areas:
            "chevron line content"
            ". . status";
        grid-template-columns: 16px 40px minmax(0, 1fr);
    }

    .general-incident-summary > .summary-date {
        display: none;
    }
}

/* Benutzerverwaltung */

.user-page {
    display: grid;
    gap: 20px;
}

.user-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.user-page-header h1 {
    margin: 5px 0 6px;
}

.user-page-header p {
    margin: 0;
    color: #64748b;
}

.user-eyebrow {
    color: #2563eb;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.user-list-card,
.user-edit-card {
    padding: 0;
    overflow: hidden;
}

.user-search-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: none;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.user-search-field {
    flex: 1;
    min-width: 260px;
}

.user-search-field label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-search-field input {
    margin: 0;
}

.user-search-form .btn {
    flex: 0 0 auto;
}

.user-list-summary {
    padding: 13px 20px;
    color: #64748b;
    font-size: 0.84rem;
    border-bottom: 1px solid #e2e8f0;
}

.user-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.user-table {
    width: 100%;
    min-width: 1080px;
    margin: 0;
    border-collapse: collapse;
}

.user-table th,
.user-table td {
    padding: 14px 15px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0;
}

.user-table th {
    color: #475569;
    background: #f8fafc;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.user-table tbody tr:last-child td {
    border-bottom: 0;
}

.user-table tbody tr:hover {
    background: #f8fbff;
}

.user-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.user-sort-link:hover {
    color: #2563eb;
}

.user-sort-icon {
    color: #2563eb;
    font-size: 0.65rem;
}

.user-sort-inactive {
    color: #94a3b8;
}

.user-id {
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.user-email span {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role-badge,
.user-status-badge,
.user-id-label {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.user-role-admin {
    color: #6d28d9;
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.user-role-moderator {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.user-role-mitarbeiter {
    color: #334155;
    background: #f8fafc;
}

.user-role-leser {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.user-status-active {
    color: #15803d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.user-status-inactive {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.user-status-neutral {
    color: #475569;
    background: #f8fafc;
}

.user-action-column {
    width: 1%;
}

.user-manage-button {
    white-space: nowrap;
}

.user-empty-state {
    padding: 36px !important;
    color: #64748b;
    text-align: center !important;
}

.user-edit-card {
    padding: 24px;
}

.user-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.user-section-heading h2 {
    margin: 0 0 5px;
}

.user-section-heading p {
    margin: 0;
    color: #64748b;
}

.user-id-label {
    color: #475569;
    background: #f8fafc;
}

.user-admin-form {
    max-width: none;
}

.user-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.user-form-field label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 700;
}

.user-form-field input,
.user-form-field select {
    width: 100%;
    margin: 0;
}

.user-form-wide {
    grid-column: 1 / -1;
}

.user-permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.user-permission-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
}

.user-permission-option input {
    width: auto;
    margin: 3px 0 0;
}

.user-permission-option span {
    display: grid;
    gap: 3px;
}

.user-permission-option small {
    color: #64748b;
}

.user-account-notice {
    margin: 18px 0;
    padding: 12px 14px;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
}

.user-form-actions {
    margin-top: 22px;
}

@media (max-width: 760px) {
    .user-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .user-search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .user-form-grid,
    .user-permission-grid {
        grid-template-columns: 1fr;
    }

    .user-form-wide {
        grid-column: auto;
    }

    .user-section-heading {
        flex-direction: column;
    }
}
/* Statusfarben der allgemeinen Störungsdatenbank */

.table-status.is-not-responsible {
    color: #854d0e;
    background: #fefce8;
    border-color: #fde047;
}

.table-status.is-provisional {
    color: #c2410c;
    background: #fff7ed;
    border-color: #fdba74;
}
.table-status.is-no-fault {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.edit-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 12px;
}

.edit-image-card {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
}

.edit-image-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
}

.edit-image-card span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
}

.edit-image-card input {
    width: auto;
    margin: 0;
}

.edit-image-card:has(input:checked) {
    border-color: #fca5a5;
    background: #fef2f2;
}

/* Dark Mode und Darstellungsumschalter */

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.theme-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    flex: 0 0 38px;
    place-items: center;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: none;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--line-strong);
    background: var(--surface-soft);
    box-shadow: none;
    transform: none;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

html[data-theme="light"] .theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun {
    display: none;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-soft: #172033;
    --text: #d7e0ed;
    --text-strong: #f8fafc;
    --muted: #94a3b8;
    --line: #263449;
    --line-strong: #3b4b63;
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-soft: #172554;
    --danger: #f87171;
    --danger-soft: #35151c;
    --success: #4ade80;
    --success-soft: #12291c;
    --warning: #fbbf24;
    --warning-soft: #33230d;
    --info: #60a5fa;
    --info-soft: #142341;
    --violet: #c084fc;
    --violet-soft: #2c1640;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-card: 0 14px 38px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 15% 0%, rgba(96, 165, 250, 0.08), transparent 30rem),
        var(--bg);
}

html[data-theme="dark"] .topbar {
    border-bottom-color: rgba(38, 52, 73, 0.94);
    background: rgba(11, 17, 32, 0.92);
}

html[data-theme="dark"] .nav-link,
html[data-theme="dark"] label,
html[data-theme="dark"] .choice-fieldset legend,
html[data-theme="dark"] .boolean-value,
html[data-theme="dark"] .activity-tag,
html[data-theme="dark"] .vehicle-lzb-badge,
html[data-theme="dark"] .vehicle-station,
html[data-theme="dark"] .vehicle-revision-cell span,
html[data-theme="dark"] .vehicle-action-count,
html[data-theme="dark"] .user-search-field label,
html[data-theme="dark"] .user-form-field label,
html[data-theme="dark"] .edit-image-card span {
    color: var(--text);
}

html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link.is-active {
    color: var(--text-strong);
    background: var(--primary-soft);
}

html[data-theme="dark"] .nav-link.is-active {
    color: var(--primary);
}

html[data-theme="dark"] .btn-secondary {
    color: var(--text);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    color: var(--text-strong);
    background: var(--surface);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #718096;
    opacity: 1;
}

html[data-theme="dark"] select option {
    color: var(--text);
    background: var(--surface);
}

html[data-theme="dark"] .account-details,
html[data-theme="dark"] .account-details > div,
html[data-theme="dark"] .choice-item,
html[data-theme="dark"] .activity-choice-list .choice-item:nth-child(odd),
html[data-theme="dark"] .user-search-form,
html[data-theme="dark"] .user-list-summary,
html[data-theme="dark"] .user-table th,
html[data-theme="dark"] .user-table td {
    border-color: var(--line);
}

html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .general-incident-row:hover,
html[data-theme="dark"] .incident-summary:hover,
html[data-theme="dark"] .vehicle-overview-table tbody tr:hover,
html[data-theme="dark"] .user-table tbody tr:hover {
    background: #152035;
}

html[data-theme="dark"] th,
html[data-theme="dark"] .vehicle-overview-table th,
html[data-theme="dark"] .user-table th {
    color: var(--muted);
    background: #151e2e;
}

html[data-theme="dark"] .incident-expanded,
html[data-theme="dark"] .conditional-panel,
html[data-theme="dark"] .vehicle-stat-link.is-active {
    background: #0f1727;
}

html[data-theme="dark"] .incident-panel {
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] .radio-tile span,
html[data-theme="dark"] .yes-no-group span,
html[data-theme="dark"] .repair-report-box,
html[data-theme="dark"] .user-permission-option,
html[data-theme="dark"] .user-account-notice,
html[data-theme="dark"] .user-id-label,
html[data-theme="dark"] .edit-image-card {
    color: var(--text);
    border-color: var(--line);
    background: var(--surface-soft);
}

html[data-theme="dark"] .radio-tile input:checked + span,
html[data-theme="dark"] .yes-no-group input:checked + span {
    color: var(--primary);
    border-color: #3b82f6;
    background: var(--primary-soft);
}

html[data-theme="dark"] .choice-comment:disabled {
    color: #64748b;
    background: #0f1727;
}

html[data-theme="dark"] .upload-box {
    border-color: #49617f;
    background: #101a2d;
}

html[data-theme="dark"] .upload-box:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

html[data-theme="dark"] .upload-box label {
    color: var(--primary);
}

html[data-theme="dark"] .role-badge,
html[data-theme="dark"] .line-badge,
html[data-theme="dark"] .vehicle-type-badge {
    color: #93c5fd;
    border-color: #1d4ed8;
    background: #172554;
}

html[data-theme="dark"] .status-pill.is-positive,
html[data-theme="dark"] .table-status.is-done,
html[data-theme="dark"] .user-status-active {
    color: #86efac;
    border-color: #166534;
    background: #12291c;
}

html[data-theme="dark"] .msg.danger,
html[data-theme="dark"] .msg.error,
html[data-theme="dark"] .table-status.is-open,
html[data-theme="dark"] .user-status-inactive,
html[data-theme="dark"] .vehicle-problem-badge {
    color: #fca5a5;
    border-color: #7f1d1d;
    background: #35151c;
}

html[data-theme="dark"] .msg.success {
    color: #86efac;
    border-color: #166534;
    background: #12291c;
}

html[data-theme="dark"] .msg.info {
    color: #93c5fd;
    border-color: #1d4ed8;
    background: #142341;
}

html[data-theme="dark"] .table-status.is-not-responsible,
html[data-theme="dark"] .user-role-leser {
    color: #fde68a;
    border-color: #854d0e;
    background: #342a0b;
}

html[data-theme="dark"] .table-status.is-provisional,
html[data-theme="dark"] .permission-note,
html[data-theme="dark"] .repair-detail-panel {
    color: #fdba74;
    border-color: #9a3412;
    background: #3a1d0d;
}

html[data-theme="dark"] .table-status.is-no-fault,
html[data-theme="dark"] .user-status-neutral,
html[data-theme="dark"] .user-role-mitarbeiter {
    color: #cbd5e1;
    border-color: #475569;
    background: #1e293b;
}

html[data-theme="dark"] .user-role-admin {
    color: #d8b4fe;
    border-color: #7e22ce;
    background: #2c1640;
}

html[data-theme="dark"] .user-role-moderator {
    color: #93c5fd;
    border-color: #1d4ed8;
    background: #172554;
}

html[data-theme="dark"] .user-page-header p,
html[data-theme="dark"] .user-list-summary,
html[data-theme="dark"] .user-id,
html[data-theme="dark"] .user-empty-state,
html[data-theme="dark"] .user-section-heading p,
html[data-theme="dark"] .user-permission-option small {
    color: var(--muted);
}

html[data-theme="dark"] .user-eyebrow,
html[data-theme="dark"] .user-sort-link:hover,
html[data-theme="dark"] .user-sort-icon {
    color: var(--primary);
}

html[data-theme="dark"] .user-sort-inactive {
    color: #64748b;
}

html[data-theme="dark"] .edit-image-card:has(input:checked) {
    border-color: #7f1d1d;
    background: #35151c;
}

html[data-theme="dark"] .account-avatar {
    border: 1px solid var(--line-strong);
    background: linear-gradient(145deg, #1e293b, #0f172a);
}

@media (max-width: 1020px) {
    .theme-toggle {
        margin-left: 4px;
    }
}

@media print {
    .theme-toggle {
        display: none !important;
    }
}
/* Linienfarben der Störungsdatenbank */
.line-badge[class*="line-"] {
    color: #ffffff;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.55);
}

/* U1 */
.line-badge.line-u1,
html[data-theme="dark"] .line-badge.line-u1 {
    color: #ffffff;
    border-color: #e3000f;
    background: #e3000f;
}

/* U2 */
.line-badge.line-u2,
html[data-theme="dark"] .line-badge.line-u2 {
    color: #ffffff;
    border-color: #a862a4;
    background: #a862a4;
}

/* U3 */
.line-badge.line-u3,
html[data-theme="dark"] .line-badge.line-u3 {
    color: #ffffff;
    border-color: #ef7c00;
    background: #ef7c00;
}

/* U4 */
.line-badge.line-u4,
html[data-theme="dark"] .line-badge.line-u4 {
    color: #ffffff;
    border-color: #00963f;
    background: #00963f;
}

/* U5 */
.line-badge.line-u5,
html[data-theme="dark"] .line-badge.line-u5 {
    color: #ffffff;
    border-color: #00a7a1;
    background: #00a7a1;
}

/* U6 */
.line-badge.line-u6,
html[data-theme="dark"] .line-badge.line-u6 {
    color: #ffffff;
    border-color: #7a4926;
    background: #7a4926;
}

/* UStrab – neutrales Schiefergrau zur Abgrenzung von den U-Bahn-Linien */
.line-badge.line-ustrab,
html[data-theme="dark"] .line-badge.line-ustrab {
    color: #ffffff;
    border-color: #64748b;
    background: #64748b;
}
/* Fahrzeugverwaltung im Adminbereich */

.vehicle-admin-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.vehicle-admin-stat {
    display: grid;
    gap: 5px;
    padding: 18px 20px;
}

.vehicle-admin-stat span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.vehicle-admin-stat strong {
    color: var(--text-strong);
    font-size: 1.75rem;
    line-height: 1;
}

.vehicle-admin-filter-field {
    flex: 0 1 230px;
    min-width: 190px;
}

.vehicle-admin-filter-field label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
}

.vehicle-admin-filter-field select {
    margin: 0;
}

.vehicle-admin-table {
    min-width: 1100px;
}

.vehicle-admin-number {
    color: var(--text-strong);
    font-weight: 800;
}

.vehicle-admin-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.vehicle-admin-row-actions .btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.76rem;
}

.vehicle-admin-status-grid {
    grid-template-columns: minmax(0, 1fr);
}

html[data-theme="dark"] .vehicle-admin-filter-field label {
    color: var(--text);
}

@media (max-width: 760px) {
    .vehicle-admin-stats {
        grid-template-columns: 1fr;
    }

    .vehicle-admin-filter-field {
        width: 100%;
        min-width: 0;
    }
}

.repair-report-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.repair-report-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.repair-report-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: auto;
}

@media (max-width: 760px) {
    .repair-report-card {
        align-items: stretch;
        flex-direction: column;
    }

    .repair-report-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-left: 0;
    }
}