/* DUEDA workbench. PDF and public approval styles remain separate. */

:root {
    --bg: #f0f2f3;
    --surface: #ffffff;
    --surface-muted: #f6f7f8;
    --line: #d7dce1;
    --line-strong: #aeb7c0;
    --text: #171a1d;
    --text-muted: #5b6670;
    --brand: #f4dc00;
    --brand-ink: #171700;
    --blue: #1769d2;
    --green: #0f7950;
    --red: #c3313d;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 1px 2px rgba(20, 24, 28, .04), 0 8px 24px rgba(20, 24, 28, .045);
    --shadow-float: 0 22px 70px rgba(9, 12, 15, .24);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

h1,
h2,
h3,
.brand-name,
.stat-value {
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1 {
    letter-spacing: 0;
    font-size: 24px;
}

h2 {
    letter-spacing: 0;
}

a,
button,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--brand) 62%, white);
    outline-offset: 2px;
}

.workspace {
    padding-top: 32px;
}

.page-heading {
    align-items: center;
    margin-bottom: 26px;
}

.page-heading .eyebrow {
    letter-spacing: 0;
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 780;
}

.page-heading p:not(.eyebrow) {
    color: var(--text-muted);
    margin: 7px 0 0;
    max-width: 64ch;
}

.button {
    min-height: 42px;
    border-radius: 9px;
    gap: 8px;
    padding-inline: 15px;
    font-size: 13px;
    font-weight: 740;
    transition: transform .14s ease, border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}

.button:hover:not(:disabled):not(.button-disabled) {
    transform: none;
}

