/* BHS Web-UI – professionelles Kanzlei-Layout (responsive, mobile-first) */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --nav-font-size: 1.05rem;
    --topbar-height: 44px; /* shared: fixed header + sticky chrome top; ~1cm+, larger type */
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f0f2f5;
    /* clip does not create a scroll container (unlike hidden) — sticky stays reliable */
    overflow-x: clip;
}

a {
    color: #1e3a5f;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1rem 1.75rem;
}

.container-login {
    max-width: 960px;
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* Header – graue Leiste ~1 cm, Desktop eine Zeile */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #6b7280;
    color: #fff;
    padding: 0 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.35rem;
    min-height: var(--topbar-height); /* ca. 1 cm+; height locked from 640px up */
    box-sizing: border-box;
    font-size: 1.05rem;
}

/* Platz unter fixierter Leiste — einmal, nicht nochmals für Toolbar */
body:has(.topbar) {
    padding-top: var(--topbar-height);
}

body:has(.topbar) .container {
    padding-top: 1rem;
}

.topbar-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.4rem;
    min-width: 0;
    line-height: 1.2;
}

.topbar-sep {
    opacity: 0.85;
}

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-left: auto;
    flex-shrink: 0;
}

.live-clock {
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
    white-space: nowrap;
}

.brand {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: nowrap;
}

.main-nav {
    background: #7e8289;
    border: 1px solid #7e8289;
    border-radius: 5px;
    padding: 2px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.main-nav a {
    font-size: var(--nav-font-size);
    color: #fff;
    padding: 0.25rem 0.55rem;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    border-radius: 3px;
    text-decoration: none;
    opacity: 0.95;
}

.main-nav a:hover,
.main-nav a:focus-visible {
    background: #000;
    color: #fff;
    opacity: 1;
    text-decoration: none;
}

.user-name {
    font-size: 1.05rem;
    white-space: nowrap;
}

.logout-link {
    color: #fff;
    background: transparent;
    border: 0;
    font: inherit;
    padding: 0.25rem 0.45rem;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border-radius: 3px;
    white-space: nowrap;
    cursor: pointer;
}

.logout-form {
    margin: 0;
}

.logout-link:hover,
.logout-link:focus-visible {
    background: #000;
    color: #fff;
    text-decoration: none;
}

@media (min-width: 640px) {
    .topbar {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        min-height: var(--topbar-height);
        height: var(--topbar-height);
        padding: 0 1rem;
        overflow: hidden;
    }

    .topbar-left {
        flex-wrap: nowrap;
    }

    .main-nav {
        flex: 1;
        justify-content: flex-start;
    }

    .topbar-right {
        margin-left: auto;
    }
}

@media (min-width: 960px) {
    :root {
        --topbar-height: 46px;
    }

    .topbar {
        min-height: var(--topbar-height);
        height: var(--topbar-height);
    }
}

.card {
    background: #fff;
    border: 1px solid #d8dee6;
    border-radius: 8px;
    padding: 1.1rem 1rem;
    margin-top: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.card h1 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: #1e3a5f;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
    width: 100%;
    max-width: 100%;
    padding: 0.65rem 0.75rem;
    min-height: 44px;
    margin-bottom: 0.85rem;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
}


input[type="number"],
input[type="date"],
textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.65rem 0.75rem;
    min-height: 44px;
    margin-bottom: 0.85rem;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
    font-family: inherit;
}

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

.profile-form {
    max-width: 480px;
}

.input-readonly,
input:disabled {
    background: #eef1f4;
    color: #4b5563;
    cursor: not-allowed;
}

.data-table input[type="text"],
.data-table input[type="password"],
.data-table input[type="number"],
.data-table select {
    margin-bottom: 0;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 0.45rem 0.5rem;
    font-size: 0.95rem;
    line-height: 1.25;
    font-family: inherit;
}

/* Keep number inputs same height as text/select (hide native spinners that inflate height) */
.data-table input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.data-table input[type="number"]::-webkit-outer-spin-button,
.data-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.65rem 1rem;
    min-height: 44px;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}

button:hover,
.btn:hover {
    background: #152a45;
}

.btn-secondary {
    background: #5a6570;
}

.btn-secondary:hover {
    background: #454e56;
}

.btn-danger {
    background: #9b1c1c;
}

.btn-danger:hover {
    background: #7a1515;
}

.btn-bar {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

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

.login-wrap form button[type="submit"] {
    width: 100%;
}

.alert {
    padding: 0.7rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f5c2c2;
}

.alert-ok {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #b7e1c1;
}

.meta {
    color: #5a6570;
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-weight: 600;
}

/* Setup table – intentional horizontal scroll on small screens */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.75rem;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-bottom: 0.25rem;
    max-width: 100%;
}

.data-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    border: 1px solid #dde2e8;
    padding: 0.35rem 0.4rem;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #eef2f6;
    font-weight: 600;
    color: #1e3a5f;
    white-space: nowrap;
    font-size: 1rem;
}

.data-table .col-check {
    width: 2.75rem;
    text-align: center;
}

.data-table .col-check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    min-height: 0;
    margin: 0;
    cursor: pointer;
}

.data-table tr.row-inactive {
    color: #6b6b6b;
}

.data-table tr.row-new {
    background: #f7fafc;
}

/* Zebra stripes – Mandanten lists (subtle contrast; thead stays opaque) */
.mandanten-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}
.mandanten-table tbody tr:nth-child(even) {
    background-color: #eef2f6;
}
.mandanten-table tbody tr.row-inactive:nth-child(odd) {
    background-color: #faf8f8;
}
.mandanten-table tbody tr.row-inactive:nth-child(even) {
    background-color: #f0eaea;
}
.mandanten-table tbody tr.row-new {
    background-color: #f7fafc;
}

code {
    font-size: 0.85em;
    background: #eef2f6;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    word-break: break-all;
}

