* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top left, rgba(var(--accent-rgb), .35), transparent 28%),
        radial-gradient(circle at right 10%, rgba(var(--primary-rgb), .16), transparent 22%),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100%;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px;
    border-right: 1px solid rgba(var(--primary-rgb), .28);
    background: linear-gradient(180deg, rgba(255,255,255,.84), rgba(var(--accent-rgb), .18));
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.brand-mark {
    width: 128px;
    height: 128px;
    flex: 0 0 128px;
    border-radius: 40px;
    display: grid;
    place-items: center;
    padding: 4px;
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(var(--primary-rgb), .22);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.brand-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-copy {
    min-width: 0;
}

.brand-copy h1 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}

.brand-copy p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .92rem;
}

.nav-group-label {
    margin: 22px 0 10px;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted-strong);
    font-weight: 700;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    color: var(--text-soft);
    transition: .18s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,.75);
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .85), rgba(255,255,255,.9));
    border: 1px solid rgba(var(--primary-rgb), .42);
    box-shadow: 0 12px 30px rgba(var(--primary-rgb), .18);
    color: var(--text);
    font-weight: 700;
}

.nav-collapse {
    margin: 0;
}

.nav-collapse summary {
    cursor: pointer;
    list-style: none;
}

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

.nav-parent {
    width: 100%;
    border: 1px solid transparent;
}

.nav-collapse[open] > .nav-parent {
    background: rgba(255,255,255,.45);
    border-color: rgba(var(--primary-rgb), .2);
    font-weight: 700;
}

.nav-chevron {
    margin-left: auto;
    font-size: .82rem;
    transition: transform .18s ease;
}

.nav-collapse[open] .nav-chevron {
    transform: rotate(180deg);
}

.nav-sublist {
    display: grid;
    gap: 6px;
    margin: 4px 0 4px 40px;
    padding-left: 12px;
    border-left: 1px solid rgba(var(--primary-rgb), .25);
}

.nav-subitem {
    padding: 10px 12px;
    border-radius: 14px;
    font-size: .94rem;
}

.nav-subitem .nav-icon {
    width: 22px;
}

.nav-icon {
    width: 28px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 28px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(var(--primary-rgb), .28);
}

.sidebar-footer strong { display: block; margin-bottom: 4px; }
.sidebar-footer span { color: var(--muted); font-size: .92rem; }

.main {
    padding: 28px;
}

.header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.header-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid rgba(var(--primary-rgb), .25);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted-strong);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}

.page-title {
    margin: 0;
    font-size: clamp(1.6rem, 2vw, 2.4rem);
    line-height: 1.1;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    max-width: 70ch;
    line-height: 1.55;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.header-actions.vertical {
    flex-direction: column;
    align-items: flex-end;
}

.header-actions.vertical form {
    margin: 0;
    width: 100%;
}

.header-actions.vertical .btn {
    width: 100%;
    min-width: 80px;
    min-height: 24px;
}

.datetime-display {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    width: fit-content;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(var(--primary-rgb), .22);
    color: var(--text-soft);
    box-shadow: 0 8px 18px rgba(var(--primary-rgb), .08);
}

.datetime-label {
    color: var(--muted-strong);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.datetime-value {
    font-size: .95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.surface {
    background: var(--surface);
    border: 1px solid rgba(var(--primary-rgb), .22);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.panel {
    padding: 22px;
}

.panel + .panel,
.surface + .surface {
    margin-top: 22px;
}

.section-title {
    margin: 0 0 14px;
    font-size: 1.15rem;
}

.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.full-width { width: 100%; }

.grid {
    display: grid;
    gap: 18px;
}

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

.card {
    padding: 20px;
    border-radius: 22px;
    background: var(--surface-strong);
    border: 1px solid rgba(var(--primary-rgb), .18);
    box-shadow: 0 10px 26px rgba(var(--primary-rgb), .10);
}

.stat-value {
    margin: 8px 0 0;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: .18s ease;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 700;
    line-height: 1.15;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-strong)); color: white; box-shadow: 0 12px 24px rgba(var(--primary-rgb), .28); }
.btn-secondary { background: rgba(255,255,255,.9); color: var(--text-soft); border-color: rgba(var(--primary-rgb), .28); }
.btn-danger { background: rgba(178,85,85,.12); color: #7d2f2f; border-color: rgba(178,85,85,.2); }
.btn-small { padding: 5px 7px; border-radius: 7px; font-size: .74rem; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .01em;
    white-space: nowrap;
}

.badge-success {
    background: rgba(var(--primary-rgb), .14);
    color: var(--primary-strong);
    border: 1px solid rgba(var(--primary-rgb), .22);
}

.badge-danger {
    background: rgba(178,85,85,.12);
    color: #7d2f2f;
    border: 1px solid rgba(178,85,85,.2);
}

.badge-follow-up-due {
    background: #ffe1d8;
    color: #7a1f15;
    border-color: rgba(204, 62, 35, .78);
    box-shadow: 0 0 0 0 rgba(204, 62, 35, .45), 0 0 20px rgba(204, 62, 35, .55);
    animation: follow-up-glow 1.15s ease-in-out infinite;
}

@keyframes follow-up-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(204, 62, 35, .42), 0 0 16px rgba(204, 62, 35, .42);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(204, 62, 35, .16), 0 0 28px rgba(204, 62, 35, .72);
        transform: scale(1.03);
    }
}

@media (prefers-reduced-motion: reduce) {
    .badge-follow-up-due {
        animation: none;
        box-shadow: 0 0 18px rgba(204, 62, 35, .58);
    }
}


.badge-neutral {
    background: rgba(93,103,92,.1);
    color: var(--muted);
    border: 1px solid rgba(93,103,92,.16);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.field { display: grid; gap: 8px; }
.field.span-3 { grid-column: span 3; }
.field.span-4 { grid-column: span 4; }
.field.span-5 { grid-column: span 5; }
.field.span-6 { grid-column: span 6; }
.field.span-8 { grid-column: span 8; }
.field.span-12 { grid-column: span 12; }

label {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-soft);
}

input, select, textarea {
    width: 100%;
    border: 1px solid rgba(var(--primary-rgb), .28);
    background: rgba(255,255,255,.95);
    color: var(--text);
    border-radius: 16px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

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

input:focus, select:focus, textarea:focus {
    border-color: rgba(var(--primary-rgb), .75);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .35);
}

/* Eigenes Auswahl-Dropdown als Ersatz fuer <datalist>. Das native datalist-Popup
   wird vom Browser gezeichnet und klappt auf dem Handy oft seitlich/uneinheitlich
   auf; dieses Dropdown oeffnet immer nach unten und in voller Feldbreite. */
.combo { position: relative; }
.combo-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border: 1px solid rgba(var(--primary-rgb), .35);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .18);
}
.combo-list[hidden] { display: none; }
.combo-list--up { top: auto; bottom: calc(100% + 4px); }
.combo-option {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--text);
    cursor: pointer;
}
.combo-option[hidden] { display: none; }
.combo-option:hover,
.combo-option.is-active {
    background: rgba(var(--accent-rgb), .25);
}
@media (max-width: 640px) {
    .combo-list { max-height: 50vh; }
    .combo-option { padding: 14px; min-height: 48px; display: flex; align-items: center; }
}

