:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #141518;
    --muted: #6d7178;
    --border: #e5e7eb;
    --primary: #111318;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    min-height: 68px;
    padding: 0 32px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand a {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.03em;
}

nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
}

nav a,
.nav-button {
    color: #4d5157;
}

nav a:hover,
.nav-button:hover {
    color: #000;
}

.inline-form {
    margin: 0;
}

.nav-button {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

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

.hero {
    max-width: 820px;
    padding: 90px 0;
}

.hero h1 {
    margin: 8px 0 24px;
    max-width: 800px;
    font-size: clamp(48px, 8vw, 82px);
    line-height: .98;
    letter-spacing: -.055em;
}

.hero p {
    max-width: 650px;
    font-size: 21px;
    line-height: 1.55;
    color: var(--muted);
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.button.secondary {
    background: #fff;
}

.button.full {
    width: 100%;
}

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

.page-head h1,
.auth-card h1,
.form-card h1 {
    margin: 5px 0 0;
    font-size: 36px;
    letter-spacing: -.04em;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card,
.panel,
.auth-card,
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-card {
    padding: 24px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

.stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: 38px;
    letter-spacing: -.04em;
}

.panel {
    padding: 24px;
    overflow-x: auto;
}

.panel h2 {
    margin-top: 0;
}

.auth-card,
.form-card {
    width: min(620px, 100%);
    margin: 40px auto;
    padding: 32px;
}

.auth-card form,
.form-card form {
    margin-top: 28px;
}

form p {
    margin: 0 0 18px;
}

label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d7d9dd;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font: inherit;
}

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

.helptext,
.muted {
    color: var(--muted);
    font-size: 13px;
}

ul.errorlist {
    padding-left: 18px;
    color: #a61b1b;
    font-size: 13px;
}

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

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

@media (max-width: 760px) {
    .topbar {
        padding: 18px 20px;
        align-items: flex-start;
        flex-direction: column;
    }

    nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .page {
        width: min(100% - 28px, 1180px);
        padding-top: 30px;
    }

    .hero {
        padding: 50px 0;
    }

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

    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .auth-card,
    .form-card {
        margin-top: 10px;
        padding: 22px;
    }
}


/* ==========================================================
   MIETNEXA V2 BOOKING UI
   ========================================================== */

.message {
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
}

.message-success {
    border-color: #b8d8c5;
}

.message-error {
    border-color: #e4b5b5;
}

.no-margin {
    margin-top: 0;
}

.booking-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    color: var(--muted);
}

.status {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.status-draft {
    color: #60646c;
}

.status-reserved {
    color: #71580b;
    background: #fff9dd;
    border-color: #e7d58e;
}

.status-confirmed {
    color: #185c36;
    background: #eff9f3;
    border-color: #b9ddc7;
}

.status-checked_out {
    color: #174ea6;
    background: #eef4ff;
    border-color: #bdd0ef;
}

.status-completed {
    color: #4b5563;
    background: #f4f5f6;
}

.status-cancelled {
    color: #8c2f2f;
    background: #fff2f2;
    border-color: #ebc1c1;
}

.booking-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.summary-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.summary-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

.summary-card strong {
    display: block;
    font-size: 16px;
    line-height: 1.35;
}

.booking-panel {
    margin-bottom: 20px;
}

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

.section-head h2 {
    margin-bottom: 4px;
}

.section-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.table-link,
.text-link {
    font-weight: 650;
}

.table-link:hover,
.text-link:hover {
    text-decoration: underline;
}

.align-right {
    text-align: right;
}

.link-button {
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.danger-link {
    color: #a33b3b;
}

.preline {
    white-space: pre-line;
}

.calendar-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.calendar-head,
.calendar-week {
    min-width: 980px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-head {
    border-bottom: 1px solid var(--border);
}

.calendar-head > div {
    padding: 11px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.calendar-week {
    border-bottom: 1px solid var(--border);
}

.calendar-week:last-child {
    border-bottom: 0;
}

.calendar-day {
    min-height: 145px;
    padding: 9px;
    border-right: 1px solid var(--border);
    background: #fff;
}

.calendar-day:last-child {
    border-right: 0;
}

.calendar-day.outside {
    background: #fafafa;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px #222;
}

.calendar-date {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.calendar-booking {
    display: block;
    margin-bottom: 6px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 8px;
    background: #fafafa;
    font-size: 11px;
}

.calendar-booking strong,
.calendar-booking span,
.calendar-booking small {
    display: block;
}

.calendar-booking span {
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-booking small {
    margin-top: 3px;
    color: var(--muted);
}

.status-border-draft {
    border-left-color: #9aa0a6;
}

.status-border-reserved {
    border-left-color: #c59b18;
}

.status-border-confirmed {
    border-left-color: #3e8b5d;
}

.status-border-checked_out {
    border-left-color: #3974c6;
}

.status-border-completed {
    border-left-color: #7b8490;
}

.stats-four {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1000px) {
    .booking-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-four {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .booking-summary,
    .stats-four {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   MIETNEXA MOBILE / STATUS BUTTON FIX
   ========================================================== */

button.button,
a.button {
    color: var(--text);
    -webkit-text-fill-color: currentColor;
    appearance: none;
    -webkit-appearance: none;
}

button.button.primary,
a.button.primary {
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
}

button.button.secondary,
a.button.secondary {
    background: #ffffff;
    color: #141518;
    -webkit-text-fill-color: #141518;
}

.booking-panel .actions form {
    margin: 0;
}

.booking-panel .actions form .button {
    width: auto;
    min-width: 120px;
}

@media (max-width: 760px) {

    .booking-panel {
        overflow-x: hidden;
    }

    .booking-panel table {
        min-width: 680px;
    }

    .booking-panel .actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .booking-panel .actions form {
        width: 100%;
    }

    .booking-panel .actions form .button {
        width: 100%;
        min-height: 50px;
        color: #141518;
        -webkit-text-fill-color: #141518;
    }

    .booking-summary {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   MIETNEXA MOBILE UI V2.1
   ========================================================== */

/*
 * Safari/iOS:
 * Status-Aktionsbuttons müssen ihren Text explizit erhalten.
 */

.booking-panel .actions button.button,
.booking-panel .actions button.button.secondary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    min-height: 46px;

    padding: 11px 18px !important;

    background: #ffffff !important;

    color: #141518 !important;
    -webkit-text-fill-color: #141518 !important;

    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;

    opacity: 1 !important;
    visibility: visible !important;

    text-indent: 0 !important;
    text-decoration: none !important;

    border: 1px solid #d8dadd !important;
    border-radius: 12px !important;

    appearance: none !important;
    -webkit-appearance: none !important;

    cursor: pointer;
}


/*
 * Mobile Buchungsansicht
 */

@media (max-width: 760px) {

    .page {
        width: 100%;
        max-width: 100%;
    }

    .booking-panel {
        overflow: visible !important;
    }


    /*
     * Statusaktionen
     */

    .booking-panel .actions {
        display: grid !important;

        grid-template-columns: 1fr !important;

        gap: 10px !important;

        width: 100% !important;
    }

    .booking-panel .actions form {
        display: block !important;

        width: 100% !important;

        margin: 0 !important;
    }

    .booking-panel .actions form .button {
        display: flex !important;

        width: 100% !important;
        min-width: 0 !important;
        min-height: 50px !important;

        color: #141518 !important;
        -webkit-text-fill-color: #141518 !important;
    }


    /*
     * Mietpositionstabelle wird mobil zur Kartenansicht.
     */

    .booking-panel table {
        display: block !important;

        width: 100% !important;
        min-width: 0 !important;

        border: 0 !important;
    }

    .booking-panel thead {
        display: none !important;
    }

    .booking-panel tbody {
        display: block !important;

        width: 100% !important;
    }

    .booking-panel tbody tr {
        display: block !important;

        width: 100% !important;

        padding: 14px 0 !important;

        border-bottom: 1px solid #e3e4e6 !important;
    }

    .booking-panel tbody tr:last-child {
        border-bottom: 0 !important;
    }

    .booking-panel tbody td {
        display: grid !important;

        grid-template-columns: minmax(100px, 38%) 1fr !important;

        align-items: baseline !important;

        gap: 12px !important;

        width: 100% !important;

        padding: 7px 0 !important;

        border: 0 !important;

        text-align: left !important;
        white-space: normal !important;
    }

    .booking-panel tbody td::before {
        color: #74777d;

        font-size: 12px;
        font-weight: 700;

        letter-spacing: 0.03em;

        text-transform: uppercase;
    }

    .booking-panel tbody td:nth-child(1)::before {
        content: "Mietobjekt";
    }

    .booking-panel tbody td:nth-child(2)::before {
        content: "Menge";
    }

    .booking-panel tbody td:nth-child(3)::before {
        content: "Tagespreis";
    }

    .booking-panel tbody td:nth-child(4)::before {
        content: "Kaution";
    }

    .booking-panel tbody td:nth-child(5)::before {
        content: "Mietsumme";
    }

    .booking-panel tbody td:nth-child(6)::before {
        content: "";
    }

    .booking-panel tbody td:nth-child(6) {
        display: block !important;

        padding-top: 12px !important;
    }


    /*
     * Kopf und Zusammenfassung
     */

    .booking-summary {
        grid-template-columns: 1fr !important;
    }

    .page-head {
        align-items: stretch;
    }

    .page-head > .actions {
        width: 100%;
    }
}


/* ==========================================================
   MIETNEXA CALENDAR UX V2.2
   ========================================================== */

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

.calendar-heading h1 {
    margin-bottom: 6px;
}

.calendar-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-nav-button {
    gap: 7px;
}

.calendar-mobile {
    display: none;
}


/* Desktop calendar */

.calendar-desktop .calendar-wrap {
    overflow: hidden;
}

.calendar-desktop .calendar-head,
.calendar-desktop .calendar-week {
    min-width: 0;
}

.calendar-desktop .calendar-day {
    min-width: 0;
}

.calendar-booking {
    transition:
        border-color 120ms ease,
        background 120ms ease,
        transform 120ms ease;
}

.calendar-booking:hover {
    background: #f5f5f6;
    transform: translateY(-1px);
}


/* ----------------------------------------------------------
   Smartphone
   ---------------------------------------------------------- */

@media (max-width: 760px) {

    .calendar-desktop {
        display: none;
    }

    .calendar-mobile {
        display: block;
    }


    /* Header */

    .calendar-page-head {
        display: block;
        margin-bottom: 18px;
    }

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

    .calendar-heading h1 {
        font-size: 34px;
        line-height: 1.06;
    }

    .calendar-toolbar {
        display: block;
    }

    .calendar-month-nav {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 8px;
        margin-bottom: 10px;
    }

    .calendar-month-nav .button {
        min-width: 0;
        min-height: 46px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .calendar-nav-button:first-child {
        justify-content: flex-start;
    }

    .calendar-nav-button:last-child {
        justify-content: flex-end;
    }

    .calendar-today-button {
        justify-content: center;
    }

    .calendar-new-button {
        display: flex;
        width: 100%;
        min-height: 50px;
        justify-content: center;
    }


    /* Mini month */

    .mobile-month-card {
        margin-bottom: 22px;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--surface);
    }

    .mobile-weekdays {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        margin-bottom: 6px;
    }

    .mobile-weekdays span {
        padding: 5px 0 8px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
        text-align: center;
    }

    .mobile-month-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }

    .mobile-date {
        position: relative;
        display: flex;
        aspect-ratio: 1 / 1;
        align-items: center;
        justify-content: center;
        min-width: 0;
        border: 1px solid transparent;
        border-radius: 10px;
        color: var(--text);
        background: transparent;
        font-size: 13px;
        font-weight: 600;
    }

    a.mobile-date {
        text-decoration: none;
    }

    .mobile-date.outside {
        opacity: 0;
        pointer-events: none;
    }

    .mobile-date.today {
        border-color: #17181b;
    }

    .mobile-date.has-booking {
        background: #f1f2f4;
    }

    .mobile-date.has-booking::after {
        position: absolute;
        bottom: 5px;
        width: 4px;
        height: 4px;
        border-radius: 999px;
        background: #17181b;
        content: "";
    }

    .mobile-date-count {
        position: absolute;
        top: 3px;
        right: 3px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: #17181b;
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
    }


    /* Agenda */

    .mobile-agenda {
        margin-bottom: 40px;
    }

    .mobile-agenda-title {
        margin-bottom: 16px;
    }

    .mobile-agenda-title h2 {
        margin: 4px 0 0;
        font-size: 27px;
    }

    .agenda-day {
        scroll-margin-top: 18px;
        margin-bottom: 22px;
    }

    .agenda-day-header {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 10px;
    }

    .agenda-date-box {
        display: flex;
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: #fff;
    }

    .agenda-date-box strong {
        font-size: 18px;
        line-height: 1;
    }

    .agenda-date-box span {
        margin-top: 3px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .agenda-weekday {
        display: block;
        font-size: 15px;
    }

    .agenda-count {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
    }

    .agenda-bookings {
        display: grid;
        gap: 9px;
    }

    .agenda-booking {
        display: block;
        padding: 14px 15px;
        border: 1px solid var(--border);
        border-left-width: 4px;
        border-radius: 13px;
        background: #fff;
        color: var(--text);
        text-decoration: none;
    }

    .agenda-booking-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 8px;
    }

    .agenda-booking-top > strong {
        font-size: 14px;
    }

    .agenda-customer {
        overflow: hidden;
        font-size: 16px;
        font-weight: 650;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .agenda-number {
        margin-top: 4px;
        color: var(--muted);
        font-size: 12px;
    }

    .calendar-empty-state {
        padding: 28px 22px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: #fff;
        text-align: center;
    }

    .calendar-empty-state > strong {
        display: block;
        font-size: 18px;
    }

    .calendar-empty-state p {
        margin: 8px 0 20px;
        color: var(--muted);
        line-height: 1.5;
    }
}



/* ==========================================================
   MIETNEXA V2.5 TIME / PRICING / CALENDAR
   ========================================================== */

.date-time-grid,
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

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

.time-section,
.form-section {
    margin: 22px 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafafa;
}

.time-section h2,
.form-section h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.form-hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.item-buffer {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}


/* Kalender */

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

.calendar-heading h1 {
    margin-bottom: 6px;
}

.calendar-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.calendar-toolbar,
.calendar-month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-mobile {
    display: none;
}

.calendar-desktop .calendar-wrap {
    overflow: hidden;
}

.calendar-desktop .calendar-head,
.calendar-desktop .calendar-week {
    min-width: 0;
}

.calendar-desktop .calendar-day {
    min-width: 0;
}


/* Mobile Tabellenlabels V2.5 */

@media (max-width: 760px) {

    .booking-items-table tbody td:nth-child(1)::before {
        content: "Mietobjekt";
    }

    .booking-items-table tbody td:nth-child(2)::before {
        content: "Menge";
    }

    .booking-items-table tbody td:nth-child(3)::before {
        content: "Tarif";
    }

    .booking-items-table tbody td:nth-child(4)::before {
        content: "Berechnung";
    }

    .booking-items-table tbody td:nth-child(5)::before {
        content: "Kaution";
    }

    .booking-items-table tbody td:nth-child(6)::before {
        content: "Mietsumme";
    }

    .booking-items-table tbody td:nth-child(6) {
        display: grid !important;
        padding-top: 7px !important;
    }

    .booking-items-table tbody td:nth-child(7)::before {
        content: "";
    }

    .booking-items-table tbody td:nth-child(7) {
        display: block !important;
        padding-top: 12px !important;
    }


    .date-time-grid,
    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .time-section,
    .form-section {
        padding: 16px;
    }


    /* Smartphone-Kalender */

    .calendar-desktop {
        display: none;
    }

    .calendar-mobile {
        display: block;
    }

    .calendar-page-head {
        display: block;
        margin-bottom: 18px;
    }

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

    .calendar-heading h1 {
        font-size: 34px;
        line-height: 1.08;
    }

    .calendar-toolbar {
        display: block;
    }

    .calendar-month-nav {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        margin-bottom: 10px;
    }

    .calendar-month-nav .button {
        min-width: 0;
        min-height: 46px;
        padding-left: 10px;
        padding-right: 10px;
        justify-content: center;
    }

    .calendar-new-button {
        display: flex;
        width: 100%;
        min-height: 50px;
        justify-content: center;
    }

    .mobile-month-card {
        margin-bottom: 26px;
        padding: 13px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: #fff;
    }

    .mobile-weekdays,
    .mobile-month-grid {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .mobile-weekdays {
        margin-bottom: 5px;
    }

    .mobile-weekdays span {
        padding: 5px 0;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
        text-align: center;
    }

    .mobile-month-grid {
        gap: 3px;
    }

    .mobile-date {
        position: relative;
        display: flex;
        aspect-ratio: 1 / 1;
        min-width: 0;
        align-items: center;
        justify-content: center;
        border: 1px solid transparent;
        border-radius: 9px;
        color: var(--text);
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
    }

    .mobile-date.outside {
        opacity: 0;
        pointer-events: none;
    }

    .mobile-date.today {
        border-color: #17181b;
    }

    .mobile-date.has-booking {
        background: #f0f1f3;
    }

    .mobile-date.has-booking::after {
        position: absolute;
        bottom: 4px;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: #17181b;
        content: "";
    }

    .mobile-date-count {
        position: absolute;
        top: 2px;
        right: 2px;
        min-width: 15px;
        height: 15px;
        padding: 0 3px;
        border-radius: 999px;
        background: #17181b;
        color: #fff;
        font-size: 8px;
        line-height: 15px;
        text-align: center;
    }

    .mobile-agenda > h2 {
        margin: 4px 0 18px;
        font-size: 28px;
    }

    .agenda-day {
        scroll-margin-top: 15px;
        margin-bottom: 24px;
    }

    .agenda-day-header {
        display: flex;
        align-items: center;
        gap: 11px;
        margin-bottom: 10px;
    }

    .agenda-date-box {
        display: flex;
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: #fff;
    }

    .agenda-date-box strong {
        font-size: 18px;
        line-height: 1;
    }

    .agenda-date-box span {
        margin-top: 3px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .agenda-day-header > div:last-child > strong {
        display: block;
        font-size: 15px;
    }

    .agenda-count {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
    }

    .agenda-bookings {
        display: grid;
        gap: 9px;
    }

    .agenda-booking {
        display: block;
        padding: 14px 15px;
        border: 1px solid var(--border);
        border-left-width: 4px;
        border-radius: 13px;
        background: #fff;
        color: var(--text);
        text-decoration: none;
    }

    .agenda-booking-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 8px;
    }

    .agenda-booking-top > strong {
        font-size: 14px;
    }

    .agenda-customer {
        overflow: hidden;
        font-size: 16px;
        font-weight: 650;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .agenda-number {
        margin-top: 4px;
        color: var(--muted);
        font-size: 12px;
    }

    .calendar-empty-state {
        padding: 28px 20px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: #fff;
        text-align: center;
    }

    .calendar-empty-state strong {
        display: block;
        font-size: 17px;
    }

    .calendar-empty-state p {
        margin: 8px 0 20px;
        color: var(--muted);
    }
}


/* ==========================================================
   MIETNEXA V3 – OPERATIONS / DOCUMENTS
   ========================================================== */

.v3-record {
    padding: 1rem 0;
    border-top: 1px solid #e5e7eb;
}

.v3-record:first-child {
    border-top: 0;
}

.v3-record form {
    margin-top: .75rem;
}

.v3-record input[type="file"] {
    max-width: 100%;
    margin-right: .5rem;
}

@media (max-width: 700px) {
    .v3-record form {
        display: grid;
        gap: .75rem;
    }

    .v3-record .button {
        width: 100%;
    }
}


/* ==========================================================
   MIETNEXA V3.1 – PRINT DOCUMENTS
   ========================================================== */

.document-create-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
}

.document-create-actions form {
    margin: 0;
}

.v3-record .actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    margin-top: .8rem;
}

@media (max-width: 700px) {
    .document-create-actions {
        display: grid;
        width: 100%;
    }

    .document-create-actions form,
    .document-create-actions .button {
        width: 100%;
    }

    .v3-record .actions {
        display: grid;
    }

    .v3-record .actions .button {
        width: 100%;
    }
}


/* ==========================================================
   MIETNEXA – DOCUMENT HISTORY ONLY
   ========================================================== */

.document-history {
    width: 100%;
}

.document-history > summary {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}

.document-history > summary::-webkit-details-marker {
    display: none;
}

.document-history > summary::after {
    margin-left: 7px;
    content: "⌄";
}

.document-history[open] > summary::after {
    content: "⌃";
}

.document-history-content {
    width: 100%;
}

@media (max-width: 700px) {
    .document-history > summary {
        min-height: 58px;
        padding: 0 4px;
        font-size: 14px;
    }
}


/* ==========================================================
   MIETNEXA UI V2 – APP SHELL / WEBSITE DESIGN LANGUAGE
   2026-10-03
   ========================================================== */

:root {
    --v2-bg: #f7f8fa;
    --v2-surface: #ffffff;
    --v2-surface-soft: #f8f8f8;
    --v2-text: #0c0d0f;
    --v2-muted: #8a8d92;
    --v2-muted-dark: #666a70;
    --v2-border: #e7e8ea;
    --v2-blue: #1769e8;
    --v2-blue-soft: #eaf2ff;
    --v2-green: #347452;
    --v2-green-soft: #edf7f1;
    --v2-red: #9c3939;
    --v2-radius: 18px;
    --v2-sidebar: 244px;
    --v2-topbar: 78px;
}

html {
    min-height: 100%;
    background: var(--v2-bg);
}

body {
    min-height: 100vh;
    background: var(--v2-bg);
    color: var(--v2-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}


/* ---------- Shell ---------- */

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: var(--v2-sidebar);
    flex-direction: column;
    border-right: 1px solid var(--v2-border);
    background: #fff;
}

.app-brand-row {
    display: flex;
    min-height: var(--v2-topbar);
    align-items: center;
    padding: 0 28px;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--v2-text);
    text-decoration: none;
}

.app-brand-mark {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: #0d0e10;
    color: #fff;
    font-size: 21px;
    font-weight: 750;
    letter-spacing: -.04em;
}

.app-brand-name {
    font-size: 21px;
    font-weight: 750;
    letter-spacing: -.04em;
}

.app-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    padding: 28px 18px;
    overflow-y: auto;
}

.app-nav-link {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 11px;
    padding: 0 14px;
    background: transparent;
    color: #74777c;
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    transition:
        background 120ms ease,
        color 120ms ease;
}

.app-nav-link:hover {
    background: #f5f6f7;
    color: var(--v2-text);
}

.app-nav-link.is-active {
    background: var(--v2-blue-soft);
    color: var(--v2-blue);
    font-weight: 650;
}

.app-nav-icon {
    display: inline-flex;
    width: 20px;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.app-sidebar-bottom {
    display: grid;
    gap: 5px;
    padding: 16px 18px 22px;
    border-top: 1px solid var(--v2-border);
}

.app-logout-form {
    margin: 0;
}

.app-nav-button {
    appearance: none;
    -webkit-appearance: none;
}

.app-workspace {
    min-height: 100vh;
    margin-left: var(--v2-sidebar);
}

.app-topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    min-height: var(--v2-topbar);
    align-items: center;
    padding: 0 42px;
    border-bottom: 1px solid var(--v2-border);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.app-topbar-spacer {
    flex: 1;
}

.app-company {
    max-width: 320px;
    overflow: hidden;
    color: #74777c;
    font-size: 14px;
    font-weight: 550;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-brand-mobile,
.mobile-nav-toggle,
.mobile-nav-close,
.app-nav-backdrop {
    display: none;
}

.page.app-page {
    width: min(1240px, calc(100% - 80px));
    margin: 0 auto;
    padding: 54px 0 90px;
}


/* ---------- Common content ---------- */

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

.v2-page-head h1 {
    margin: 5px 0 8px;
    font-size: clamp(38px, 4vw, 54px);
    line-height: 1;
    letter-spacing: -.055em;
}

.v2-page-head p {
    margin: 0;
    color: var(--v2-muted-dark);
    font-size: 15px;
    line-height: 1.55;
}

.v2-kicker,
.v2-section-kicker {
    display: block;
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.v2-primary-action {
    min-height: 48px;
    border-radius: 12px;
    padding: 0 20px;
    background: #111214 !important;
    border-color: #111214 !important;
}

.v2-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.v2-stat-card {
    display: flex;
    min-height: 174px;
    flex-direction: column;
    padding: 22px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    transition:
        border-color 120ms ease,
        transform 120ms ease;
}

.v2-stat-card:hover {
    border-color: #d5d7da;
    transform: translateY(-1px);
}

.v2-stat-label {
    color: var(--v2-muted);
    font-size: 13px;
}

.v2-stat-card strong {
    margin-top: 16px;
    font-size: 42px;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -.045em;
}

.v2-stat-link {
    margin-top: auto;
    color: var(--v2-muted-dark);
    font-size: 12px;
}

.v2-content-card {
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    overflow: hidden;
}

.v2-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px 22px;
}

.v2-section-head h2 {
    margin: 5px 0 5px;
    font-size: 23px;
    letter-spacing: -.035em;
}

.v2-section-head p {
    margin: 0;
    color: var(--v2-muted);
    font-size: 13px;
}

.v2-inline-link {
    color: var(--v2-text);
    font-size: 13px;
    font-weight: 650;
}

.v2-booking-list {
    border-top: 1px solid var(--v2-border);
}

.v2-booking-row {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.5fr)
        minmax(145px, .7fr)
        minmax(110px, .5fr)
        28px;
    align-items: center;
    gap: 24px;
    min-height: 92px;
    padding: 17px 28px;
    border-bottom: 1px solid var(--v2-border);
    background: #fff;
    transition: background 120ms ease;
}

.v2-booking-row:last-child {
    border-bottom: 0;
}

.v2-booking-row:hover {
    background: #fafafa;
}

.v2-booking-main {
    min-width: 0;
}

.v2-booking-main strong {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-booking-number {
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .035em;
}

.v2-booking-date span,
.v2-booking-date small {
    display: block;
    color: var(--v2-muted);
    font-size: 11px;
}

.v2-booking-date strong {
    display: block;
    margin: 4px 0 2px;
    font-size: 14px;
}

.v2-booking-status {
    display: flex;
    justify-content: flex-start;
}

.v2-row-arrow {
    color: #a1a4a8;
    font-size: 18px;
    text-align: right;
}

.v2-empty-state {
    padding: 56px 28px;
    border-top: 1px solid var(--v2-border);
    text-align: center;
}

.v2-empty-state strong {
    display: block;
    font-size: 17px;
}

.v2-empty-state p {
    margin: 7px 0 0;
    color: var(--v2-muted);
    font-size: 13px;
}


/* ---------- Existing pages brought into V2 language ---------- */

.app-page > .page-head {
    margin-bottom: 28px;
}

.app-page > .page-head h1 {
    margin: 5px 0 0;
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.04;
    letter-spacing: -.05em;
}

.app-page .eyebrow {
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
}

.app-page .panel,
.app-page .summary-card,
.app-page .stat-card,
.app-page .form-card {
    border-color: var(--v2-border);
    border-radius: var(--v2-radius);
    box-shadow: none;
}

.app-page .panel {
    background: #fff;
}

.app-page .booking-summary {
    gap: 12px;
}

.app-page .summary-card {
    padding: 18px 20px;
}

.app-page .summary-card span {
    color: var(--v2-muted);
}

.app-page .summary-card strong {
    font-size: 15px;
}

.app-page .section-head h2,
.app-page .panel h2 {
    letter-spacing: -.025em;
}

.app-page table th {
    color: var(--v2-muted);
}

.app-page table td,
.app-page table th {
    border-color: var(--v2-border);
}

.app-page .button {
    border-color: #dedfe2;
    border-radius: 11px;
}

.app-page .button.primary {
    background: #111214;
    border-color: #111214;
}

.app-page .status-confirmed {
    color: var(--v2-green);
    background: var(--v2-green-soft);
    border-color: transparent;
}

.message-stack {
    margin-bottom: 22px;
}


/* ---------- Public/auth fallback ---------- */

.public-topbar {
    display: flex;
    min-height: 82px;
    align-items: center;
    padding: 0 max(28px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid var(--v2-border);
    background: #fff;
}

.public-page {
    background: transparent;
}


/* ---------- Tablet ---------- */

@media (max-width: 1050px) {

    :root {
        --v2-sidebar: 214px;
    }

    .app-brand-row {
        padding-left: 22px;
        padding-right: 22px;
    }

    .app-nav {
        padding-left: 14px;
        padding-right: 14px;
    }

    .app-sidebar-bottom {
        padding-left: 14px;
        padding-right: 14px;
    }

    .page.app-page {
        width: min(100% - 48px, 1240px);
    }

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


/* ---------- Mobile ---------- */

@media (max-width: 760px) {

    :root {
        --v2-topbar: 68px;
    }

    body.nav-open {
        overflow: hidden;
    }

    .app-sidebar {
        width: min(86vw, 310px);
        transform: translateX(-102%);
        transition: transform 180ms ease;
        box-shadow: 18px 0 45px rgba(0, 0, 0, .08);
    }

    body.nav-open .app-sidebar {
        transform: translateX(0);
    }

    .app-nav-backdrop {
        position: fixed;
        z-index: 40;
        inset: 0;
        display: block;
        background: rgba(16, 18, 20, .24);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    body.nav-open .app-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .app-workspace {
        margin-left: 0;
    }

    .app-topbar {
        min-height: var(--v2-topbar);
        padding: 0 18px;
    }

    .mobile-nav-toggle {
        display: grid;
        width: 40px;
        height: 40px;
        place-content: center;
        gap: 4px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        padding: 0;
    }

    .mobile-nav-toggle span {
        display: block;
        width: 19px;
        height: 2px;
        border-radius: 2px;
        background: #111214;
    }

    .app-topbar-brand-mobile {
        display: flex;
        align-items: center;
        gap: 9px;
        margin-left: 8px;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: -.03em;
    }

    .app-brand-mark-small {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        border-radius: 9px;
        font-size: 15px;
    }

    .mobile-nav-close {
        display: inline-flex;
        width: 36px;
        height: 36px;
        margin-left: auto;
        align-items: center;
        justify-content: center;
        border: 0;
        background: transparent;
        color: #666;
        font-size: 28px;
        font-weight: 300;
    }

    .app-company {
        max-width: 34vw;
        font-size: 12px;
    }

    .page.app-page {
        width: 100%;
        padding: 28px 16px 64px;
    }

    .v2-page-head {
        display: block;
        margin-bottom: 22px;
    }

    .v2-page-head h1 {
        font-size: 38px;
    }

    .v2-page-head p {
        font-size: 14px;
    }

    .v2-primary-action {
        display: flex;
        width: 100%;
        margin-top: 20px;
    }

    .v2-dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .v2-stat-card {
        min-height: 138px;
        padding: 17px;
        border-radius: 15px;
    }

    .v2-stat-card strong {
        margin-top: 13px;
        font-size: 34px;
    }

    .v2-stat-link {
        font-size: 10px;
    }

    .v2-content-card {
        border-radius: 16px;
    }

    .v2-section-head {
        display: block;
        padding: 21px 18px 17px;
    }

    .v2-inline-link {
        display: inline-block;
        margin-top: 14px;
    }

    .v2-booking-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px 16px;
        min-height: 0;
        padding: 17px 18px;
    }

    .v2-booking-main {
        grid-column: 1;
    }

    .v2-booking-date {
        grid-column: 1;
    }

    .v2-booking-status {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
    }

    .v2-row-arrow {
        grid-column: 2;
        grid-row: 2;
        align-self: end;
    }

    .app-page > .page-head h1 {
        font-size: 36px;
    }

    .app-page > .page-head {
        margin-bottom: 20px;
    }

    .app-page .booking-summary {
        gap: 9px;
    }

    .app-page .summary-card {
        padding: 16px;
    }
}


/* ---------- Small phones ---------- */

@media (max-width: 420px) {

    .app-company {
        max-width: 28vw;
    }

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

    .v2-stat-card {
        min-height: 128px;
        padding: 15px;
    }

    .v2-stat-card strong {
        font-size: 31px;
    }

    .v2-stat-link {
        display: none;
    }
}


/* ==========================================================
   MIETNEXA UI V2 – PHASE 2
   BOOKING DETAIL
   ========================================================== */

.v2-booking-page {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.v2-booking-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 28px;
}

.v2-booking-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 7px;
}

.v2-booking-title-row h1 {
    margin: 0;
    font-size: clamp(38px, 5vw, 58px);
    line-height: .98;
    letter-spacing: -.055em;
}

.v2-booking-title-row .status {
    flex: 0 0 auto;
}

.v2-booking-customer-line {
    margin: 10px 0 0;
    color: var(--v2-muted-dark);
    font-size: 15px;
}

.v2-booking-actions {
    display: flex;
    gap: 9px;
    flex: 0 0 auto;
}


/* ---------- Overview ---------- */

.v2-booking-overview {
    display: grid;
    grid-template-columns: minmax(220px, .72fr) minmax(0, 1.6fr);
    gap: 14px;
    margin-bottom: 14px;
}

.v2-booking-customer-card,
.v2-booking-time-card {
    border: 1px solid var(--v2-border);
    border-radius: 17px;
    background: #fff;
}

.v2-booking-customer-card {
    display: flex;
    min-height: 126px;
    flex-direction: column;
    justify-content: center;
    padding: 22px 24px;
}

.v2-card-label {
    display: block;
    margin-bottom: 8px;
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
}

.v2-booking-customer-card > strong {
    font-size: 18px;
    letter-spacing: -.02em;
}

.v2-card-subline {
    margin-top: 6px;
    color: var(--v2-muted);
    font-size: 12px;
}

.v2-booking-time-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1fr;
    align-items: center;
    min-height: 126px;
    padding: 20px 24px;
}

.v2-time-block,
.v2-duration-block {
    min-width: 0;
}

.v2-time-block span,
.v2-duration-block span {
    display: block;
    color: var(--v2-muted);
    font-size: 11px;
}

.v2-time-block strong,
.v2-duration-block strong {
    display: block;
    margin-top: 5px;
    font-size: 16px;
    letter-spacing: -.015em;
}

.v2-time-block small {
    display: block;
    margin-top: 3px;
    color: var(--v2-muted-dark);
}

.v2-time-arrow {
    padding: 0 24px;
    color: #b3b5b8;
}

.v2-duration-block {
    padding-left: 28px;
    border-left: 1px solid var(--v2-border);
}


/* ---------- Detail sections ---------- */

.v2-detail-section {
    margin-top: 14px;
    padding: 27px 28px;
    border: 1px solid var(--v2-border);
    border-radius: 18px;
    background: #fff;
}

.v2-detail-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.v2-detail-section-head h2 {
    margin: 5px 0 0;
    font-size: 23px;
    line-height: 1.15;
    letter-spacing: -.035em;
}

.v2-detail-section-head p {
    margin: 6px 0 0;
    color: var(--v2-muted);
    font-size: 12px;
    line-height: 1.5;
}


/* ---------- Rental items ---------- */

.v2-rental-items {
    display: grid;
    gap: 9px;
}

.v2-rental-item {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 16px;
    min-height: 92px;
    padding: 16px 18px;
    border: 1px solid var(--v2-border);
    border-radius: 14px;
    background: #fff;
}

.v2-rental-item-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 12px;
    background: var(--v2-blue-soft);
    color: var(--v2-blue);
    font-size: 19px;
}

.v2-rental-item-main {
    min-width: 0;
}

.v2-rental-item-name {
    display: block;
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-rental-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    margin-top: 7px;
    color: var(--v2-muted-dark);
    font-size: 11px;
}

.v2-rental-buffer {
    display: block;
    margin-top: 6px;
    color: var(--v2-muted);
}

.v2-rental-item-money {
    min-width: 110px;
    text-align: right;
}

.v2-rental-item-money span,
.v2-rental-item-money small {
    display: block;
    color: var(--v2-muted);
    font-size: 10px;
}

.v2-rental-item-money strong {
    display: block;
    margin: 4px 0;
    font-size: 16px;
}

.v2-rental-item-action {
    min-width: 70px;
    text-align: right;
}

.v2-booking-totals {
    display: flex;
    justify-content: flex-end;
    gap: 42px;
    margin-top: 20px;
    padding-top: 19px;
    border-top: 1px solid var(--v2-border);
}

.v2-booking-totals > div {
    min-width: 120px;
    text-align: right;
}

.v2-booking-totals span {
    display: block;
    color: var(--v2-muted);
    font-size: 11px;
}

.v2-booking-totals strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    letter-spacing: -.025em;
}


/* ---------- Notes ---------- */

.v2-note-card {
    padding: 19px 20px;
    border-radius: 13px;
    background: var(--v2-surface-soft);
}

.v2-note-card p {
    margin: 0;
}


/* ---------- Workflow ---------- */

.v2-workflow {
    display: grid;
    grid-template-columns: 1fr 42px 1fr 42px 1fr;
    align-items: start;
    padding: 8px 4px 3px;
}

.v2-workflow-step {
    display: flex;
    gap: 13px;
    min-width: 0;
}

.v2-workflow-marker {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid #dfe1e4;
    border-radius: 50%;
    background: #fff;
    color: #96999d;
    font-size: 12px;
    font-weight: 650;
}

.v2-workflow-marker.is-done {
    border-color: transparent;
    background: var(--v2-green-soft);
    color: var(--v2-green);
}

.v2-workflow-body {
    min-width: 0;
}

.v2-workflow-label {
    display: block;
    color: var(--v2-muted);
    font-size: 10px;
}

.v2-workflow-body strong {
    display: block;
    margin-top: 3px;
    font-size: 14px;
}

.v2-workflow-body small {
    display: block;
    margin-top: 5px;
    color: var(--v2-muted);
    line-height: 1.45;
}

.v2-workflow-line {
    height: 1px;
    margin-top: 17px;
    background: var(--v2-border);
}

.v2-workflow-action {
    display: inline-block;
    margin-top: 8px;
    color: var(--v2-blue);
    font-size: 12px;
    font-weight: 650;
}

.v2-warning-text {
    color: #9a641f !important;
}


/* ---------- Data rows ---------- */

.v2-data-list {
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: 14px;
}

.v2-data-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    align-items: center;
    min-height: 76px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--v2-border);
}

.v2-data-row:last-child {
    border-bottom: 0;
}

.v2-data-row > div {
    min-width: 0;
}

.v2-data-row span {
    display: block;
    color: var(--v2-muted);
    font-size: 10px;
}

.v2-data-row strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-data-row-link {
    grid-template-columns: repeat(5, minmax(0, 1fr)) 24px;
    color: inherit;
    transition: background 120ms ease;
}

.v2-data-row-link:hover {
    background: #fafafa;
}

.v2-empty-inline {
    padding: 20px;
    border-radius: 13px;
    background: var(--v2-surface-soft);
    color: var(--v2-muted-dark);
    font-size: 13px;
}

.v2-empty-inline a {
    margin-left: 6px;
    color: var(--v2-blue);
    font-weight: 650;
}

.v2-empty-state-contained {
    border: 1px dashed #dfe1e4;
    border-radius: 14px;
}


/* ---------- Damage / records ---------- */

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

.v2-record-card {
    padding: 19px;
    border: 1px solid var(--v2-border);
    border-radius: 14px;
}

.v2-record-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.v2-record-card-head strong {
    display: block;
    font-size: 15px;
}

.v2-record-reference {
    color: var(--v2-muted);
    font-size: 11px;
}

.v2-record-card > p {
    margin: 15px 0;
    color: var(--v2-muted-dark);
    font-size: 13px;
}

.v2-upload-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.v2-upload-row input[type="file"] {
    max-width: 100%;
    font-size: 12px;
}

.v2-muted-text {
    display: block;
    margin-top: 10px;
    color: var(--v2-muted);
}

.v2-positive-empty {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 18px 20px;
    border-radius: 13px;
    background: var(--v2-green-soft);
    color: var(--v2-green);
}

.v2-positive-empty > span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: rgba(52, 116, 82, .08);
    font-weight: 700;
}

.v2-positive-empty strong,
.v2-positive-empty small {
    display: block;
}

.v2-positive-empty small {
    margin-top: 3px;
    opacity: .75;
}


/* ---------- Documents ---------- */

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

.v2-document-card {
    margin: 0;
    border-color: var(--v2-border);
    border-radius: 14px;
    box-shadow: none;
}

.v2-document-main {
    display: flex;
    align-items: center;
    gap: 13px;
}

.v2-document-main > div {
    min-width: 0;
}

.v2-document-main strong,
.v2-document-main span {
    display: block;
}

.v2-document-main span {
    margin-top: 4px;
    color: var(--v2-muted);
    font-size: 11px;
}

.v2-document-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 11px;
    background: var(--v2-surface-soft);
    color: #6f7378;
}

.v2-document-card > .actions {
    margin-top: 14px;
}

.v2-document-card .v2-upload-row {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--v2-border);
}


/* Existing accepted history behavior remains */

.v2-document-list .document-history {
    margin-top: 0;
}

.v2-document-list .document-history-content {
    display: grid;
    gap: 10px;
    padding-top: 10px;
}


/* ---------- Status ---------- */

.v2-status-section {
    margin-bottom: 0;
}

.v2-status-section > .actions {
    margin-top: 0;
}


/* ==========================================================
   PHASE 2 – TABLET
   ========================================================== */

@media (max-width: 980px) {

    .v2-booking-overview {
        grid-template-columns: 1fr;
    }

    .v2-rental-item {
        grid-template-columns: 50px minmax(0, 1fr) auto;
    }

    .v2-rental-item-action {
        grid-column: 2 / -1;
        text-align: left;
    }

    .v2-workflow {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .v2-workflow-line {
        width: 1px;
        height: 24px;
        margin: 0 0 0 17px;
    }

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

    .v2-data-row-link .v2-row-arrow {
        display: none;
    }
}


/* ==========================================================
   PHASE 2 – MOBILE
   ========================================================== */

@media (max-width: 760px) {

    .v2-booking-hero {
        display: block;
        margin-bottom: 20px;
    }

    .v2-booking-title-row {
        gap: 10px;
    }

    .v2-booking-title-row h1 {
        max-width: 100%;
        font-size: 36px;
        overflow-wrap: anywhere;
    }

    .v2-booking-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        margin-top: 20px;
    }

    .v2-booking-actions .button {
        display: flex;
        min-width: 0;
        justify-content: center;
    }

    .v2-booking-customer-card {
        min-height: 104px;
        padding: 18px;
    }

    .v2-booking-time-card {
        grid-template-columns: 1fr auto 1fr;
        min-height: 0;
        padding: 18px;
    }

    .v2-time-arrow {
        padding: 0 13px;
    }

    .v2-duration-block {
        grid-column: 1 / -1;
        margin-top: 17px;
        padding: 16px 0 0;
        border-top: 1px solid var(--v2-border);
        border-left: 0;
    }

    .v2-detail-section {
        margin-top: 10px;
        padding: 20px 17px;
        border-radius: 16px;
    }

    .v2-detail-section-head {
        display: block;
        margin-bottom: 18px;
    }

    .v2-detail-section-head > .button,
    .v2-detail-section-head > .document-create-actions {
        margin-top: 15px;
    }

    .v2-rental-item {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 12px;
        padding: 15px;
    }

    .v2-rental-item-icon {
        width: 42px;
        height: 42px;
    }

    .v2-rental-item-money {
        grid-column: 2;
        text-align: left;
    }

    .v2-rental-item-action {
        grid-column: 2;
    }

    .v2-booking-totals {
        gap: 24px;
    }

    .v2-booking-totals > div {
        min-width: 0;
    }

    .v2-data-row,
    .v2-data-row-link {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        min-height: 0;
        padding: 16px;
    }

    .v2-record-card-head {
        display: block;
    }

    .v2-record-reference {
        display: block;
        margin-top: 7px;
    }

    .v2-upload-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .v2-upload-row .button {
        width: 100%;
    }

    .document-create-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .document-create-actions form,
    .document-create-actions .button {
        width: 100%;
    }

    .v2-document-card .actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .v2-document-card .actions .button {
        width: 100%;
    }
}


/* ==========================================================
   PHASE 2 – SMALL PHONE
   ========================================================== */

@media (max-width: 430px) {

    .v2-booking-actions {
        grid-template-columns: 1fr;
    }

    .v2-booking-time-card {
        grid-template-columns: 1fr 20px 1fr;
        padding: 16px;
    }

    .v2-time-block strong {
        font-size: 14px;
    }

    .v2-time-arrow {
        padding: 0;
        text-align: center;
    }

    .v2-data-row,
    .v2-data-row-link {
        grid-template-columns: 1fr;
    }

    .v2-booking-totals {
        justify-content: space-between;
    }
}


/* ==========================================================
   MIETNEXA UI V2 – PHASE 3
   LISTS · FORMS · BILLING · CALENDAR
   ========================================================== */

.v2-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.v2-list-card {
    overflow: hidden;
}

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

.v2-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.v2-table th {
    padding: 14px 18px;
    border-bottom: 1px solid var(--v2-border);
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .055em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.v2-table td {
    padding: 18px;
    border-bottom: 1px solid var(--v2-border);
    color: var(--v2-muted-dark);
    font-size: 14px;
    line-height: 1.45;
    vertical-align: middle;
}

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

.v2-table tbody tr {
    transition: background-color 120ms ease;
}

.v2-table tbody tr:hover {
    background: #fafbfc;
}

.v2-table td strong {
    color: var(--v2-text);
    font-weight: 650;
}

.v2-record-link {
    color: var(--v2-blue);
    font-weight: 650;
}

.v2-record-link:hover {
    text-decoration: underline;
}

.v2-money-cell {
    text-align: right !important;
    white-space: nowrap;
}

.v2-date-range {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.v2-date-range > span {
    color: var(--v2-muted);
}

.v2-neutral-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--v2-border);
    border-radius: 999px;
    background: var(--v2-surface-soft);
    color: var(--v2-muted-dark);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.v2-asset-name {
    display: flex;
    align-items: center;
    gap: 11px;
}

.v2-mini-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--v2-blue-soft);
    color: var(--v2-blue);
    font-size: 17px;
}

.v2-list-card > .v2-empty-state {
    padding: 56px 28px;
}


/* ---------- Forms ---------- */

.v2-form-page,
.v2-record-page {
    width: min(100%, 1040px);
    margin: 0 auto;
}

.v2-form-page {
    width: min(100%, 900px);
}

.v2-form-card {
    margin-bottom: 16px;
    padding: 26px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
}

.v2-form-section-head {
    margin-bottom: 24px;
}

.v2-form-section-head h2 {
    margin: 4px 0 0;
    color: var(--v2-text);
    font-size: 21px;
    line-height: 1.2;
}

.v2-form-section-head p {
    max-width: 680px;
    margin: 8px 0 0;
    color: var(--v2-muted);
    font-size: 14px;
    line-height: 1.55;
}

.v2-form p {
    margin: 0;
}

.v2-form-fields {
    display: grid;
    gap: 19px;
}

.v2-form-fields > p,
.v2-form-grid > p {
    display: grid;
    gap: 8px;
}

.v2-form label {
    color: var(--v2-muted-dark);
    font-size: 12px;
    font-weight: 700;
}

.v2-form input:not([type="checkbox"]):not([type="radio"]),
.v2-form select,
.v2-form textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #dfe1e4;
    border-radius: 10px;
    outline: 0;
    background: #fff;
    color: var(--v2-text);
    font: inherit;
    transition:
        border-color 120ms ease,
        box-shadow 120ms ease;
}

.v2-form textarea {
    min-height: 108px;
    resize: vertical;
}

.v2-form input[type="file"] {
    min-height: 46px;
    padding: 9px;
    border: 1px solid #dfe1e4;
    border-radius: 10px;
    background: #fff;
}

.v2-form input:focus,
.v2-form select:focus,
.v2-form textarea:focus {
    border-color: #8bb5f5;
    box-shadow: 0 0 0 3px rgba(23, 105, 232, .10);
}

.v2-form ul.errorlist {
    margin: 0;
    padding: 0;
    color: var(--v2-red);
    font-size: 12px;
    list-style: none;
}

.v2-form .helptext {
    display: block;
    margin-top: 2px;
    color: var(--v2-muted);
    font-size: 12px;
    line-height: 1.45;
}

.v2-form-grid {
    display: grid;
    gap: 18px;
}

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

.v2-form-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.v2-form-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.v2-form-hint {
    margin: 18px 0 0 !important;
    padding-top: 16px;
    border-top: 1px solid var(--v2-border);
    color: var(--v2-muted);
    font-size: 12px;
    line-height: 1.5;
}

.v2-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.v2-form-card > .v2-form > .v2-form-actions {
    padding-top: 4px;
}


/* ---------- Calendar ---------- */

.v2-calendar-page-head {
    margin-bottom: 16px;
}

.v2-calendar-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.v2-calendar-card {
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    box-shadow: none;
}

.calendar-desktop .v2-calendar-card {
    overflow: hidden;
}

.calendar-desktop .calendar-head {
    background: #fafafa;
    border-bottom-color: var(--v2-border);
}

.calendar-desktop .calendar-head > div {
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.calendar-desktop .calendar-day {
    background: #fff;
    border-color: var(--v2-border);
}

.calendar-desktop .calendar-day.outside {
    background: #fafafa;
}

.calendar-desktop .calendar-day.today {
    background: #fbfdff;
}

.calendar-desktop .calendar-date {
    color: var(--v2-muted-dark);
    font-weight: 650;
}

.calendar-desktop .calendar-day.today .calendar-date {
    color: var(--v2-blue);
}

.calendar-booking {
    border-radius: 9px;
    box-shadow: none;
}


/* ---------- Invoice detail ---------- */

.v2-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: 12px;
    background: var(--v2-border);
}

.v2-meta-grid > div {
    display: grid;
    gap: 5px;
    padding: 16px;
    background: var(--v2-surface);
}

.v2-meta-grid span,
.v2-invoice-totals span {
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.v2-meta-grid strong {
    color: var(--v2-text);
    font-size: 14px;
}

.v2-inline-operation {
    margin-top: 20px;
}

.v2-invoice-totals {
    display: flex;
    justify-content: flex-end;
    gap: 34px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--v2-border);
}

.v2-invoice-totals > div {
    display: grid;
    gap: 5px;
    min-width: 92px;
    text-align: right;
}

.v2-invoice-totals strong {
    color: var(--v2-text);
    font-size: 16px;
}

.v2-invoice-totals .v2-total-emphasis strong {
    font-size: 20px;
}

.v2-payment-list {
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: 12px;
}

.v2-payment-row {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--v2-border);
}

.v2-payment-row:last-child {
    border-bottom: 0;
}

.v2-payment-row > div {
    display: grid;
    gap: 3px;
}

.v2-payment-row strong {
    color: var(--v2-text);
}

.v2-payment-row span,
.v2-payment-row time {
    color: var(--v2-muted);
    font-size: 12px;
}

.v2-empty-inline {
    padding: 20px 16px;
    color: var(--v2-muted);
    font-size: 14px;
}

.v2-payment-form {
    margin-top: 20px;
}

.v2-payment-form .v2-form-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.v2-danger-section {
    border-color: #eadada;
}


/* ==========================================================
   PHASE 3 – TABLET
   ========================================================== */

@media (max-width: 1050px) {

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

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


/* ==========================================================
   PHASE 3 – MOBILE
   ========================================================== */

@media (max-width: 760px) {

    .v2-head-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        margin-top: 20px;
    }

    .v2-head-actions .button {
        width: 100%;
    }

    .v2-list-card {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .v2-table-wrap {
        overflow: visible;
    }

    .v2-table,
    .v2-table tbody {
        display: block;
        width: 100%;
    }

    .v2-table thead {
        display: none;
    }

    .v2-table tr {
        display: block;
        margin-bottom: 10px;
        padding: 15px 17px;
        border: 1px solid var(--v2-border);
        border-radius: 15px;
        background: var(--v2-surface);
    }

    .v2-table td {
        display: flex;
        width: 100%;
        align-items: baseline;
        justify-content: space-between;
        gap: 18px;
        padding: 7px 0;
        border: 0;
        text-align: right;
    }

    .v2-table td:first-child {
        padding-top: 0;
    }

    .v2-table td:last-child {
        padding-bottom: 0;
    }

    .v2-table td::before {
        flex: 0 0 34%;
        color: var(--v2-muted);
        content: "";
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .04em;
        text-align: left;
        text-transform: uppercase;
    }

    .v2-table td > * {
        min-width: 0;
    }

    .v2-table .v2-money-cell {
        text-align: right !important;
    }

    .v2-table .v2-asset-name {
        justify-content: flex-end;
    }

    .v2-table .v2-date-range {
        justify-content: flex-end;
    }

    /* Buchungen */
    .v2-list-card .v2-table td:nth-child(1)::before {
        content: "Buchung";
    }

    .v2-list-card .v2-table td:nth-child(2)::before {
        content: "Kunde";
    }

    .v2-list-card .v2-table td:nth-child(3)::before {
        content: "Zeitraum";
    }

    .v2-list-card .v2-table td:nth-child(4)::before {
        content: "Dauer";
    }

    .v2-list-card .v2-table td:nth-child(5)::before {
        content: "Status";
    }

    .v2-list-card .v2-table td:nth-child(6)::before {
        content: "Betrag";
    }

    .v2-form-card {
        padding: 20px 17px;
        border-radius: 16px;
    }

    .v2-form-grid-two,
    .v2-form-grid-three,
    .v2-form-grid-four,
    .v2-payment-form .v2-form-fields {
        grid-template-columns: 1fr;
    }

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

    .v2-form-actions .button {
        width: 100%;
    }

    .v2-calendar-toolbar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .v2-calendar-toolbar .button {
        min-width: 0;
        padding-right: 8px;
        padding-left: 8px;
    }

    .v2-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .v2-invoice-totals {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .v2-invoice-totals > div {
        min-width: 0;
    }
}


/* ==========================================================
   PHASE 3 – SMALL PHONE
   ========================================================== */

@media (max-width: 430px) {

    .v2-meta-grid {
        grid-template-columns: 1fr;
    }

    .v2-invoice-totals {
        grid-template-columns: 1fr;
    }

    .v2-invoice-totals > div {
        text-align: left;
    }

    .v2-table td {
        display: grid;
        grid-template-columns: minmax(90px, 34%) 1fr;
    }

    .v2-table td::before {
        flex: none;
    }
}


/* ==========================================================
   MIETNEXA UI V2 – MASTERDATA CRUD
   ========================================================== */

.v2-row-action {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.v2-row-action a,
.v2-subtle-link {
    color: var(--v2-muted-dark);
    font-size: 13px;
    font-weight: 650;
}

.v2-row-action a:hover,
.v2-subtle-link:hover {
    color: var(--v2-blue);
}

.v2-masterdata-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: 13px;
    background: var(--v2-border);
}

.v2-masterdata-grid > div {
    display: grid;
    min-height: 82px;
    align-content: center;
    gap: 6px;
    padding: 16px;
    background: var(--v2-surface);
}

.v2-masterdata-grid span,
.v2-masterdata-note > span {
    color: var(--v2-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.v2-masterdata-grid strong {
    overflow-wrap: anywhere;
    color: var(--v2-text);
    font-size: 14px;
    font-weight: 650;
}

.v2-masterdata-note {
    margin-top: 16px;
    padding: 17px;
    border: 1px solid var(--v2-border);
    border-radius: 13px;
    background: var(--v2-surface-soft);
}

.v2-masterdata-note p {
    margin: 7px 0 0;
    color: var(--v2-text);
    font-size: 14px;
    line-height: 1.6;
}

.v2-delete-card {
    max-width: 720px;
}

.v2-delete-warning h2 {
    margin: 5px 0 8px;
    color: var(--v2-text);
    font-size: 22px;
}

.v2-delete-warning p {
    margin: 0;
    color: var(--v2-muted-dark);
    font-size: 14px;
    line-height: 1.6;
}

.button.v2-danger-button {
    border: 1px solid #b94a4a;
    background: #b94a4a;
    color: #fff;
}

.button.v2-danger-button:hover {
    border-color: #a13d3d;
    background: #a13d3d;
}

@media (max-width: 1050px) {
    .v2-masterdata-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .v2-masterdata-grid {
        grid-template-columns: 1fr 1fr;
    }

    .v2-row-action {
        width: auto;
    }
}

@media (max-width: 430px) {
    .v2-masterdata-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   MIETNEXA – RECHNUNGSARBEITSPLATZ
   ========================================================== */

.invoice-workspace {
    width: min(100%, 1120px);
}

.invoice-workspace-head {
    align-items: flex-start;
}

.invoice-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.invoice-title-line h1 {
    margin-right: 2px;
}

.invoice-status {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--v2-border);
    border-radius: 999px;
    background: var(--v2-surface-soft);
    color: var(--v2-muted-dark);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.invoice-status-draft {
    border-color: #d9e6fb;
    background: var(--v2-blue-soft);
    color: var(--v2-blue);
}

.invoice-status-issued {
    border-color: #dbe8df;
    background: var(--v2-green-soft);
    color: var(--v2-green);
}

.invoice-status-cancelled {
    border-color: #eadada;
    background: #fff5f5;
    color: var(--v2-red);
}

.invoice-editor {
    display: grid;
    gap: 16px;
}

.invoice-editor .v2-detail-section {
    margin: 0;
}

.invoice-editor-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 260px));
    gap: 18px;
}

.invoice-field {
    display: grid;
    gap: 7px;
}

.invoice-field label {
    color: var(--v2-muted-dark);
    font-size: 12px;
    font-weight: 700;
}

.invoice-field input:not([type="checkbox"]),
.invoice-field select,
.invoice-field textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #dfe1e4;
    border-radius: 10px;
    outline: 0;
    background: #fff;
    color: var(--v2-text);
    font: inherit;
}

.invoice-field textarea {
    min-height: 92px;
    resize: vertical;
}

.invoice-field input:focus,
.invoice-field select:focus,
.invoice-field textarea:focus {
    border-color: #8bb5f5;
    box-shadow: 0 0 0 3px rgba(23, 105, 232, .10);
}

.invoice-field .errorlist,
.invoice-form-errors .errorlist {
    margin: 0;
    padding: 0;
    color: var(--v2-red);
    font-size: 12px;
    list-style: none;
}

.invoice-input-suffix {
    display: flex;
    align-items: stretch;
}

.invoice-input-suffix input {
    border-radius: 10px 0 0 10px !important;
}

.invoice-input-suffix > span {
    display: inline-flex;
    min-width: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid #dfe1e4;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: #fafafa;
    color: var(--v2-muted-dark);
    font-size: 13px;
    font-weight: 650;
}

.invoice-edit-items {
    display: grid;
    gap: 12px;
}

.invoice-edit-item {
    padding: 18px;
    border: 1px solid var(--v2-border);
    border-radius: 14px;
    background: #fff;
}

.invoice-edit-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
}

.invoice-edit-item-head > strong {
    color: var(--v2-text);
    font-size: 13px;
}

.invoice-delete-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--v2-muted);
    font-size: 12px;
    cursor: pointer;
}

