/* HP0106E_UI_OVERFLOW_BASELINE
   Ziel: Dokumentbreite stabilisieren und breite Tabellen/Diagnoseinhalte in lokale Scrollcontainer legen.
   Keine funktionale Datenbank- oder Prozesslogik. */

html,
body.hp-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* HP0107B release function-test mobile/admin cleanup */
.hp-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: #f5f7f2;
}

.hp-login-card {
    width: min(100%, 420px);
    margin: 0 auto;
}

.hp-login-brand {
    display: grid;
    justify-items: center;
    gap: .35rem;
    margin-bottom: .85rem;
    color: #52605a;
    font-weight: 700;
}

.hp-login-brand img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.hp-remember-login {
    margin: .25rem 0 .75rem;
}

.finance-table thead th,
.hp-table-sticky thead th,
.hp-advances-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
}

.finance-table th:first-child,
.finance-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.finance-table .group-row td:first-child {
    z-index: 2;
}

.finance-table .group-row td {
    background: #eef3ea;
}

.table-wrap.hp-finance-table-wrap {
    max-height: calc(100vh - 12rem);
    overflow-y: auto;
}

.finance-table th:first-child,
.finance-table td:first-child {
    min-width: 7rem;
    max-width: 10rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.finance-table .finance-group-label {
    font-weight: 800;
}

.finance-table .finance-group-spacer {
    min-width: 10rem;
}

.hp-expense-mobile-cards,
.hp-advances-mobile-summary {
    display: none;
}

.hp-expense-mobile-card,
.hp-advance-summary-card {
    border: 1px solid #d7ddd2;
    border-radius: 8px;
    padding: .9rem;
    background: #fff;
    display: grid;
    gap: .45rem;
}

.hp-expense-mobile-card > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
}

.hp-mobile-status,
.hp-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #cfd8c7;
    padding: .15rem .5rem;
    font-size: .82rem;
    background: #f6f8f4;
}

.hp-status-badge.inactive {
    background: #f5f5f5;
    color: #67716b;
}

.hp-mobile-amount,
.hp-advance-summary-card strong {
    font-size: 1.35rem;
    font-weight: 800;
}

.hp-mobile-card-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.hp-bank-account-grid-compact {
    align-items: stretch;
}

.hp-bank-account-card.compact {
    border-radius: 8px;
}

.hp-bank-account-card-main strong {
    font-size: 1rem;
    line-height: 1.25;
}

.hp-bank-account-card-main span {
    font-size: .98rem;
}

.hp-quick-splits {
    display: grid;
    gap: .75rem;
}

.hp-quick-expense-card {
    width: min(100%, 760px);
    margin-left: auto;
    margin-right: auto;
}

.hp-quick-splits-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
}

.hp-quick-splits-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.hp-quick-split-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(7rem, .5fr) minmax(0, 1fr) auto;
    gap: .6rem;
    align-items: end;
    border: 1px solid #d7ddd2;
    border-radius: 8px;
    padding: .7rem;
}

.hp-category-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .4rem;
}

.hp-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}

.hp-field-label {
    font-weight: 700;
    color: #173f20;
}

.hp-category-picker .account-search {
    min-width: 0;
}

.hp-technical-select {
    display: none !important;
}

.hp-finance-mobile-summary {
    display: none;
}

.hp-finance-mobile-card {
    border: 1px solid #d7ddd2;
    border-radius: 8px;
    background: #fff;
    padding: .9rem;
    display: grid;
    gap: .55rem;
}

.hp-finance-mobile-card-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: flex-start;
}

.hp-finance-mobile-card h2 {
    margin: 0;
    font-size: 1rem;
}

.hp-finance-mobile-card-head strong {
    white-space: nowrap;
}

.hp-finance-month-chips,
.hp-finance-mobile-accounts {
    display: grid;
    gap: .35rem;
}

.hp-finance-month-chips {
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}

.hp-finance-month-chips span,
.hp-finance-mobile-accounts div {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    border-radius: 8px;
    background: #f6f8f4;
    padding: .45rem .55rem;
}

.hp-finance-mobile-accounts div {
    background: #fbfaf1;
}

.hp-quick-split-summary {
    border-radius: 8px;
    padding: .65rem .8rem;
    background: #eef8ef;
    border: 1px solid #bfe2c4;
    font-weight: 700;
}

.hp-quick-split-summary.is-mismatch {
    background: #fff7e6;
    border-color: #edc36d;
}

.hp-vehicle-card.is-inactive {
    opacity: .68;
}