/* Tablet ≥640px */
@media (min-width: 640px) {
    .container {
        padding: 1.15rem 1.25rem 2rem;
    }

    .card {
        padding: 1.25rem 1.35rem;
        margin-top: 1rem;
    }

    .card h1 {
        font-size: 1.35rem;
    }

    .btn-bar {
        flex-direction: row;
    }

    .btn-bar .btn,
    .btn-bar button {
        width: auto;
    }

    .table-wrap {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Desktop ≥960px */
@media (min-width: 960px) {
    .container {
        padding: 1.25rem 1.5rem 2rem;
    }

    .card {
        padding: 1.35rem 1.5rem;
    }

    input[type="email"],
    input[type="password"],
    input[type="text"],
    input[type="number"],
    input[type="date"],
    select {
        padding: 0.45rem 0.65rem;
        min-height: 0;
        font-size: 0.95rem;
    }

    button,
    .btn {
        padding: 0.5rem 1rem;
        min-height: 0;
    }

    .data-table {
        min-width: 0;
    }

    .container-login {
        min-height: auto;
        display: block;
        padding-top: 0;
    }

    .login-wrap {
        margin: 3.5rem auto;
    }
}

/* Mandanten page – sticky chrome flush under fixed header */
body.page-mandanten .container,
body.page-zeiterfassung .container {
    max-width: none;
    width: 100%;
    /* no extra padding-top: body already offsets the fixed header once */
    padding-top: 0;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: 0;
}

body.page-mandanten .mandanten-page,
body.page-mandanten #mandanten-form {
    /* keep ancestors free of overflow that breaks position:sticky (FF/Edge) */
    overflow: visible;
}

.mandanten-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-height));
}

.mandanten-sticky-chrome {
    position: sticky;
    top: var(--topbar-height); /* exact fixed header height — no gap/jitter */
    z-index: 50;
    background: #f0f2f5;
    padding: 0.25rem 0 0.35rem;
    margin: 0;
    border-bottom: 1px solid #d8dee6;
    /* promote stable sticky compositing */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.category-tabs :is(a, button) {
    font-size: var(--nav-font-size);
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    min-height: 40px;
    border-radius: 4px 4px 0 0;
    background: #e5e9ef;
    color: #1e3a5f;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #d0d7e0;
    border-bottom: none;
}

.category-tabs :is(a, button):hover {
    background: #dde3eb;
    text-decoration: none;
}

.category-tabs :is(a, button).active {
    background: #fff;
    color: #1e3a5f;
    box-shadow: 0 -1px 0 #fff;
}

.mandanten-actions {
    margin-top: 0.35rem;
    margin-bottom: 0.15rem;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.mandanten-actions .btn,
.mandanten-actions button {
    width: auto;
}

.mandanten-filter-label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e3a5f;
}

.mandanten-filter-select {
    /* Override global select { width: 100% } — sit beside Löschen, content-sized */
    width: auto;
    max-width: 20rem;
    min-width: 9rem;
    flex: 0 0 auto;
    margin-bottom: 0;
    padding: 0.35rem 0.5rem;
    min-height: 40px;
    border: 1px solid #c5ced8;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9rem;
    text-overflow: ellipsis;
}

.mandanten-ro-hint {
    margin: 0.5rem 0;
}

/* List area: document/body scrolls vertically (no inner overflow-y).
   Horizontal pan via overflow-x:clip + JS-synced sticky bottom scrollbar
   (overflow-x:auto would force overflow-y and break viewport sticky thead). */
.mandanten-scroll {
    flex: 1;
    overflow: visible;
    background: #fff;
    border: 1px solid #d8dee6;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    /* no margin-top: spacer scrolled away before thead lock (= visible drift) */
    margin-top: 0;
    margin-bottom: 0;
}

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

.mandanten-x-pan {
    position: relative;
    left: 0;
}

.mandanten-table {
    min-width: 1400px;
    font-size: 0.82rem;
}

.mandanten-table th,
.mandanten-table td {
    padding: 0.25rem 0.3rem;
    white-space: nowrap;
}

/* Tab „Nicht aktive“: nur 5 Spalten (Status, Nachname, Vorname, Firma, Mandanten-ID)
   – keine große Mindestbreite, Tabelle nur so breit wie der Inhalt */
.mandanten-table.mandanten-table-inaktiv {
    min-width: 0;
    width: auto;
}
.mandanten-table.mandanten-table-inaktiv td {
    padding-right: 1rem;
}

.mandanten-table th {
    font-size: 0.95rem;
}

/* Sticky column headers vs browser/page scroll (not an inner scroller).
   top = --mandanten-thead-top from JS (topbar bottom + chrome border-box, or
   live chrome.getBoundingClientRect().bottom when chrome is stuck). Fallback =
   topbar + chrome height CSS vars. border-collapse:separate required for <th>. */
.mandanten-scroll .mandanten-table {
    border-collapse: separate;
    border-spacing: 0;
}

.mandanten-scroll thead th {
    position: sticky;
    top: var(--mandanten-thead-top, calc(var(--topbar-height) + var(--mandanten-chrome-height, 0px)));
    z-index: 3;
    background-color: #eef2f6; /* opaque – must cover zebra rows scrolling under */
    background-image: none;
    border-bottom: 2px solid #c5ced8;
    box-shadow: 0 1px 0 #c5ced8;
}

/* Viewport-sticky horizontal scrollbar (always in view when table is wider) */
.mandanten-hscroll {
    position: sticky;
    bottom: 0;
    z-index: 45;
    overflow-x: auto;
    overflow-y: hidden;
    height: 18px;
    background: #e8ecf1;
    border: 1px solid #d8dee6;
    border-radius: 0 0 6px 6px;
    margin-bottom: 0.75rem;
    scrollbar-gutter: stable;
    scrollbar-width: auto; /* Firefox: normal thickness (was thin) */
    scrollbar-color: #8a96a5 #dce2ea;
}

.mandanten-hscroll::-webkit-scrollbar {
    height: 14px; /* Chrome/Edge/Safari: easy to grab */
}

.mandanten-hscroll::-webkit-scrollbar-track {
    background: #dce2ea;
    border-radius: 0 0 5px 5px;
}

.mandanten-hscroll::-webkit-scrollbar-thumb {
    background: #8a96a5;
    border-radius: 6px;
    border: 2px solid #dce2ea;
    min-width: 48px;
}

.mandanten-hscroll::-webkit-scrollbar-thumb:hover {
    background: #6d7a8a;
}

.mandanten-hscroll.is-idle {
    visibility: hidden;
    pointer-events: none;
    height: 0;
    border: 0;
    margin: 0;
}

.mandanten-scroll:has(+ .mandanten-hscroll.is-idle) {
    border-bottom: 1px solid #d8dee6;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.mandanten-hscroll-spacer {
    height: 1px;
    pointer-events: none;
}

.mandanten-table input[type="text"],
.mandanten-table input[type="number"],
.mandanten-table select {
    min-width: 5rem;
    min-height: 36px;
    padding: 0.3rem 0.35rem;
    font-size: 0.85rem;
    line-height: 1.25;
    font-family: inherit;
}

.mandanten-table input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.mandanten-table input[type="number"]::-webkit-outer-spin-button,
.mandanten-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mandanten-table select {
    min-width: 6.5rem;
}

.mandanten-table input[name*="[notiz]"],
.mandanten-table input[name*="[firma]"],
.mandanten-table input[name*="[taetigkeit]"],
.mandanten-table input[name*="[email]"] {
    min-width: 7.5rem;
}

.mandanten-table input[name*="[datum]"] {
    min-width: 5.5rem;
    max-width: 6.5rem;
}


/* Validation: mark only invalid fields */
.field-error,
input.field-error,
select.field-error {
    border-color: #c62828 !important;
    background-color: #fff5f5 !important;
    box-shadow: 0 0 0 1px #c62828;
}

.field-error-msg {
    display: block;
    color: #9b1c1c;
    font-size: 0.75rem;
    line-height: 1.2;
    margin-top: 0.2rem;
    white-space: normal;
    max-width: 10rem;
}

.mandanten-table tr.row-has-error td {
    vertical-align: top;
}

/* 0.7.5: Leistungen-Jahreszeile, auf die „Aktuell → Bearbeiten“ springt */
.mandanten-table tbody tr.row-highlight > td {
    background-color: #fff3c4;
    box-shadow: inset 0 2px 0 #e0b800, inset 0 -2px 0 #e0b800;
}
.mandanten-table tbody tr.row-highlight > td:first-child {
    box-shadow: inset 3px 0 0 #e0b800, inset 0 2px 0 #e0b800, inset 0 -2px 0 #e0b800;
}

/* Leistungen */
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.55rem;
    min-height: 32px;
    font-size: 0.8rem;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sm:hover {
    background: #152a45;
    color: #fff;
    text-decoration: none;
}
.leistungen-empty {
    margin: 0.75rem 0;
    font-weight: 600;
}
.leistungen-mandant-label {
    margin: 0.35rem 0 0.5rem;
}
.leistungen-actions {
    align-items: center;
}
.leistungen-year-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    margin: 0;
}
.leistungen-year-input {
    width: 5rem;
    min-height: 40px;
    padding: 0.35rem 0.5rem;
    border: 1px solid #c5ced8;
    border-radius: 4px;
}
.leistungen-sub-tabs {
    margin-top: 0.15rem;
    margin-bottom: 0.25rem;
}
.leistungen-sub-tabs :is(a, button) {
    padding: 0.35rem 0.7rem;
    min-height: 36px;
}
.leistungen-inline-msg {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: normal;
    max-width: 28rem;
}
.leistungen-inline-ok {
    color: #1b5e20;
}
.leistungen-inline-error {
    color: #9b1c1c;
}
.leistungen-table {
    min-width: 640px;
}
.leistungen-sub-buchhaltung,
.leistungen-sub-gehalt,
.leistungen-sub-jahres,
.leistungen-sub-jobcenter,
.leistungen-sub-registration {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}
.leistungen-table .input-zeit {
    width: 5.5rem;
    min-width: 3.5rem;
    /* height/padding/font inherit from .mandanten-table / .data-table number rules */
}
.leistungen-table .input-notizen {
    min-width: 8.5rem;
    width: 10rem;
}
.col-leistungen {
    white-space: nowrap;
}

