:root {
    color-scheme: light;
    --background: #f3f5f7;
    --surface: #ffffff;
    --surface-subtle: #f8fafb;
    --text: #17212b;
    --muted: #64717d;
    --border: #dce2e7;
    --primary: #1f5f68;
    --primary-hover: #174c54;
    --primary-soft: #e3f0f1;
    --danger: #a12626;
    --danger-soft: #fbeaea;
    --shadow: 0 18px 45px rgba(23, 33, 43, 0.08);
    --radius: 16px;
    --container: 1080px;
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

a {
    color: var(--primary);
}

.container {
    width: min(calc(100% - 32px), var(--container));
    margin-inline: auto;
}

.site-header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.brand__mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: white;
    background: var(--primary);
    border-radius: 12px;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.main-nav > a {
    color: var(--text);
    text-decoration: none;
    font-weight: 650;
}

.main-nav form {
    margin: 0;
}

.page {
    flex: 1;
    padding: 48px 0;
}

.page--centered {
    display: grid;
    place-items: center;
    padding-inline: 16px;
}

.content-stack {
    display: grid;
    gap: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(24px, 4vw, 40px);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 460px);
}

.card__header {
    margin-bottom: 24px;
}

.card__header > :first-child,
.hero > div > :first-child {
    margin-top: 0;
}

.card__header > :last-child,
.hero > div > :last-child {
    margin-bottom: 0;
}

h1,
h2,
p {
    overflow-wrap: anywhere;
}

h1,
h2 {
    line-height: 1.2;
    letter-spacing: -0.025em;
}

h1 {
    margin: 8px 0 12px;
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    margin: 6px 0 10px;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
}

.eyebrow {
    margin-bottom: 0;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.form {
    display: grid;
    gap: 20px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    font-weight: 700;
}

.form-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--text);
    background: white;
    border: 1px solid #bdc7cf;
    border-radius: 10px;
    outline: none;
}

.form-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
}

.button--primary {
    color: white;
    background: var(--primary);
}

.button--primary:hover {
    background: var(--primary-hover);
}

.button--secondary {
    color: var(--text);
    background: white;
    border-color: var(--border);
}

.button--secondary:hover {
    background: var(--surface-subtle);
}

.button--full {
    width: 100%;
}

.button--disabled {
    color: var(--muted);
    background: var(--surface-subtle);
    border-color: var(--border);
    cursor: not-allowed;
}

.alert {
    margin-bottom: 22px;
    padding: 13px 15px;
    border-radius: 10px;
}

.alert--error {
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #efcaca;
}

.hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.badge {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 7px 11px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
}

.details-list {
    margin: 0;
    display: grid;
}