@media (max-width: 780px) {
    .hp-login-brand img {
        width: 52px;
        height: 52px;
    }

    .hp-expense-mobile-cards,
    .hp-advances-mobile-summary {
        display: grid;
        gap: .75rem;
    }

    .hp-expenses-table-wrap,
    .hp-advances-card .hp-table-scroll {
        display: none;
    }

    .finance-table th:first-child,
    .finance-table td:first-child {
        min-width: 7rem;
        max-width: 9rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .finance-table .group-row td:first-child {
        box-shadow: 8px 0 10px rgba(255,255,255,.85);
    }

    .hp-bank-account-card.compact {
        min-height: 7rem;
    }

    .hp-bank-account-card-main {
        gap: .28rem;
    }

    .hp-quick-split-row {
        grid-template-columns: 1fr;
    }

    .hp-quick-splits-head {
        align-items: stretch;
        flex-direction: column;
    }

    .hp-finance-mobile-summary {
        display: grid;
        gap: .75rem;
    }

    .hp-finance-table-wrap {
        display: none;
    }
}

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

.hp-main-shell,
.hp-content,
.hp-topbar,
.hp-topbar-right,
.hp-page-head,
.page-head,
.hp-page-head-wrap,
.card,
.hp-card,
.panel,
section,
article,
form,
.grid,
.grid.two,
.details,
.action-grid,
.kpi-grid,
.hp-bank-account-grid,
.hp-chart-wrap {
    min-width: 0;
    max-width: 100%;
}

.hp-content {
    width: 100%;
    overflow-x: clip;
}

@supports not (overflow: clip) {
    .hp-content { overflow-x: hidden; }
}

.table-wrap,
.hp-table-wrap,
.hp-diagnostic-table-wrap,
.hp-expenses-table-wrap,
.hp-bank-runs-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

.table-wrap > table,
.hp-table-wrap > table,
.hp-diagnostic-table-wrap > table,
.hp-expenses-table-wrap > table,
.hp-bank-runs-table-wrap > table {
    min-width: 100%;
    width: max-content;
    max-width: none;
}

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

.hp-diagnostic-table-wrap table {
    table-layout: auto;
}

.hp-diagnostic-table-wrap th,
.hp-diagnostic-table-wrap td {
    min-width: 9rem;
    max-width: min(34rem, 72vw);
    overflow-wrap: anywhere;
    word-break: break-word;
}

pre,
code,
kbd,
samp {
    max-width: 100%;
    overflow-wrap: anywhere;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.table-wrap pre,
.hp-table-wrap pre {
    min-width: min(24rem, 80vw);
    max-width: min(42rem, 78vw);
}

.hp-filter-bar,
.filter-bar,
.inline-form,
.stacked-actions,
.actions,
.hp-actions-top,
.hp-actions-top-clean,
.hp-row-actions,
.hp-filter-actions {
    min-width: 0;
    max-width: 100%;
}

.hp-filter-bar input,
.hp-filter-bar select,
.hp-filter-bar textarea,
.filter-bar input,
.filter-bar select,
.filter-bar textarea,
.stack input,
.stack select,
.stack textarea {
    min-width: 0;
    max-width: 100%;
}

.hp-btn,
.btn,
.button {
    max-width: 100%;
}

.hp-btn.small,
.btn.small,
.button.small {
    white-space: nowrap;
}

@media (max-width: 780px) {
    body.hp-shell {
        padding-top: var(--hp-mobilebar-height, 58px);
        overflow-x: hidden;
    }

    .hp-mobile-bar {
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .hp-mobile-brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .hp-mobile-mode-toggle {
        flex: 0 0 auto;
        max-width: 7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .hp-sidebar {
        width: min(84vw, 300px, calc(100vw - 1rem));
        max-width: calc(100vw - 1rem);
        box-sizing: border-box;
        overflow-x: hidden;
    }

    body:not(.hp-menu-open) .hp-sidebar {
        pointer-events: none;
    }

    .hp-menu-backdrop {
        max-width: 100vw;
    }

    .hp-main-shell,
    .hp-content {
        width: 100%;
        max-width: 100vw;
        margin-left: 0;
    }

    .hp-content {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .page-head,
    .hp-page-head,
    .hp-page-head-wrap {
        display: grid;
        grid-template-columns: 1fr;
        gap: .8rem;
    }

    .actions,
    .hp-actions-top,
    .hp-actions-top-clean,
    .stacked-actions {
        width: 100%;
    }

    .actions .hp-btn,
    .hp-actions-top .hp-btn,
    .hp-actions-top-clean .hp-btn,
    .stacked-actions .button,
    .stacked-actions .btn {
        flex: 1 1 100%;
        white-space: normal;
    }

    .card,
    .hp-card,
    .panel {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .table-wrap,
    .hp-table-wrap,
    .hp-diagnostic-table-wrap,
    .hp-expenses-table-wrap,
    .hp-bank-runs-table-wrap {
        margin-left: -.25rem;
        margin-right: -.25rem;
        padding-bottom: .45rem;
    }

    .table-wrap > table,
    .hp-table-wrap > table,
    .hp-diagnostic-table-wrap > table,
    .hp-expenses-table-wrap > table,
    .hp-bank-runs-table-wrap > table {
        min-width: 42rem;
    }

    .hp-diagnostic-table-wrap > table {
        min-width: 32rem;
    }

    .hp-bankmatch-table > table,
    .hp-expenses-table-wrap > table {
        min-width: 58rem;
    }

    .hp-filter-bar,
    .filter-bar {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: .65rem !important;
    }

    .hp-filter-bar label,
    .filter-bar label,
    .hp-filter-bar button,
    .hp-filter-bar a,
    .filter-bar button,
    .filter-bar a {
        width: 100%;
    }
}