.flash {
    margin-bottom: 18px;
    padding: 15px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    font-weight: 600;
}

.flash.success { background: rgba(var(--primary-rgb), .14); color: var(--primary-strong); border-color: rgba(var(--primary-rgb), .22); }
.flash.error { background: rgba(178,85,85,.12); color: #7d2f2f; border-color: rgba(178,85,85,.2); }

.table-wrap {
    overflow: auto;
    border-radius: 22px;
    border: 2px solid var(--line-strong);
    background: var(--surface-soft);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border: 1px solid var(--table-border);
    padding: 10px 12px;
    vertical-align: middle;
}

th {
    background: var(--table-header-bg);
    text-align: left;
    font-size: .92rem;
}

.meta-table td,
.meta-table th {
    background: var(--table-meta-bg);
}

.row-inactive { background: var(--table-highlight-bg); }
.row-weekend { background: var(--table-weekend-bg); }
.row-regular { background: rgba(255,255,255,.9); }

.hours-cell {
    min-width: 105px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.time-report-body {
    padding: 14px;
}

.time-report-table th,
.time-report-table td,
.time-report-meta-table th,
.time-report-meta-table td {
    padding: 6px 8px;
}

.time-report-table input,
.time-report-table select,
.time-report-meta-table input,
#time-report-form .summary-box input {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 10px;
}

.time-report-table input[type="time"] {
    min-width: 92px;
}

.time-report-table input[name*="[pause]"] {
    max-width: 84px;
}

.mobile-day-toggle,
.mobile-ticket-toggle,
.mobile-ticket-detail-panel,
.mobile-property-toggle,
.mobile-property-detail-panel {
    display: none !important;
}

.time-report-actions {
    align-items: center;
}

.time-report-autosave-status {
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
    min-width: 210px;
    text-align: right;
}

.time-report-autosave-status[data-state="saving"],
.time-report-autosave-status[data-state="dirty"] {
    color: var(--primary-strong);
}

.time-report-autosave-status[data-state="saved"] {
    color: var(--primary-strong);
}

.time-report-autosave-status[data-state="error"] {
    color: #7d2f2f;
}

@media (min-width: 781px) {
    .mobile-day-toggle,
    .mobile-ticket-toggle,
    .mobile-ticket-detail-panel,
    .mobile-property-toggle,
    .mobile-property-detail-panel {
        display: none !important;
    }

    .desktop-day-label {
        display: inline;
    }

    .ticket-detail-content {
        display: block;
    }
}

.weekly-summary-row {
    background: rgba(var(--accent-rgb), .28);
}

.weekly-summary-row td {
    border-top: 2px solid rgba(var(--primary-rgb), .26);
    font-variant-numeric: tabular-nums;
}

.weekly-summary-label,
.weekly-summary-detail {
    color: var(--text-soft);
    font-size: .9rem;
}

.summary-box {
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(var(--primary-rgb), .28);
    background: rgba(255,255,255,.84);
}

.summary-row {
    display: grid;
    grid-template-columns: 1.5fr .8fr;
}

.summary-row > div {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(var(--primary-rgb), .18);
}

.summary-row > div:first-child {
    background: rgba(var(--accent-rgb), .22);
    font-weight: 700;
    border-right: 1px solid rgba(var(--primary-rgb), .18);
}

.summary-row:last-child > div {
    border-bottom: 0;
    font-size: 1.1rem;
    font-weight: 800;
}


.ticket-history {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.ticket-history-entry {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(var(--primary-rgb), .18);
}

.ticket-history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    font-size: .9rem;
}

.ticket-history-details {
    margin-top: 8px;
    white-space: pre-wrap;
    color: var(--text-soft);
    font-size: .92rem;
}

.ticket-history-toggle {
    margin-top: 10px;
}

.ticket-history-toggle summary {
    cursor: pointer;
    color: var(--primary-strong);
    font-weight: 400;
}

.last-activity {
    display: grid;
    gap: 5px;
    font-size: .92rem;
}

.ticket-state-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

.ticket-follow-up-note {
    margin-top: 6px;
    font-size: .9rem;
}

.ticket-table {
    min-width: 980px;
    table-layout: fixed;
}

.ticket-table th,
.ticket-table td {
    vertical-align: top;
}

.ticket-table tbody tr:nth-child(odd) {
    background: rgba(255,255,255,.86);
}

.ticket-table tbody tr:nth-child(even) {
    background: rgba(var(--accent-rgb), .18);
}

.ticket-table .badge {
    white-space: nowrap;
}

.ticket-table .ticket-state-badges {
    flex-direction: column;
    flex-wrap: nowrap;
}

.ticket-table .ticket-state-badges .badge {
    font-weight: 400;
}

.ticket-table .ticket-state-badges .badge-success:not(.ticket-follow-up-badge) {
    background: rgba(var(--primary-rgb), .08);
    color: var(--text-soft);
    border-color: rgba(var(--primary-rgb), .14);
}

.ticket-table .ticket-state-badges .badge-danger:not(.ticket-follow-up-badge):not(.badge-follow-up-due) {
    background: rgba(178,85,85,.07);
    color: #8d4a4a;
    border-color: rgba(178,85,85,.12);
}

.ticket-table .ticket-state-badges .badge-neutral:not(.ticket-follow-up-badge) {
    background: rgba(93,103,92,.06);
    color: var(--muted);
    border-color: rgba(93,103,92,.1);
}

.ticket-follow-up-badge {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
    white-space: normal;
}

.ticket-follow-up-line,
.ticket-col-state-subline {
    white-space: nowrap;
}

.ticket-col-state-headline,
.ticket-col-state-subline {
    display: block;
}

.ticket-col-number { width: 64px; }
.ticket-col-ticket { width: 48%; }
.ticket-col-state { width: 190px; }
.ticket-col-people { width: 170px; }
.ticket-col-last { width: 160px; }
.ticket-col-actions { width: 142px; }

.ticket-cell-description {
    margin-top: 6px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ticket-compact-cell {
    overflow-wrap: anywhere;
}

.ticket-person-lines {
    display: grid;
    gap: 8px;
}

.ticket-person-name {
    font-weight: 400;
    color: var(--text-soft);
}

.ticket-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.ticket-actions form {
    display: flex;
    margin: 0;
    width: 100%;
}

.ticket-actions .btn {
    width: 100%;
    min-height: 28px;
    white-space: normal;
    text-align: center;
}

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

.dashboard-ticket-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(var(--primary-rgb), .18);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.dashboard-ticket-item:hover,
.dashboard-ticket-item:focus-visible {
    border-color: rgba(var(--primary-rgb), .36);
    box-shadow: 0 10px 24px rgba(15,23,42,.08);
    transform: translateY(-1px);
}

.dashboard-change-notes-panel {
    border-color: rgba(178,85,85,.24);
    background: rgba(178,85,85,.055);
}

.dashboard-change-notes-list {
    display: grid;
    gap: 8px;
}

.dashboard-change-note {
    padding: 10px 12px;
    border: 1px solid rgba(178,85,85,.16);
    border-radius: 14px;
    background: rgba(255,245,245,.72);
    font-size: .75rem;
    line-height: 1.45;
}

.dashboard-change-note strong {
    display: block;
    margin-top: 2px;
    color: #7f3f3f;
}

.dashboard-change-note ul {
    margin: 4px 0 0;
    padding-left: 16px;
    color: var(--text-soft);
}

.dashboard-change-note li {
    margin: 0;
}

.dashboard-change-note-meta {
    color: #9a5b5b;
    font-size: .72rem;
}

@media (min-width: 781px) {
    .dashboard-change-note {
        font-size: 6px;
        line-height: 1.35;
    }

    .dashboard-change-note-meta {
        font-size: 6px;
    }
}

.ticket-follow-up-icon {
    display: inline-block;
    line-height: 1;
}

.legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 16px;
    color: var(--muted);
    font-size: .95rem;
}

.signature-box {
    padding: 18px;
    border: 1px dashed rgba(var(--primary-rgb), .38);
    border-radius: 20px;
    background: rgba(255,255,255,.55);
}

.signature-line {
    margin-top: 30px;
    border-bottom: 1px solid rgba(var(--primary-rgb), .55);
    padding-bottom: 8px;
    color: var(--muted);
}



.handover-page {
    display: grid;
    gap: 18px;
}

/* ---------- Abnahmeprotokoll: Wizard ---------- */
.handover-wizard {
    position: relative;
}
.hw-progress {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface, #fff);
    padding: 10px 0 6px;
    margin: -10px 0 6px;
}
.hw-progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
}
.hw-progress-fill {
    height: 100%;
    width: 0;
    background: rgba(var(--primary-rgb, 30, 95, 184), 0.85);
    transition: width .2s ease;
}
.hw-progress-text {
    margin-top: 6px;
    font-size: .9rem;
    color: var(--muted, #6b7280);
}
.hw-step {
    min-height: 50vh;
}
@media print {
    .hw-step { min-height: 0; display: block !important; }
    .hw-progress, .hw-nav, .hw-ocr-modal { display: none !important; }
}
.hw-nav {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: var(--surface, #fff);
    padding: 12px 0;
    margin-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, .08);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.hw-nav .btn {
    min-width: 120px;
}

/* OCR-Eingabe pro Zähler */
.hw-ocr-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.hw-ocr-row input {
    flex: 1 1 auto;
    min-width: 0;
}
.hw-ocr-btn {
    flex: 0 0 auto;
    font-size: 1.2rem;
    padding: 0 14px;
}

/* Bestätigungs-Modal nach dem Speichern */
.hw-confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.hw-confirm-modal[hidden] { display: none; }
.hw-confirm-inner {
    background: #fff;
    border-radius: 16px;
    max-width: 460px;
    width: 100%;
    padding: 22px 22px 18px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
}
.hw-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 2.4rem;
    line-height: 64px;
    margin: 0 auto 12px;
}
.hw-confirm-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
}
.hw-confirm-text {
    margin: 0 0 12px;
    color: #374151;
    font-size: .95rem;
}
.hw-confirm-links {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    text-align: left;
}
.hw-confirm-links li {
    margin: 4px 0;
}
.hw-confirm-links a {
    color: #1d4ed8;
    text-decoration: none;
}
.hw-confirm-links a:hover {
    text-decoration: underline;
}
.hw-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* OCR-Modal */
.hw-ocr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .82);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}
.hw-ocr-modal[hidden] { display: none; }
.hw-ocr-modal-inner {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 95vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
}
.hw-ocr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hw-ocr-viewport {
    position: relative;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hw-ocr-viewport img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}