.details-list > div {
    display: grid;
    grid-template-columns: minmax(100px, 180px) 1fr;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.details-list > div:last-child {
    padding-bottom: 0;
}

.details-list dt {
    color: var(--muted);
    font-weight: 700;
}

.details-list dd {
    margin: 0;
}

.site-footer {
    padding: 24px 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

.site-footer p {
    margin: 0;
}

@media (max-width: 640px) {
    .site-header__inner,
    .hero {
        align-items: stretch;
        flex-direction: column;
    }

    .site-header__inner {
        padding-block: 14px;
    }

    .main-nav {
        justify-content: space-between;
    }

    .page {
        padding-top: 28px;
    }

    .details-list > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.alert--success {
    color: #17623a;
    background: #e9f7ef;
    border: 1px solid #bfe4ce;
}

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

.form-field select {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--text);
    background: white;
    border: 1px solid #bdc7cf;
    border-radius: 10px;
    outline: none;
}

.form-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.button--danger-secondary {
    color: var(--danger);
    background: white;
    border-color: #efcaca;
}

.button--danger-secondary:hover {
    background: var(--danger-soft);
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

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

.data-table th {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-table td:first-child,
.data-table th:first-child {
    padding-left: 0;
}

.data-table td:last-child,
.data-table th:last-child {
    padding-right: 0;
}

.table-secondary {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.9rem;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.table-actions form {
    margin: 0;
}

.status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.status--active {
    color: #17623a;
    background: #e9f7ef;
}

.status--inactive {
    color: var(--danger);
    background: var(--danger-soft);
}

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

.action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.action-group form {
    margin: 0;
}

.field-display {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 11px 13px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.card--compact {
    padding-block: 20px;
}

.form-field select:disabled {
    color: var(--muted);
    background: var(--surface-subtle);
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .action-group {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Kundenmodul */

select,
textarea {
    font: inherit;
}

.form-field textarea,
.form-field select,
.prescription-editor input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--text);
    background: white;
    border: 1px solid #bdc7cf;
    border-radius: 10px;
    outline: none;
}

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

.form-field textarea:focus,
.form-field select:focus,
.prescription-editor input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.main-nav {
    flex-wrap: wrap;
}

.main-nav > a[aria-current="page"] {
    color: var(--primary);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.alert-list {
    margin: 8px 0 0;
    padding-left: 20px;
}

.alert-list li + li {
    margin-top: 4px;
}

.customer-hero,
.dashboard-hero {
    background:
        radial-gradient(circle at top right, rgba(31, 95, 104, 0.12), transparent 38%),
        var(--surface);
}

.customer-search {
    display: flex;
    align-items: end;
    gap: 12px;
}

.customer-search__field {
    flex: 1 1 420px;
}

.customer-search__status {
    flex: 0 1 210px;
}

.filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 24px;
    padding-top: 20px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.filter-summary strong {
    color: var(--text);
}

.customer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.customer-card {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(23, 33, 43, 0.06);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.customer-card:hover {
    transform: translateY(-3px);
    border-color: #b8c8cc;
    box-shadow: var(--shadow);
}

.customer-card--archived {
    background: var(--surface-subtle);
}

.customer-card__link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.customer-card__top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.customer-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 14px;
    font-weight: 850;
    letter-spacing: 0.03em;
}

.customer-avatar--large {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    font-size: 1.35rem;
}

.customer-avatar--small {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.customer-card__identity {
    min-width: 0;
    flex: 1;
}

.customer-card__identity h2 {
    margin: 0 0 4px;
    font-size: 1.2rem;
}

.customer-number {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.customer-card__details {
    display: grid;
    gap: 12px;
    margin: 24px 0;
}

.customer-card__details p {
    margin: 0;
    display: grid;
    gap: 2px;
}

.customer-card__details span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.customer-card__details strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}

.customer-card__footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--primary);
    border-top: 1px solid var(--border);
    font-weight: 750;
}

.empty-state {
    padding-block: 70px;
    display: grid;
    justify-items: center;
    text-align: center;
}

.empty-state__icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 22px;
    font-weight: 850;
}

.empty-state h2 {
    margin-bottom: 4px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.section-number {
    flex: 0 0 auto;
    color: #a9b5bc;
    font-size: 1.35rem;
    font-weight: 850;
}

.form-section {
    box-shadow: 0 10px 30px rgba(23, 33, 43, 0.055);
}

.form-section--sensitive,
.sensitive-card {
    border-color: #ead8b9;
    background:
        linear-gradient(180deg, rgba(255, 249, 237, 0.7), rgba(255, 255, 255, 0) 180px),
        var(--surface);
}

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

.form-field--span-two {
    grid-column: span 2;
}

.form-field--span-three {
    grid-column: 1 / -1;
}

.form-grid--spaced {
    margin-top: 24px;
}

.form-field--spaced {
    margin-top: 20px;
}

.prescription-editor {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.prescription-editor__header,
.prescription-editor__row {
    display: grid;
    grid-template-columns: minmax(80px, 0.8fr) repeat(4, minmax(90px, 1fr));
    align-items: center;
    gap: 10px;
    padding: 12px;
}

.prescription-editor__header {
    color: var(--muted);
    background: var(--surface-subtle);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.prescription-editor__row + .prescription-editor__row {
    border-top: 1px solid var(--border);
}

.prescription-editor input {
    min-width: 0;
    min-height: 44px;
}

.choice-group {
    margin: 26px 0 0;
    padding: 0;
    border: 0;
}

.choice-group legend {
    margin-bottom: 12px;
    font-weight: 800;
}

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

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

.choice-card {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 650;
}

.choice-card:hover {
    border-color: #b8c8cc;
}

.choice-card input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

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

.split-panel .choice-group {
    margin: 0;
    padding: 22px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.sticky-form-actions {
    position: sticky;
    bottom: 16px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.customer-profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background:
        radial-gradient(circle at top right, rgba(31, 95, 104, 0.12), transparent 42%),
        var(--surface);
}

.customer-profile-hero--archived {
    background: var(--surface-subtle);
}

.customer-profile-hero__identity {
    display: flex;
    align-items: center;
    gap: 20px;
}

.customer-profile-hero h1 {
    margin-block: 7px;
}

.profile-kicker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-actions {
    display: flex;
    gap: 10px;
}

.quick-info-grid,
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.quick-info-card,
.stat-card {
    min-width: 0;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(23, 33, 43, 0.045);
}

.quick-info-card span,
.stat-card__label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.quick-info-card strong {
    display: block;
    overflow-wrap: anywhere;
}

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

.stat-card {
    padding: 24px;
}

.stat-card strong {
    display: block;
    margin: 6px 0 14px;
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1;
}

.stat-card a,
.text-link {
    font-weight: 750;
    text-decoration: none;
}

.profile-layout,
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 0.72fr);
    align-items: start;
    gap: 24px;
}

.profile-sidebar {
    position: sticky;
    top: 24px;
}

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

.detail-grid > div {
    min-width: 0;
    padding: 16px;
    background: var(--surface);
}

.detail-grid__wide {
    grid-column: 1 / -1;
}

.detail-grid dt,
.inline-details dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.detail-grid dd,
.inline-details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.vision-panels {
    display: grid;
    gap: 20px;
}

.vision-panel {
    padding: 22px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.vision-panel__heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.vision-panel__heading h3 {
    margin: 0;
}

.vision-panel__heading span {
    color: var(--muted);
    font-size: 0.9rem;
}

.prescription-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
}

.prescription-table th,
.prescription-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.prescription-table thead th {
    color: var(--muted);
    background: #eef2f4;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.inline-details {
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.inline-details > div {
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.note-box {
    margin: 16px 0 0;
    padding: 14px;
    background: #fff;
    border-left: 3px solid var(--primary);
    border-radius: 6px 10px 10px 6px;
}

.tag-section {
    margin-top: 24px;
}

.tag-section h3,
.sidebar-section h3 {
    margin: 0 0 10px;
    font-size: 0.9rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    padding: 6px 10px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 750;
}

.tag--warning {
    color: #7a4e00;
    background: #fff1cc;
}

.tag--muted {
    color: var(--muted);
    background: #edf1f3;
}

.sidebar-section + .sidebar-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-section p {
    margin: 0;
}

.empty-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px;
    background: var(--surface-subtle);
    border: 1px dashed #bfcbd1;
    border-radius: 12px;
}

.empty-inline p {
    margin: 4px 0 0;
    color: var(--muted);
}

.danger-zone {
    border-color: #efcaca;
}

.dashboard-layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.65fr);
}

.recent-list {
    display: grid;
}

.recent-list__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    color: var(--text);
    border-top: 1px solid var(--border);
    text-decoration: none;
}

.recent-list__item:hover strong {
    color: var(--primary);
}

.recent-list__identity {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
}

.recent-list__identity small,
.recent-list__date {
    color: var(--muted);
}

.recent-list__date {
    flex: 0 0 auto;
    font-size: 0.88rem;
}

.stacked-actions {
    display: grid;
    gap: 10px;
}

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

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

    .profile-layout,
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
    }
}

@media (max-width: 820px) {
    .form-grid--three,
    .choice-grid,
    .split-panel {
        grid-template-columns: 1fr;
    }

    .form-field--span-two,
    .form-field--span-three {
        grid-column: auto;
    }

    .prescription-editor {
        overflow-x: auto;
    }

    .prescription-editor__header,
    .prescription-editor__row {
        min-width: 660px;
    }

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

    .customer-profile-hero,
    .customer-profile-hero__identity {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-actions {
        width: 100%;
    }

    .profile-actions .button {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .main-nav {
        width: 100%;
        align-items: stretch;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .main-nav > a,
    .main-nav form,
    .main-nav .button {
        width: 100%;
    }

    .main-nav > a {
        min-height: 42px;
        display: grid;
        place-items: center;
        padding: 8px;
        background: var(--surface-subtle);
        border-radius: 9px;
    }

    .customer-search,
    .customer-profile-hero,
    .empty-inline {
        align-items: stretch;
        flex-direction: column;
    }

    .customer-search__field,
    .customer-search__status {
        width: 100%;
        flex-basis: auto;
    }

    .customer-grid,
    .quick-info-grid,
    .stat-grid,
    .detail-grid,
    .inline-details {
        grid-template-columns: 1fr;
    }

    .detail-grid__wide {
        grid-column: auto;
    }

    .customer-card {
        padding: 20px;
    }

    .sticky-form-actions {
        bottom: 8px;
    }

    .sticky-form-actions .button {
        flex: 1;
    }

    .recent-list__date {
        display: none;
    }
}

/* Mobile-friendly sign control for decimal prescription values. */
.signed-number {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
}

.signed-number input {
    width: 100%;
    min-width: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.signed-number__toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    color: var(--text);
    background: var(--surface-subtle);
    border: 1px solid #bdc7cf;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 850;
    line-height: 1;
    touch-action: manipulation;
}

.signed-number__toggle:hover,
.signed-number__toggle:focus-visible {
    color: var(--primary);
    background: var(--primary-soft);
    outline: none;
}

.signed-number__toggle--active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.signed-number:focus-within {
    border-radius: 10px;
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.signed-number:focus-within input,
.signed-number:focus-within .signed-number__toggle {
    border-color: var(--primary);
}

.signed-number:focus-within input {
    box-shadow: none;
}

/* Aufträge, Offerten und Rechnungen */

.status--warning {
    color: #765000;
    background: #fff1cc;
}

.status--neutral {
    color: #42515d;
    background: #edf1f3;
}

.order-hero,
.invoice-hero,
.order-detail-hero {
    background:
        radial-gradient(circle at top right, rgba(31, 95, 104, 0.14), transparent 40%),
        var(--surface);
}

.order-detail-hero,
.invoice-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.profile-actions--wrap {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.document-chip {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.document-chip--offer {
    color: #765000;
    background: #fff1cc;
}

.document-chip--order {
    color: var(--primary);
    background: var(--primary-soft);
}

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

.stat-card__money {
    font-size: clamp(1.25rem, 2.4vw, 2rem) !important;
    line-height: 1.15 !important;
}

.order-filter,
.invoice-filter {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.order-filter__search,
.invoice-filter__search {
    flex: 1 1 280px;
}

.order-filter > .form-field:not(.order-filter__search),
.invoice-filter > .form-field:not(.invoice-filter__search) {
    flex: 0 1 210px;
}

.segment-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.segment-fieldset legend {
    margin-bottom: 10px;
    font-weight: 800;
}

.segment-control {
    width: fit-content;
    display: flex;
    padding: 4px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.segment-control label {
    cursor: pointer;
}

.segment-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment-control span {
    min-width: 120px;
    min-height: 42px;
    display: grid;
    place-items: center;
    padding: 8px 18px;
    border-radius: 9px;
    font-weight: 800;
}

.segment-control input:checked + span {
    color: white;
    background: var(--primary);
    box-shadow: 0 7px 18px rgba(31, 95, 104, 0.2);
}

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

.is-muted-field {
    opacity: 0.55;
}

.order-prescription-editor {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.order-prescription-editor__header,
.order-prescription-editor__row {
    display: grid;
    grid-template-columns: minmax(62px, 0.55fr) repeat(5, minmax(100px, 1fr));
    align-items: center;
    gap: 10px;
    padding: 12px;
}

.order-prescription-editor__header {
    color: var(--muted);
    background: var(--surface-subtle);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.order-prescription-editor__row + .order-prescription-editor__row {
    border-top: 1px solid var(--border);
}

.order-prescription-editor__row > input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 11px;
    color: var(--text);
    background: white;
    border: 1px solid #bdc7cf;
    border-radius: 10px;
    outline: none;
}

.order-prescription-editor__row > input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.order-items-wrapper {
    border: 1px solid var(--border);
    border-radius: 14px;
}

.order-items-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

.order-items-table th,
.order-items-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.order-items-table th {
    color: var(--muted);
    background: var(--surface-subtle);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

.order-items-table select,
.order-items-table input {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    color: var(--text);
    background: white;
    border: 1px solid #bdc7cf;
    border-radius: 9px;
    font: inherit;
}

.order-items-table th:nth-child(1),
.order-items-table td:nth-child(1) {
    width: 150px;
}

.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3) {
    width: 100px;
}

.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
    width: 160px;
}

.order-items-table th:nth-child(5),
.order-items-table td:nth-child(5) {
    width: 135px;
}

.order-items-table th:nth-child(6),
.order-items-table td:nth-child(6) {
    width: 48px;
}

.order-item-total {
    white-space: nowrap;
    font-weight: 800;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--danger);
    background: white;
    border: 1px solid #efcaca;
    border-radius: 9px;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

.icon-button:hover {
    background: var(--danger-soft);
}

.order-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
    align-items: stretch;
    gap: 24px;
}

.order-summary {
    background:
        linear-gradient(180deg, rgba(227, 240, 241, 0.7), rgba(255, 255, 255, 0) 180px),
        var(--surface);
}

.order-summary__list,
.invoice-totals {
    margin: 0;
    display: grid;
}

.order-summary__list > div,
.invoice-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.order-summary__list dt,
.order-summary__list dd,
.invoice-totals dt,
.invoice-totals dd {
    margin: 0;
}

.order-summary__list dd,
.invoice-totals dd {
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.order-summary__total {
    margin-top: 8px;
    padding: 16px !important;
    color: var(--primary);
    background: var(--primary-soft);
    border: 0 !important;
    border-radius: 10px;
    font-size: 1.08rem;
    font-weight: 850;
}

.form-hint {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.price-table td:nth-last-child(-n+3),
.price-table th:nth-last-child(-n+3) {
    text-align: right;
}

.details-list--compact > div {
    grid-template-columns: 90px 1fr;
    padding-block: 12px;
}

.invoice-action-card {
    border-color: #b9d6d9;
    background:
        linear-gradient(180deg, rgba(227, 240, 241, 0.72), rgba(255, 255, 255, 0) 180px),
        var(--surface);
}

.invoice-page {
    padding-top: 28px;
}

.invoice-toolbar {
    align-items: center;
    padding-block: 22px;
}

.invoice-toolbar h1 {
    margin-block: 5px;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.invoice-shell {
    padding: 28px;
    overflow-x: auto;
    background: #e6eaed;
    border-radius: 18px;
}

.invoice-shell--standalone {
    min-height: 100vh;
    border-radius: 0;
}

.invoice-document {
    width: min(100%, 900px);
    min-height: 1270px;
    margin-inline: auto;
    padding: 58px;
    color: #17212b;
    background: white;
    box-shadow: 0 24px 60px rgba(23, 33, 43, 0.18);
    font-size: 0.94rem;
}

.invoice-document__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    padding-bottom: 26px;
    border-bottom: 1px solid #cad2d8;
}

.invoice-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.invoice-brand__mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    color: white;
    background: #1d5874;
    border-radius: 14px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.invoice-brand div {
    display: grid;
}

.invoice-brand strong {
    color: #173e57;
    font-size: 1.48rem;
    letter-spacing: -0.04em;
}

.invoice-brand em {
    font-family: Georgia, serif;
    font-weight: 500;
}

.invoice-brand small {
    color: #7a858e;
}

.invoice-company,
.invoice-address-grid address {
    margin: 0;
    font-style: normal;
}

.invoice-company {
    padding-left: 22px;
    border-left: 1px solid #cad2d8;
    line-height: 1.55;
}

.invoice-document__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin: 30px 0;
}

.invoice-kicker {
    margin: 0 0 4px;
    color: #1d5874;
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.invoice-document__title-row h2 {
    margin: 0;
    color: #173e57;
    font-size: 2rem;
}

.invoice-status-badge {
    padding: 8px 14px;
    color: #1d5874;
    background: #e7f0f5;
    border: 1px solid #bfd3df;
    border-radius: 8px;
    font-weight: 850;
}

.invoice-status-badge--paid {
    color: #17623a;
    background: #e9f7ef;
    border-color: #bfe4ce;
}

.invoice-status-badge--cancelled {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #efcaca;
}

.invoice-address-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 50px;
    margin-bottom: 30px;
}

.invoice-address-grid address {
    line-height: 1.55;
}

.invoice-address-grid address > span {
    display: block;
    margin-bottom: 8px;
    color: #1d5874;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.invoice-meta-grid {
    margin: 0 0 26px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    padding: 18px 22px;
    background: #f7f9fa;
    border: 1px solid #d7dee3;
    border-radius: 10px;
}

.invoice-meta-grid > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 0;
}

.invoice-meta-grid dt,
.invoice-meta-grid dd {
    margin: 0;
}

.invoice-meta-grid dt {
    color: #50606c;
    font-weight: 750;
}

.invoice-meta-grid dd {
    font-weight: 800;
    text-align: right;
}

.invoice-table-wrapper {
    overflow: hidden;
    border: 1px solid #d2dae0;
    border-radius: 9px;
}

.invoice-table,
.invoice-prescription-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th,
.invoice-table td {
    padding: 12px 13px;
    border-bottom: 1px solid #dde3e7;
    text-align: left;
    vertical-align: top;
}

.invoice-table thead th {
    color: white;
    background: #215a7e;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

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

.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) {
    width: 58px;
    text-align: center;
}

.invoice-table th:nth-last-child(-n+3),
.invoice-table td:nth-last-child(-n+3) {
    text-align: right;
}

.invoice-table td:nth-last-child(-n+2) {
    white-space: nowrap;
}

.invoice-table td:nth-child(2) strong,
.invoice-table td:nth-child(2) span {
    display: block;
}

.invoice-table td:nth-child(2) span {
    margin-top: 2px;
    color: #5d6a74;
}

.invoice-totals-wrap {
    display: flex;
    justify-content: flex-end;
    margin: 16px 0 26px;
}

.invoice-totals {
    width: min(100%, 470px);
}

.invoice-totals > div {
    padding: 9px 12px;
}

.invoice-totals__grand {
    color: #173e57;
    background: #e7f0f5;
    border: 1px solid #bfd3df !important;
    font-size: 1.12rem;
    font-weight: 900;
}

.invoice-totals__remaining {
    color: var(--danger);
    font-weight: 900;
}

.invoice-lower-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 18px;
}

.invoice-box {
    min-width: 0;
    padding: 16px;
    border: 1px solid #d7dee3;
    border-radius: 9px;
}

.invoice-box h3 {
    margin: 0 0 12px;
    color: #1d5874;
    font-size: 1rem;
}

.invoice-box p {
    margin: 0 0 10px;
}

.invoice-prescription-table th,
.invoice-prescription-table td {
    padding: 7px 8px;
    border: 1px solid #dde3e7;
    text-align: center;
}

.invoice-prescription-table thead th {
    color: #52616d;
    background: #f5f7f8;
    font-size: 0.72rem;
}

.invoice-measurements {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
    padding: 9px 10px;
    background: #f7f9fa;
    border-radius: 7px;
    font-weight: 750;
}

.invoice-document__footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 28px;
    padding-top: 16px;
    color: #65717a;
    border-top: 1px solid #cad2d8;
    font-size: 0.8rem;
}

.invoice-payment-card {
    margin-bottom: 16px;
}

.payment-overview {
    display: grid;
    text-align: right;
}

.payment-overview span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.payment-overview strong {
    font-size: 1.6rem;
}

.invoice-payment-form {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 0.7fr) auto;
    align-items: end;
    gap: 14px;
}

.print-document-body {
    display: block;
    background: #e6eaed;
}

.print-document-actions {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid #d4dade;
    backdrop-filter: blur(10px);
}

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

    .order-form-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .form-grid--four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .order-prescription-editor {
        overflow-x: auto;
    }

    .order-prescription-editor__header,
    .order-prescription-editor__row {
        min-width: 760px;
    }

    .invoice-document {
        min-width: 760px;
    }

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

@media (max-width: 640px) {
    .order-detail-hero,
    .invoice-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-actions--wrap {
        justify-content: stretch;
    }

    .profile-actions--wrap .button {
        flex: 1 1 100%;
    }

    .stat-grid--four,
    .form-grid--four {
        grid-template-columns: 1fr;
    }

    .order-filter,
    .invoice-filter {
        align-items: stretch;
        flex-direction: column;
    }

    .order-filter > .form-field,
    .invoice-filter > .form-field {
        width: 100%;
        flex-basis: auto !important;
    }

    .segment-control {
        width: 100%;
    }

    .segment-control label {
        flex: 1;
    }

    .segment-control span {
        min-width: 0;
    }
}

@page {
    size: A4 portrait;
    margin: 10mm;
}

@media print {
    html,
    body,
    .print-document-body {
        min-height: auto;
        background: white !important;
    }

    body {
        display: block;
    }

    .no-print,
    .site-header,
    .site-footer {
        display: none !important;
    }

    .invoice-page,
    .page {
        padding: 0 !important;
    }

    .invoice-page > .container,
    .invoice-shell,
    .invoice-shell--standalone {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: visible;
        background: white;
        border-radius: 0;
    }

    .invoice-document {
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
        font-size: 9.5pt;
    }

    .invoice-document__header {
        padding-bottom: 16px;
    }

    .invoice-document__title-row {
        margin: 18px 0;
    }

    .invoice-address-grid,
    .invoice-meta-grid {
        margin-bottom: 18px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 8px 9px;
    }

    .invoice-lower-grid {
        break-inside: avoid;
    }

    .invoice-totals-wrap,
    .invoice-table-wrapper,
    .invoice-meta-grid,
    .invoice-box {
        break-inside: avoid;
    }
}

.brand__logo {
    width: 150px;
    height: 54px;
    display: block;
    object-fit: contain;
    object-position: left center;
}

.invoice-brand img {
    width: 190px;
    height: auto;
    display: block;
}

@media (max-width: 640px) {
    .brand__logo {
        width: 138px;
        height: 50px;
    }
}

@media print {
    .invoice-brand img {
        width: 155px;
    }
}

/* ===== Refined invoice / offer / order document styling v2 ===== */
.invoice-shell {
    padding: 28px;
    overflow-x: auto;
    background: #e9edf0;
    border-radius: 18px;
}

.invoice-document {
    width: min(100%, 980px);
    min-height: 0;
    margin-inline: auto;
    padding: 46px 48px 34px;
    color: #17212b;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(23, 33, 43, 0.12);
    font-size: 0.94rem;
}

.invoice-document__header--refined {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 36px;
    padding-bottom: 18px;
    border-bottom: 1px solid #cfd7de;
}

.invoice-brand--split {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.invoice-brand__mark-image {
    width: 146px;
    height: 82px;
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
}

.invoice-brand__copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.invoice-brand__copy strong {
    color: #174d7d;
    font-size: 1.28rem;
    line-height: 1.08;
    letter-spacing: -0.035em;
    white-space: nowrap;
}

.invoice-brand__copy strong span {
    font-weight: 900;
}

.invoice-brand__copy strong em {
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: 700;
}

.invoice-brand__copy small {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    color: #878d92;
    font-family: Georgia, serif;
    font-size: 0.9rem;
    font-style: italic;
    white-space: nowrap;
}

.invoice-brand__copy small::before,
.invoice-brand__copy small::after {
    content: '';
    width: 36px;
    height: 1px;
    background: #cfd4d8;
}

.invoice-contact {
    width: min(100%, 270px);
    min-width: 230px;
    margin: 0;
    padding-left: 26px;
    color: #33495b;
    border-left: 1px solid #d5dce2;
    font-style: normal;
    font-size: 0.86rem;
    line-height: 1.45;
}

.invoice-contact > div {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    margin-top: 5px;
}

.invoice-contact > div > span:first-child {
    color: #71808c;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.invoice-contact > div > strong {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #174d7d;
    font-weight: 800;
}

.invoice-contact__address {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1px !important;
    margin: 0 0 8px !important;
}

.invoice-contact__address strong,
.invoice-contact__address span {
    display: block;
}

.invoice-contact__address strong {
    color: #174d7d;
    font-size: 0.94rem;
}

.invoice-document__title-row--refined {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 30px 0 28px;
}

.invoice-document__title-row--refined h2 {
    margin: 0;
    color: #174d7d;
    font-size: 2.15rem;
    font-weight: 900;
    line-height: 1.1;
}

.invoice-status-badge {
    min-width: 92px;
    padding: 8px 14px;
    color: #174d7d;
    background: #edf5ff;
    border: 1px solid #bdd5f1;
    border-radius: 8px;
    font-weight: 850;
    text-align: center;
    white-space: nowrap;
}

.invoice-status-badge--paid,
.invoice-status-badge--completed {
    color: #17623a;
    background: #e9f7ef;
    border-color: #bfe4ce;
}

.invoice-status-badge--cancelled {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #efcaca;
}

.invoice-address-grid--refined {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 64px;
    margin-bottom: 26px;
}

.invoice-address-grid--refined address {
    min-width: 0;
    margin: 0;
    font-style: normal;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.invoice-address-grid--refined address > span {
    display: block;
    margin-bottom: 9px;
    color: #174d7d;
    font-size: 0.9rem;
    font-weight: 850;
}

.invoice-meta-grid--refined {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0 0 24px;
    padding: 17px 20px;
    background: #fbfcfd;
    border: 1px solid #d8e0e6;
    border-radius: 11px;
}

.invoice-meta-column {
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
    margin: 0;
}

.invoice-meta-column + .invoice-meta-column {
    margin-left: 22px;
    padding-left: 22px;
    border-left: 1px solid #d8e0e6;
}

.invoice-meta-column > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(90px, auto);
    align-items: start;
    gap: 12px;
    min-width: 0;
}

.invoice-meta-column dt,
.invoice-meta-column dd {
    min-width: 0;
    margin: 0;
}

.invoice-meta-column dt {
    color: #465d70;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.invoice-meta-column dd {
    max-width: 155px;
    color: #17212b;
    font-weight: 850;
    text-align: right;
    overflow-wrap: anywhere;
}

.invoice-table-wrapper {
    overflow: hidden;
    border: 1px solid #d2dae0;
    border-radius: 9px;
}

.invoice-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.invoice-table__position { width: 8%; }
.invoice-table__description { width: 42%; }
.invoice-table__quantity { width: 12%; }
.invoice-table__unit-price { width: 19%; }
.invoice-table__total { width: 19%; }

.invoice-table th,
.invoice-table td {
    min-width: 0;
    padding: 12px 12px;
    border-bottom: 1px solid #dde3e7;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.invoice-table thead th {
    color: #ffffff;
    background: #215a7e;
    font-size: 0.77rem;
    letter-spacing: 0.01em;
}

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

.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) {
    text-align: center;
}

.invoice-table th:nth-child(n+3),
.invoice-table td:nth-child(n+3) {
    text-align: right;
}

.invoice-table td:nth-child(n+3) {
    white-space: nowrap;
}

.invoice-table td:nth-child(2) strong,
.invoice-table td:nth-child(2) span {
    display: block;
}

.invoice-table td:nth-child(2) strong {
    color: #2f4659;
}

.invoice-table td:nth-child(2) span {
    margin-top: 2px;
    color: #5d6a74;
}

.invoice-totals-wrap {
    display: flex;
    justify-content: flex-end;
    margin: 16px 0 24px;
}

.invoice-totals--refined {
    width: min(100%, 500px);
    margin: 0;
    overflow: hidden;
    border: 1px solid #d7dee3;
    border-radius: 9px;
}

.invoice-totals--refined > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 9px 12px;
    border-bottom: 1px solid #e1e6ea;
}

.invoice-totals--refined > div:last-child {
    border-bottom: 0;
}

.invoice-totals--refined dt,
.invoice-totals--refined dd {
    min-width: 0;
    margin: 0;
}

.invoice-totals--refined dt {
    color: #3c5264;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.invoice-totals--refined dd {
    display: grid;
    grid-template-columns: 40px minmax(84px, auto);
    align-items: baseline;
    gap: 10px;
    color: #17212b;
    white-space: nowrap;
}

.invoice-totals--refined dd span {
    color: #40586b;
    font-weight: 750;
}

.invoice-totals--refined dd strong {
    text-align: right;
}

.invoice-money--negative,
.invoice-money--negative span,
.invoice-money--negative strong {
    color: #c53b35 !important;
}

.invoice-totals__grand {
    color: #174d7d;
    background: #edf5ff;
    border-bottom: 0 !important;
}

.invoice-totals__grand dt,
.invoice-totals__grand dd,
.invoice-totals__grand dd span {
    color: #174d7d;
    font-weight: 900;
}

.invoice-totals__grand dt {
    font-size: 1.08rem;
}

.invoice-totals__grand dd strong {
    font-size: 1.3rem;
}

.invoice-totals__remaining dt,
.invoice-totals__remaining dd,
.invoice-totals__remaining dd span {
    color: #c53b35;
    font-weight: 900;
}

.invoice-lower-grid--refined {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
    gap: 18px;
}

.invoice-box {
    min-width: 0;
    padding: 15px;
    border: 1px solid #d7dee3;
    border-radius: 9px;
}

.invoice-box h3,
.invoice-payment-information h3 {
    margin: 0 0 11px;
    color: #174d7d;
    font-size: 1rem;
    font-weight: 900;
}

.invoice-box p {
    margin: 0 0 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.invoice-prescription-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.invoice-prescription-table th,
.invoice-prescription-table td {
    padding: 7px 6px;
    border: 1px solid #dde3e7;
    text-align: center;
    overflow-wrap: anywhere;
}

.invoice-prescription-table thead th {
    color: #52616d;
    background: #f5f7f8;
    font-size: 0.7rem;
}

.invoice-measurements {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
    padding: 9px 10px;
    background: #f7f9fa;
    border-radius: 7px;
}

.invoice-measurements span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.invoice-payment-information {
    margin-top: 18px;
    padding: 15px;
    border: 1px solid #d7dee3;
    border-radius: 9px;
}

.invoice-payment-information__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 24px;
}

.invoice-payment-information__grid > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, auto);
    gap: 12px;
    min-width: 0;
}

.invoice-payment-information__grid span {
    color: #61717d;
    font-weight: 700;
}

.invoice-payment-information__grid strong {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.invoice-document__footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 26px;
    padding-top: 14px;
    color: #65717a;
    border-top: 1px solid #cad2d8;
    font-size: 0.78rem;
}

/* Optional Swiss QR payment part. Disabled until real banking data is configured. */
.qr-bill-page {
    width: min(100%, 980px);
    margin: 28px auto 0;
    display: grid;
    grid-template-columns: 30% 70%;
    min-height: 490px;
    background: #ffffff;
    border-top: 1px dashed #333333;
    box-shadow: 0 24px 60px rgba(23, 33, 43, 0.12);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.75rem;
}

.qr-bill-page h2 {
    margin: 0 0 16px;
    font-size: 1.12rem;
}

.qr-bill-receipt,
.qr-bill-payment-part {
    padding: 18px;
}

.qr-bill-receipt {
    border-right: 1px dashed #333333;
}

.qr-bill-copy {
    display: grid;
    gap: 2px;
    margin-bottom: 18px;
}

.qr-bill-copy strong {
    margin-bottom: 3px;
}

.qr-bill-amount {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 4px 12px;
    margin: 14px 0 18px;
}

.qr-bill-payment-part__layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 22px;
}

.swiss-qr-code {
    width: 180px;
    height: 180px;
}

.swiss-qr-code svg {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-bill-details {
    min-width: 0;
}

.brand__logo {
    width: 150px;
    height: 56px;
    display: block;
    object-fit: contain;
    object-position: left center;
}

@media (max-width: 820px) {
    .invoice-document,
    .qr-bill-page {
        min-width: 780px;
    }
}

@media (max-width: 640px) {
    .brand__logo {
        width: 138px;
        height: 52px;
    }
}

@page {
    size: A4 portrait;
    margin: 10mm;
}

@media print {
    html,
    body,
    .print-document-body {
        min-height: auto;
        background: #ffffff !important;
    }

    body {
        display: block;
    }

    .no-print,
    .site-header,
    .site-footer,
    .print-hide-status {
        display: none !important;
    }

    .invoice-page,
    .page {
        padding: 0 !important;
    }

    .invoice-page > .container,
    .invoice-shell,
    .invoice-shell--standalone {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: visible;
        background: #ffffff;
        border-radius: 0;
    }

    .invoice-document {
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
        font-size: 8.8pt;
    }

    .invoice-document__header--refined {
        gap: 24px;
        padding-bottom: 12px;
    }

    .invoice-brand__mark-image {
        width: 118px;
        height: 66px;
    }

    .invoice-brand__copy strong {
        font-size: 1.05rem;
    }

    .invoice-brand__copy small {
        font-size: 0.76rem;
    }

    .invoice-contact {
        min-width: 205px;
        width: 225px;
        padding-left: 20px;
        font-size: 7.6pt;
    }

    .invoice-document__title-row--refined {
        margin: 18px 0;
    }

    .invoice-document__title-row--refined h2 {
        font-size: 20pt;
    }

    .invoice-address-grid--refined {
        gap: 45px;
        margin-bottom: 16px;
    }

    .invoice-meta-grid--refined {
        margin-bottom: 16px;
        padding: 12px 14px;
    }

    .invoice-meta-column {
        gap: 7px;
    }

    .invoice-meta-column + .invoice-meta-column {
        margin-left: 16px;
        padding-left: 16px;
    }

    .invoice-meta-column > div {
        grid-template-columns: minmax(0, 1fr) minmax(82px, auto);
        gap: 8px;
    }

    .invoice-meta-column dd {
        max-width: 125px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 7px 8px;
    }

    .invoice-totals-wrap {
        margin: 10px 0 16px;
    }

    .invoice-totals--refined > div {
        padding: 6px 9px;
    }

    .invoice-lower-grid--refined {
        gap: 12px;
    }

    .invoice-box,
    .invoice-payment-information {
        padding: 10px;
    }

    .invoice-box h3,
    .invoice-payment-information h3 {
        margin-bottom: 7px;
        font-size: 9pt;
    }

    .invoice-prescription-table th,
    .invoice-prescription-table td {
        padding: 4px;
    }

    .invoice-measurements {
        margin-top: 6px;
        padding: 6px 8px;
    }

    .invoice-document__footer {
        margin-top: 16px;
        padding-top: 9px;
    }

    .invoice-table-wrapper,
    .invoice-totals-wrap,
    .invoice-meta-grid--refined,
    .invoice-lower-grid--refined,
    .invoice-box,
    .invoice-payment-information {
        break-inside: avoid;
    }

    .qr-bill-page {
        width: 210mm;
        height: 105mm;
        min-width: 210mm;
        min-height: 105mm;
        margin: 172mm 0 0 -10mm;
        grid-template-columns: 62mm 148mm;
        border-top: 0.5pt dashed #000000;
        box-shadow: none;
        break-before: page;
        page-break-before: always;
        font-size: 7pt;
    }

    .qr-bill-receipt,
    .qr-bill-payment-part {
        padding: 5mm;
    }

    .qr-bill-payment-part__layout {
        grid-template-columns: 51mm 1fr;
        gap: 5mm;
    }

    .swiss-qr-code {
        width: 46mm;
        height: 46mm;
    }
}

/* Produkte & Lagerverwaltung */
.product-hero {
    background:
        radial-gradient(circle at top right, rgba(31, 95, 104, 0.12), transparent 38%),
        var(--surface);
}

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

.inventory-kpi {
    padding: 22px 26px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 10px 28px rgba(23, 33, 43, 0.05);
}

.inventory-kpi span {
    color: var(--muted);
    font-weight: 700;
}

.inventory-kpi strong {
    font-size: 1.8rem;
    letter-spacing: -0.04em;
}

.product-search {
    display: grid;
    grid-template-columns: minmax(240px, 1.8fr) minmax(170px, 1fr) minmax(160px, 0.8fr) minmax(130px, 0.65fr) auto auto;
    align-items: end;
    gap: 12px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.product-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(23, 33, 43, 0.06);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: #b8c8cc;
    box-shadow: var(--shadow);
}

.product-card--inactive {
    opacity: 0.72;
}

.product-card__link {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.product-card__image {
    height: 180px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(145deg, #eef3f4, #f8fafb);
    border-bottom: 1px solid var(--border);
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card__image span,
.product-image-placeholder,
.product-detail-image > span {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 22px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.product-card__body {
    padding: 22px;
}

.product-card__chips,
.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.product-card__chips {
    justify-content: flex-start;
}

.product-card h2 {
    margin: 14px 0 4px;
    font-size: 1.25rem;
}

.product-card__subline {
    min-height: 24px;
    margin: 0 0 18px;
}

.product-card__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.product-card__facts > div {
    padding: 12px;
    background: var(--surface-subtle);
    border-radius: 10px;
}

.product-card__facts span,
.product-card__facts strong {
    display: block;
}

.product-card__facts span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.product-card__facts strong {
    margin-top: 3px;
}

.product-form-layout,
.product-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
    align-items: start;
    gap: 24px;
}

.product-form-layout > *,
.product-detail-layout > * {
    min-width: 0;
}

.form-field--spaced {
    margin-top: 18px;
}

.form-grid--compact {
    gap: 12px;
}

.product-image-card {
    overflow: hidden;
}

.product-image-preview,
.product-image-placeholder {
    width: 100%;
    height: 240px;
    margin-bottom: 18px;
    object-fit: contain;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.product-image-placeholder {
    place-items: center;
    color: var(--primary);
    font-size: 1.3rem;
}

.is-hidden {
    display: none !important;
}

.attribute-editor {
    display: grid;
    gap: 10px;
}

.attribute-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.5fr) minmax(80px, 0.5fr) 42px;
    gap: 10px;
    align-items: center;
}

.attribute-row input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 11px;
    color: var(--text);
    background: white;
    border: 1px solid #bdc7cf;
    border-radius: 9px;
    font: inherit;
}

.product-price-preview {
    margin-top: 18px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--primary-soft);
    border-radius: 12px;
}

.product-price-preview span {
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 750;
}

.product-price-preview strong {
    white-space: nowrap;
    font-size: 1.15rem;
}

.product-edit-stock-note {
    margin-top: 16px;
    padding: 16px;
    display: grid;
    gap: 2px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.product-edit-stock-note span,
.product-edit-stock-note small {
    color: var(--muted);
}

.product-edit-stock-note strong {
    font-size: 1.65rem;
}

.product-overview {
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.4fr);
    align-items: start;
    gap: 28px;
}

.product-detail-image {
    min-height: 250px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.product-detail-image img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
}

.product-detail-list > div:first-child {
    border-top: 0;
}

.product-price-list {
    margin: 0;
    display: grid;
}

.product-price-list > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-top: 1px solid var(--border);
}

.product-price-list > div:first-child {
    border-top: 0;
}

.product-price-list dt {
    color: var(--muted);
    font-weight: 700;
}

.product-price-list dd {
    margin: 0;
    font-weight: 800;
    text-align: right;
}

.product-price-list__final {
    margin: 6px -10px;
    padding-inline: 10px !important;
    background: var(--primary-soft);
    border: 0 !important;
    border-radius: 10px;
}

.stock-positive {
    color: #17623a;
    font-weight: 800;
}

.stock-negative {
    color: var(--danger);
    font-weight: 800;
}

.category-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
    align-items: start;
    gap: 24px;
}

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

.category-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px;
    color: var(--text);
    background: var(--surface-subtle);
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
}

.category-list__item:hover,
.category-list__item.is-current {
    border-color: #b8c8cc;
    background: var(--primary-soft);
}

.category-list__item strong,
.category-list__item small {
    display: block;
}

.category-list__item small {
    margin-top: 2px;
    color: var(--muted);
}

.category-attributes-heading {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.category-attributes-heading p {
    margin: 2px 0 0;
}

.order-product-picker {
    margin-bottom: 18px;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 110px auto;
    align-items: end;
    gap: 12px;
    background: var(--primary-soft);
    border: 1px solid #c9dddf;
    border-radius: 12px;
}

.order-product-picker--empty {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.order-items-table--products {
    min-width: 1220px;
}

.order-items-table--products th:nth-child(1),
.order-items-table--products td:nth-child(1) {
    width: 140px;
}

.order-items-table--products th:nth-child(2),
.order-items-table--products td:nth-child(2) {
    min-width: 280px;
}

.order-items-table--products th:nth-child(3),
.order-items-table--products td:nth-child(3) {
    width: 90px;
}

.order-items-table--products th:nth-child(4),
.order-items-table--products td:nth-child(4) {
    width: 145px;
}

.order-items-table--products th:nth-child(5),
.order-items-table--products td:nth-child(5) {
    width: 130px;
}

.order-items-table--products th:nth-child(6),
.order-items-table--products td:nth-child(6) {
    width: 110px;
}

.order-items-table--products th:nth-child(7),
.order-items-table--products td:nth-child(7) {
    width: 125px;
}

.order-items-table--products th:nth-child(8),
.order-items-table--products td:nth-child(8) {
    width: 48px;
}

.order-product-ref {
    width: fit-content;
    margin-bottom: 5px;
    display: block;
    padding: 2px 7px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 850;
}

@media (max-width: 900px) {
    .inventory-kpis,
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .product-search__q {
        grid-column: 1 / -1;
    }

    .product-form-layout,
    .product-detail-layout,
    .category-layout,
    .product-overview {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .inventory-kpis,
    .product-grid,
    .product-search {
        grid-template-columns: 1fr;
    }

    .product-search__q {
        grid-column: auto;
    }

    .inventory-kpi {
        padding: 18px 20px;
    }

    .attribute-row {
        grid-template-columns: 1fr 1fr 42px;
    }

    .attribute-row input:nth-child(1) {
        grid-column: 1 / -1;
    }

    .attribute-row .icon-button {
        grid-column: 3;
        grid-row: 2;
    }

    .order-product-picker,
    .order-product-picker--empty {
        grid-template-columns: 1fr;
    }

    .product-card__image {
        height: 150px;
    }
}

.check-card--inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.check-card--inline input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--primary);
}

/* 2026-08-09: Dokument-Rezept und sichtbare Produktübernahme */
.prescription-heading {
    align-items: flex-start;
}

.prescription-visibility-toggle {
    flex: 0 0 auto;
    min-width: 245px;
}

.prescription-visibility-toggle span {
    display: grid;
    gap: 2px;
}

.prescription-visibility-toggle small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.order-product-picker__status {
    min-height: 1.15rem;
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.order-product-picker__status.is-success {
    color: var(--success, #23734a);
}

.order-product-picker__status.is-error {
    color: var(--danger);
}

.order-items-table tr.is-product-added td {
    animation: order-product-added 1.8s ease-out;
}

@keyframes order-product-added {
    0%, 35% { background: var(--primary-soft); }
    100% { background: transparent; }
}

.invoice-lower-grid--single {
    grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 760px) {
    .prescription-heading {
        display: grid;
        gap: 14px;
    }

    .prescription-visibility-toggle {
        min-width: 0;
        width: 100%;
    }
}

/* Teilrechnungen und Rechnungskorrekturen */
.alert--warning {
    color: #765000;
    background: #fff6dc;
    border: 1px solid #ead8a0;
}

.alert--info {
    color: #1d5874;
    background: #eef6f8;
    border: 1px solid #c7dfe3;
}

.alert a {
    color: inherit;
    font-weight: 800;
}

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

.billing-card {
    min-height: 112px;
}

.billing-card--warning {
    border-color: #ead8a0;
    background: #fffaf0;
}

.invoice-warning-note {
    margin: 0 0 16px;
    padding: 11px 12px;
    color: #765000;
    background: #fff6dc;
    border: 1px solid #ead8a0;
    border-radius: 9px;
    font-size: 0.9rem;
}

.table-row--muted {
    opacity: 0.62;
}

.table-row--muted td {
    background: #fafafa;
}

.invoice-create-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    gap: 24px;
    align-items: start;
}

.invoice-create-summary {
    position: sticky;
    top: 92px;
}

.invoice-selection-table th:first-child,
.invoice-selection-table td:first-child {
    width: 46px;
    text-align: center;
}

.invoice-selection-table th:nth-child(n+3),
.invoice-selection-table td:nth-child(n+3) {
    text-align: right;
}

.invoice-selection-table input[type="checkbox"],
.invoice-correction-table input[type="checkbox"] {
    width: 19px;
    height: 19px;
    accent-color: var(--primary);
}

.invoice-quantity-input {
    width: 92px;
    min-height: 40px;
    padding: 8px 9px;
    text-align: right;
}

.invoice-row--inactive {
    opacity: 0.54;
}

.check-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
}

.check-card input {
    width: 19px;
    height: 19px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.check-card span {
    display: grid;
    gap: 3px;
}

.check-card small {
    color: var(--muted);
}

.check-card--warning {
    border-color: #ead8a0;
    background: #fffaf0;
}

.invoice-correction-table input[type="text"],
.invoice-correction-table input[type="number"],
.invoice-correction-table select {
    width: 100%;
    min-height: 42px;
    padding: 8px 9px;
}

.invoice-correction-table th:first-child,
.invoice-correction-table td:first-child {
    width: 46px;
    text-align: center;
}

.invoice-correction-table th:nth-child(2),
.invoice-correction-table td:nth-child(2) {
    min-width: 280px;
}

.inline-discount-fields {
    display: grid;
    grid-template-columns: 92px 100px;
    gap: 8px;
}

.form-actions--end {
    justify-content: flex-end;
}

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

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

    .invoice-create-summary {
        position: static;
    }
}

@media (max-width: 640px) {
    .billing-overview-grid {
        grid-template-columns: 1fr;
    }
}


/* Teilrechnungen: bereits verrechnete Auftragspositionen */
.billing-lock-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.order-item--billed {
    background: var(--surface-soft, #f7f7f7);
}

.order-item-billed-note {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.78rem;
}

.order-item--billed input:disabled,
.order-item--billed select:disabled,
.billing-lock-fieldset:disabled input,
.billing-lock-fieldset:disabled select,
.billing-lock-fieldset:disabled textarea {
    cursor: not-allowed;
    opacity: 0.72;
}

.order-item--billed .icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

/* Rechnungsaktionen */
.inline-action-form {
    display: inline-flex;
    margin: 0;
}

.invoice-correction-table--additional tbody tr:not(.invoice-row--inactive) {
    background: #fbfdfb;
}


/* Sichtbarkeitsfilter */
.filter-form {
    display: block;
}

.filter-controls {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-controls .order-filter__search,
.filter-controls .invoice-filter__search,
.filter-controls .customer-search__field,
.filter-controls .product-search__q {
    flex: 1 1 320px;
}

.product-filter-controls .form-field:not(.product-search__q) {
    flex: 0 1 240px;
}

.filter-visibility {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 16px;
}

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

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

.filter-check-group {
    min-width: 0;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-subtle);
}

.filter-check-group legend {
    padding: 0 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.filter-check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.filter-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

@media (max-width: 900px) {
    .filter-visibility--three {
        grid-template-columns: 1fr;
    }

    .filter-visibility--two {
        grid-template-columns: 1fr;
    }
}

/* Kompakte Mehrfachfilter: Dropdown-Anordnung mit Checkboxen */
.filter-dropdown {
    position: relative;
    flex: 0 0 auto;
    min-width: 165px;
    z-index: 10;
}

.filter-dropdown[open] {
    z-index: 80;
}

.filter-dropdown > summary {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 38px 10px 13px;
    color: var(--text);
    background: #fff;
    border: 1px solid #bdc7cf;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    list-style: none;
    user-select: none;
    white-space: nowrap;
}

.filter-dropdown > summary::-webkit-details-marker {
    display: none;
}

.filter-dropdown > summary::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.16s ease;
}

.filter-dropdown[open] > summary {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.filter-dropdown[open] > summary::after {
    transform: translateY(-35%) rotate(225deg);
}

.filter-dropdown__count {
    min-width: 34px;
    padding: 3px 7px;
    color: var(--muted);
    background: var(--surface-subtle);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
}

.filter-dropdown__menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    width: max-content;
    min-width: 235px;
    max-width: min(310px, calc(100vw - 32px));
    display: grid;
    gap: 5px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(24, 34, 43, 0.16);
}

.filter-dropdown__menu--right {
    right: 0;
    left: auto;
}

.filter-dropdown__title {
    display: block;
    padding: 3px 7px 7px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.filter-dropdown .filter-check {
    width: 100%;
    min-height: 38px;
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 0.88rem;
}

.filter-dropdown .filter-check:hover {
    background: var(--surface-subtle);
}

.filter-dropdown .filter-check input[type="checkbox"] {
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    .filter-controls {
        align-items: stretch;
    }

    .filter-dropdown {
        flex: 1 1 100%;
        width: 100%;
    }

    .filter-dropdown__menu,
    .filter-dropdown__menu--right {
        right: auto;
        left: 0;
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}