/* Gehaltsabrechnung Monatstabelle */
.gehalt-monate-page {
    padding: 0.65rem 0.75rem 0.85rem;
}
.gehalt-monate-actions {
    margin-top: 0;
    margin-bottom: 0.35rem;
}
.gehalt-monate-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e3a5f;
}
.gehalt-monate-page .leistungen-mandant-label,
.gehalt-monate-mandant {
    margin: 0;
    display: inline;
    font-size: 0.92rem;
}
.gehalt-monate-scroll {
    overflow-x: auto;
    max-width: 100%;
}
.gehalt-monate-table {
    width: auto;
    min-width: 0;
    max-width: 52rem;
    font-size: 0.85rem;
    border-collapse: collapse;
}
.gehalt-monate-table th,
.gehalt-monate-table td {
    padding: 0.12rem 0.35rem;
    white-space: nowrap;
}
.gehalt-monate-table th {
    font-size: 0.95rem;
    background-color: #eef2f6;
}
.gehalt-monate-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}
.gehalt-monate-table tbody tr:nth-child(even) {
    background-color: #eef2f6;
}
.gehalt-monate-table tbody tr.row-has-error {
    background-color: #fff5f5;
}
.gehalt-monate-table .input-zeit,
.gehalt-monate-table input[type="number"],
.gehalt-monate-table input[type="text"] {
    width: 4.5rem;
    min-width: 4rem;
    min-height: 28px;
    height: 28px;
    padding: 0.1rem 0.3rem;
    font-size: 0.82rem;
    line-height: 1.2;
    box-sizing: border-box;
}
.gehalt-monate-table .input-notizen {
    width: 100%;
    min-width: 9rem;
    min-height: 28px;
    height: 28px;
    padding: 0.1rem 0.3rem;
    font-size: 0.82rem;
    line-height: 1.2;
    box-sizing: border-box;
}
.gehalt-monate-page .alert {
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.55rem;
    font-size: 0.88rem;
}

/* ===== 0.6.0 – Leistungen-Toolbar (alle Unterkategorien + Rhythmus-Leisten der Bearbeiten-Seiten)
   Eine Zeile: Label links neben dem Feld (vertikal zentriert), Felder exakt so hoch wie die Buttons. */
.leistungen-toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    margin: 0.35rem 0 0.2rem;
}
.leistungen-toolbar .tb-field {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e3a5f;
    white-space: nowrap;
    flex: 0 0 auto;
}
.leistungen-toolbar .tb-label {
    line-height: 1;
}
.leistungen-toolbar .tb-input,
.leistungen-toolbar .tb-btn {
    height: 34px;
    min-height: 34px;
    max-height: 34px;
    margin: 0;
    box-sizing: border-box;
    font-size: 0.9rem;
    line-height: 1.2;
    vertical-align: middle;
}
.leistungen-toolbar .tb-input {
    width: auto;
    padding: 0 0.5rem;
    border: 1px solid #c5ced8;
    border-radius: 4px;
    background: #fff;
    font-family: inherit;
}
.leistungen-toolbar .tb-year {
    width: 4.75rem;
}
.leistungen-toolbar .tb-select {
    min-width: 8.5rem;
}
.leistungen-toolbar .tb-btn {
    width: auto;
    padding: 0 1rem;
    flex: 0 0 auto;
}
.leistungen-toolbar .tb-value {
    font-weight: 400;
}
.leistungen-toolbar .tb-hint {
    font-weight: 400;
    font-size: 0.82rem;
    white-space: normal;
}
.leistungen-toolbar .leistungen-inline-msg {
    margin-left: 0.25rem;
}
@media (max-width: 639px) {
    .leistungen-toolbar {
        flex-wrap: wrap;
    }
}