.invoice-remove-new {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--v2-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.invoice-remove-new:hover,
.invoice-delete-toggle:hover {
    color: var(--v2-red);
}

.invoice-item-description {
    margin-bottom: 14px;
}

.invoice-item-grid {
    display: grid;
    grid-template-columns:
        minmax(90px, .7fr)
        minmax(90px, .7fr)
        minmax(120px, 1fr)
        minmax(120px, 1fr)
        minmax(90px, .7fr)
        minmax(130px, 1fr);
    gap: 12px;
    align-items: end;
}

.invoice-checkbox-field {
    min-height: 46px;
    align-content: center;
}

.invoice-checkbox-field > label {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--v2-border);
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
}

.invoice-checkbox-field input {
    width: auto;
}

.invoice-add-item {
    margin-top: 14px;
}

.invoice-current-total {
    display: grid;
    justify-content: end;
    gap: 3px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--v2-border);
    text-align: right;
}

.invoice-current-total > span {
    color: var(--v2-muted);
    font-size: 12px;
}

.invoice-current-total > strong {
    color: var(--v2-text);
    font-size: 25px;
    letter-spacing: -.02em;
}

.invoice-current-total > small {
    color: var(--v2-muted);
    font-size: 11px;
}

.invoice-notes-field {
    margin-top: 18px;
}