.hw-ocr-placeholder {
    color: rgba(255, 255, 255, .8);
    text-align: center;
    font-size: 2.4rem;
    line-height: 1.2;
}
.hw-ocr-placeholder small {
    display: block;
    font-size: .85rem;
    margin-top: 6px;
    opacity: .7;
}
.hw-ocr-result label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}
.hw-ocr-result input {
    width: 100%;
    font-size: 1.4rem;
    text-align: center;
    padding: 10px;
}
.hw-ocr-status {
    font-size: .9rem;
}
.hw-ocr-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.hw-ocr-actions .btn {
    flex: 1 1 auto;
    min-width: 100px;
}

@media (min-width: 720px) {
    .hw-ocr-actions .btn {
        flex: 0 0 auto;
    }
}


.handover-doc {
    display: grid;
    gap: 18px;
}

.handover-doc h2,
.handover-doc h3 {
    margin-top: 0;
}

.handover-section {
    display: grid;
    gap: 14px;
}

.handover-section-title {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-soft);
}

.handover-choice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.handover-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.74);
    border: 1px solid rgba(var(--primary-rgb), .18);
    font-weight: 700;
    color: var(--text-soft);
}

.handover-choice input {
    width: auto;
    min-width: 18px;
    min-height: 18px;
}

.handover-table {
    min-width: 980px;
}

.handover-table input,
.handover-table textarea {
    border-radius: 10px;
    padding: 8px 10px;
    min-height: 42px;
}

.handover-table textarea {
    min-height: 58px;
}

.handover-room-list {
    display: grid;
    gap: 14px;
}

.handover-room {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.7);
    border: 1px solid rgba(var(--primary-rgb), .18);
}

.handover-room-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.handover-room-name-field {
    margin: 0;
}

.handover-photo-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}

.handover-photo-input {
    display: none;
}

.handover-photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.handover-photo-gallery:empty {
    display: none;
}

.handover-photo-item {
    display: grid;
    gap: 8px;
    margin: 0;
}

.handover-photo-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(var(--primary-rgb), .18);
    background: white;
}

.signature-pad {
    display: grid;
    gap: 10px;
}

.signature-canvas {
    width: 100%;
    height: 190px;
    border-radius: 18px;
    border: 1px dashed rgba(var(--primary-rgb), .48);
    background: rgba(255,255,255,.96);
    touch-action: none;
}

.signature-meta {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 12px;
}

.handover-email-panel {
    display: grid;
    gap: 12px;
    margin-top: 4px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(var(--primary-rgb), .18);
}

.handover-email-panel h4 {
    margin: 0 0 6px;
    color: var(--text-soft);
}

.handover-email-action {
    justify-content: end;
}

.print-field-value {
    display: none;
}

body.handover-print-mode .handover-doc {
    max-width: none;
}

body.handover-print-mode .handover-page,
body.handover-print-mode .handover-doc,
body.handover-print-mode .table-wrap {
    overflow: visible !important;
}

