.mopped-form-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--mm-burlywood-25) 100%);
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(61, 43, 31, .08);
}

.page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--mm-burlywood-25) 100%);
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(61, 43, 31, .08);
}

.page-hero h1 {
    margin: .15rem 0 .35rem;
    color: var(--mm-ink);
    font-weight: 700;
}

.page-hero p {
    margin: 0;
    color: var(--mm-ink-soft);
}

.modal-nav {
    position: fixed;
    top: 50%;
    z-index: 2002;
    width: 3.25rem;
    height: 3.25rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    background: var(--mm-crimson) !important;
    border-color: var(--mm-crimson) !important;
    border-radius: 50% !important;
    font-size: 1.25rem;
    transform: translateY(-50%);
}

.modal-nav:hover,
.modal-nav:focus {
    color: #fff !important;
    background: var(--mm-crimson-dark) !important;
    border-color: var(--mm-crimson-dark) !important;
}

.modal-nav[hidden] {
    display: none !important;
}

.modal-prev {
    left: 1rem;
}

.modal-next {
    right: 1rem;
}

.mopped-detail-hero-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mopped-detail-start-badge {
    width: 5rem;
    height: 5rem;
    flex: 0 0 5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--mm-crimson);
    background: #fff;
    border: 2px solid var(--mm-burlywood);
    border-radius: 50%;
    font-size: 2.7rem;
    font-weight: 800;
    line-height: 1;
}

.hero-metric {
    min-width: 130px;
    padding: .8rem 1rem;
    text-align: center;
    color: var(--mm-ink);
    background: #fff;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 12px;
}