/* Leistungen-Listen: neue Spalten */
.leistungen-table .input-periode {
    min-width: 7.5rem;
}
.leistungen-table .input-mitarbeiter {
    min-width: 11rem;
}
.leistungen-table input.input-kosten {
    width: 6.5rem;
    min-width: 5rem;
    text-align: right;
}

/* Bearbeiten-Seiten (Gehalt monatlich, Buchhaltung Perioden) */
.gehalt-monate-table input.input-kosten {
    width: 6rem;
    min-width: 5rem;
    text-align: right;
}
.gehalt-monate-table td.num {
    text-align: right;
}
.edit-rhythmus-bar {
    margin: 0.25rem 0 0.35rem;
}
.buchhaltung-sections {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
}
.buchhaltung-context {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
    margin: 0.35rem 0;
}
.buchhaltung-context p {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0.45rem 0.75rem;
    border: 1px solid;
    border-radius: 6px;
}
.buchhaltung-context > .leistungen-inline-msg {
    align-self: center;
    white-space: normal;
    overflow-wrap: anywhere;
}
.buchhaltung-context .buchhaltung-context-mandant {
    background: #f0f7f2;
    border-color: #a6c7af;
    color: #155724;
}
.buchhaltung-context .buchhaltung-context-jahr {
    background: #fff8d9;
    border-color: #dfca79;
    color: #665017;
    font-size: inherit;
}
.buchhaltung-section {
    flex: 0 1 calc(40rem + 1.3rem + 2px);
    min-width: 0;
    max-width: 100%;
    padding: 0.65rem;
    border: 1px solid #a7bfd8;
    border-radius: 6px;
    background: #eef4fa;
}
.buchhaltung-section-eur {
    border-color: #a6c7af;
    background: #f0f7f2;
}
.buchhaltung-section .edit-rhythmus-bar {
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
}
.buchhaltung-section .edit-rhythmus-bar .tb-field {
    gap: 0.35rem;
    margin-left: 0;
}
.buchhaltung-section .edit-rhythmus-bar .tb-select {
    min-width: 7.5rem;
}
.buchhaltung-section-title {
    font-weight: 700;
    color: #1e3a5f;
    font-size: 1rem;
    min-width: 3.5rem;
}
.buchhaltung-legacy {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.85rem;
}

/* ===== 0.6.2 – Meldungen Mandanten (Aktive / Nicht aktive) inline in der Aktionsleiste, wie Leistungen */
.mandanten-actions .leistungen-inline-msg {
    margin-left: 0.25rem;
}

/* ===== 0.6.3 – Aktive Menüpunkte hellgrün (Hauptmenü, Mandanten-Tabs, Leistungen-Unterkategorien) */
.main-nav a.active {
    font-weight: 600;
}
.main-nav a.active:not(:hover):not(:focus-visible) {
    background: #d4edda;
    color: #155724;
    opacity: 1;
}
.category-tabs :is(a, button).active {
    background: #d4edda;
    color: #155724;
    border-color: #b1dfbb;
    box-shadow: none;
}
.category-tabs :is(a, button).active:hover {
    background: #c3e6cb;
    color: #155724;
}
/* Tabs auf den Bearbeiten-Unterseiten (Gehalt-Monate, Buchhaltung-Perioden) */
.leistungen-edit-page > .gehalt-monate-page {
    margin-top: 0;
}

.leistungen-edit-actions {
    flex-direction: row;
    align-items: center;
    margin: 0;
    padding-top: 0.35rem;
}
.leistungen-edit-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 7.5rem;
    width: 7.5rem;
    height: 40px;
    padding: 0 0.75rem;
    font-size: 1rem;
    line-height: 1.2;
}

/* ===== 0.7.0 – Aktuell-Übersicht */
body.page-aktuell .container {
    max-width: 1880px;
}
.aktuell-page .aktuell-h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e3a5f;
    margin: 1.6rem 0 0.6rem;
    padding: 0.65rem 0.85rem;
    background-color: #f0f1f3;
    border: 1px solid #b8c0ca;
    border-radius: 6px;
}
.aktuell-page .aktuell-h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
}
.aktuell-abschnitt {
    margin: 0 0 1.25rem;
    scroll-margin-top: calc(var(--topbar-height) + 0.75rem);
}
.aktuell-abschnitt-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    margin: 0.9rem 0 0.25rem;
}
.aktuell-stichtag-main {
    margin: 0.15rem 0;
    font-size: 1.02rem;
}
.aktuell-stichtag-details {
    margin: 0.1rem 0 0.5rem;
    padding-left: 1.2rem;
    font-size: 0.85rem;
}
.aktuell-listen {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem 1.25rem;
}
.aktuell-liste-titel {
    font-size: 1rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0.35rem 0 0.3rem;
}
.aktuell-liste-titel .meta {
    font-weight: 400;
    font-size: 0.85rem;
}
.aktuell-leer {
    margin: 0.2rem 0 0.5rem;
}
.aktuell-table {
    width: 100%;
    font-size: 0.9rem;
}
.aktuell-table th,
.aktuell-table td {
    padding: 0.3rem 0.45rem;
    vertical-align: middle;
}
.aktuell-table .aktuell-bearbeiten {
    width: 1%;
    white-space: nowrap;
}
.aktuell-sub {
    font-size: 0.78rem;
}
/* 0.9.5: Zusatzinfo in eigener Spalte „Status“ – grau (.meta), aber Schriftgröße wie die übrigen Zellen */
.aktuell-table .aktuell-status .aktuell-sub {
    font-size: inherit;
}
.aktuell-table .aktuell-id {
    white-space: nowrap;
}
/* Zeilenfarben (hell, gut lesbar) */
.aktuell-table tbody tr.aktuell-row-rot > td,
.aktuell-legende-item.aktuell-row-rot {
    background: #f8d7da;
    color: #58151c;
}
.aktuell-table tbody tr.aktuell-row-gelb > td,
.aktuell-legende-item.aktuell-row-gelb {
    background: #fff3cd;
    color: #664d03;
}
/* 0.9.6: neutrale Zeilen (3.x Jahressteuererklärungen) – ohne Ampelfarbe */
.aktuell-table tbody tr.aktuell-row-neutral > td {
    background: #fff;
    color: inherit;
}
.aktuell-table tbody tr.aktuell-row > td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.aktuell-kopfzeile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    margin: 0.25rem 0 0.5rem;
}
.aktuell-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.aktuell-filter-label {
    margin: 0;
    font-weight: 600;
    color: #1e3a5f;
}
.aktuell-legende {
    margin: 0;
}
.aktuell-legende-item {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    margin-right: 0.25rem;
    font-weight: 600;
}
.aktuell-kommt {
    font-style: italic;
    color: #555;
    margin: 0.3rem 0 0.8rem;
}