body.handover-print-mode .handover-table {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

body.handover-print-mode .handover-table th,
body.handover-print-mode .handover-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.handover-print-mode .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.handover-print-mode .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.handover-print-mode .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.handover-print-mode .handover-choice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.handover-print-mode .signature-meta { grid-template-columns: 1fr 180px; }
body.handover-print-mode .handover-room { box-shadow: none; }
body.handover-print-mode .handover-photo-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.palette-groups {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.palette-group {
    display: grid;
    gap: 7px;
    padding: 9px 10px;
    border-radius: 16px;
    background: rgba(255,255,255,.62);
    border: 1px solid rgba(var(--primary-rgb), .13);
}

.palette-group-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.palette-group-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .96rem;
    font-weight: 800;
    color: var(--text-soft);
}

.palette-main-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,.9);
    box-shadow: 0 3px 9px rgba(15, 23, 42, .12);
}

.palette-group-description {
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.2;
}

.palette-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 148px));
    justify-content: center;
    gap: 6px;
}

.palette-option {
    position: relative;
}

.palette-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.palette-field {
    min-height: 50px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(var(--primary-rgb), .14);
    background: rgba(255,255,255,.88);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), .045);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
}

.palette-option input:checked + .palette-field {
    border-color: rgba(var(--primary-rgb), .74);
    background: var(--surface-strong);
    box-shadow: 0 8px 18px rgba(var(--primary-rgb), .14);
    transform: translateY(-1px);
}

.palette-option input:focus-visible + .palette-field,
.palette-field:hover {
    border-color: rgba(var(--primary-rgb), .45);
    box-shadow: 0 7px 18px rgba(var(--primary-rgb), .10);
}

.palette-preview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    height: 18px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.78);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .045);
}

.palette-preview span {
    display: block;
    height: 100%;
}

.palette-name {
    margin-top: 4px;
    font-size: .7rem;
    line-height: 1;
    font-weight: 800;
    color: var(--text-soft);
    text-align: center;
    white-space: nowrap;
}

.palette-selected-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: .6rem;
    display: none;
    place-items: center;
    box-shadow: 0 3px 8px rgba(var(--primary-rgb), .24);
}

.palette-option input:checked + .palette-field .palette-selected-dot {
    display: grid;
}

.palette-save-status {
    margin-top: 10px;
    min-height: 1.2em;
    color: var(--muted);
    font-size: .86rem;
}

@media (max-width: 780px) {
    .palette-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 28px;
}

.login-shell > .datetime-display {
    margin-top: 0;
}

.login-flash {
    width: min(100%, 960px);
}

.login-card-row {
    width: min(100%, 960px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.login-card {
    width: min(100%, 460px);
    padding: 28px;
    border-radius: 32px;
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(var(--primary-rgb), .28);
    box-shadow: 0 30px 70px rgba(var(--primary-rgb), .18);
    backdrop-filter: blur(20px);
}

.login-card-row .login-card {
    width: 100%;
}

.login-card--larooms {
    background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(var(--accent-rgb), .16));
}

.login-card--sparstrom {
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(221,235,248,.72));
    border-color: rgba(47,95,151,.32);
    box-shadow: 0 30px 70px rgba(47,95,151,.16);
}

.login-card--sparstrom .btn-primary {
    background: linear-gradient(135deg, #2f5f97, #6ea8d8);
    box-shadow: 0 12px 24px rgba(47,95,151,.24);
}



.property-timeline {
    display: grid;
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid rgba(var(--primary-rgb), .16);
    border-radius: 18px;
    background: rgba(255,255,255,.58);
}

.property-timeline-head {
    display: grid;
    gap: 3px;
}

.property-timeline-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
}

.property-timeline-item {
    display: grid;
    gap: 4px;
    padding: 10px 11px;
    border: 1px solid rgba(var(--primary-rgb), .16);
    border-radius: 14px;
    background: rgba(255,255,255,.82);
    color: inherit;
    text-decoration: none;
}

.property-timeline-item:hover,
.property-timeline-item:focus-visible,
.property-timeline-item.is-active {
    border-color: rgba(var(--primary-rgb), .36);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .07);
}

.property-timeline-item.is-active {
    background: rgba(var(--accent-rgb), .38);
}

.property-timeline-item span {
    font-weight: 800;
}

.property-timeline-item small {
    color: var(--muted);
    font-size: .74rem;
}

.property-timeline-item ul {
    margin: 2px 0 0;
    padding-left: 16px;
    color: var(--text-soft);
    font-size: .78rem;
    line-height: 1.35;
}

.property-timeline-badge {
    justify-self: start;
    width: fit-content;
}

.property-filter-form { align-items: end; }
.property-view-selector {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(var(--primary-rgb), .16);
    border-radius: 16px;
    background: rgba(255,255,255,.58);
}
.property-view-selector legend {
    padding: 0 6px;
    font-size: .78rem;
    font-weight: 800;
    color: var(--text-soft);
}
.property-view-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid rgba(var(--primary-rgb), .18);
    border-radius: 999px;
    background: rgba(255,255,255,.8);
    color: var(--text-soft);
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.property-view-option input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
}
.property-table { min-width: 1180px; table-layout: fixed; }
.property-table th, .property-table td { vertical-align: top; }
.property-col-status { width: 100px; }
.property-col-object { width: 90px; }
.property-col-building { width: 210px; }
.property-col-unit { width: 180px; }
.property-col-person { width: 200px; }
.property-col-money { width: 155px; }
.property-col-actions { width: 112px; }
.property-cell-title { display: grid; gap: 4px; }
.property-rent-lines { display: grid; gap: 3px; }
.property-rent-lines { white-space: nowrap; }
.property-detail-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.property-detail-section { display: grid; gap: 12px; padding: 16px; border-radius: 18px; }
.property-detail-section[hidden] { display: none !important; }
.property-detail-section[data-property-view-section="tenant"] { grid-column: 1; }
.property-detail-section[data-property-view-section="apartment"] { grid-column: 2; }
.property-detail-section[data-property-view-section="property"] { grid-column: 3; }
.property-section-head { padding-bottom: 10px; border-bottom: 1px solid rgba(var(--primary-rgb), .14); }
.property-section-head .section-title { margin-bottom: 5px; font-size: 1rem; }
.property-section-head .muted { margin: 0; font-size: .78rem; line-height: 1.35; }
.property-detail-groups { display: grid; gap: 10px; }
.property-detail-subgroup { padding: 10px; border: 1px solid rgba(var(--primary-rgb), .12); border-radius: 14px; background: rgba(255,255,255,.52); }
.property-detail-subgroup h4 { margin: 0 0 8px; font-size: .84rem; line-height: 1.2; color: var(--text-soft); }
.property-compact-field-grid { gap: 8px 10px; }
.property-compact-field { gap: 4px; }
.property-compact-field label { font-size: .72rem; line-height: 1.2; }
.property-compact-field input { min-height: 34px; padding: 7px 9px; border-radius: 10px; font-size: .82rem; }
.property-detail-section input[readonly] { background: rgba(255,255,255,.62); color: var(--muted); }

@media (max-width: 1180px) {
    .property-detail-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .property-detail-section[data-property-view-section] { grid-column: auto; }
    .property-detail-section[data-property-view-section="tenant"] { order: 1; }
    .property-detail-section[data-property-view-section="apartment"] { order: 2; }
    .property-detail-section[data-property-view-section="property"] { order: 3; }
}