.hero-metric span {
    display: block;
    color: var(--mm-crimson);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.hero-metric small {
    color: var(--mm-ink-soft);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.toolbar-card,
.table-card,
.info-card {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(220, 20, 60, .06);
}

.toolbar-card {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
}

.moppeds-filter-bar,
.history-filter-bar {
    gap: .35rem;
}

.event-update-picker {
    align-items: flex-end;
}

.event-update-select-form {
    display: flex;
    align-items: flex-end;
    gap: .45rem;
}

.event-update-select-form .toolbar-field-select {
    flex: 0 0 300px;
}

.moppeds-filter-bar .btn,
.history-filter-bar .btn {
    margin-bottom: 0;
}

.toolbar-card .search-form,
.hero-actions {
    width: 100%;
}

.hero-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}

.event-toggle-on {
    color: var(--mm-ink);
    border-color: #e0a800;
    box-shadow: 0 0 0 .18rem rgba(255, 193, 7, .2);
    font-weight: 800;
}

.event-toggle-off {
    background: #fff;
    font-weight: 700;
}

.toolbar-field {
    flex: 1;
}

.toolbar-field-small {
    flex: 0 0 130px;
}

.toolbar-field-select {
    flex: 0 0 150px;
}

.toolbar-field label {
    color: var(--mm-ink);
    font-size: .82rem;
    font-weight: 700;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.card-title-row h2 {
    margin: .15rem 0 0;
    color: var(--mm-ink);
    font-size: 1.2rem;
    font-weight: 700;
}

.pagination-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    padding-top: .85rem;
    color: var(--mm-ink-soft);
    font-size: .9rem;
}

.pagination-row .disabled {
    pointer-events: none;
    opacity: .45;
}

.empty-cell {
    padding: 1rem !important;
    color: var(--mm-ink-soft) !important;
    text-align: center;
}

.start-mopped-table th:first-child,
.start-mopped-table td:first-child {
    width: 72px;
    text-align: center;
}

.planning-table th:nth-child(2),
.planning-table td:nth-child(2) {
    width: 72px;
    text-align: center;
}

.start-number-xl {
    width: 2.9rem;
    height: 2.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    line-height: 1;
    padding: 0;
    border-radius: 50% !important;
}

.history-log-table th:nth-child(2),
.history-log-table td:nth-child(2) {
    width: 72px;
    text-align: center;
}

.history-date-cell {
    white-space: nowrap;
}

.history-date-main,
.history-date-meta {
    display: block;
}

.history-date-main {
    font-weight: 700;
}

.history-date-meta {
    font-size: .75rem;
    line-height: 1.2;
    color: var(--mm-muted);
}

.history-entry-link {
    text-decoration: none;
}

.history-entry-link:hover {
    color: var(--mm-crimson-dark);
    border-color: var(--mm-crimson);
    text-decoration: none;
}

.table-sort-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.table-sort-link:hover {
    color: var(--mm-crimson);
    text-decoration: none;
}

.history-log-table thead .table-sort-link,
.history-log-table thead .table-sort-link:hover,
.history-log-table thead .table-sort-link:focus {
    color: #fff;
}

.compact-mopped-select {
    max-width: 360px;
}

.history-art-badge {
    color: #fff;
    border: 0;
}

.history-art-badge:hover {
    color: #fff;
    filter: brightness(.95);
}

.history-art-update {
    background: #6b7280;
}

.history-art-service {
    background: #0f766e;
}

.history-art-reifentausch {
    background: #2563eb;
}

.history-art-bremsbelagtausch {
    background: #7c3aed;
}

.history-art-defekt {
    background: #d97706;
}

.history-art-reparatur {
    background: #be123c;
}

.history-art-unfall {
    background: #111827;
}

.history-art-default {
    background: var(--mm-crimson);
}

.selected-mopped-line {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
}

.selected-mopped-line .start-number-xl {
    width: 2.9rem;
    height: 2.9rem;
    display: inline-flex;
    margin-bottom: 0;
    color: var(--mm-crimson-dark);
    font-size: 1.6rem;
    letter-spacing: 0;
    text-transform: none;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.kpi-tile {
    display: block;
    padding: 1.35rem;
    color: var(--mm-ink);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(220, 20, 60, .06);
    transition: transform .15s ease, box-shadow .15s ease;
}

.kpi-tile:hover {
    color: var(--mm-ink);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(220, 20, 60, .1);
}

.kpi-tile i {
    color: var(--mm-crimson);
    font-size: 1.5rem;
}

.kpi-tile span {
    display: block;
    margin-top: .75rem;
    color: var(--mm-crimson);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.kpi-tile strong {
    display: block;
    margin-top: .35rem;
    font-size: 1.05rem;
}

.kpi-tile small {
    color: var(--mm-ink-soft);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.detail-item {
    padding: .85rem;
    background: var(--mm-burlywood-25);
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 10px;
}

.detail-item.wide {
    grid-column: 1 / -1;
}

.detail-item span {
    display: block;
    margin-bottom: .25rem;
    color: var(--mm-ink-soft);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.detail-item strong {
    color: var(--mm-ink);
}

.compact-form {
    margin-bottom: 1rem;
    padding: 1.25rem 1.5rem;
}

.upload-card {
    margin-top: 1rem;
}

.history-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
}

.history-media-card {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .75rem;
    color: var(--mm-ink);
    text-align: center;
    text-decoration: none;
    background: #fffdf8;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 12px;
    overflow: hidden;
}

.history-media-card:hover {
    color: var(--mm-crimson);
    border-color: var(--mm-crimson);
    text-decoration: none;
}

.history-media-card img,
.history-media-card video {
    width: 100%;
    height: 86px;
    object-fit: cover;
    border-radius: 8px;
}

.history-media-card .pdf-preview-thumb {
    width: 100%;
    height: 118px;
    display: block;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 8px;
}

.history-media-card .pdf-preview-thumb iframe {
    width: 100%;
    height: 160px;
    border: 0;
    pointer-events: none;
    transform: scale(.82);
    transform-origin: top left;
}

.history-media-card i {
    color: var(--mm-crimson);
    font-size: 2rem;
}

.history-media-card span {
    max-width: 100%;
    color: inherit;
    font-size: .82rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.history-attachment-thumbs {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.history-attachment-thumb {
    width: 64px;
    height: 48px;
    display: block;
    overflow: hidden;
    background: #fffdf8;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 8px;
}

.history-attachment-thumb:hover {
    border-color: var(--mm-crimson);
}

.history-attachment-thumb img,
.history-attachment-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-attachment-thumb .pdf-preview-thumb {
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    border: 0;
    border-radius: 0;
}

.history-attachment-thumb .pdf-preview-thumb iframe {
    width: 118px;
    height: 90px;
    max-width: none;
    display: block;
    border: 0;
    pointer-events: none;
    transform: scale(.55);
    transform-origin: top left;
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .75rem;
    margin: .75rem 0;
}

.setup-field label {
    min-height: 2.2rem;
}

.setup-save-row {
    align-items: flex-end;
    margin-top: .75rem;
}

.setup-save-actions {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.setup-save-actions .btn {
    width: 100%;
    border-radius: 999px;
    font-weight: 700;
}

.inline-mail-form {
    display: flex;
    gap: .35rem;
    align-items: center;
    margin-top: .35rem;
}

.inline-mail-form .form-select {
    min-width: 150px;
    max-width: 220px;
    margin: 0;
}

.inline-action-form {
    display: inline-block;
    margin: 0 0 0 .25rem;
}

.compact-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .3rem;
}

.compact-actions .inline-action-form,
.compact-actions .inline-mail-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.compact-mail-form {
    gap: .25rem;
}

.compact-mail-form .form-select {
    min-width: 96px;
    max-width: 118px;
    height: calc(1.35em + .46rem + 2px);
    padding: .18rem 1.35rem .18rem .38rem;
    font-size: .72rem;
    line-height: 1.2;
}

.setup-track-edit-link {
    color: var(--mm-ink);
    text-decoration: none;
}

.setup-track-edit-link:hover,
.setup-track-edit-link:focus {
    color: var(--mm-crimson);
    text-decoration: underline;
}

.setup-name-sub {
    display: block;
    margin-top: .15rem;
    color: var(--mm-ink-soft);
    font-size: .78rem;
    line-height: 1.2;
}

.suspension-table {
    table-layout: auto;
    width: 100%;
}

.suspension-table th:first-child,
.suspension-table td:first-child {
    width: 1%;
    white-space: nowrap;
}

body.mm-admin .table.suspension-table thead tr th,
body.mm-admin .table.suspension-table tbody td {
    padding-left: .35rem;
    padding-right: .35rem;
}

.suspension-table th:nth-child(2),
.suspension-table td:nth-child(2) {
    width: 112px;
    min-width: 112px;
    white-space: nowrap;
}

.suspension-table th:nth-child(3),
.suspension-table td:nth-child(3) {
    width: 190px;
    min-width: 190px;
    white-space: nowrap;
}

.suspension-table-spacer {
    width: auto;
}

.setup-status {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .35rem;
}

.suspension-table .compact-actions {
    flex-wrap: nowrap;
}

.setup-email-button,
.setup-delete-button,
.setup-reactivate-button {
    border-radius: 999px;
    font-weight: 700;
    padding-inline: .85rem;
}

.btn-xs {
    padding: .28rem .48rem;
    font-size: .78rem;
    line-height: 1.2;
    border-radius: 7px;
}

.form-select-xs {
    width: auto;
    min-width: 96px;
    max-width: 118px;
    height: calc(1.5em + .56rem + 2px);
    padding: .22rem 1.55rem .22rem .45rem;
    font-size: .72rem;
}

.suspension-table th:nth-child(1),
.suspension-table td:nth-child(1) {
    width: 22%;
}

.suspension-table th:nth-child(2),
.suspension-table td:nth-child(2) {
    width: 18%;
}

.suspension-table th:nth-child(3),
.suspension-table td:nth-child(3) {
    width: 20%;
}

.suspension-table th:nth-child(4),
.suspension-table td:nth-child(4) {
    width: 40%;
}

.setup-status {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.setup-status a.badge {
    text-decoration: none;
}

.setup-status a.badge:hover {
    color: var(--mm-crimson);
    border-color: var(--mm-crimson);
}

.error-card {
    width: min(520px, 100%);
    margin: 6vh auto;
    padding: 2rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(61, 43, 31, .14);
}

.error-icon {
    width: 4rem;
    height: 4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--mm-crimson);
    background: var(--mm-crimson-soft);
    border-radius: 50%;
    font-size: 1.6rem;
}

.error-card h1 {
    color: var(--mm-ink);
}

.mopped-form-hero h1 {
    margin: .15rem 0 .35rem;
    color: var(--mm-ink);
    font-weight: 700;
}

.mopped-form-hero p {
    margin: 0;
    color: var(--mm-ink-soft);
}

.mopped-form-card {
    background: #fff;
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(220, 20, 60, .07);
    overflow: hidden;
}

.form-section {
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid var(--mm-burlywood-50);
}

.form-section:last-of-type {
    border-bottom: 0;
}

.form-section-head {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.form-section-head > i {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.5rem;
    color: var(--mm-crimson);
    background: var(--mm-crimson-soft);
    border-radius: 50%;
}

.form-section-head h2 {
    margin: 0 0 .15rem;
    color: var(--mm-ink);
    font-size: 1.1rem;
    font-weight: 700;
}

.form-section-head p {
    margin: 0;
    color: var(--mm-ink-soft);
    font-size: .9rem;
}

.form-field label,
.mopped-form-card label {
    color: var(--mm-ink);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.mopped-form-card .form-control,
.mopped-form-card .form-select {
    min-height: 42px;
    line-height: 1.5;
    border-color: var(--mm-burlywood);
    background: #fffdf8;
    border-radius: 8px;
}

.mopped-form-card input[type="date"].form-control,
.mopped-form-card input[type="number"].form-control {
    -webkit-appearance: none;
    appearance: none;
}

.mopped-form-card .form-control:focus,
.mopped-form-card .form-select:focus {
    background: #fff;
    border-color: var(--mm-crimson);
    box-shadow: 0 0 0 .15rem var(--mm-crimson-soft);
}

.mopped-form-card input[type="file"].form-control {
    min-height: 48px;
    padding: .42rem .55rem;
    color: var(--mm-ink-soft);
    cursor: pointer;
    line-height: 2rem;
}

.mopped-form-card input[type="file"].form-control::file-selector-button {
    margin-right: .75rem;
    padding: .52rem .9rem;
    color: #fff;
    background: var(--mm-crimson);
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.mopped-form-card input[type="file"].form-control:hover::file-selector-button {
    background: var(--mm-crimson-dark);
    transform: translateY(-1px);
}

.mopped-form-card input[type="file"].form-control::-webkit-file-upload-button {
    margin-right: .75rem;
    padding: .52rem .9rem;
    color: #fff;
    background: var(--mm-crimson);
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.native-file-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
}

.nice-file-control {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem .45rem;
    background: #fffdf8;
    border: 1px solid var(--mm-burlywood);
    border-radius: 8px;
}

.nice-file-button {
    display: inline-flex !important;
    align-items: center;
    gap: .45rem;
    margin: 0 !important;
    padding: .62rem .95rem;
    color: #fff !important;
    background: var(--mm-crimson);
    border-radius: 8px;
    font-weight: 800 !important;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.nice-file-button:hover {
    background: var(--mm-crimson-dark);
}

.nice-file-name {
    min-width: 0;
    color: var(--mm-ink-soft);
    font-size: .92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-hint {
    display: block;
    margin-top: .3rem;
    margin-bottom: .8rem;
    color: var(--mm-ink-soft);
    font-size: .78rem;
    line-height: 1.25;
}

.field-error {
    display: block;
    margin-top: .3rem;
    color: #b00020;
    font-size: .78rem;
    line-height: 1.25;
}

.form-control.is-invalid {
    border-color: #b00020;
    box-shadow: 0 0 0 .12rem rgba(176, 0, 32, .12);
}

.event-confirm-modal {
    padding: 1rem;
}

.event-confirm-dialog {
    width: min(460px, 100%);
    padding: 1.5rem;
    background: #fffdf8;
    border: 2px solid var(--mm-burlywood-50);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
    color: var(--mm-ink);
}

.event-confirm-dialog h2 {
    margin: 0 0 .5rem;
    color: var(--mm-crimson);
    font-size: 1.35rem;
}

.event-confirm-dialog p {
    margin: 0 0 1.25rem;
}

.event-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
}

.history-created-meta {
    margin-top: 1.85rem;
    margin-bottom: 0;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .85rem;
    padding: .65rem .85rem;
    background: var(--mm-burlywood-25);
    border: 1px solid var(--mm-burlywood-50);
    border-radius: 10px;
}

.notes-control {
    min-height: 150px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 1.5rem;
    background: var(--mm-burlywood-25);
}

.form-actions .btn {
    border-radius: 999px;
    font-weight: 700;
    padding: .65rem 1rem;
}

@media (max-width: 760px) {
    html {
        font-size: 75%;
    }

    .mopped-form-hero,
    .page-hero {
        flex-direction: column;
        padding: 1rem;
    }

    .toolbar-card,
    .inline-mail-form {
        flex-direction: column;
        align-items: stretch;
    }

    .moppeds-filter-bar,
    .history-filter-bar {
        gap: .55rem;
        padding: .85rem;
    }

    .event-update-picker {
        padding: .85rem;
    }

    .event-update-select-form {
        flex-direction: row;
        align-items: flex-end;
        gap: .45rem;
    }

    .event-update-select-form .toolbar-field-select {
        flex: 0 0 300px;
    }

    .event-update-meta-row {
        row-gap: .7rem;
    }

    .event-update-meta-row .event-update-meta-field {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .event-update-meta-row .form-control,
    .event-update-meta-row .form-select {
        width: 100%;
        min-height: 44px;
        font-size: .95rem;
    }

    .moppeds-filter-bar .toolbar-field-select,
    .history-filter-bar .toolbar-field-select,
    .history-filter-bar .toolbar-field-small {
        flex: 0 0 auto;
    }

    .moppeds-filter-bar .btn,
    .history-filter-bar .btn {
        width: 100%;
    }

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

    .form-section,
    .form-actions {
        padding: 1rem;
    }

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

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