/* ===== 0.7.1 – Dauerfristverlängerung (Buchhaltung) + Zeilenfrist in Aktuell */
.leistungen-table .col-dfv select {
    min-width: 5.5rem;
}
.leistungen-toolbar .tb-select[name="leistung_dauerfristverlaengerung"] {
    min-width: 5.5rem;
}
.aktuell-frist {
    font-weight: 600;
}

/* ===== 0.7.5 – Rolle hinter dem Benutzernamen in der Kopfzeile */
.user-role {
    opacity: 0.9;
}
.topbar-right {
    min-width: 0;
}
.topbar-right .user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis; /* bei knappem Platz kürzen statt Menü/Abmelden zu verdrängen; voller Text im title */
}
.topbar-right .logout-link {
    flex-shrink: 0;
}
@media (min-width: 640px) {
    .topbar-right {
        flex-shrink: 1;
    }
    .main-nav {
        flex: 1 0 auto; /* Menü nicht unter Inhaltsbreite schrumpfen lassen – zuerst kürzt der Name */
    }
}
@media (min-width: 640px) and (max-width: 1239px) {
    /* 0.7.5: zu schmal für eine Zeile (Uhr/Marke/Version/Datum + Menü + Name/Rolle) → zweizeilige Kopfzeile;
       Höhe über --topbar-height, damit Seitenabstand und Sticky-Bereiche mitwandern */
    :root {
        --topbar-height: 74px;
    }
    .topbar {
        flex-wrap: wrap;
        align-content: center;
        row-gap: 2px;
    }
    .topbar-left {
        flex: 0 0 100%;
    }
}
@media (min-width: 640px) and (max-width: 1365px) {
    :root {
        --nav-font-size: 0.92rem;
    }
    /* mittlere Breiten: Kopfzeile etwas kompakter, damit Name + Rolle möglichst vollständig bleiben */
    .topbar {
        gap: 0.5rem;
    }
    .live-clock,
    .brand,
    .user-name {
        font-size: 0.88rem;
    }
    .main-nav a,
    .logout-link {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
        font-size: var(--nav-font-size);
    }
    .topbar-right {
        gap: 0.4rem;
    }
}