.invoice-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 4px 0 8px;
}

.invoice-finalize-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-top: 16px;
    padding: 24px 26px;
    border: 1px solid #dbe8df;
    border-radius: var(--v2-radius);
    background: #fbfdfb;
}

.invoice-finalize-card h2 {
    margin: 4px 0 0;
    color: var(--v2-text);
    font-size: 20px;
}

.invoice-finalize-card p {
    max-width: 680px;
    margin: 7px 0 0;
    color: var(--v2-muted);
    font-size: 13px;
    line-height: 1.55;
}

.invoice-issued-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: 12px;
    background: var(--v2-border);
}

.invoice-issued-summary > div {
    display: grid;
    gap: 5px;
    padding: 17px;
    background: #fff;
}

.invoice-issued-summary span {
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.invoice-issued-summary strong {
    color: var(--v2-text);
    font-size: 15px;
}

.invoice-more-actions {
    margin-top: 16px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: #fff;
}

.invoice-more-actions > summary {
    padding: 18px 22px;
    color: var(--v2-muted-dark);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.invoice-more-actions-content {
    padding: 0 22px 22px;
}

.invoice-form-errors {
    padding: 14px 16px;
    border: 1px solid #eadada;
    border-radius: 12px;
    background: #fff7f7;
    color: var(--v2-red);
    font-size: 13px;
}

.invoice-overview-card {
    overflow: hidden;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
}

.invoice-create-inline {
    display: inline;
}

.invoice-text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--v2-blue);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.invoice-text-button:hover {
    text-decoration: underline;
}


/* Rechnungen erhalten auf Mobilgeräten eigene Labels.
   Die globalen Buchungslabels werden bewusst überschrieben. */

@media (max-width: 1050px) {

    .invoice-item-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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


@media (max-width: 760px) {

    .invoice-title-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .invoice-editor-meta {
        grid-template-columns: 1fr;
    }

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

    .invoice-edit-item {
        padding: 16px;
    }

    .invoice-editor-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .invoice-editor-actions .button {
        width: 100%;
    }

    .invoice-finalize-card {
        align-items: stretch;
        flex-direction: column;
    }

    .invoice-finalize-card .button {
        width: 100%;
    }

    .invoice-overview-card {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .invoice-list-table td::before {
        content: attr(data-label) !important;
    }

    .invoice-items-table td:nth-child(1)::before {
        content: "Pos." !important;
    }

    .invoice-items-table td:nth-child(2)::before {
        content: "Beschreibung" !important;
    }

    .invoice-items-table td:nth-child(3)::before {
        content: "Berechnung" !important;
    }

    .invoice-items-table td:nth-child(4)::before {
        content: "Netto" !important;
    }

    .invoice-items-table td:nth-child(5)::before {
        content: "USt." !important;
    }

    .invoice-items-table td:nth-child(6)::before {
        content: "Brutto" !important;
    }
}


@media (max-width: 520px) {

    .invoice-item-grid {
        grid-template-columns: 1fr;
    }

    .invoice-edit-item-head {
        align-items: flex-start;
    }

    .invoice-editor-actions {
        grid-template-columns: 1fr;
    }

    .invoice-issued-summary {
        grid-template-columns: 1fr;
    }

    .invoice-current-total {
        justify-content: stretch;
        text-align: left;
    }
}


/* ==========================================================
   MIETNEXA – INVOICE EDITOR MOBILE POLISH
   ========================================================== */

.invoice-customer-card h2 {
    margin: 6px 0 8px;
}

.invoice-customer-card p {
    margin: 0;
    color: var(--v2-muted);
    line-height: 1.55;
}

.invoice-field-caption {
    color: var(--v2-muted-dark);
    font-size: 12px;
    font-weight: 700;
}

.invoice-preview-hint {
    margin: -2px 0 8px;
    color: var(--v2-muted);
    font-size: 11px;
    text-align: right;
}

.invoice-item-grid select {
    appearance: auto;
}

@media (max-width: 760px) {

    .invoice-workspace {
        width: 100%;
    }

    .invoice-workspace-head {
        margin-bottom: 22px;
    }

    .invoice-workspace-head h1 {
        font-size: clamp(34px, 10vw, 46px);
        line-height: .98;
    }

    .invoice-editor {
        gap: 12px;
    }

    .invoice-editor .v2-detail-section,
    .invoice-customer-card {
        padding: 20px;
        border-radius: 16px;
    }

    .invoice-editor .v2-detail-section-head {
        margin-bottom: 18px;
    }

    .invoice-editor .v2-detail-section-head h2,
    .invoice-customer-card h2 {
        font-size: 24px;
        line-height: 1.08;
    }

    .invoice-item-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
    }

    .invoice-item-description {
        margin-bottom: 16px;
    }

    .invoice-field input:not([type="checkbox"]),
    .invoice-field select,
    .invoice-field textarea {
        min-height: 50px;
        font-size: 16px;
    }

    .invoice-input-suffix > span {
        min-width: 44px;
    }

    .invoice-checkbox-field {
        min-height: auto;
    }

    .invoice-checkbox-field > label {
        min-height: 50px;
    }

    .invoice-current-total {
        margin-top: 18px;
        padding: 18px 2px 0;
    }

    .invoice-current-total > strong {
        font-size: 29px;
    }

    .invoice-add-item {
        width: 100%;
    }

    .invoice-editor-actions {
        grid-template-columns: 1fr 1fr;
        padding-top: 2px;
    }

    .invoice-editor-actions .button {
        min-height: 52px;
    }

    .invoice-preview-hint {
        margin-top: -3px;
        text-align: center;
    }

    .invoice-finalize-card {
        margin-top: 12px;
        padding: 22px 20px;
    }

    .invoice-finalize-card h2 {
        font-size: 26px;
    }
}


@media (max-width: 520px) {

    .invoice-item-grid {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-item-grid .invoice-field:nth-child(3),
    .invoice-item-grid .invoice-field:nth-child(4),
    .invoice-item-grid .invoice-field:nth-child(5),
    .invoice-item-grid .invoice-checkbox-field {
        grid-column: auto;
    }

    .invoice-edit-item {
        padding: 16px 14px;
        border-radius: 13px;
    }

    .invoice-edit-item-head {
        margin-bottom: 14px;
    }

    .invoice-editor-actions {
        grid-template-columns: 1fr 1fr;
    }
}


@media (max-width: 390px) {

    .invoice-item-grid {
        grid-template-columns: 1fr;
    }

    .invoice-editor-actions {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   MIETNEXA – RECHNUNGSEDITOR MOBILE POLISH
   ========================================================== */

/*
   Der Rechnungseditor soll auf kleinen Displays nicht wie ein
   verkleinertes Desktop-Formular wirken. Jede Rechnungsposition
   wird deshalb als ruhige, klar gegliederte Karte dargestellt.
*/

@media (max-width: 760px) {

    .invoice-workspace {
        width: 100%;
    }

    .invoice-workspace-head {
        gap: 14px;
    }

    .invoice-workspace-head > div {
        min-width: 0;
        width: 100%;
    }

    .invoice-workspace-head p {
        overflow-wrap: anywhere;
    }


    /* Rechnungsdaten */

    .invoice-editor-meta {
        gap: 14px;
    }

    .invoice-editor-meta .invoice-field {
        min-width: 0;
    }


    /* Positionskarten */

    .invoice-edit-items {
        gap: 14px;
    }

    .invoice-edit-item {
        overflow: hidden;
        padding: 0;
        border-radius: 14px;
    }

    .invoice-edit-item-head {
        margin: 0;
        padding: 14px 15px;
        border-bottom: 1px solid var(--v2-border);
        background: var(--v2-surface-soft);
    }

    .invoice-edit-item-head > strong {
        font-size: 13px;
    }

    .invoice-delete-toggle,
    .invoice-remove-new {
        flex-shrink: 0;
    }

    .invoice-item-description {
        margin: 0;
        padding: 15px 15px 0;
    }

    .invoice-item-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px 10px;
        padding: 14px 15px 16px;
    }

    .invoice-item-grid .invoice-field {
        min-width: 0;
    }

    .invoice-item-grid input,
    .invoice-item-grid select {
        min-width: 0;
    }

    .invoice-checkbox-field {
        grid-column: 1 / -1;
        min-height: 0;
    }

    .invoice-checkbox-field > label {
        min-height: 44px;
        justify-content: flex-start;
    }


    /* Eingabefelder */

    .invoice-field input:not([type="checkbox"]),
    .invoice-field select,
    .invoice-field textarea {
        font-size: 16px;
    }

    .invoice-input-suffix {
        min-width: 0;
    }

    .invoice-input-suffix input {
        min-width: 0;
    }

    .invoice-input-suffix > span {
        flex: 0 0 46px;
        min-width: 46px;
    }


    /* Position hinzufügen */

    .invoice-add-item {
        width: 100%;
        min-height: 46px;
        margin-top: 12px;
    }


    /* Betrag */

    .invoice-current-total {
        justify-content: stretch;
        margin-top: 18px;
        padding: 18px 2px 0;
        text-align: right;
    }

    .invoice-current-total > strong {
        font-size: 24px;
    }


    /* Editor-Aktionen */

    .invoice-editor-actions {
        position: relative;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding-top: 4px;
    }

    .invoice-editor-actions .button {
        min-height: 46px;
    }


    /* Abschließen bewusst deutlich vom Bearbeiten trennen */

    .invoice-finalize-card {
        gap: 18px;
        margin-top: 18px;
        padding: 20px 18px;
    }

    .invoice-finalize-card h2 {
        font-size: 19px;
    }

    .invoice-finalize-card p {
        font-size: 13px;
    }

    .invoice-finalize-card form {
        width: 100%;
    }

    .invoice-finalize-card .button {
        min-height: 48px;
    }
}


@media (max-width: 520px) {

    .invoice-item-grid {
        grid-template-columns: 1fr 1fr;
    }

    /*
       Beschreibung und Brutto-Schalter nutzen die volle Breite.
       Die vier kompakten Zahlenfelder bleiben paarweise angeordnet,
       damit eine Position mobil nicht unnötig lang wird.
    */

    .invoice-item-description {
        width: 100%;
    }

    .invoice-checkbox-field {
        grid-column: 1 / -1;
    }

    .invoice-editor-actions {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 370px) {

    /*
       Auf sehr schmalen Geräten fällt die Positionskarte auf eine
       Spalte zurück. Dadurch gibt es auch dort kein horizontales
       Überlaufen.
    */

    .invoice-item-grid {
        grid-template-columns: 1fr;
    }

    .invoice-checkbox-field {
        grid-column: auto;
    }
}

/* Phase 1: long invoice content remains readable in mobile cards. */
.invoice-items-table td { white-space: normal; overflow-wrap: anywhere; }
.invoice-edit-item[hidden] { display: none; }
.invoice-editor-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) {
    .invoice-editor-meta { grid-template-columns: 1fr; }
}

/* Phase 2: small, responsive case and operations surfaces, preserving UI V2. */
.phase2-page { min-width: 0; overflow-wrap: anywhere; }
.phase2-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.phase2-card { min-width: 0; padding: 18px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; margin-bottom: 12px; }
.phase2-card h2, .phase2-card h3 { margin: 0 0 10px; font-size: 18px; }
.phase2-card p { color: #526078; margin: 10px 0; }
.phase2-overdue { border-left: 4px solid #dc2626; }
.phase2-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 24px; }
.phase2-filter p { flex: 1 1 150px; min-width: 0; }
.phase2-page input, .phase2-page select, .phase2-page textarea { max-width: 100%; box-sizing: border-box; }
.phase2-page .v2-form-actions, .phase2-page .v2-head-actions { flex-wrap: wrap; }
.phase2-page button, .phase2-page .button { min-height: 44px; white-space: normal; }
@media (max-width: 600px) {
    .phase2-page .v2-page-head { display: flex; flex-direction: column; gap: 16px; }
    .phase2-page .v2-head-actions, .phase2-page .v2-form-actions { width: 100%; gap: 10px; }
    .phase2-page .v2-head-actions > *, .phase2-page .v2-form-actions > * { flex: 1 1 auto; }
    .phase2-page .v2-form-actions form .button { width: 100%; }
    .phase2-card { padding: 14px; }
}
/* The case time summary must fit tablets as well as phones. */
@media (min-width: 761px) and (max-width: 980px) {
    .v2-booking-time-card { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
    .v2-booking-time-card .v2-duration-block { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--v2-border); padding: 16px 0 0; }
}
.v2-booking-page, .v2-booking-overview > *, .v2-booking-time-card > * { min-width: 0; }
@media (max-width: 980px) {
    .v2-booking-hero { flex-wrap: wrap; }
    .v2-booking-actions { flex-wrap: wrap; max-width: 100%; }
}

/* Phase 3: operational forms and touch actions within UI V2. */
.phase3-form input:not([type=checkbox]):not([type=radio]), .phase3-form select, .phase3-form textarea { max-width:100%; width:100%; box-sizing:border-box; }
.phase3-form label { display:block; margin-bottom:.4rem; }
.phase3-form input[type=checkbox] { min-width:22px; min-height:22px; }
.phase3-form ul { padding-left:0; list-style:none; }
.phase3-form li { padding:.4rem 0; }
.phase2-card .button { min-height:44px; white-space:normal; }
.phase2-card form { margin-top:.5rem; }
.phase3-invitation { overflow-wrap:anywhere; }
.app-nav-link span:last-child { min-width:0; white-space:normal; overflow-wrap:anywhere; }
.app-page h1, .app-page h2 { overflow-wrap:anywhere; }
@media (max-width:760px) {
    .phase3-asset-history td { display:block; text-align:left; white-space:normal; overflow-wrap:anywhere; }
    .phase3-asset-history td::before { content:attr(data-label); display:block; margin-bottom:3px; }
}
.phase3-panel { padding:20px; margin-bottom:16px; }
.phase3-panel > h2:first-child { margin-top:0; }