.simple-answer-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    font-size: 3rem;
    font-weight: 800;
}

.login-card h1,
.setup-card h1 { margin: 0 0 10px; font-size: 2rem; }

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


.visibility-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), .30);
    color: var(--text-soft);
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}

.assignment-table th,
.assignment-table td {
    vertical-align: top;
}

.assignment-user-cell {
    min-width: 220px;
    cursor: grab;
}

.assignment-user-cell:active {
    cursor: grabbing;
}

.assignment-dropzone {
    min-width: 155px;
    min-height: 62px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
    border: 1px dashed rgba(var(--primary-rgb), .30);
    background: rgba(255,255,255,.62);
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.assignment-dropzone.drag-over {
    border-color: rgba(var(--primary-rgb), .85);
    background: rgba(var(--accent-rgb), .30);
    box-shadow: 0 10px 22px rgba(var(--primary-rgb), .10);
}

.assignment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(var(--primary-rgb), .11);
    color: var(--text-soft);
    font-size: .82rem;
    font-weight: 800;
}

.assignment-badge.owner {
    background: rgba(var(--accent-rgb), .38);
}

.assignment-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mobile-nav-toggle {
    display: none;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: 1px solid rgba(var(--primary-rgb), .28);
    background: rgba(255,255,255,.92);
}

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 320px);
        transform: translateX(-100%);
        transition: transform .22s ease;
        z-index: 40;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-footer { position: static; margin-top: 20px; }
    .mobile-nav-toggle { display: inline-grid; place-items: center; }
    .main { padding: 18px; }
    .header { align-items: flex-start; }
    .header-card { width: 100%; }
    .grid.cols-4, .grid.cols-3, .grid.cols-2, .system-grid, .property-detail-sections, .handover-choice-grid, .signature-meta { grid-template-columns: 1fr; }
    .field.span-3, .field.span-4, .field.span-5, .field.span-6, .field.span-8, .field.span-12 { grid-column: span 12; }
    .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    html,
    body {
        min-width: 0;
    }

    body {
        background:
            radial-gradient(circle at top left, rgba(var(--accent-rgb), .28), transparent 34%),
            var(--bg);
    }

    .main {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .header-card {
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 20px;
    }

    .header-card > div {
        min-width: 0;
    }

    .mobile-nav-toggle {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        border-radius: 14px;
        font-size: 1.1rem;
    }

    .eyebrow {
        margin-bottom: 4px;
        font-size: .7rem;
    }

    .page-title {
        font-size: 1.38rem;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .page-subtitle {
        font-size: .92rem;
        line-height: 1.45;
    }

    .datetime-display {
        margin-top: 8px;
        padding: 7px 9px;
        border-radius: 12px;
    }

    .datetime-value {
        font-size: .86rem;
    }

    .header-actions.vertical {
        width: 100%;
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
    }

    .header-actions.vertical form {
        flex: 1 1 0;
    }

    .header-actions.vertical .btn {
        min-height: 42px;
        white-space: normal;
    }

    .surface {
        border-radius: 20px;
    }

    .panel {
        padding: 14px;
    }

    .panel + .panel,
    .surface + .surface {
        margin-top: 16px;
    }

    .card {
        padding: 14px;
        border-radius: 18px;
    }

    .grid {
        gap: 12px;
    }

    .section-title {
        font-size: 1.05rem;
    }

    .field-grid {
        gap: 12px;
    }

    label {
        font-size: .86rem;
    }

    input,
    select,
    textarea {
        min-height: 42px;
        padding: 10px 12px;
        border-radius: 12px;
    }

    textarea {
        min-height: 96px;
    }

    .btn {
        min-height: 40px;
        padding: 10px 12px;
        border-radius: 12px;
        white-space: normal;
    }

    .btn-small {
        min-height: 34px;
        padding: 7px 10px;
    }

    .badge {
        padding: 5px 8px;
        font-size: .76rem;
    }

    .table-wrap {
        border-radius: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-inline: contain;
    }

    th,
    td {
        padding: 8px 9px;
    }

    .toolbar,
    .table-actions {
        gap: 10px;
    }

    .table-actions .btn {
        flex: 1 1 130px;
    }

    .dashboard-ticket-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .summary-row {
        grid-template-columns: 1.1fr .9fr;
    }

    .summary-row > div {
        padding: 11px 12px;
    }

    .time-report-body {
        padding: 8px;
    }

    .weekly-summary-label,
    .weekly-summary-detail {
        font-size: .86rem;
    }

    .handover-table {
        min-width: 900px;
    }

    .desktop-day-label {
        display: none;
    }

    .mobile-day-toggle,
    .mobile-ticket-toggle,
    .mobile-property-toggle {
        appearance: none;
        border: 1px solid rgba(var(--primary-rgb), .24);
        background: rgba(255,255,255,.9);
        color: var(--text);
        cursor: pointer;
        font: inherit;
        text-align: left;
    }

    .mobile-day-toggle {
        display: grid !important;
        gap: 2px;
        width: 100%;
        min-height: 54px;
        place-items: center;
        padding: 6px;
        border-radius: 14px;
        text-align: center;
    }

    .mobile-day-toggle span {
        font-weight: 800;
        font-variant-numeric: tabular-nums;
    }

    .mobile-day-toggle small {
        color: var(--muted);
        font-size: .62rem;
        line-height: 1.15;
    }


    body.mobile-detail-open {
        overflow: hidden;
    }


    .time-report-table,
    .time-report-table thead,
    .time-report-table tbody,
    .time-report-table tr,
    .time-report-table th,
    .time-report-table td,
    .ticket-table,
    .ticket-table thead,
    .ticket-table tbody,
    .ticket-table tr,
    .ticket-table th,
    .ticket-table td,
    .property-table,
    .property-table thead,
    .property-table tbody,
    .property-table tr,
    .property-table th,
    .property-table td {
        float: none !important;
        width: auto;
    }

    .time-report-table {
        display: block !important;
        min-width: 0;
        border-collapse: separate;
    }

    .time-report-table thead {
        display: none !important;
    }

    .time-report-table tbody {
        display: grid !important;
        gap: 10px;
    }

    .time-report-table tr[data-row-day] {
        display: grid !important;
        grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        padding: 10px;
        border: 1px solid rgba(var(--primary-rgb), .18);
        border-radius: 18px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    }

    .time-report-table tr[data-row-day] > td {
        display: none !important;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .time-report-table tr[data-row-day] > td:nth-child(1),
    .time-report-table tr[data-row-day] > td:nth-child(2),
    .time-report-table tr[data-row-day] > td:nth-child(3) {
        display: grid !important;
        gap: 4px;
        align-content: start;
    }

    .time-report-table tr[data-row-day].is-mobile-expanded {
        position: fixed !important;
        inset: 0;
        z-index: 2200;
        display: grid !important;
        grid-template-columns: 1fr;
        align-content: start;
        gap: 12px;
        padding: 14px;
        overflow-y: auto;
        border: 0;
        border-radius: 0;
        background: linear-gradient(180deg, var(--surface), var(--surface-soft));
        box-shadow: none;
    }

    .time-report-table tr[data-row-day].is-mobile-expanded > td {
        display: grid !important;
        gap: 5px;
        min-width: 0;
        padding: 12px;
        border: 1px solid rgba(var(--primary-rgb), .14);
        border-radius: 16px;
        background: rgba(255,255,255,.9);
    }

    .time-report-table tr[data-row-day].is-mobile-expanded .time-report-day-cell {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .time-report-table tr[data-row-day].is-mobile-expanded td:last-child {
        grid-column: auto;
    }

    .time-report-table tr[data-row-day].is-mobile-expanded .mobile-day-toggle {
        min-height: 52px;
        border-color: rgba(var(--primary-rgb), .28);
        background: var(--primary);
        color: var(--primary-contrast);
        box-shadow: 0 10px 24px rgba(var(--primary-rgb), .18);
    }

    .time-report-table tr[data-row-day].is-mobile-expanded .mobile-day-toggle small {
        color: rgba(255,255,255,.82);
    }

    .time-report-table td[data-mobile-label]::before,
    .ticket-table td[data-mobile-label]::before,
    .property-table td[data-mobile-label]::before {
        content: attr(data-mobile-label);
        color: var(--muted);
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .02em;
    }

    .time-report-table input,
    .time-report-table select {
        width: 100%;
        min-width: 0;
    }

    .time-report-table input[type="time"],
    .time-report-table input[name*="[pause]"] {
        min-width: 0;
        max-width: none;
    }

    .time-report-table .hours-cell {
        min-width: 0;
        text-align: left;
        font-size: 1rem;
    }

    .weekly-summary-row {
        display: grid !important;
        gap: 6px;
        padding: 10px;
        border: 1px solid rgba(var(--primary-rgb), .18);
        border-radius: 16px;
    }

    .weekly-summary-row > td {
        display: block !important;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .ticket-table {
        display: block !important;
        min-width: 0;
        table-layout: auto;
    }

    .ticket-table thead {
        display: none !important;
    }

    .ticket-table tbody {
        display: grid !important;
        gap: 10px;
    }

    .ticket-table tbody tr[data-mobile-expand-row] {
        display: block !important;
        padding: 8px;
        border: 1px solid rgba(var(--primary-rgb), .18);
        border-radius: 18px;
        background: rgba(255,255,255,.84);
        box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    }

    .ticket-table tbody tr[data-mobile-expand-row] > td {
        display: none !important;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .ticket-table tbody tr[data-mobile-expand-row] > .ticket-cell {
        display: block !important;
    }

    .mobile-ticket-toggle,
    .mobile-property-toggle {
        display: block !important;
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        border-radius: 14px;
        font-weight: 700;
        overflow-wrap: anywhere;
    }

    .mobile-ticket-toggle,
    .mobile-property-toggle {
        display: grid !important;
        gap: 3px;
    }

    .mobile-ticket-toggle small,
    .mobile-property-toggle small {
        color: var(--muted);
        font-size: .76rem;
        font-weight: 600;
        line-height: 1.2;
    }

    .ticket-detail-content,
    .mobile-ticket-detail-panel {
        display: none !important;
    }

    .ticket-table tbody tr[data-mobile-expand-row].is-mobile-expanded {
        display: block !important;
    }

    .ticket-table tbody tr[data-mobile-expand-row].is-mobile-expanded > td {
        display: none !important;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .ticket-table tbody tr[data-mobile-expand-row].is-mobile-expanded > .ticket-cell {
        display: block !important;
    }

    .mobile-ticket-detail-panel.is-mobile-ticket-active {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2200;
        display: grid !important;
        grid-template-rows: auto 1fr;
        gap: 12px;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        padding: calc(14px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        box-sizing: border-box;
        border: 0;
        border-radius: 0;
        background: linear-gradient(180deg, var(--surface), var(--surface-soft));
        box-shadow: none;
    }

    .mobile-ticket-detail-panel.is-mobile-ticket-active .mobile-ticket-back {
        position: sticky;
        top: 0;
        z-index: 1;
        border-color: rgba(var(--primary-rgb), .28);
        background: var(--primary);
        color: var(--primary-contrast);
        box-shadow: 0 10px 24px rgba(var(--primary-rgb), .18);
    }

    .mobile-ticket-detail-panel.is-mobile-ticket-active .mobile-ticket-back small {
        color: rgba(255,255,255,.82);
    }

    .mobile-ticket-detail-grid {
        display: grid;
        align-content: start;
        gap: 12px;
        min-height: 0;
    }

    .mobile-ticket-detail-item {
        display: grid;
        gap: 6px;
        min-width: 0;
        padding: 12px;
        border: 1px solid rgba(var(--primary-rgb), .14);
        border-radius: 16px;
        background: rgba(255,255,255,.96);
    }

    .mobile-ticket-detail-item > span {
        color: var(--muted);
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .02em;
    }

    .mobile-ticket-detail-panel.is-mobile-ticket-active .ticket-actions {
        margin-top: 0;
    }

    .mobile-ticket-detail-panel.is-mobile-ticket-active .ticket-actions .btn,
    .mobile-ticket-detail-panel.is-mobile-ticket-active .ticket-actions form,
    .mobile-ticket-detail-panel.is-mobile-ticket-active .ticket-actions button {
        width: 100%;
    }

    .ticket-actions .btn {
        min-height: 34px;
    }

    .property-table {
        display: block !important;
        min-width: 0;
        table-layout: auto;
    }

    .property-table thead {
        display: none !important;
    }

    .property-table tbody {
        display: grid !important;
        gap: 10px;
    }

    .property-table tbody tr[data-mobile-expand-row] {
        display: block !important;
        padding: 8px;
        border: 1px solid rgba(var(--primary-rgb), .18);
        border-radius: 18px;
        background: rgba(255,255,255,.84);
        box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
    }

    .property-table tbody tr[data-mobile-expand-row] > td {
        display: none !important;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .property-table tbody tr[data-mobile-expand-row] > .property-cell {
        display: block !important;
    }

    .property-table tbody tr[data-mobile-expand-row]:not(.is-mobile-expanded) > .property-cell::before,
    .property-table tbody tr[data-mobile-expand-row]:not(.is-mobile-expanded) .property-row-status {
        display: none !important;
        content: none;
    }

    .mobile-property-detail-panel {
        display: none !important;
    }

    .mobile-property-detail-panel.is-mobile-property-active {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2200;
        display: grid !important;
        grid-template-rows: auto 1fr;
        gap: 12px;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        padding: calc(14px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        box-sizing: border-box;
        border: 0;
        border-radius: 0;
        background: linear-gradient(180deg, var(--surface), var(--surface-soft));
        box-shadow: none;
    }

    .mobile-property-detail-panel.is-mobile-property-active .mobile-property-back {
        position: sticky;
        top: 0;
        z-index: 1;
        border-color: rgba(var(--primary-rgb), .28);
        background: var(--primary);
        color: var(--primary-contrast);
        box-shadow: 0 10px 24px rgba(var(--primary-rgb), .18);
    }

    .mobile-property-detail-panel.is-mobile-property-active .mobile-property-back small {
        color: rgba(255,255,255,.82);
    }

    .mobile-property-detail-grid {
        display: grid;
        align-content: start;
        gap: 12px;
        min-height: 0;
    }

    .mobile-property-detail-item {
        display: grid;
        gap: 6px;
        min-width: 0;
        padding: 12px;
        border: 1px solid rgba(var(--primary-rgb), .14);
        border-radius: 16px;
        background: rgba(255,255,255,.96);
    }

    .mobile-property-detail-item > span {
        color: var(--muted);
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .02em;
    }

    .mobile-property-detail-item .text-right,
    .mobile-property-detail-item .property-rent-lines {
        text-align: left;
    }

    .property-view-selector {
        gap: 7px;
        padding: 9px;
        border-radius: 14px;
    }

    .property-view-option {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
        min-height: 38px;
        padding: 7px 10px;
    }

    .property-detail-section {
        padding: 14px;
        border-radius: 16px;
    }

    .property-detail-subgroup {
        padding: 9px;
    }

    .property-compact-field input {
        min-height: 38px;
    }

    .handover-choice {
        padding: 9px 10px;
    }

    .handover-room-header {
        grid-template-columns: 1fr;
    }

    .handover-photo-actions {
        justify-content: stretch;
    }

    .handover-photo-actions .btn {
        width: 100%;
    }

    .handover-photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .signature-canvas {
        height: 150px;
    }

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

    .login-shell {
        min-height: 100dvh;
        justify-content: flex-start;
        padding: 16px;
    }

    .login-card-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .login-card {
        padding: 20px;
        border-radius: 24px;
    }

    .login-card h1,
    .setup-card h1 {
        font-size: 1.55rem;
    }

    .sidebar {
        width: min(86vw, 300px);
        padding: 18px;
        overflow-y: auto;
        box-shadow: 20px 0 60px rgba(15, 23, 42, .18);
    }

    .brand {
        gap: 10px;
        margin-bottom: 20px;
    }

    .brand-mark {
        width: 72px;
        height: 72px;
        flex-basis: 72px;
        border-radius: 22px;
    }

    .brand-copy h1 {
        font-size: .98rem;
    }

    .brand-copy p,
    .sidebar-footer span {
        font-size: .82rem;
    }

    .nav-group-label {
        margin: 16px 0 8px;
    }

    .nav-list {
        gap: 6px;
    }

    .nav-item {
        gap: 10px;
        padding: 11px 12px;
        border-radius: 14px;
    }

    .nav-sublist {
        margin-left: 28px;
        padding-left: 10px;
    }

    .sidebar-footer {
        padding: 12px 14px;
        border-radius: 14px;
    }

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

@media (max-width: 480px) {
    .main {
        padding: 10px;
    }

    .header-card {
        padding: 11px 12px;
    }

    .header-actions.vertical {
        flex-direction: column;
    }

    .panel {
        padding: 12px;
    }

    .card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.45rem;
    }

    .property-view-option {
        flex-basis: 100%;
    }

    .login-card {
        padding: 18px;
    }
}

/* ---------- Mieter-Antrag (öffentlicher Wizard) ---------- */
.wizard-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wizard-card {
    width: 100%;
    max-width: 560px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(var(--primary-rgb), .22);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100dvh - 32px);
}

.wizard-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wizard-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wizard-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(var(--accent-rgb), .25);
    padding: 4px;
}

.wizard-brand-name {
    font-weight: 700;
    line-height: 1.1;
}

.wizard-brand-sub {
    color: var(--muted);
    font-size: .9rem;
}

.wizard-progress-track {
    height: 6px;
    background: rgba(var(--primary-rgb), .12);
    border-radius: 99px;
    overflow: hidden;
}

.wizard-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    transition: width .3s ease;
}

.wizard-progress-label {
    margin-top: 6px;
    font-size: .82rem;
    color: var(--muted-strong);
}

.wizard-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 2px;
}

.wizard-title {
    margin: 0;
    font-size: 1.35rem;
}

.wizard-subtitle {
    margin: 4px 0 16px;
    color: var(--muted);
}

.wizard-fields {
    display: grid;
    gap: 14px;
}

.wizard-field {
    display: grid;
    gap: 6px;
}

.wizard-field label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-soft);
}

.wizard-field input,
.wizard-field select,
.wizard-field textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border-radius: 14px;
}

.wizard-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(var(--primary-rgb), .22);
    border-radius: 14px;
    background: rgba(var(--accent-rgb), .12);
    cursor: pointer;
}

.wizard-check input {
    margin-top: 2px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.wizard-actions .btn {
    min-width: 110px;
    padding: 12px 18px;
    font-size: 1rem;
}

.wizard-next {
    margin-left: auto;
}

.wizard-done {
    text-align: center;
    padding: 20px 0;
}

.wizard-done-icon {
    display: inline-grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
}

@media (max-width: 640px) {
    .wizard-page {
        padding: 8px;
        align-items: stretch;
    }
    .wizard-card {
        max-height: calc(100dvh - 16px);
        padding: 16px;
        border-radius: 18px;
    }
    .wizard-title {
        font-size: 1.2rem;
    }
    .wizard-subtitle {
        margin-bottom: 12px;
    }
    .wizard-fields {
        gap: 10px;
    }
    .wizard-field input,
    .wizard-field select,
    .wizard-field textarea {
        padding: 11px 12px;
        font-size: 16px; /* verhindert iOS-Zoom */
    }
    .wizard-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* ============================================================
 * Mietvertrag (Wohnraummietvertrag) – druckbares Layout
 * ============================================================ */

.mietvertrag-page .contract-doc {
    background: white;
    color: #111827;
    border-radius: 18px;
    padding: 28px clamp(16px, 4vw, 40px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    line-height: 1.55;
    font-size: 0.98rem;
    max-width: 880px;
    margin: 0 auto;
    position: relative;
}

/* Logo oben rechts — auf dem Bildschirm absolute zum contract-doc,
 * beim Drucken position:fixed, damit es auf JEDER Seite erscheint. */
.mietvertrag-page .contract-page-logo {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 50%;
    overflow: hidden;
}
.mietvertrag-page .contract-page-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    /* Leicht hochskalieren, damit der dünne graue Rand im PNG außerhalb
     * des runden, mit overflow:hidden maskierten Containers gerät. */
    transform: scale(1.12);
    transform-origin: center;
}

/* Vertragspartei-Block (Vermieter/Mieter mit zentrierter Anordnung) */
.mietvertrag-page .contract-parties-block { margin: 12px 0 20px; }
.mietvertrag-page .contract-party {
    margin: 8px 0;
    padding: 10px 14px;
    text-align: center;
    background: rgba(0,0,0,0.025);
    border-radius: 8px;
    line-height: 1.5;
}
.mietvertrag-page .contract-center { text-align: center; }
.mietvertrag-page .contract-right { text-align: right; font-size: .92rem; }
.mietvertrag-page .contract-spaced { margin: 14px 0; }
.mietvertrag-page .contract-indent { padding-left: 18px; }

/* Unterschriften nach Vorlage: Ort/Datum-Linie über Pad, Caption darunter */
.mietvertrag-page .contract-signatures .signature-row {
    margin-top: 32px;
    break-inside: avoid;
    page-break-inside: avoid;
}
.mietvertrag-page .contract-signatures .signature-place {
    border-bottom: 1px solid #111827;
    padding: 0 6px 4px;
    font-style: italic;
    margin-bottom: 4px;
    max-width: 360px;
}
.mietvertrag-page .contract-signatures .signature-caption {
    margin-top: 4px;
    border-top: 1px solid #111827;
    padding: 6px 4px 0;
    color: #374151;
    font-size: .9rem;
}

.mietvertrag-page .contract-header {
    text-align: center;
    border-bottom: 2px solid #111827;
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.mietvertrag-page .contract-header h1 {
    margin: 0 0 6px;
    font-size: 1.65rem;
    letter-spacing: .02em;
}

.mietvertrag-page .contract-meta {
    color: #6b7280;
    font-size: .9rem;
}

.mietvertrag-page .contract-parties {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 14px;
    align-items: start;
    margin: 18px 0 12px;
    padding: 14px 16px;
    background: rgba(0,0,0,0.025);
    border-radius: 10px;
    font-size: .95rem;
}

.mietvertrag-page .contract-parties > div:nth-child(2) {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    align-self: center;
}

.mietvertrag-page .contract-intro {
    text-align: center;
    font-style: italic;
    margin: 14px 0 24px;
    color: #374151;
}

.mietvertrag-page .contract-clause {
    margin: 18px 0;
}

.mietvertrag-page .contract-clause h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    color: #111827;
    border-left: 3px solid var(--primary, #2563eb);
    padding-left: 10px;
    /* Überschrift nicht allein am Seitenende lassen, sondern am Folgetext halten */
    break-after: avoid;
    page-break-after: avoid;
    break-inside: avoid;
}

.mietvertrag-page .contract-clause p {
    margin: 6px 0;
    text-align: justify;
    hyphens: auto;
    /* keine einzelnen Rest-/Anfangszeilen am Seitenrand */
    orphans: 2;
    widows: 2;
}

.mietvertrag-page .contract-clause ul {
    margin: 6px 0 6px 22px;
    padding: 0;
}

.mietvertrag-page .contract-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: .95rem;
}

.mietvertrag-page .contract-table th,
.mietvertrag-page .contract-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.mietvertrag-page .contract-table td {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mietvertrag-page .contract-table .contract-total th,
.mietvertrag-page .contract-table .contract-total td {
    border-top: 2px solid #111827;
    border-bottom: 0;
    padding-top: 8px;
    font-size: 1rem;
}

.mietvertrag-page .contract-signatures {
    margin-top: 28px;
    break-inside: avoid;
}

.mietvertrag-page .contract-place {
    margin: 0 0 8px;
    text-align: left;
    font-style: italic;
    color: #374151;
}

.mietvertrag-page .contract-footer {
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: .8rem;
}

.mietvertrag-page .signature-image {
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: white;
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mietvertrag-page .signature-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 720px) {
    .mietvertrag-page .contract-parties {
        grid-template-columns: 1fr;
    }
    .mietvertrag-page .contract-parties > div:nth-child(2) {
        text-align: left;
    }
    .mietvertrag-page .contract-doc {
        padding: 18px 14px;
        font-size: .96rem;
    }
    .mietvertrag-page .contract-header h1 {
        font-size: 1.35rem;
    }
}

@media print {
    /* ------------------------------------------------------------
     * Konsolidierter Print-Block für den Mietvertrag.
     * Eine @page-Regel, klare Logo-Positionierung, KEIN erzwungener
     * Seitenumbruch vor den Unterschriften (das hat in Chrome dazu
     * geführt, dass die letzten Seiten beim Speichern als PDF
     * abgeschnitten wurden, obwohl die Print-Vorschau sie zeigte).
     * ------------------------------------------------------------ */
    @page {
        size: A4;
        margin: 22mm 18mm 18mm 18mm;
    }

    /* App-Chrome bei Mietvertrag/Abnahmeprotokoll ausblenden. */
    body:has(.mietvertrag-page) .header,
    body:has(.mietvertrag-page) .flash,
    body:has(.mietvertrag-page) .sidebar,
    body:has(.mietvertrag-page) .mobile-nav-toggle {
        display: none !important;
    }
    body:has(.mietvertrag-page) .app-shell { display: block !important; }
    body:has(.mietvertrag-page) .main { padding: 0 !important; }

    .mietvertrag-page.surface,
    .mietvertrag-page .surface {
        background: white !important;
        box-shadow: none !important;
        padding: 0 !important;
        border: 0 !important;
        outline: 0 !important;
        border-radius: 0 !important;
    }

    .mietvertrag-page .contract-doc {
        box-shadow: none;
        border-radius: 0;
        padding: 18mm 0 0 0;   /* Platz für Logo oben rechts auf Seite 1 */
        max-width: none;
        font-size: 10pt;
        line-height: 1.45;
        color: black;
    }
    .mietvertrag-page .contract-header { margin-top: 0; }
    .mietvertrag-page .contract-header h1 {
        font-size: 16pt;
    }
    .mietvertrag-page .contract-clause {
        margin: 10pt 0;
        /* Kein erzwungener Umbruch je Paragraph – der Text füllt die Seiten
           durchgehend (spart Papier). Überschriften bleiben über break-after
           am Folgetext (siehe .contract-clause h3). */
    }
    .mietvertrag-page .contract-clause h3 {
        font-size: 11pt;
        border-left: 0;
        padding-left: 0;
        text-align: center;
        font-weight: 700;
        margin-bottom: 4pt;
    }
    .mietvertrag-page .contract-party {
        background: transparent;
        padding: 4pt 0;
    }
    .mietvertrag-page .signature-canvas {
        border: 1px solid #111827;
        height: 70px;
    }
    .mietvertrag-page .signature-image {
        border: 1px solid #111827;
        height: 70px;
    }
    .mietvertrag-page .contract-signatures {
        margin-top: 18pt;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .mietvertrag-page .contract-footer {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Logo erscheint einmal oben rechts auf der ersten Seite. Wir
     * verwenden position:absolute relativ zur .contract-doc — das
     * wird von allen Browsern korrekt zur Seitenzahl-Berechnung
     * mitgezählt. position:fixed wirkt in Chromium-PDFs unzuverlässig
     * und hat in der Vergangenheit dafür gesorgt, dass die letzten
     * Seiten abgeschnitten wurden. */
    .mietvertrag-page .contract-page-logo {
        display: block !important;
        position: absolute;
        top: 0;
        right: 0;
        width: 22mm;
        height: 22mm;
        padding: 0;
        background: transparent !important;
        z-index: 10;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .mietvertrag-page .contract-page-logo img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        transform: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