.button-primary {
    border-color: #c9b500;
    background: linear-gradient(180deg, #ffe700 0%, var(--brand) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 4px 12px rgba(173, 155, 0, .15);
}

.button-primary:hover {
    background: #ffe70a;
    box-shadow: 0 7px 18px rgba(173, 155, 0, .2);
}

.button-secondary {
    border-color: var(--line);
    background: var(--surface);
    box-shadow: 0 1px 1px rgba(15, 20, 24, .035);
}

.button-secondary:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.button-quiet {
    border-radius: var(--radius-sm);
}

.button-with-icon svg,
.icon-button svg,
.document-lightbox-actions svg,
.embedded-preview-toolbar svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.icon-button {
    border-radius: var(--radius-sm);
    transition: color .14s ease, background-color .14s ease, border-color .14s ease, transform .14s ease;
}

.icon-button:hover {
    transform: translateY(-1px);
}

.panel,
.work-section,
.editor-band,
.context-panel,
.app-dialog,
.search-workspace,
.filter-bar,
.record-stat-strip,
.document-proof-strip {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.panel,
.work-section,
.editor-band,
.context-panel {
    border-color: var(--line);
}

.section-heading {
    align-items: center;
}

.field input,
.field select,
.field textarea,
.search-field input,
.filter-select select,
.topbar-search input {
    border-radius: var(--radius-sm);
    transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus,
.filter-select select:focus {
    outline: 0;
    border-color: color-mix(in srgb, var(--blue) 72%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 13%, transparent);
}

.status-badge {
    min-height: 27px;
    border-radius: 999px;
    padding-inline: 9px;
    font-size: 11px;
    font-weight: 760;
}

.stat-strip,
.document-proof-strip {
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface);
}

.stat,
.document-proof-strip > div {
    padding-block: 16px;
}

.document-status-overview {
    gap: 10px;
    margin-bottom: 16px;
}

.document-status-overview a {
    min-height: 72px;
    border-radius: var(--radius-md);
    padding: 13px 16px;
    box-shadow: 0 1px 1px rgba(15, 20, 24, .025);
    transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.document-status-overview a:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.document-status-overview a.is-active {
    border-color: var(--text);
    box-shadow: inset 0 -4px 0 var(--brand), var(--shadow-soft);
}

.document-status-overview strong {
    font-variant-numeric: tabular-nums;
    font-size: 1.45rem;
}

.case-status-overview {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.case-status-overview a {
    min-width: 0;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 1px 1px rgba(15, 20, 24, .025);
    transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.case-status-overview a:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.case-status-overview a.is-active {
    border-color: var(--text);
    box-shadow: inset 0 -4px 0 var(--brand), var(--shadow-soft);
}

.case-status-overview small {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
}

.case-status-overview strong {
    flex: none;
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 18px;
}

.search-workspace,
.filter-bar {
    padding: 13px;
    margin-bottom: 16px;
}

.filter-reset {
    white-space: nowrap;
}

.record-list {
    display: grid;
    gap: 8px;
    border: 0;
    background: transparent;
}

.record-row {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 1px 1px rgba(15, 20, 24, .025);
    transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.record-row:last-child {
    border-bottom: 1px solid var(--line);
}

.record-row:hover {
    border-color: var(--line-strong);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.document-row {
    min-height: 76px;
    padding: 11px 12px;
}

.document-type-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.document-primary-link strong {
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    font-size: 14px;
}

.document-row-actions {
    gap: 3px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-muted);
}

.document-row-actions .icon-button {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    border-color: transparent;
    background: transparent;
    padding: 9px;
}

.document-row-actions .icon-button:hover {
    border-color: var(--line);
    background: var(--surface);
}

.document-row-actions .document-action-preview {
    color: #0c5caf;
}

.document-row-actions .document-action-open {
    color: #fff;
    background: #202428;
}

.document-row-actions .document-action-open:hover {
    color: #fff;
    border-color: #202428;
    background: #353b40;
}

.document-view-heading {
    align-items: center;
    padding: 0 0 22px;
}

.document-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: auto;
}

.document-toolbar form {
    margin: 0;
}

.document-proof-strip {
    margin-bottom: 18px;
}

.document-preview-shell {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #dfe3e6;
    box-shadow: var(--shadow-soft);
}

.embedded-preview-toolbar {
    min-height: 64px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px 10px 18px;
}

.embedded-preview-toolbar > div {
    display: grid;
    gap: 1px;
}

.embedded-preview-toolbar small {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 9px;
    font-weight: 760;
}

.embedded-preview-toolbar strong {
    font-family: Montserrat, sans-serif;
    font-size: 14px;
}

.document-preview-shell > iframe {
    width: min(100%, 960px);
    height: min(1180px, calc(100dvh - 128px));
    min-height: 720px;
    margin: 0 auto;
    display: block;
    border: 0;
}

.working-preview-canvas {
    overflow: hidden;
}

.working-preview-canvas iframe {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

.table-shell {
    border-radius: 10px;
    border: 1px solid var(--line);
    overflow: hidden auto;
}

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

.table-shell thead {
    background: var(--surface-muted);
}

.table-shell th {
    color: var(--text-muted);
    letter-spacing: 0;
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 760;
}

.table-shell th,
.table-shell td {
    padding: 13px 14px;
}

.table-shell tbody tr:hover {
    background: color-mix(in srgb, var(--brand) 5%, var(--surface));
}

.receivables-table-shell {
    background: var(--surface);
}

.receivables-table .receivable-action {
    text-align: right;
}

.document-lightbox {
    width: min(1560px, calc(100vw - 28px));
    max-width: none;
    height: min(1040px, calc(100dvh - 28px));
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: hidden;
    color: var(--text);
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-float);
}

.document-lightbox::backdrop {
    background: rgba(12, 15, 18, .72);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.document-lightbox[open] {
    animation: document-lightbox-in .18s ease-out;
}

@keyframes document-lightbox-in {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.document-lightbox-frame {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.document-lightbox-toolbar {
    min-height: 70px;
    padding: 10px 12px 10px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.document-lightbox-title {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.document-lightbox-title > span {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 9px;
    font-weight: 760;
}

.document-lightbox-title h2 {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.document-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-lightbox-close {
    width: 44px;
    height: 44px;
    border-color: var(--line);
    background: var(--surface-muted);
}

.document-lightbox-stage {
    min-height: 0;
    position: relative;
    padding: 14px;
    overflow: hidden;
    background: #cfd4d8;
}

.document-lightbox-stage iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(10, 14, 18, .13);
    transition: opacity .14s ease;
}

.document-lightbox-stage[data-loading="true"] iframe {
    opacity: 0;
}

.document-lightbox-loader {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: #3d474f;
    font-size: 13px;
    font-weight: 700;
}

.document-lightbox-stage[data-loading="true"] .document-lightbox-loader {
    display: grid;
}

.document-lightbox-loader span {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(23, 26, 29, .16);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: document-loader-spin .7s linear infinite;
}

@keyframes document-loader-spin {
    to { transform: rotate(360deg); }
}

html.document-preview-open {
    overflow: hidden;
}

@media (max-width: 920px) {
    .document-toolbar {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 720px) {
    .button {
        min-height: 44px;
    }

    .workspace {
        padding: 22px 16px calc(96px + env(safe-area-inset-bottom));
    }

    .page-heading {
        gap: 15px;
        margin-bottom: 20px;
    }

    .page-heading h1 {
        font-size: 1.75rem;
    }

    .page-heading p:not(.eyebrow) {
        font-size: 14px;
    }

    .document-status-overview {
        gap: 8px;
    }

    .case-status-overview {
        width: calc(100% + 32px);
        display: flex;
        gap: 8px;
        margin-left: -16px;
        padding: 0 16px 5px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .case-status-overview::-webkit-scrollbar {
        display: none;
    }

    .case-status-overview a {
        flex: 0 0 132px;
        scroll-snap-align: start;
    }

    .document-status-overview a {
        min-height: 64px;
        padding: 11px 14px;
    }

    .search-workspace,
    .filter-bar {
        padding: 12px;
    }

    .record-list {
        gap: 10px;
    }

    .record-row {
        border-radius: 11px;
    }

    .customer-row .record-contact,
    .case-row .record-customer,
    .case-row .next-action-cell strong {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .document-row {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 8px 10px;
        padding: 12px;
    }

    .document-row > .document-primary-link {
        grid-column: 2;
    }

    .document-row > .status-badge {
        grid-area: 1 / 3;
        align-self: center;
    }

    .document-row > .document-number,
    .document-row > .document-date,
    .document-row > .document-amount {
        grid-column: 2 / -1;
        display: flex;
        align-items: baseline;
        gap: 6px;
    }

    .document-row > .document-number small::after,
    .document-row > .document-date small::after,
    .document-row > .document-amount small::after {
        content: ":";
    }

    .document-row-actions {
        grid-column: 2 / -1;
        justify-self: start;
    }

    .document-row-actions .icon-button {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
    }

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

    .document-toolbar .button {
        min-height: 46px;
    }

    .embedded-preview-toolbar {
        padding-left: 14px;
    }

    .embedded-preview-toolbar .button span {
        display: none;
    }

    .document-lightbox {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .document-lightbox-toolbar {
        min-height: 64px;
        padding: max(8px, env(safe-area-inset-top)) 8px 8px 14px;
    }

    .document-lightbox-title h2 {
        font-size: 14px;
    }

    .document-lightbox-actions {
        gap: 5px;
    }

    .document-lightbox-actions .button {
        width: 42px;
        min-width: 42px;
        padding: 0;
    }

    .document-lightbox-actions .button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .document-lightbox-close {
        width: 42px;
        height: 42px;
    }

    .document-lightbox-stage {
        padding: 0;
    }

    .document-lightbox-stage iframe {
        border-radius: 0;
        box-shadow: none;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17191c;
        --surface: #23262a;
        --surface-muted: #2a2e32;
        --line: #3a4046;
        --line-strong: #626c76;
        --text: #f3f5f6;
        --text-muted: #adb5bd;
        --shadow-soft: 0 1px 2px rgba(0, 0, 0, .16), 0 8px 24px rgba(0, 0, 0, .12);
    }

    .document-row-actions .document-action-open {
        color: #171a1d;
        background: var(--brand);
    }

    .document-lightbox-stage {
        background: #111315;
    }
}

@media (prefers-reduced-motion: reduce) {
    .document-lightbox[open],
    .document-lightbox-loader span {
        animation: none;
    }
}

/* Customer dossier ------------------------------------------------------- */
.customer-record-heading .heading-actions {
    flex-wrap: wrap;
}

.customer-dossier {
    display: grid;
    grid-template-columns: minmax(250px, .72fr) minmax(0, 1.8fr);
    gap: 18px;
    margin: 18px 0;
}

.customer-facts-card,
.customer-address-book {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: var(--shadow-soft);
}

.customer-facts-card {
    align-self: start;
}

.customer-address-book {
    padding-bottom: 18px;
}

.customer-section-heading {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.customer-section-heading h2 {
    margin: 2px 0 0;
    font-size: 17px;
    letter-spacing: 0;
}

.customer-section-kicker,
.address-kind-label {
    display: block;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 760;
    letter-spacing: 0;
    line-height: 1.3;
    text-transform: uppercase;
}

.text-action {
    min-height: 32px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line-strong);
    cursor: pointer;
    padding: 4px 1px 2px;
    font: inherit;
    font-size: 11px;
    font-weight: 710;
    text-decoration: none;
}

.text-action:hover {
    border-color: var(--brand);
}

.text-action:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
    border-color: transparent;
}

.customer-facts-list {
    margin: 0;
    padding: 4px 18px 12px;
}

.customer-facts-list > div {
    display: grid;
    gap: 4px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.customer-facts-list > div:last-child {
    border-bottom: 0;
}

.customer-facts-list dt,
.customer-copy-list dt {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
}

.customer-facts-list dd,
.customer-copy-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 620;
}

.empty-value {
    color: var(--text-muted);
    font-weight: 500;
}

.customer-address-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 18px 0;
}

.customer-address-card {
    --address-accent: var(--brand);
    min-width: 0;
    min-height: 232px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, color-mix(in srgb, var(--address-accent) 8%, var(--surface)) 0, var(--surface) 38%);
    border: 1px solid var(--line);
    border-top: 3px solid var(--address-accent);
    border-radius: 7px;
    padding: 15px;
}

.customer-address-card[data-address-kind="delivery"] { --address-accent: #4c8ed9; }
.customer-address-card[data-address-kind="site"] { --address-accent: #d27832; }
.customer-address-card[data-address-kind="other"] { --address-accent: #8b72c4; }

.customer-address-card > header {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
}

.address-kind-mark {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--text);
    background: color-mix(in srgb, var(--address-accent, var(--brand)) 22%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--address-accent, var(--brand)) 48%, var(--line));
    border-radius: 6px;
    font-size: 12px;
    font-weight: 790;
}

.customer-address-card h3 {
    margin: 2px 0 0;
    font-size: 14px;
    line-height: 1.25;
}

.customer-address-card address {
    display: grid;
    gap: 3px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-style: normal;
    line-height: 1.4;
}

.customer-address-card address strong {
    color: var(--text);
    font-weight: 680;
}

.customer-address-card > footer {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.customer-address-card > footer form {
    margin: 0;
}

.customer-address-empty {
    min-height: 170px;
    display: flex;
    align-items: center;
    gap: 14px;
    grid-column: 1 / -1;
    color: var(--text);
    text-align: left;
    background: var(--surface-muted);
    border: 1px dashed var(--line-strong);
    border-radius: 7px;
    cursor: pointer;
    padding: 22px;
}

.customer-address-empty > span:last-child {
    display: grid;
    gap: 4px;
}

.customer-address-empty small {
    color: var(--text-muted);
    font-size: 11px;
}

.customer-support-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 18px;
    margin-bottom: 18px;
}

.customer-contact-list {
    display: grid;
}

.customer-contact-card {
    display: grid;
    grid-template-columns: 38px minmax(130px, .8fr) minmax(160px, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
}

.customer-contact-card > div,
.customer-contact-links {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.customer-contact-card small,
.customer-contact-links a {
    color: var(--text-muted);
    overflow-wrap: anywhere;
    font-size: 11px;
}

.customer-contact-create {
    margin: 12px 16px 16px;
}

.customer-copy-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 4px 16px 12px;
}

.customer-copy-list > div {
    display: grid;
    gap: 5px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.customer-copy-list > div:last-child {
    border-bottom: 0;
}

.customer-copy-list dd {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
    line-height: 1.45;
}

.customer-history-grid {
    margin-top: 0;
}

.customer-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: min(840px, calc(100dvh - 32px));
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 24px 80px rgba(12, 16, 20, .32);
}

.customer-dialog::backdrop {
    background: rgba(17, 20, 23, .52);
    backdrop-filter: blur(3px);
}

.customer-dialog[open] {
    animation: customer-dialog-in 180ms ease-out;
}

@keyframes customer-dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(.99); }
    to { opacity: 1; transform: none; }
}

.customer-dialog-form {
    max-height: inherit;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.customer-dialog-form > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 17px;
    border-bottom: 1px solid var(--line);
}

.customer-dialog-form > header h2 {
    margin: 3px 0 4px;
    font-size: 20px;
    letter-spacing: 0;
}

.customer-dialog-form > header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
}

.customer-dialog-body {
    display: grid;
    gap: 20px;
    padding: 20px 22px;
    overflow: auto;
    overscroll-behavior: contain;
}

.customer-dialog-form > footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--line);
}

.customer-form-section {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
}

.customer-form-section + .customer-form-section {
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.customer-form-section legend {
    margin-bottom: 13px;
    padding: 0;
    font-size: 13px;
    font-weight: 740;
}

.customer-form-grid {
    display: grid;
    grid-template-columns: minmax(150px, .55fr) minmax(220px, 1fr) minmax(150px, .65fr);
    align-items: start;
    gap: 14px;
}

.customer-form-grid .field {
    min-width: 0;
    margin: 0;
}

.customer-form-grid .field-wide {
    grid-column: 1 / -1;
}

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

.customer-form-grid .field-postal {
    max-width: 180px;
}

.field-optional {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 560;
}

.selection-card-compact {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: -3px;
    padding: 13px 14px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
}

.selection-card-compact input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--text);
}

.selection-card-compact > span {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.selection-card-compact strong {
    font-size: 12px;
}

.selection-card-compact small {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.4;
}

.selection-card-compact:has(input:focus-visible) {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

@media (width <= 1050px) {
    .customer-dossier,
    .customer-support-grid {
        grid-template-columns: 1fr;
    }

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

@media (width <= 720px) {
    .customer-record-heading .heading-actions-row {
        grid-template-columns: 1fr 1fr;
    }

    .customer-record-heading .heading-actions-row > :first-child {
        grid-column: 1 / -1;
    }

    .customer-section-heading {
        min-height: 64px;
        padding: 14px;
    }

    .customer-section-heading .button {
        width: 42px;
        min-width: 42px;
        padding: 0;
    }

    .customer-section-heading .button span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .customer-facts-list,
    .customer-address-grid {
        grid-template-columns: 1fr;
        padding-left: 14px;
        padding-right: 14px;
    }

    .customer-address-card {
        min-height: 220px;
    }

    .customer-contact-card {
        grid-template-columns: 38px minmax(0, 1fr) auto;
        align-items: start;
        padding: 12px 14px;
    }

    .customer-contact-links {
        grid-column: 2 / -1;
    }

    .customer-dialog {
        width: 100vw;
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .customer-dialog-form {
        height: 100dvh;
    }

    .customer-dialog-form > header {
        padding: max(14px, env(safe-area-inset-top)) 16px 14px;
    }

    .customer-dialog-body {
        gap: 18px;
        padding: 18px 16px;
    }

    .customer-dialog-form > footer {
        display: grid;
        grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }

    .customer-dialog-form > footer .button {
        width: 100%;
        min-height: 46px;
    }

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

    .customer-form-grid .field-grow,
    .customer-form-grid .field-wide {
        grid-column: 1;
    }

    .customer-form-grid .field-postal {
        max-width: none;
    }

    .customer-form-grid input,
    .customer-form-grid select,
    .customer-form-grid textarea {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .customer-dialog[open] { animation: none; }
}

/* Customer relationship workspace --------------------------------------- */
.customer-operational-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr);
    gap: 18px;
    margin: 18px 0;
}

.customer-cases-primary,
.customer-contacts-primary,
.customer-history-section,
.customer-detail-shelf {
    min-width: 0;
}

.customer-cases-primary .compact-record {
    min-height: 66px;
}

.customer-contact-list-quiet {
    padding: 3px 0;
}

.customer-contact-card.customer-contact-trigger {
    width: 100%;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    color: var(--text);
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    cursor: pointer;
    font: inherit;
    transition: background-color 160ms ease-out;
}

.customer-contact-card.customer-contact-trigger:last-child {
    border-bottom: 0;
}

.customer-contact-card.customer-contact-trigger:hover {
    background: var(--surface-muted);
}

.customer-contact-card.customer-contact-trigger:focus-visible {
    position: relative;
    outline: 2px solid var(--blue);
    outline-offset: -3px;
}

.customer-contact-trigger > svg,
.customer-detail-action > svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.customer-contact-identity {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.customer-contact-identity strong,
.customer-contact-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-contact-identity small {
    color: var(--text-muted);
    font-size: 11px;
}

.customer-contact-meta {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.customer-contact-meta small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-contact-meta .status-badge {
    flex: none;
}

.customer-contact-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px;
    color: var(--text);
    text-align: left;
    background: var(--surface-muted);
    border: 1px dashed var(--line-strong);
    border-radius: 7px;
    cursor: pointer;
    padding: 15px;
}

.customer-contact-empty > span:last-child {
    display: grid;
    gap: 3px;
}

.customer-contact-empty small {
    color: var(--text-muted);
    font-size: 10px;
}

.customer-detail-shelf {
    display: grid;
    grid-template-columns: minmax(170px, .45fr) minmax(0, 1.55fr);
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--surface-muted) 74%, var(--surface));
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
}

.customer-detail-shelf h2 {
    margin: 3px 0 0;
    font-size: 15px;
}

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

.customer-detail-action {
    min-width: 0;
    min-height: 62px;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
    padding: 9px 11px;
    font: inherit;
    transition: border-color 160ms ease-out, transform 160ms ease-out;
}

.customer-detail-action:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.customer-detail-action:active {
    transform: scale(.98);
}

.customer-detail-action:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.customer-detail-action > span:nth-child(2) {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.customer-detail-action strong,
.customer-detail-action small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-detail-action strong {
    font-size: 12px;
}

.customer-detail-action small {
    color: var(--text-muted);
    font-size: 10px;
}

.detail-action-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--text);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.detail-action-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.customer-history-section {
    margin-bottom: 18px;
}

.activity-list-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-list-columns li:nth-child(odd) {
    border-right: 1px solid var(--line);
}

.customer-dialog-wide {
    width: min(980px, calc(100vw - 32px));
}

.customer-address-grid-dialog {
    padding: 0;
}

.customer-channel-section h3,
.customer-channel-form h3 {
    margin: 0 0 12px;
    font-size: 13px;
}

.customer-channel-list {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
}

.customer-channel-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 115px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    color: var(--text);
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}

.customer-channel-row:last-child {
    border-bottom: 0;
}

.customer-channel-row:hover {
    background: var(--surface-muted);
}

.customer-channel-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 12px;
}

.customer-channel-row small,
.channel-kind {
    color: var(--text-muted);
    font-size: 10px;
}

.customer-channel-form,
.customer-note-form {
    display: grid;
    gap: 13px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.customer-channel-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.customer-channel-form > h3,
.customer-channel-form > .customer-form-grid {
    grid-column: 1 / -1;
}

.customer-channel-form > .button {
    grid-column: 2;
    grid-row: 3;
}

.customer-channel-form .button,
.customer-note-form .button {
    justify-self: start;
}

.customer-note-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.customer-note-list li {
    padding: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.customer-note-list p {
    margin: 0 0 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.5;
}

.customer-note-list time {
    color: var(--text-muted);
    font-size: 10px;
}

.postal-code-assist {
    grid-column: 1 / -1;
    min-height: 16px;
    margin: -6px 0 0;
    color: var(--text-muted);
    font-size: 10px;
}

.postal-code-assist[data-state="success"] {
    color: #2d7d46;
}

.postal-code-assist[data-state="pending"]::before {
    content: "";
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 6px;
    border: 1px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: customer-postal-spin 650ms linear infinite;
}

@keyframes customer-postal-spin {
    to { transform: rotate(1turn); }
}

@media (width <= 1050px) {
    .customer-operational-grid {
        grid-template-columns: 1fr;
    }

    .customer-detail-shelf {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (width <= 720px) {
    .customer-priority-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .customer-detail-actions,
    .activity-list-columns {
        grid-template-columns: 1fr;
    }

    .activity-list-columns li:nth-child(odd) {
        border-right: 0;
    }

    .customer-contact-card.customer-contact-trigger {
        grid-template-columns: 38px minmax(0, 1fr) 16px;
    }

    .customer-contact-trigger > svg {
        grid-column: 3;
        grid-row: 1;
    }

    .customer-address-grid-dialog {
        padding: 0;
    }

    .customer-channel-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .customer-channel-form {
        grid-template-columns: 1fr;
    }

    .customer-channel-form > .button {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .customer-detail-action,
    .customer-contact-card.customer-contact-trigger {
        transition: none;
    }

    .postal-code-assist[data-state="pending"]::before {
        animation: none;
    }
}

/* Shared work surfaces: scoped to staff pages, never document snapshots. */
.workspace-workbench {
    --bg: #e8ebea;
    --surface: #fafbfa;
    --surface-muted: #f0f2f1;
    --line: #ccd2cf;
    --line-strong: #98a49f;
    --text: #202725;
    --text-muted: #52615b;
    --brand: #f1d900;
    --blue: #145f91;
    --radius-md: 8px;
    --radius-lg: 8px;
    --shadow-soft: none;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.workspace-workbench :where(h1, h2, h3, p, span, a, button, summary, label, th, td, input, select, textarea) {
    letter-spacing: 0;
}

.workspace-workbench .sidebar {
    background: #202725;
    border-inline-end: 1px solid #35413b;
}

.workspace-workbench .brand-name {
    font-size: 26px;
    font-weight: 750;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.workspace-workbench .brand-byline,
.workspace-workbench .sidebar-foot,
.workspace-workbench .nav-group-label {
    color: #acb9b2;
    font-size: 11px;
    font-weight: 500;
    text-transform: none;
}

.workspace-workbench .nav-link {
    min-height: 46px;
    gap: 10px;
    color: #dce5df;
    font-weight: 500;
}

.workspace-workbench .nav-icon {
    box-sizing: content-box;
    width: 17px;
    height: 17px;
    padding: 5px;
    border: 1px solid #526158;
    border-radius: 6px;
    color: #d1ded6;
}

.workspace-workbench .nav-link[aria-current="page"] {
    color: #fff;
    background: #35423a;
    border-color: #526158;
    box-shadow: inset 3px 0 0 var(--brand);
}

.workspace-workbench .nav-link[aria-current="page"] .nav-icon {
    background: var(--brand);
    border-color: var(--brand);
    color: #202725;
}

.workspace-workbench .topbar {
    border-top: 0;
    border-bottom: 1px solid var(--line-strong);
    background: var(--surface);
    box-shadow: none;
}

.workspace-workbench .topbar-company { color: var(--text-muted); font-weight: 500; }
.workspace-workbench .topbar-view { font-weight: 600; }
.workspace-workbench .workspace { padding-block-start: 24px; }
.workspace-workbench .page-heading { margin-block-end: 20px; gap: 14px; }
.workspace-workbench .page-heading h1 { font-size: 24px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.workspace-workbench .section-heading h2 { font: 600 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.workspace-workbench .page-heading .eyebrow { font-size: 11px; font-weight: 500; text-transform: none; }
.workspace-workbench .page-heading-actions { flex-wrap: wrap; }

.workspace-workbench :is(.work-section, .panel, .editor-band, .context-panel, .search-workspace) {
    border-radius: 0;
    box-shadow: none;
    border-inline: 0;
}

.workspace-workbench .section-heading {
    min-height: 52px;
    padding-block: 12px;
    border-bottom: 1px solid var(--line);
}

.workspace-workbench :is(.stat-strip, .record-stat-strip, .document-proof-strip) {
    border-radius: 0;
    box-shadow: none;
    border-inline: 0;
    background: var(--surface-muted);
}

.workspace-workbench :is(.stat, .document-proof-strip > div) { padding-block: 12px; }
.workspace-workbench .stat-value { font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; }
.workspace-workbench .stat-label { font-weight: 500; color: var(--text-muted); }
.workspace-workbench :is(.filter-bar, .document-status-overview a) { border-radius: 6px; box-shadow: none; }
.workspace-workbench .document-status-overview a { min-height: 58px; padding-block: 10px; }
.workspace-workbench .document-status-overview strong { font-size: 20px; font-weight: 600; }

.workspace-workbench :is(.button, .quick-create-button, .profile-button) {
    min-height: 44px;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: none;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.workspace-workbench .button-primary {
    color: #202500;
    border-color: #aa9c00;
    background: var(--brand);
}

.workspace-workbench :is(.button-primary, .quick-create-button):hover { background: #ffe729; }
.workspace-workbench :is(.button, .icon-button, .document-status-overview a):hover { transform: none; box-shadow: none; }
.workspace-workbench :is(.button, .icon-button, summary):active { filter: brightness(.94); }
.workspace-workbench :is(.button, button):disabled { opacity: .55; cursor: not-allowed; }
.workspace-workbench .icon-button { border: 1px solid var(--line-strong); background: var(--surface); }
.workspace-workbench .document-row-actions { border: 0; background: transparent; padding: 0; gap: 4px; }
.workspace-workbench .document-row-actions .icon-button { color: var(--text); }
.workspace-workbench .document-row-actions .document-action-preview { color: var(--blue); }
.workspace-workbench .document-row-actions .document-action-open { color: var(--text); background: var(--surface-muted); }
.workspace-workbench .document-row-actions .document-action-open:hover { color: var(--text); background: var(--surface); border-color: var(--line-strong); }

.workspace-workbench :where(a, button, summary, input, select, textarea):focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}
.workspace-workbench .sidebar :focus-visible { outline-color: var(--brand); }
.workspace-workbench .field :is(input, select, textarea) { border-color: var(--line-strong); }
.workspace-workbench :is(input, textarea)::placeholder { color: var(--text-muted); opacity: 1; }
.workspace-workbench :is(.record-row, .compact-record):hover { background: var(--surface-muted); }
.workspace-workbench :is(.record-header, .data-table thead) { background: var(--surface-muted); color: var(--text-muted); }
.workspace-workbench .status-badge { font-weight: 600; min-height: 25px; border-radius: 5px; }
.workspace-workbench .status-draft { color: #4b5661; background: #e6eaf0; border-color: #a1adbb; }
.workspace-workbench :is(.status-finalized, .status-accepted) { color: #176343; background: #dcf1e5; border-color: #72ad8c; }
.workspace-workbench :is(.status-overdue, .status-declined) { color: #912b3b; background: #fbe4e8; border-color: #cc8290; }

.workspace-workbench :is(.action-menu-panel, .mobile-menu-panel) {
    border-radius: 8px;
    border-color: var(--line-strong);
    box-shadow: 0 12px 32px #15281e26;
}
.workspace-workbench :is(.action-menu-title, .profile-summary small) { font-size: 11px; text-transform: none; }
.workspace-workbench :is(.action-menu-panel, .mobile-menu-panel) svg { padding: 5px; box-sizing: content-box; border: 1px solid var(--line); border-radius: 6px; }
.workspace-workbench :is(.action-menu-panel, .mobile-menu-panel) strong { font-weight: 600; font-size: 13px; }
.workspace-workbench :is(.action-menu-panel, .mobile-menu-panel) small { font-size: 11px; }
.workspace-workbench .mobile-nav { background: var(--surface); border-top-color: var(--line-strong); }
.workspace-workbench .mobile-nav > a > svg,
.workspace-workbench .mobile-nav > details > summary > svg {
    box-sizing: content-box;
    width: 18px;
    height: 18px;
    padding: 3px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
}

@media (prefers-color-scheme: dark) {
    .workspace-workbench {
        --bg: #191e1c;
        --surface: #232a26;
        --surface-muted: #2b342e;
        --line: #435047;
        --line-strong: #728578;
        --text: #edf3ee;
        --text-muted: #b5c4b9;
        --blue: #8acbff;
    }
    .workspace-workbench .status-draft { color: #dce3ec; background: #343e49; border-color: #7d8d9f; }
    .workspace-workbench :is(.status-finalized, .status-accepted) { color: #baf0d2; background: #214832; border-color: #5c9875; }
    .workspace-workbench :is(.status-overdue, .status-declined) { color: #ffd0d9; background: #512a33; border-color: #b77786; }
}

@media (width <= 720px) {
    .workspace-workbench { --mobile-header-height: calc(52px + env(safe-area-inset-top)); }
    .workspace-workbench .sidebar { height: var(--mobile-header-height); }
    .workspace-workbench .topbar { top: var(--mobile-header-height); }
    .workspace-workbench .document-commandbar { top: calc(var(--mobile-header-height) + 50px); }
    .workspace-workbench .brand { padding: 0; }
    .workspace-workbench .brand-name { font-size: 21px; }
    .workspace-workbench .workspace { padding-block-start: 18px; }
    .workspace-workbench .page-heading { align-items: flex-start; text-align: start; }
    .workspace-workbench .page-heading h1 { font-size: 21px; }
    .workspace-workbench .page-heading .page-heading-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .workspace-workbench .page-heading-actions > .button { flex: 1 1 auto; }
    .workspace-workbench .search-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
    .workspace-workbench .search-line > .search-field,
    .workspace-workbench .search-line > .button { grid-column: 1 / -1; }
    .workspace-workbench .search-line :is(input, select) { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
    .workspace-workbench :is(.field input, .field select, .field textarea, .search-field input) { font-size: 16px; }
    .workspace-workbench .mobile-nav > :is(a, details) { min-width: 0; }
    .workspace-workbench .mobile-nav summary { min-height: 52px; }
    .workspace-workbench :is(.icon-button, .document-lightbox-close) { min-width: 44px; min-height: 44px; }
    @supports selector(:has(*)) {
        .workspace-workbench .topbar:not(:has(.network-notice:not([hidden]))) { display: none; }
        .workspace-workbench .topbar-context { display: none; }
        .workspace-workbench .document-commandbar { top: var(--mobile-header-height); }
        .workspace-workbench:has(.network-notice:not([hidden])) .document-commandbar { top: calc(var(--mobile-header-height) + 50px); }
    }
}

/* Progressive entry animation; browsers without support keep native dialogs. */
@supports (transition-behavior: allow-discrete) {
    @media (prefers-reduced-motion: no-preference) {
        .workspace-workbench .app-dialog[open] {
            opacity: 1;
            transition: opacity 160ms ease;
            @starting-style { opacity: 0; }
        }
        .workspace-workbench details[open] > :is(.action-menu-panel, .mobile-menu-panel) {
            opacity: 1;
            transition: opacity 140ms ease;
            @starting-style { opacity: 0; }
        }
    }
}

@media (forced-colors: active) {
    .workspace-workbench :is(.button, .icon-button, .nav-icon, .status-badge) { border-color: ButtonText; }
    .workspace-workbench .nav-link[aria-current="page"] { outline: 2px solid Highlight; }
}