/* Neuanlage: Kontaktdaten, Steuerdaten, weitere Angaben in drei Zeilen. */
.mandanten-create-wrap {
    margin-top: .25rem;
    background: #f7fafc;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    padding: .35rem;
}
.mandanten-create-scroll { width: 100%; min-width: 0; }
.mandanten-create-grid {
    display: grid;
    grid-template-columns: repeat(330, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.mandanten-create-grid thead,
.mandanten-create-grid tbody,
.mandanten-create-grid tr { display: contents; }
.mandanten-create-grid th,
.mandanten-create-grid td { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.mandanten-create-grid .col-check { display: none; }
#mandanten-create-table input[type="text"],
#mandanten-create-table select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.mandanten-create-grid th:nth-child(2) { grid-column: 1 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(2) { grid-column: 1 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(3) { grid-column: 31 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(3) { grid-column: 31 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(4) { grid-column: 61 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(4) { grid-column: 61 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(5) { grid-column: 91 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(5) { grid-column: 91 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(6) { grid-column: 121 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(6) { grid-column: 121 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(7) { grid-column: 151 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(7) { grid-column: 151 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(8) { grid-column: 181 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(8) { grid-column: 181 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(9) { grid-column: 211 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(9) { grid-column: 211 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(10) { grid-column: 241 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(10) { grid-column: 241 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(11) { grid-column: 271 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(11) { grid-column: 271 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(12) { grid-column: 301 / span 30; grid-row: 1; }
.mandanten-create-grid td:nth-of-type(12) { grid-column: 301 / span 30; grid-row: 2; }
.mandanten-create-grid th:nth-child(13) { grid-column: 1 / 42; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(13) { grid-column: 1 / 42; grid-row: 4; }
.mandanten-create-grid th:nth-child(14) { grid-column: 42 / 83; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(14) { grid-column: 42 / 83; grid-row: 4; }
.mandanten-create-grid th:nth-child(15) { grid-column: 83 / 125; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(15) { grid-column: 83 / 125; grid-row: 4; }
.mandanten-create-grid th:nth-child(16) { grid-column: 125 / 166; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(16) { grid-column: 125 / 166; grid-row: 4; }
.mandanten-create-grid th:nth-child(17) { grid-column: 166 / 207; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(17) { grid-column: 166 / 207; grid-row: 4; }
.mandanten-create-grid th:nth-child(18) { grid-column: 207 / 249; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(18) { grid-column: 207 / 249; grid-row: 4; }
.mandanten-create-grid th:nth-child(19) { grid-column: 249 / 290; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(19) { grid-column: 249 / 290; grid-row: 4; }
.mandanten-create-grid th:nth-child(20) { grid-column: 290 / 331; grid-row: 3; }
.mandanten-create-grid td:nth-of-type(20) { grid-column: 290 / 331; grid-row: 4; }
.mandanten-create-grid th:nth-child(21) { grid-column: 1 / 38; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(21) { grid-column: 1 / 38; grid-row: 6; }
.mandanten-create-grid th:nth-child(22) { grid-column: 38 / 74; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(22) { grid-column: 38 / 74; grid-row: 6; }
.mandanten-create-grid th:nth-child(23) { grid-column: 74 / 111; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(23) { grid-column: 74 / 111; grid-row: 6; }
.mandanten-create-grid th:nth-child(24) { grid-column: 111 / 148; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(24) { grid-column: 111 / 148; grid-row: 6; }
.mandanten-create-grid th:nth-child(25) { grid-column: 148 / 184; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(25) { grid-column: 148 / 184; grid-row: 6; }
.mandanten-create-grid th:nth-child(26) { grid-column: 184 / 221; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(26) { grid-column: 184 / 221; grid-row: 6; }
.mandanten-create-grid th:nth-child(27) { grid-column: 221 / 258; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(27) { grid-column: 221 / 258; grid-row: 6; }
.mandanten-create-grid th:nth-child(28) { grid-column: 258 / 294; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(28) { grid-column: 258 / 294; grid-row: 6; }
.mandanten-create-grid th:nth-child(29) { grid-column: 294 / 331; grid-row: 5; }
.mandanten-create-grid td:nth-of-type(29) { grid-column: 294 / 331; grid-row: 6; }

/* ===== 0.8.0 – Programm (Mandant + Leistungen Buchhaltung/Gehalt/Jahressteuer) */
.mandanten-table select.input-programm {
    min-width: 8rem;
}

/* ===== 0.8.1 – Buchhaltung Bearbeiten: Auswahl direkt neben „UStVA“ / „EÜR“ (ohne „Rhythmus“), „keine“ */
.edit-rhythmus-bar .buchhaltung-section-head {
    gap: 0.6rem;
}
.edit-rhythmus-bar .buchhaltung-section-head .buchhaltung-section-title {
    min-width: 0;
}
.buchhaltung-perioden-table td.buchhaltung-keine {
    font-style: italic;
}

/* Gleiche Spaltenbreiten für Monate, Quartale und Jahreszeiträume. */
.buchhaltung-perioden-table {
    table-layout: fixed;
    width: 40rem;
    min-width: 40rem;
    max-width: 40rem;
}
.buchhaltung-perioden-table tbody td {
    height: calc(28px + 0.24rem);
}
.buchhaltung-perioden-table input[type="text"],
.buchhaltung-perioden-table input[type="number"] {
    display: block;
}
.buchhaltung-col-erledigt { width: 4.5rem; }
.buchhaltung-col-zeitraum { width: 10.5rem; }
.buchhaltung-col-zeitraum-only { width: 35.5rem; }
.buchhaltung-col-zeit { width: 6.5rem; }
.buchhaltung-col-kosten { width: 8rem; }
.buchhaltung-col-notizen { width: 10.5rem; }
.buchhaltung-perioden-table input.input-notizen {
    width: 100%;
    min-width: 0;
}
.buchhaltung-perioden-table td:last-child {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ===== 0.9.0 – Buchhaltung: erledigte UStVA-/EÜR-Perioden als Häkchen (kompakt, einzeilig) */
.leistungen-table .input-rhythmus {
    min-width: 8.5rem;
}
.leistungen-table td.col-erledigt {
    white-space: nowrap;
}
.leistungen-table .erledigt-list {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
}
.leistungen-table label.erledigt-item {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin: 0;
    font-weight: 400;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}
.leistungen-table label.erledigt-item input[type="checkbox"] {
    margin: 0;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}
.leistungen-table label.erledigt-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
}
.leistungen-table label.erledigt-item.is-wechsel {
    border-left: 2px solid #9aa5b1;
    padding-left: 0.5rem;
}
.leistungen-table .erledigt-keine {
    color: #888;
    font-style: italic;
}
.buchhaltung-perioden-table tr.row-wechsel td {
    border-top: 2px solid #9aa5b1;
}
.edit-rhythmus-bar .buchhaltung-wechsel,
.edit-rhythmus-bar .buchhaltung-vorher {
    margin-left: 0.75rem;
}

/* ===== 0.9.1 – Gehaltsabrechnung: SV-/SOKA-BAU-Meldung fest „monatlich“ (ausgegraut) */
select.is-fest,
select.is-fest:disabled {
    background-color: #eef0f2;
    color: #6b7280;
    border-color: #d1d5db;
    cursor: not-allowed;
    opacity: 1;
}
.edit-rhythmus-bar .tb-field + .tb-field {
    margin-left: 0.25rem;
}

/* ===== 0.9.2 – Mandanten: GEA (EÜR/Bilanz) direkt nach „Besteuerungsform“ */
.mandanten-table select.input-gea {
    min-width: 5.5rem;
}

/* Mandanten: Zeiterfassung */
.page-zeiterfassung .mandanten-page > .category-tabs {
    justify-content: flex-start;
    margin: 0;
    padding-top: 0.25rem;
}
.time-tracking { max-width: 64rem; margin: 0.65rem auto 0; padding: 0.5rem 1rem 0.75rem; }
.time-tracking-heading { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.25rem 1rem; text-align: center; }
.time-tracking-heading h1 { margin: 0; font-size: 1.6rem; }
.time-tracking .time-tracking-context { justify-content: center; margin-top: 0.5rem; }
.time-tracking-selection { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1rem; margin-top: 0.75rem; }
.time-tracking-selection label { display: flex; flex-direction: column; gap: 0.4rem; max-width: 100%; }
.time-tracking-selection select { min-width: min(18rem, 100%); max-width: 100%; }
.time-tracking-clock { display: flex; justify-content: center; flex-wrap: wrap; align-items: baseline; gap: 0.2em; margin: 0.4rem auto 0.6rem; font-size: clamp(2rem, 6vw, 6rem); font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1.2; }
.time-tracking-clock > span { white-space: nowrap; }
.time-tracking-buttons { display: flex; justify-content: center; flex-wrap: nowrap; gap: 0.6rem; max-width: 46rem; margin: 0 auto; }
.time-tracking-buttons .btn { flex: 0 1 auto; min-width: 0; white-space: nowrap; font-size: clamp(1rem, 3vw, 2.75rem); padding: 0.45em 0.7em; font-weight: 700; }
.time-tracking-start { background: #18743d; border-color: #18743d; color: #fff; }
.time-tracking-save { text-align: center; margin: 1rem 0 0.5rem; }
.time-tracking-save .btn { font-size: 1.25rem; padding: 0.6em 1.6em; }
.time-tracking-message, .time-tracking-hint { text-align: center; }
.time-tracking-message { margin: 0.5rem 0; }
.time-tracking-message:empty { display: none; }
.time-tracking-hint { margin: 0.75rem 0 0; }
.time-tracking-error { color: #a32222; }
.time-tracking .btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 480px) {
    .time-tracking-clock { font-size: clamp(1.7rem, 7vw, 2.4rem); }
    .time-tracking-buttons { gap: 0.35rem; }
    .time-tracking-buttons .btn { padding: 0.5em 0.55em; }
}

/* Buchhaltung: numerische Perioden mit engeren Abständen. */
.leistungen-sub-buchhaltung .erledigt-list {
    gap: 0.25rem;
}
.leistungen-sub-buchhaltung label.erledigt-item {
    gap: 0.1rem;
    font-size: 0.8rem;
}
.leistungen-sub-buchhaltung label.erledigt-item input[type="checkbox"] {
    width: 0.85rem;
    height: 0.85rem;
}

/* Inaktive Perioden bleiben auch bei Flex-Darstellung ausgeblendet. */
.leistungen-sub-buchhaltung [hidden] { display: none !important; }

.buchhaltung-details [hidden] { display: none !important; }
.buchhaltung-details .erledigt-inline { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.buchhaltung-details .erledigt-item { display: inline-flex; align-items: center; gap: 0.1rem; font-size: 0.8rem; white-space: nowrap; }

button[form="navigation-form"] { font-family: inherit; line-height: inherit; }
.meta > button[form="navigation-form"] { color: #1e3a5f; background: none; border: 0; padding: 0; font-size: inherit; text-align: left; }

.buchhaltung-details {
    width: calc(83.35rem + 4px);
    max-width: 100%;
    margin-top: 0.75rem;
    padding: 0.65rem;
    border: 1px solid #c4b4d6;
    border-radius: 6px;
    background: #f5f0fa;
}
.buchhaltung-details-row {
    flex-wrap: wrap;
    margin: 0;
}
.buchhaltung-details-row + .buchhaltung-details-row {
    margin-top: 0.65rem;
}

/* SV-Meldung: Erledigtstatus und Monatsdaten in einer gemeinsamen Tabelle. */
.buchhaltung-section.gehalt-sv-section {
    flex-basis: calc(45.5rem + 1.3rem + 2px);
}
.gehalt-sv-table {
    table-layout: fixed;
    width: 45.5rem;
    min-width: 45.5rem;
    max-width: 45.5rem;
}
.gehalt-meldungen .gehalt-monate-table th {
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e3a5f;
    background-color: #eef2f6;
}
.gehalt-meldungen .gehalt-monate-label {
    font-weight: 700;
}
.gehalt-meldungen .buchhaltung-col-erledigt,
.gehalt-sv-table th:nth-child(1) { width: 3.75rem; }
.gehalt-meldungen .buchhaltung-col-zeitraum-only { width: auto; }
.gehalt-sv-table th:nth-child(2) { width: 5.5rem; }
.gehalt-sv-table th:nth-child(3) { width: 5.75rem; }
.gehalt-sv-table th:nth-child(4),
.gehalt-sv-table th:nth-child(5) { width: 6.5rem; }
.gehalt-sv-table th:nth-child(6) { width: 5.5rem; }
.gehalt-sv-table th:nth-child(7) { width: 6.75rem; }
.gehalt-sv-table th:nth-child(8) { width: 5.25rem; }
.gehalt-sv-table input[type="number"],
.gehalt-sv-table input[type="text"] {
    width: 100%;
    min-width: 0;
}

/* Gehalt: schmale Jahresangaben, Meldungsbereiche mit automatischem Umbruch. */
.leistungen-toolbar.gehalt-jahresangaben {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
}
.gehalt-jahresangaben .gehalt-jahresangabe {
    width: fit-content;
    max-width: 100%;
    flex-wrap: wrap;
    padding: 0.65rem;
    border: 1px solid #c4b4d6;
    border-radius: 6px;
    background: #f5f0fa;
}
.gehalt-jahresangaben .tb-select {
    width: 7rem;
    min-width: 0;
    max-width: 100%;
}
.gehalt-jahresangaben .tb-select[name="mitarbeiter_id"] {
    width: 10rem;
}
.gehalt-meldungen .gehalt-meldung-soka,
.gehalt-meldungen .gehalt-meldung-lst {
    flex: 0 1 auto;
    width: max-content;
}
.gehalt-meldung-soka .buchhaltung-section-head {
    flex-direction: column;
    align-items: flex-start;
}
.gehalt-meldung-lst .edit-rhythmus-bar,
.gehalt-meldung-lst .edit-rhythmus-bar .tb-field {
    flex-direction: column;
    align-items: flex-start;
}
.gehalt-meldung-lst .edit-rhythmus-bar .tb-select {
    width: calc(8rem + 2ch);
    min-width: calc(8rem + 2ch);
}
.gehalt-meldung-soka .gehalt-monate-scroll,
.gehalt-meldung-lst .gehalt-monate-scroll {
    /* Nur Beschriftung und Auswahl bestimmen die Kastenbreite. */
    contain: inline-size;
    width: 100%;
    min-width: 0;
}
.gehalt-meldung-soka .buchhaltung-perioden-table,
.gehalt-meldung-lst .buchhaltung-perioden-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.gehalt-meldung-soka .buchhaltung-col-zeitraum-only {
    width: auto;
}

/* Buchhaltung: kompakte Meldungsbereiche und Jahresangaben im gemeinsamen Raster. */
.buchhaltung-kompakt .buchhaltung-section-eur {
    flex-basis: calc(32rem + 1.3rem + 2px);
}
.buchhaltung-kompakt .edit-rhythmus-bar {
    align-items: flex-end;
}
.buchhaltung-kompakt .edit-rhythmus-bar .tb-field {
    flex-direction: column;
    align-items: flex-start;
}
.buchhaltung-kompakt .buchhaltung-section-eur .edit-rhythmus-bar {
    margin-top: 0;
}
.buchhaltung-kompakt .buchhaltung-section-eur .buchhaltung-section-head {
    gap: 0;
}
.buchhaltung-kompakt .edit-rhythmus-bar .tb-select {
    width: calc(8rem + 2ch);
    min-width: calc(8rem + 2ch);
}
.buchhaltung-kompakt .buchhaltung-section-eur .buchhaltung-perioden-table {
    width: 32rem;
    min-width: 32rem;
    max-width: 32rem;
}
.buchhaltung-kompakt .buchhaltung-col-erledigt { width: 3.75rem; }
.buchhaltung-kompakt .buchhaltung-col-zeitraum { width: 5.5rem; }
.buchhaltung-kompakt .buchhaltung-col-zeit { width: 5.5rem; }
.buchhaltung-kompakt .buchhaltung-col-kosten { width: 6.75rem; }
.buchhaltung-kompakt .buchhaltung-col-notizen { width: 10.5rem; }
.buchhaltung-kompakt .buchhaltung-perioden-table input[type="number"],
.buchhaltung-kompakt .buchhaltung-perioden-table input[type="text"] {
    width: 100%;
    min-width: 0;
}
.buchhaltung-kompakt .buchhaltung-section-privat {
    flex: 0 1 auto;
    width: max-content;
}
.buchhaltung-kompakt .buchhaltung-section-privat .gehalt-monate-scroll {
    contain: inline-size;
    width: 100%;
    min-width: 0;
}
.buchhaltung-kompakt .buchhaltung-section-privat .buchhaltung-perioden-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.buchhaltung-kompakt .buchhaltung-col-zeitraum-only { width: auto; }
.buchhaltung-kompakt .buchhaltung-perioden-table th,
.buchhaltung-kompakt .buchhaltung-perioden-table th .meta {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e3a5f;
}

.jahressteuer-felder { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem; }
.jahressteuer-feld { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.65rem; max-width: 100%; border: 1px solid #a6c7af; border-radius: 6px; background: #f0f7f2; }
.jahressteuer-feld h3 { margin: 0; font-size: 1rem; color: #155724; }
.jahressteuer-feld label { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; }
.jahressteuer-feld input, .jahressteuer-feld select { width: 9rem; max-width: 100%; margin: 0; }
.jahressteuer-feld.jahressteuer-details { background: #f5f0fa; border-color: #c4b4d6; }
.jahressteuer-feld input[name="notizen"] { width: 18rem; }

/* Gemeinsame Leistungsmerkmale und zusätzliche Prioritätsmarkierung. */
.leistung-flags { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.leistung-flags .leistung-flag { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0.65rem; border: 1px solid #c4b4d6; border-radius: 6px; background: #f5f0fa; font-size: 0.9rem; font-weight: 600; color: #1e3a5f; }
.leistung-flag input[type="checkbox"] { width: 1.1rem; height: 1.1rem; min-height: 0; margin: 0; }
.aktuell-table tbody tr.aktuell-prioritaet > td { border-top: 2px solid #c62828; border-bottom: 2px solid #c62828; }
.aktuell-table tbody tr.aktuell-prioritaet > td:first-child { border-left: 2px solid #c62828; }
.aktuell-table tbody tr.aktuell-prioritaet > td:last-child { border-right: 2px solid #c62828; }
.aktuell-prioritaet-label { color: #b71c1c; }

/* Kompakte aktive Mandantenliste; Stammdaten werden einzeln bearbeitet. */
.mandanten-table.mandanten-compact-table { width: 100%; min-width: 680px; table-layout: auto; }
.mandanten-pagination { align-items: center; padding: .5rem 0; }

/* Steuerangaben auf der Mandanten-Bearbeitungsseite. */
.jahressteuer-feld.mandant-steuerfeld { background: #eaf4ff; border-color: #a8c9e8; }

#mandant-edit-form select[name="daten[gea]"] { width: 12rem; }

#mandant-edit-form input[name="daten[anschrift_firma]"],
#mandant-edit-form input[name="daten[anschrift_privat]"] { width: 18rem; }

/* Aktive Mandanten gesamt und persönliche Zuordnung neben der Navigation. */
.mandanten-counts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .45rem .75rem; border: 1px solid #a8c9e8; border-radius: 6px; background: #eaf4ff; color: #1e3a5f; font-size: .9rem; }
.mandanten-counts > span { white-space: nowrap; }

/* Zuletzt geöffneter Mandant: gesamte Zeile auch beim Darüberfahren hellgrün. */
.mandanten-compact-table tbody tr.mandant-last-opened,
.mandanten-compact-table tbody tr.mandant-last-opened > td { background-color: #e2f3df; }

.registration-felder .jahressteuer-feld input[name="notizen"] { width: 14rem; }

/* Stammdaten im Lesemodus bleiben gut lesbar und mit der Maus kopierbar. */
#mandant-edit-form input[readonly] { cursor: text; user-select: text; color: inherit; opacity: 1; }

/* Kompakte Unterkategorien der aktuellen Aufgaben. */
.aktuell-karten {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 32rem), 1fr));
    gap: 0.75rem;
    align-items: start;
    margin-bottom: 1rem;
}
.aktuell-karten > .aktuell-abschnitt,
.aktuell-einzelkarte {
    min-width: 0;
    margin: 0;
    padding: 0.65rem;
    background: #eaf4ff;
    border: 1px solid #a8c9e8;
    border-radius: 6px;
}
.aktuell-karten .aktuell-abschnitt-kopf { margin-top: 0; }
.aktuell-karten .table-wrap { max-width: 100%; overflow-x: auto; }

/* Karten schließen in der jeweils nächsten freien Spalte an. */
.aktuell-karten.aktuell-karten-kompakt {
    grid-auto-rows: 1px;
    grid-auto-flow: row dense;
}

.buchhaltung-jahresstatus { white-space: nowrap; }
.buchhaltung-kosten-symbol { color: #0069d9; font-weight: 700; margin-left: .4rem; }

/* Hellgrüne Zusatzbereiche in der Buchhaltungsbearbeitung. */
.buchhaltung-kompakt .buchhaltung-section-privat,
.buchhaltung-kompakt .gehalt-jahresangabe.buchhaltung-angabe-gruen {
    background: #f0f7f2;
    border-color: #a6c7af;
}

.aktuell-table tbody tr > td.aktuell-status.aktuell-versand-gelb { background: #fff3cd; color: #664d03; }
.aktuell-table tbody tr > td.aktuell-status.aktuell-versand-rot { background: #f8d7da; color: #58151c; }

/* SV/EB und Private Nutzung: Mandantenzeilen immer weiß. */
#aktuell-salden .aktuell-table tbody tr > td,
#aktuell-privat .aktuell-table tbody tr > td {
    background-color: #fff;
    color: inherit;
}

.buchhaltung-unterlagen { padding: .65rem; background: #f0f7f2; border: 1px solid #a6c7af; border-radius: 6px; max-width: 100%; }
.buchhaltung-unterlagen-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.buchhaltung-unterlagen-zeile + .buchhaltung-unterlagen-zeile { margin-top: .5rem; }
.buchhaltung-unterlagen-zeile label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
.buchhaltung-unterlagen-zeile input[type="text"] { width: 8rem; margin: 0; }
.buchhaltung-unterlagen-zeile input[type="checkbox"] { width: auto; margin: 0; }

.aktuell-unterlagen-icon { display: inline-flex; width: 1.15em; height: 1.15em; vertical-align: -.15em; margin-right: .25em; color: #1e3a5f; cursor: help; }
.aktuell-unterlagen-icon svg { width: 100%; height: 100%; }

.leistung-flags .leistung-flag-check { display: inline-flex; flex-direction: row; align-items: center; gap: .4rem; margin: 0; }
.leistung-flags .leistung-flag .rechnung-datum { width: 7.5rem; min-width: 0; margin: 0; font-weight: normal; }
