/* Shared shell proportions follow DIGI-FRAME prod; mobile forms retain readable type and touch targets. */
:root {
    --df-control-h-head: var(--studio-button-height);
    --df-bar-gap: 12px;
    --mud-typography-body1-size: 1rem;
    --mud-typography-body1-lineheight: 1.55;
    --mud-typography-body2-size: .9375rem;
    --mud-typography-caption-size: .8125rem;
}
html { scroll-padding-top: calc(var(--mud-appbar-height, 64px) + 16px); }
body { -webkit-font-smoothing: antialiased; }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 3000; transform: translateY(-200%); padding: 10px 16px; background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-primary); border-radius: var(--df-radius); }
.skip-link:focus { transform: none; }
.mud-main-content, .main-canvas > *, .panel > *, .two-col > *, .three-col > *, .settings-grid > *, .extra-values > *, .rate-editor > *, .due-item > * { min-width: 0; }
.mud-main-content:focus { outline: none; }
.mud-appbar { box-shadow: inset 0 -1px 0 rgb(0 0 0 / 8%) !important; }
.appbar-page, .drawer-close { display: none; }
.appbar-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar-context { display: flex; align-items: center; min-width: 0; }
.company-indicator { display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin-left: 12px; }
.company-indicator > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-indicator > .mud-icon-root { flex-shrink: 0; }
.appbar-desktop-actions { display: flex; align-items: center; }
.appbar-mobile-actions, .mobile-navigation { display: none; }
.mobile-logout { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 48px; padding: 8px 16px; border: 0; background: transparent; color: var(--mud-palette-text-primary); font: inherit; cursor: pointer; }
.mobile-logout:hover { background: var(--mud-palette-action-default-hover); }
.mobile-logout .mud-icon-root { color: var(--mud-palette-text-secondary); }
.mud-drawer .mud-drawer-content { display: flex; flex-direction: column; min-height: 100%; overscroll-behavior: contain; }
.brand-header { min-height: var(--mud-appbar-height, 64px); align-items: center; padding: 0 20px !important; flex-shrink: 0; border-bottom: 1px solid var(--df-line); }
.brand-link { flex: 1; gap: 3px; }
.brand-word { font-size: 26px; }
.brand-sub { font-size: 9px; letter-spacing: 2px; }
.nav-compact { padding-top: 8px; padding-bottom: 16px; }
.nav-compact .mud-nav-link .mud-nav-link-text { flex-wrap: wrap; overflow-wrap: anywhere; line-height: 1.4; }
.invoice-nav-label { white-space: nowrap; }
.nav-badge { flex-shrink: 0; }
.drawer-foot { flex-shrink: 0; padding: 10px 16px; }
.page-heading { align-items: center; gap: 16px; margin: 0 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--df-line); }
.page-heading h1 { font-size: 1.6rem; font-weight: 700; }
.page-heading .eyebrow { font-size: .7rem; letter-spacing: .08em; }
.page-heading > :is(button, a, .mud-button-root) { flex-shrink: 0; min-height: var(--df-control-h-head); }
.panel, .panel-flat, .info-grid section, .metrics > div, .stat-tile { border-color: var(--df-line); box-shadow: none; }
.section-heading, .report-heading { flex-wrap: wrap; }
.section-heading > div, .report-heading > div { min-width: 0; }
.report-heading strong, .stat-tile strong, .metrics strong, .due-item strong, .doc-customer h2 { overflow-wrap: anywhere; }
.tag, .status { border-radius: var(--df-radius); }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.quick-action { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--df-line); border-radius: var(--df-radius-lg); background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); font-weight: 600; }
.quick-action:hover { text-decoration: none; border-color: var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 4%, var(--mud-palette-surface)); }
.quick-action > .mud-icon-root { flex-shrink: 0; color: var(--mud-palette-primary); }
.quick-action > span:first-of-type { flex: 1; min-width: 0; }
.quick-action small { display: block; margin-top: 3px; color: var(--mud-palette-text-secondary); font-size: .78rem; font-weight: 400; }
.quick-action > span:last-child { color: var(--mud-palette-text-secondary); }
.extra-values { grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto; }
.table-scroll, .table-panel, .chart-scroll { max-width: 100%; overscroll-behavior-x: contain; }
.chart-scroll { overflow-x: auto; padding-bottom: 4px; }
.filter-row { min-width: 0; }
.filter-row > label { flex: 1 1 150px; }
.row-actions a, .filter-actions a { text-decoration: none; }
.document-disclosure > summary { cursor: pointer; font-weight: 600; min-height: 44px; padding-block: 10px; }
.document-disclosure[open] > summary { margin-bottom: 12px; }
.document-disclosure { margin-top: 16px; }
.document-editor fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.document-editor .row-actions { margin-top: 16px; }
.document-hash { display: block; overflow-wrap: anywhere; }
@media (min-width: 960px) and (max-width: 2199.98px), (min-width: 960px) and (max-height: 1199.98px) {
    :root { --df-canvas-pad: 16px; }
    html:root { font-size: 15px; }
    body .mud-layout { --mud-appbar-height: 56px; }
    th, td { padding: 10px 12px; }
    .panel:not(.table-panel), .panel-flat { padding: 18px; }
}
@media (min-width: 760.01px) and (max-width: 1100px) {
    .extra-values { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .quick-action { padding: 12px; gap: 8px; }
    .quick-action small { line-height: 1.4; }
    .page-heading > .filter-row { flex: 1 1 300px; }
}
@media (max-width: 959.98px) {
    :root { --df-canvas-pad: 12px; }
    .workspace-layout { --mobile-navigation-height: 68px; }
    .workspace-layout .appbar-context { flex: 1; flex-direction: column; align-items: flex-start; overflow: hidden; padding-inline: 8px; }
    .workspace-layout .appbar-spacer { display: none; }
    .workspace-layout .appbar-page { width: 100%; margin: 0; line-height: 1.4; }
    .workspace-layout .company-indicator { max-width: 100%; min-height: 24px; margin: 0; font-size: .75rem; line-height: 1.3; opacity: .9; }
    .workspace-layout .appbar-desktop-actions { display: none; }
    .workspace-layout .appbar-mobile-actions { display: inline-flex; }
    .workspace-layout > .mud-main-content > .main-canvas { padding-bottom: calc(var(--df-canvas-pad) + var(--mobile-navigation-height) + env(safe-area-inset-bottom)) !important; }
    .mobile-navigation { position: fixed; inset: auto 0 0; z-index: 1100; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: var(--mobile-navigation-height); padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: var(--mud-palette-surface); border-top: 1px solid var(--df-line); box-shadow: 0 -4px 20px rgb(0 0 0 / 4%); }
    .mobile-navigation > :is(a, button) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 56px; padding: 6px 2px; border: 0; border-radius: 10px; background: transparent; color: var(--mud-palette-text-secondary); font: inherit; font-size: .6875rem; font-weight: 600; line-height: 1.3; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
    .mobile-navigation .mud-icon-root { font-size: 22px; }
    .mobile-navigation > .active { color: var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 9%, var(--mud-palette-surface)); }
    .mobile-navigation > :is(a, button):hover { background: var(--mud-palette-action-default-hover); }
    body:has(.workspace-layout) { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
    body:has(.workspace-layout) #mud-snackbar-container.mud-snackbar-location-bottom-right { bottom: calc(80px + env(safe-area-inset-bottom)); }
    body .mud-layout { --mud-appbar-height: 56px; }
    body .mud-appbar, body .mud-appbar .mud-toolbar { min-height: 56px; height: 56px; }
    body .mud-appbar .mud-toolbar { padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); gap: 0; }
    .mud-appbar .mud-icon-button { width: 44px; height: 44px; min-width: 44px; padding: 10px; flex-shrink: 0; }
    .mud-appbar .mud-icon-root { font-size: 22px; }
    .appbar-user { display: none; }
    .appbar-page { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; font-weight: 600; margin-left: 8px; }
    .app-navigation { max-width: calc(100vw - 48px); }
    .drawer-close { display: inline-flex; flex-shrink: 0; }
    .nav-compact .mud-nav-link, .nav-compact > .mud-nav-group > .mud-nav-link { min-height: 48px; padding-block: 10px; }
    .drawer-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .page-heading { flex-wrap: wrap; }
    .mud-dialog { max-width: calc(100vw - 24px) !important; max-height: calc(100dvh - 24px) !important; margin: 12px !important; }
    .mud-dialog .mud-dialog-content { padding: 16px; overflow-wrap: anywhere; }
    .mud-dialog .mud-dialog-actions { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
    .mud-menu-item { min-height: 44px; }
    :is(.button-row, .actions, .filter-actions) > * { min-width: 0; }
}
@media (max-width: 760px) {
    .page-heading { gap: 12px; padding-bottom: 14px; margin-bottom: 16px; align-items: stretch; }
    .page-heading h1 { font-size: 1.45rem; overflow-wrap: anywhere; }
    .page-heading p { font-size: .875rem; line-height: 1.5; }
    .page-heading > :is(button, a, .mud-button-root), .page-heading > .filter-row { width: 100%; }
    .quick-actions { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
    .quick-action { padding: 12px 14px; }
    .quick-action small { font-size: .8rem; }
    .panel:not(.table-panel), .panel-flat { padding: 14px; margin-bottom: 14px; }
    .table-panel { padding: 0; }
    .metrics, .stat-grid { gap: 10px; }
    .metrics > div, .stat-tile { padding: 12px; }
    .stat-tile strong, .metrics strong { font-size: clamp(1rem, 4.5vw, 1.4rem); font-variant-numeric: tabular-nums; }
    .stat-tile small, .metrics small { line-height: 1.4; }
    .extra-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
    .extra-values > strong { white-space: normal; align-self: center; }
    .discount-editor { padding: 10px 12px; gap: 8px; }
    .discount-editor label { margin: 0; }
    .due-item { gap: 12px; }
    .due-item label, .issue-panel label:has(input[type=date]) { max-width: none; }
    .due-item .actions, .issue-panel .actions { width: 100%; min-width: 0; }
    .actions > :is(button, a), .button-row > :is(button, a), .filter-actions > :is(button, a) { flex: 1 1 140px; text-align: center; }
    .actions > small { flex-basis: 100%; }
    .primary, .secondary, .text-button, .file-button { min-height: var(--studio-button-height); white-space: normal; line-height: 1.4; display: inline-flex; align-items: center; justify-content: center; }
    .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
    .row-actions > :is(a, button) { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding-inline: 10px; }
    .section-heading > .row-actions { width: 100%; }
    .section-heading > .row-actions > a { flex: 1 1 140px; }
    .steps { gap: 8px; display: grid; grid-template-columns: minmax(0, 1fr); padding-bottom: 12px; }
    .steps > span { padding: 6px 10px; background: var(--df-surface-sunken); border-left: 2px solid var(--df-line-strong); }
    .steps > .current { border-left-color: var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 7%, transparent); }
    .upload-panel { padding: 24px 14px; }
    .info-grid { gap: 10px; }
    .info-grid section { padding: 14px; }
    input.mud-input-slot, textarea.mud-input-slot, .acc-manage .acc-input { font-size: 16px !important; }
    .check { min-height: 44px; align-items: center; }
    .check input[type=checkbox] { width: 20px; height: 20px; margin: 0; }
    .report-heading { align-items: flex-start; gap: 10px; }
    .filter-actions { gap: 8px; }
    .chart-scroll .bar-chart { min-width: 528px; }
    .chart-scroll .bar-value { display: block; }
    .chart-scroll .bar-col { min-width: 38px; }
    .doc-customer h2 { flex-wrap: wrap; }
    .acc-manage .acc-recovery-code.acc-shared-key { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 420px) {
    .filter-row { grid-template-columns: minmax(0, 1fr); }
    .filter-actions { grid-column: auto; }
    .extra-toolbar > button { width: 100%; }
    .keep-table { min-width: 420px; }
}

/* Page identity, scope controls and status rows share the reference application's control tiers. */
:root { --df-control-h: 56px; --df-control-h-grid: 48px; }
.list-toolbar .list-search { flex: 2 1 280px; }
.list-toolbar .filter-actions { min-height: 44px; }
.result-count { margin: 12px 0 0; font-size: .8125rem; color: var(--mud-palette-text-secondary); font-variant-numeric: tabular-nums; }
.load-status, .draft-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--df-line); background: var(--mud-palette-surface); border-radius: var(--df-radius); font-size: .875rem; }
.draft-status { color: var(--mud-palette-warning); border-left: 3px solid var(--mud-palette-warning); }
.draft-status .mud-icon-root { flex-shrink: 0; }
.load-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.load-error > span { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.load-error > button { flex-shrink: 0; }
.mud-table-container { max-width: 100%; }
.mud-table-cell { overflow-wrap: anywhere; }
.mud-dialog-title { border-bottom: 1px solid var(--df-line); }
.mud-dialog-actions { border-top: 1px solid var(--df-line); background: var(--df-surface-sunken); }
@media (min-width: 960px) {
    .filter-panel :is(input, select) { min-height: var(--df-control-h-grid); }
    .filter-panel .filter-actions > :is(a, button) { min-height: var(--df-control-h-grid); display: inline-flex; align-items: center; justify-content: center; }
    .page-heading { min-height: 72px; }
    .section-heading { align-items: center; }
}
@media (max-width: 959.98px) {
    .load-error > button { width: 100%; }
    .mud-table .mud-table-cell { max-width: 100%; white-space: normal !important; }
    .mud-table .mud-table-cell::before { overflow-wrap: normal; }
    .mud-dialog .mud-dialog-title { padding: 16px; }
    .mud-dialog .mud-dialog-title .mud-typography { font-size: 1.15rem; padding-right: 24px; }
    .mud-dialog .mud-dialog-actions .mud-button-root { min-height: 44px; white-space: normal; }
}
@media (max-width: 760px) {
    .list-toolbar .list-search { grid-column: 1 / -1; }
    .list-toolbar .filter-actions { min-height: 0; }
    .draft-status { align-items: flex-start; line-height: 1.5; }
    .list-toolbar input { margin-top: 6px; }
    .filter-panel .filter-actions a { width: auto; }
    .panel:has(.mud-table) { max-width: 100%; }
}
@media (max-width: 420px) {
    .mud-dialog .mud-dialog-actions { flex-direction: column-reverse; align-items: stretch; }
    .mud-dialog .mud-dialog-actions .mud-button-root { width: 100%; }
}

@media (max-width: 959.98px) {
    /* A two-column row card keeps labels above values; neither can overlap a long customer name. */
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 14px; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td { min-width: 0; padding: 0; text-align: left; white-space: normal; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td::before { float: none; display: block; margin: 0 0 4px; padding: 0; font-size: .72rem; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td:first-child { grid-column: 1 / -1; padding-bottom: 4px; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td:first-child > strong { white-space: normal; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td:is(.row-actions, [colspan], :has(select), :has(.pay-editor)) { grid-column: 1 / -1; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td.row-actions { display: flex; margin: 0; padding-top: 8px; border-top: 1px solid var(--df-line); }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td a { white-space: normal; overflow-wrap: anywhere; }
    .pay-editor { justify-content: flex-start; }
    .pay-editor input { width: 100%; }
    /* Separate records visually while keeping their labels and actions together. */
    .table-panel:has(> table:not(.keep-table)) { border: 0; background: transparent; overflow: visible; }
    .table-panel > table:not(.keep-table) { border-collapse: separate; }
    .table-panel > table:not(.keep-table) tbody { display: grid; gap: 12px; }
    .table-panel > table:not(.keep-table) tbody > tr { background: var(--mud-palette-surface); border: 1px solid var(--df-line); border-radius: var(--df-radius-lg); }
    .table-panel > table:not(.keep-table) tfoot { margin-top: 12px; }
}

@media (max-width: 959.98px) {
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td:is([data-label="Kunde"], [data-label^="Kunde "], [data-label="Titel"], [data-label="Downloads"]) { grid-column: 1 / -1; }
}
.workspace-layout .mud-input-control { min-width: 0; margin-top: 12px; margin-bottom: 12px; }
.workspace-layout .mud-input.mud-input-outlined { min-height: var(--studio-field-height); border-radius: var(--df-radius); background: var(--mud-palette-surface); }
.workspace-layout .mud-input:not(.mud-input-multiline) .mud-input-slot { padding-top: 16px; padding-bottom: 16px; }
.workspace-layout .mud-input:not(.mud-input-multiline) input.mud-input-slot { height: var(--studio-field-height); box-sizing: border-box; }
.workspace-layout .mud-input.mud-input-multiline { min-height: 112px; }
.workspace-layout .mud-input-control .mud-input-label { font-weight: 500; }
.workspace-layout .filter-row { align-items: flex-start; gap: 16px; }
.workspace-layout .filter-row > .mud-input-control { flex: 1 1 220px; }
.workspace-layout .filter-row .mud-input-control { margin: 8px 0; }
.workspace-layout .filter-row > .list-search { flex-grow: 2; }
.workspace-layout .two-col > .mud-input-control { width: 100%; }
.workspace-layout .document-editor fieldset > .mud-input-control { margin-bottom: 20px; }
/* MudSelect's list inherits the popover height. A layout border would add a second scroll range. */
.studio-select-popover { color: var(--mud-palette-text-primary); background: var(--mud-palette-surface); border: 0; outline: 1px solid var(--mud-palette-lines-default); outline-offset: -1px; border-radius: 8px; }
.studio-select-popover .mud-list-item { min-height: 48px; }
.studio-select-popover .mud-selected-item { background: var(--mud-palette-primary-hover); color: var(--mud-palette-primary); }

/* Keep short workspace tab sets visible on phones, using MudBlazor's own tab semantics. */
@media (max-width: 700px) {
    :is(.workspace-tabs, .document-workspace-tabs) .mud-tabs-tabbar-wrapper { width: 100%; }
    :is(.workspace-tabs, .document-workspace-tabs) .mud-tabs-tabbar-wrapper > .mud-tooltip-root { flex: 1; min-width: 0; }
    :is(.workspace-tabs, .document-workspace-tabs) .mud-tab { width: 100%; min-width: 0; min-height: 56px; padding: 8px 4px; font-size: .75rem; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; text-align: center; text-transform: none; }
    :is(.workspace-tabs, .document-workspace-tabs) .mud-tab .mud-icon-root { display: none; }
    .mud-dialog:not(.document-pdf-dialog) { margin: 12px; width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
    .mud-dialog:not(.document-pdf-dialog) .mud-dialog-content { padding: 16px; }
    .workspace-layout .invoice-archive-filters .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .workspace-layout .invoice-archive-filters .filter-row > .mud-input-control { margin: 0; }
    .workspace-layout .invoice-archive-filters .mud-input.mud-input-outlined { min-height: 52px; }
    .workspace-layout .invoice-archive-filters .mud-input:not(.mud-input-multiline) .mud-input-slot { min-height: 52px; padding-block: 14px; }
    .invoice-archive-filters .filter-actions { grid-column: 1 / -1; flex-wrap: wrap; }
    .document-audit-table .mud-table-cell { overflow-wrap: anywhere; }
    .document-audit-table .mud-table-cell::before { flex-shrink: 0; padding-right: 12px; }
}

@media (max-width: 700px) {
    .acc-manage .acc-nav .acc-nav-heading, .acc-manage .acc-nav .mud-divider { display: none; }
    .acc-manage .acc-nav .mud-navmenu { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
    .acc-manage .acc-nav .mud-nav-item { grid-column: span 2; min-width: 0; }
    .acc-manage .acc-nav .mud-nav-item:is(.acc-nav-back, .acc-nav-logout) { grid-column: span 3; }
    .acc-manage .acc-nav .mud-nav-link { justify-content: center; padding: 10px 4px; min-height: 44px; }
    .acc-manage .acc-nav .mud-nav-link-text { margin: 0; text-align: center; font-size: .8125rem; line-height: 1.35; }
    .acc-manage .acc-nav .mud-nav-link-icon { display: none; }
    .acc-manage .acc-content { padding: 16px !important; }
    .acc-profile-table table { width: 100%; table-layout: fixed; }
    .acc-profile-table td { padding: 10px 8px; overflow-wrap: anywhere; }
    .acc-profile-table td:first-child { width: 45% !important; }
    .document-pdf-dialog .mud-dialog-actions { flex-direction: row; align-items: center; }
    .document-pdf-dialog .mud-dialog-actions .mud-button-root { width: auto; }
    .document-pdf-dialog .document-pdf-controls .mud-button-root { width: 40px; flex: none; }
}

@media (max-width: 380px) {
    .workspace-tabs:has(.mud-tabs-tabbar-wrapper > .mud-tooltip-root:nth-child(4)) .mud-tab { font-size: .6875rem; padding-inline: 2px; overflow-wrap: normal; }
}

/* Let content shrink inside nested editors instead of widening the viewport. */
.main-canvas { overflow-wrap: anywhere; }
.table-panel, .chart-scroll, fieldset { min-width: 0; }
@media (max-width: 959.98px) {
    .mud-dialog { display: flex; flex-direction: column; }
    .mud-dialog .mud-dialog-title, .mud-dialog .mud-dialog-actions { flex-shrink: 0; }
    .mud-dialog .mud-dialog-content { min-height: 0; overflow-y: auto; }
    .mud-simple-table .mud-table-root { table-layout: fixed; }
    .mud-simple-table td { width: auto !important; overflow-wrap: anywhere; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td:has(.row-actions) { grid-column: 1 / -1; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td:has(.row-actions)::before { content: none; }
    :is(.panel, .table-panel, .table-scroll) > table:not(.keep-table) td.hide-sm { display: block !important; }
}
@media (max-width: 760px) {
    .main-canvas :is(input, select, textarea) { min-width: 0; max-width: 100%; }
    .main-canvas input[type=file] { width: 100%; }
    .page-heading > div, .section-heading > div { max-width: 100%; }
    .workspace-layout .filter-row > .mud-input-control { width: 100%; }
    .mud-button-root .mud-button-label { white-space: normal; overflow-wrap: anywhere; }
    .billing-workspace-nav a { flex: 1 1 120px; min-height: 44px; text-align: center; }
    .document-limit { white-space: normal; }
}
@media (max-width: 420px) {
    .workspace-layout .invoice-archive-filters .filter-row { grid-template-columns: minmax(0, 1fr); }
    .extra-values { grid-template-columns: minmax(0, 1fr); }
}

/* Text buttons share the same baseline as native buttons; icon buttons keep their compact size. */
.workspace-layout .mud-button-root:not(.mud-icon-button):not(.mud-tab) { min-height: var(--studio-button-height); border-radius: var(--df-radius); text-transform: none; line-height: 1.4; }
@media (max-width: 700px) {
    :root { --studio-button-height: 48px; }
    .documents-heading-actions { width: 100%; }
    .documents-heading-actions > .primary { flex: 1; }
}
