/* Shared application shell and components. Theme values live in theme.css. */

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

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--tenant-brand-deep) 40%, transparent), transparent 34rem),
        radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--tenant-brand-accent) 10%, transparent), transparent 28rem),
        linear-gradient(145deg, var(--theme-page-background-start) 0%, var(--theme-page-background-deep) 100%);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(var(--theme-page-grid) 1px, transparent 1px), linear-gradient(90deg, var(--theme-page-grid) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
    mask-image: linear-gradient(to bottom, black, transparent 80%);
}

body.sidebar-open { overflow: hidden; }

button, input, textarea, select { font: inherit; }

.shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-header {
    border-bottom: 1px solid var(--theme-line-subtle);
    background: var(--theme-header-surface);
    box-shadow: var(--theme-shadow-header);
    backdrop-filter: blur(16px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 4.8rem;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2.5rem);
}

.brand { display: flex; align-items: center; gap: .85rem; }

.brand-logo {
    width: 2.65rem;
    height: auto;
    filter: drop-shadow(0 .45rem 1rem color-mix(in srgb, var(--tenant-brand-accent) 18%, transparent));
}

.brand-copy { display: grid; gap: .08rem; }
.brand-copy strong { color: var(--text); font-size: 1.05rem; letter-spacing: -.02em; }
.brand-copy small { color: var(--muted); font-size: .72rem; letter-spacing: .035em; }

.sidebar-toggle {
    min-height: 2.45rem;
    margin: 0;
    padding: .5rem .8rem;
    border-color: var(--theme-sidebar-toggle-border);
    color: var(--theme-sidebar-toggle-text);
    background: var(--theme-sidebar-toggle-background);
    box-shadow: none;
}

.content {
    width: 100%;
    margin: 0 auto;
    padding: clamp(1.5rem, 5vh, 3.5rem) clamp(1rem, 3vw, 2.5rem);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 940px);
    justify-content: center;
    gap: 1rem;
}

.workspace.sidebar-active {
    grid-template-columns: 17.5rem minmax(0, 1fr);
    justify-content: stretch;
}

.workspace.sidebar-active .app-sidebar { grid-column: 1; grid-row: 1; }
.workspace.sidebar-active .panel { grid-column: 2; grid-row: 1; padding: clamp(1.25rem, 2.5vw, 2rem); }

[hidden] { display: none !important; }

.panel {
    padding: clamp(1.5rem, 4.5vw, 3.25rem);
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-panel);
    background: var(--surface);
    box-shadow: var(--theme-shadow-panel);
    backdrop-filter: blur(18px);
}

.eyebrow {
    margin-bottom: .7rem;
    color: var(--cyan);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 .75rem;
    color: var(--text);
    font-size: clamp(1.75rem, 5vw, 2.55rem);
    line-height: 1.08;
    letter-spacing: -.04em;
}

h2, h3, h4 { color: var(--text); }
p { line-height: 1.6; }
form { margin-top: 1.5rem; }
fieldset { color: var(--theme-text); }

label {
    display: block;
    margin: 1rem 0 .42rem;
    color: var(--theme-text-label);
    font-size: .88rem;
    font-weight: 700;
}

input, textarea, select {
    width: 100%;
    min-height: 3rem;
    padding: .72rem .9rem;
    border: 1px solid var(--theme-field-border);
    border-radius: var(--theme-radius-control);
    color: var(--text);
    background: var(--theme-field-background);
    box-shadow: var(--theme-shadow-field-inset);
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.1rem;
    height: 1.1rem;
    min-height: 1.1rem;
    padding: 0;
    box-shadow: none;
    accent-color: var(--tenant-brand-accent);
}

textarea { resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: var(--theme-field-border-hover); }
input:focus, textarea:focus, select:focus {
    border-color: var(--cyan);
    outline: 3px solid color-mix(in srgb, var(--tenant-brand-accent) 16%, transparent);
}

button {
    min-height: 2.8rem;
    margin-top: 1.25rem;
    padding: .68rem 1rem;
    border: 1px solid var(--tenant-brand-accent);
    border-radius: var(--theme-radius-control);
    color: var(--theme-button-primary-text);
    background: var(--theme-button-primary-background);
    box-shadow: 0 .45rem 1.1rem color-mix(in srgb, var(--tenant-brand-accent) 13%, transparent);
    font-weight: 780;
    cursor: pointer;
    transition: border-color var(--theme-motion-fast), background var(--theme-motion-fast), box-shadow var(--theme-motion-fast), transform var(--theme-motion-fast);
}

button:hover {
    background: var(--theme-button-primary-background-hover);
    box-shadow: 0 .55rem 1.4rem color-mix(in srgb, var(--tenant-brand-accent) 20%, transparent);
    transform: translateY(-1px);
}
button:focus-visible { outline: 3px solid var(--theme-focus-ring); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
button[aria-busy="true"] { cursor: wait; }

.global-activity {
    position: fixed;
    inset: 0 0 auto;
    z-index: 10000;
    height: 3px;
    overflow: hidden;
    background: color-mix(in srgb, var(--tenant-brand-accent) 20%, transparent);
}
.global-activity span {
    display: block;
    width: 38%;
    height: 100%;
    background: var(--tenant-brand-accent);
    animation: global-activity-slide 1s ease-in-out infinite;
}
@keyframes global-activity-slide {
    from { transform: translateX(-110%); }
    to { transform: translateX(300%); }
}

.flash-stack {
    position: fixed;
    z-index: 9000;
    top: 1rem;
    right: 1rem;
    display: grid;
    gap: .75rem;
    width: min(28rem, calc(100vw - 2rem));
}
.flash-message {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--theme-success-line);
    border-radius: var(--theme-radius-control);
    color: var(--theme-info-text);
    background: var(--theme-info-surface);
    box-shadow: var(--theme-shadow-panel);
}
.flash-message[data-tone="error"] {
    border-color: var(--theme-danger-line);
    color: var(--danger);
    background: var(--theme-danger-surface);
}
.flash-dismiss {
    min-width: auto;
    padding: 0 .25rem;
    border: 0;
    color: inherit;
    background: transparent;
}
@media (prefers-reduced-motion: reduce) {
    .global-activity span { animation: none; width: 100%; }
}

button.secondary {
    border-color: var(--theme-button-secondary-border);
    color: var(--theme-button-secondary-text);
    background: var(--theme-button-secondary-background);
    box-shadow: none;
}
button.secondary:hover { border-color: var(--cyan); background: var(--theme-button-secondary-background-hover); }

.button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.disabled-control-hint { position: relative; display: inline-flex; }
.disabled-control-hint::after {
    position: absolute;
    bottom: calc(100% - .8rem);
    left: 50%;
    z-index: 20;
    width: max-content;
    max-width: min(18rem, 80vw);
    padding: .48rem .62rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--theme-radius-sm);
    color: var(--text);
    background: var(--theme-button-secondary-background);
    box-shadow: var(--theme-shadow-tooltip);
    content: attr(data-tooltip);
    font-size: .74rem;
    font-weight: 600;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, .25rem);
    transition: opacity var(--theme-motion-tooltip), transform var(--theme-motion-tooltip);
}
.disabled-control-hint:not([data-tooltip])::after { content: none; }
.disabled-control-hint[data-tooltip]:hover::after { opacity: 1; transform: translate(-50%, 0); }

.qr-code {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 1.5rem auto;
    border: .75rem solid var(--theme-white);
    border-radius: var(--theme-radius-lg);
    background: var(--theme-white);
    box-shadow: var(--theme-shadow-code);
}

details { color: var(--theme-text-soft); }
.secret {
    overflow-wrap: anywhere;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-control);
    color: var(--cyan-bright);
    background: var(--theme-code-background);
    letter-spacing: .08em;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    padding: 1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--theme-radius-md);
    color: var(--theme-text-bright-soft);
    background: var(--theme-recovery-background);
    list-style: none;
    font: 700 .95rem var(--theme-font-mono);
}

.tenant-list { display: grid; gap: .75rem; margin-top: 1.5rem; }
.tenant-choice {
    width: 100%;
    margin: 0;
    padding: 1rem;
    border-color: var(--theme-tenant-choice-border);
    text-align: left;
    color: var(--text);
    background: var(--theme-tenant-choice-background);
}
.tenant-choice span { display: block; margin-top: .25rem; color: var(--muted); font-size: .82rem; font-weight: 500; }

.feedback {
    margin: 1.25rem 0 0;
    padding: .8rem 1rem;
    border: 1px solid var(--theme-danger-line);
    border-radius: var(--theme-radius-control);
    color: var(--danger);
    background: var(--theme-danger-surface);
}

.feedback[data-tone="success"] {
    border-color: var(--theme-success-line);
    color: var(--theme-info-text);
    background: var(--theme-info-surface);
}

.inline-feedback {
    margin: .85rem 0 0;
    padding: .7rem .85rem;
    border: 1px solid var(--theme-success-line);
    border-radius: var(--theme-radius-control);
    color: var(--theme-info-text);
    background: var(--theme-info-surface);
}
.inline-feedback[data-tone="progress"] { border-color: var(--line-strong); color: var(--theme-text-soft); background: var(--theme-surface-soft); }
.inline-feedback[data-tone="error"] { border-color: var(--theme-danger-line); color: var(--danger); background: var(--theme-danger-surface); }

.app-dialog {
    width: min(34rem, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--theme-radius-panel);
    color: var(--theme-text);
    background: transparent;
    box-shadow: var(--theme-shadow-panel);
}

.app-dialog::backdrop {
    background: var(--theme-overlay-surface);
    backdrop-filter: blur(5px);
}

.app-dialog-card {
    margin: 0;
    padding: clamp(1.3rem, 4vw, 2rem);
    border-radius: inherit;
    background: var(--surface);
}

.app-dialog-card h2 { margin: 0 0 .65rem; }
.app-dialog-card p { margin: 0; color: var(--theme-text-soft); }
.app-dialog-actions { justify-content: flex-end; margin-top: 1.5rem; }
.app-dialog-actions button { margin: 0; }
.quotation-invoice-dialog-actions { justify-content: center; }

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dialog-heading h2 { margin: .25rem 0 0; }
.customer-routing-dialog .app-dialog-card { max-height: calc(100vh - 2rem); overflow-y: auto; }
.customer-routing-frame { display: grid; gap: 1rem; }
.customer-routing-frame > .muted { margin-bottom: .25rem; }

.electronic-deposit-flow { margin-top: 1rem; }
.electronic-operation-flow { display: contents; }
.electronic-dashboard-actions { align-items: stretch; }
.electronic-dashboard-actions > form { display: flex; margin: 0; }
.electronic-dashboard-actions > form > button,
.electronic-dashboard-actions .electronic-operation-flow > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.8rem;
    min-height: 2.8rem;
    margin: 0;
    white-space: nowrap;
}
.app-dialog.electronic-deposit-dialog,
.app-dialog.electronic-operation-dialog { width: min(48rem, calc(100vw - 2rem)); max-width: none; }
.electronic-deposit-dialog-card,
.electronic-operation-dialog-card { max-height: calc(100vh - 2rem); overflow-y: auto; }
.electronic-flow-status { display: grid; gap: .25rem; margin-bottom: 1rem; padding: .9rem 1rem; border: 1px solid var(--theme-line-strong); border-radius: var(--theme-radius-control); color: var(--theme-text-soft); background: var(--theme-surface-soft); }
.electronic-flow-status strong { color: var(--theme-text); }
.electronic-flow-status[data-tone="success"] { border-color: var(--theme-success-line); background: var(--theme-info-surface); }
.electronic-flow-status[data-tone="progress"] { border-color: color-mix(in srgb, var(--tenant-brand-accent) 45%, var(--theme-line-strong)); background: color-mix(in srgb, var(--tenant-brand-accent) 8%, var(--theme-surface-soft)); }
.electronic-flow-status[data-tone="warning"] { border-color: var(--theme-warning-line); background: var(--theme-warning-surface); }
.electronic-flow-status[data-tone="error"] { border-color: var(--theme-danger-line); background: var(--theme-danger-surface); }
.electronic-flow-steps { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; counter-reset: electronic-flow-step; }
.electronic-flow-step { position: relative; display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .8rem; align-items: start; padding: .9rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-card-background); counter-increment: electronic-flow-step; }
.electronic-flow-step:not(:last-child)::after { position: absolute; top: 2.65rem; bottom: -.8rem; left: 1.88rem; width: 2px; content: ""; background: var(--theme-line-strong); }
.electronic-flow-step > div { min-width: 0; }
.electronic-flow-step strong { color: var(--theme-text); }
.electronic-flow-step p { margin-top: .2rem; font-size: .78rem; line-height: 1.45; }
.electronic-flow-marker { position: relative; z-index: 1; display: grid; place-items: center; width: 2rem; height: 2rem; border: 2px solid var(--theme-line-strong); border-radius: 50%; color: var(--theme-text-soft); background: var(--theme-card-background); }
.electronic-flow-marker::before { content: counter(electronic-flow-step); font-size: .72rem; font-weight: 800; }
.electronic-flow-step[data-flow-state="success"] .electronic-flow-marker { border-color: var(--theme-success-line); color: var(--theme-info-text); background: var(--theme-info-surface); }
.electronic-flow-step[data-flow-state="success"] .electronic-flow-marker::before { content: "✓"; }
.electronic-flow-step[data-flow-state="success"] .status-chip { color: var(--theme-info-text); background: var(--theme-info-surface); }
.electronic-flow-step[data-flow-state="running"] .electronic-flow-marker { border-color: var(--tenant-brand-accent); border-right-color: transparent; animation: electronic-flow-spin .8s linear infinite; }
.electronic-flow-step[data-flow-state="running"] .electronic-flow-marker::before { content: ""; }
.electronic-flow-step[data-flow-state="running"] .status-chip { color: var(--theme-text); background: color-mix(in srgb, var(--tenant-brand-accent) 12%, var(--theme-surface-soft)); }
.electronic-flow-step[data-flow-state="warning"] .electronic-flow-marker { border-color: var(--theme-warning-line); color: var(--theme-warning-text); background: var(--theme-warning-surface); }
.electronic-flow-step[data-flow-state="warning"] .electronic-flow-marker::before { content: "!"; }
.electronic-flow-step[data-flow-state="warning"] .status-chip { color: var(--theme-warning-text); background: var(--theme-warning-surface); }
.electronic-flow-step[data-flow-state="error"] .electronic-flow-marker { border-color: var(--theme-danger-line); color: var(--danger); background: var(--theme-danger-surface); }
.electronic-flow-step[data-flow-state="error"] .electronic-flow-marker::before { content: "×"; }
.electronic-flow-step[data-flow-state="error"] .status-chip { color: var(--danger); background: var(--theme-danger-surface); }
.electronic-flow-step[data-flow-state="waiting"] .status-chip { color: var(--muted); background: var(--theme-surface-soft); }
.electronic-flow-technical { margin-top: 1rem; padding: .8rem .9rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.electronic-flow-technical summary { cursor: pointer; font-weight: 700; }
.electronic-flow-technical dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: .8rem 0 0; }
.electronic-flow-technical dl > div { min-width: 0; }
.electronic-flow-technical dt { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.electronic-flow-technical dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.electronic-operation-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; margin: 1rem 0 0; }
.electronic-operation-results > div { min-width: 0; padding: .75rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.electronic-operation-results dt { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.electronic-operation-results dd { margin: .2rem 0 0; color: var(--theme-text); font-size: 1.15rem; font-weight: 800; }
.electronic-flow-actions { align-items: center; }
.electronic-flow-actions form { margin: 0; }

@keyframes electronic-flow-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .electronic-flow-step[data-flow-state="running"] .electronic-flow-marker { animation: none; }
}

@media (max-width: 680px) {
    .app-dialog.electronic-deposit-dialog,
    .app-dialog.electronic-operation-dialog { width: calc(100vw - 1rem); }
    .electronic-deposit-dialog-card,
    .electronic-operation-dialog-card { max-height: calc(100vh - 1rem); padding: 1rem; }
    .electronic-flow-step { grid-template-columns: 2rem minmax(0, 1fr); }
    .electronic-flow-step > .status-chip { grid-column: 2; justify-self: start; }
    .electronic-flow-technical dl { grid-template-columns: 1fr; }
    .electronic-operation-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .electronic-flow-actions { align-items: stretch; flex-direction: column-reverse; }
    .electronic-flow-actions form,
    .electronic-flow-actions button,
    .electronic-flow-actions .button-link { width: 100%; }
}

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

.dashboard-heading,
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.status-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 1.9rem;
    padding: .3rem .7rem;
    border: 1px solid color-mix(in srgb, var(--tenant-brand-accent) 34%, transparent);
    border-radius: var(--theme-radius-pill);
    color: var(--theme-info-text);
    background: var(--theme-info-surface);
    font-size: .74rem;
    font-weight: 750;
}
.status-badge.warning { border-color: var(--theme-warning-line); color: var(--theme-warning-text); background: var(--theme-warning-surface); }

.app-sidebar {
    position: sticky;
    top: 1.25rem;
    display: flex;
    flex-direction: column;
    align-self: start;
    overflow: hidden;
    max-height: calc(100vh - 2.5rem);
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-xl);
    background: var(--theme-sidebar-surface);
    box-shadow: var(--theme-shadow-floating);
}

.sidebar-header {
    display: grid;
    grid-template-columns: 2.45rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .72rem;
    min-height: 4.75rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--theme-sidebar-divider);
    background: linear-gradient(145deg, color-mix(in srgb, var(--tenant-brand-deep) 24%, transparent), var(--theme-sidebar-header-tail));
}
.sidebar-organization-mark,
.sidebar-user-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--tenant-brand-highlight) 30%, var(--line));
    color: var(--theme-sidebar-nav-active-text);
    background: color-mix(in srgb, var(--tenant-brand-accent) 13%, var(--theme-surface-soft));
    font-weight: 800;
}
.sidebar-organization-mark { width: 2.45rem; height: 2.45rem; border-radius: .72rem; font-size: 1rem; }
.sidebar-organization-copy,
.sidebar-user-copy { display: grid; min-width: 0; gap: .08rem; }
.sidebar-organization-copy span,
.sidebar-user-copy span { color: var(--theme-sidebar-nav-muted); font-size: .65rem; letter-spacing: .035em; }
.sidebar-organization-copy strong,
.sidebar-user-copy strong { overflow: hidden; color: var(--theme-sidebar-nav-active-text); font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-close { display: none; min-width: 2.2rem; min-height: 2.2rem; margin: 0; padding: 0; border: 0; color: var(--muted); background: transparent; box-shadow: none; font-size: 1.55rem; line-height: 1; }
.sidebar-close:hover { color: var(--text); background: color-mix(in srgb, var(--theme-white) 6%, transparent); box-shadow: none; transform: none; }
.sidebar-nav {
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1rem .72rem;
    scrollbar-color: color-mix(in srgb, var(--tenant-brand-accent) 28%, transparent) transparent;
    scrollbar-width: thin;
}
.sidebar-section { display: grid; gap: .18rem; margin: 0; }
.sidebar-section-title,
.sidebar-settings-label {
    margin: 0;
    padding: 0 .68rem .28rem;
    color: var(--theme-sidebar-nav-muted);
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .105em;
    line-height: 1.3;
    text-transform: uppercase;
}
.sidebar-nav-item {
    display: grid;
    grid-template-columns: .65rem minmax(0, 1fr);
    gap: .06rem .62rem;
    align-items: center;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: .55rem .68rem;
    border: 1px solid transparent;
    border-radius: .62rem;
    color: var(--theme-sidebar-nav-text);
    background: transparent;
    box-shadow: none;
    text-align: left;
    text-decoration: none;
    transition: color var(--theme-motion-fast), border-color var(--theme-motion-fast), background var(--theme-motion-fast);
}
.sidebar-nav-item::before {
    grid-row: 1 / span 2;
    width: .34rem;
    height: .34rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--theme-sidebar-nav-muted) 58%, transparent);
    content: "";
    transition: transform var(--theme-motion-fast), background var(--theme-motion-fast), box-shadow var(--theme-motion-fast);
}
.sidebar-nav-item > span { grid-column: 2; font-size: .83rem; font-weight: 680; line-height: 1.25; }
.sidebar-nav-item small { grid-column: 2; color: var(--theme-sidebar-nav-muted); font-size: .64rem; font-weight: 500; line-height: 1.3; }
.sidebar-nav-item:hover,
.sidebar-nav-item:focus-visible { border-color: color-mix(in srgb, var(--tenant-brand-accent) 22%, transparent); color: var(--theme-sidebar-nav-active-text); background: color-mix(in srgb, var(--theme-white) 4%, transparent); box-shadow: none; transform: none; }
.sidebar-nav-item.active {
    border-color: color-mix(in srgb, var(--tenant-brand-accent) 28%, transparent);
    color: var(--theme-sidebar-nav-active-text);
    background: linear-gradient(90deg, color-mix(in srgb, var(--tenant-brand-accent) 18%, transparent), color-mix(in srgb, var(--tenant-brand-accent) 7%, transparent));
    box-shadow: inset 2px 0 0 var(--tenant-brand-highlight);
}
.sidebar-nav-item:hover::before,
.sidebar-nav-item:focus-visible::before,
.sidebar-nav-item.active::before { background: var(--tenant-brand-highlight); transform: scale(1.25); }
.sidebar-nav-item.active::before { box-shadow: 0 0 .65rem color-mix(in srgb, var(--tenant-brand-highlight) 55%, transparent); }
.sidebar-nav-item.active small { color: var(--theme-sidebar-nav-active-muted); }
.ui-contribution-slot { display: contents; }
.ui-contribution-slot[hidden] { display: none; }
.sidebar-settings {
    margin: .1rem 0 0;
    padding-top: .85rem;
    border-top: 1px solid var(--theme-sidebar-divider);
}
.sidebar-settings > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 2.45rem;
    padding: .5rem .68rem;
    border-radius: .62rem;
    color: var(--theme-sidebar-nav-text);
    cursor: pointer;
    font-size: .78rem;
    font-weight: 720;
    list-style: none;
    transition: color var(--theme-motion-fast), background var(--theme-motion-fast);
}
.sidebar-settings > summary::-webkit-details-marker { display: none; }
.sidebar-settings > summary:hover,
.sidebar-settings > summary:focus-visible { color: var(--theme-sidebar-nav-active-text); background: color-mix(in srgb, var(--theme-white) 4%, transparent); outline: none; }
.sidebar-summary-chevron { width: .48rem; height: .48rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform var(--theme-motion-fast); }
.sidebar-settings[open] .sidebar-summary-chevron { transform: rotate(225deg); }
.sidebar-settings-list { display: grid; gap: .12rem; margin-top: .35rem; padding-left: .42rem; border-left: 1px solid color-mix(in srgb, var(--tenant-brand-accent) 18%, transparent); }
.sidebar-settings-label { margin-top: .65rem; padding-left: .72rem; font-size: .56rem; }
.sidebar-settings-label:first-child { margin-top: .15rem; }
.sidebar-submenu-item {
    display: grid;
    gap: .06rem;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: .48rem .72rem;
    border: 1px solid transparent;
    border-radius: .55rem;
    color: var(--theme-sidebar-nav-text);
    background: transparent;
    box-shadow: none;
    text-align: left;
    text-decoration: none;
    transition: color var(--theme-motion-fast), border-color var(--theme-motion-fast), background var(--theme-motion-fast);
}
.sidebar-submenu-item > span { font-size: .76rem; font-weight: 620; line-height: 1.3; }
.sidebar-submenu-item small { color: var(--theme-sidebar-nav-muted); font-size: .61rem; font-weight: 500; }
.sidebar-submenu-item:hover,
.sidebar-submenu-item:focus-visible,
.sidebar-submenu-item.active { border-color: color-mix(in srgb, var(--tenant-brand-accent) 21%, transparent); color: var(--theme-sidebar-nav-active-text); background: color-mix(in srgb, var(--tenant-brand-accent) 9%, transparent); box-shadow: none; transform: none; }
.sidebar-submenu-item.active small { color: var(--theme-sidebar-nav-active-muted); }
.sidebar-account {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .62rem;
    padding: .78rem .9rem;
    border-top: 1px solid var(--theme-sidebar-divider);
    background: color-mix(in srgb, var(--theme-surface-soft) 72%, transparent);
}
.sidebar-user-avatar { width: 2rem; height: 2rem; border-radius: 50%; font-size: .72rem; }
.sidebar-user-copy strong { font-size: .76rem; }
.sidebar-user-copy span { font-size: .6rem; }
.sidebar-account form { margin: 0; }
.sidebar-account-actions { display: flex; gap: .15rem; align-items: center; }
.sidebar-logout {
    display: grid;
    width: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: .55rem;
    color: var(--theme-sidebar-nav-muted);
    background: transparent;
    box-shadow: none;
}
.sidebar-logout:hover,
.sidebar-logout:focus-visible { border-color: var(--theme-sidebar-divider); color: var(--theme-sidebar-logout-hover); background: color-mix(in srgb, var(--theme-white) 4%, transparent); box-shadow: none; transform: none; }
.sidebar-overlay { display: none; }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.summary-card,
.next-step-card,
.retention-policy {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: var(--theme-card-background);
}
.summary-card strong, .summary-card span { display: block; }
.summary-card strong { margin: .45rem 0 .3rem; color: var(--text); }
.summary-card > span:last-child { color: var(--muted); font-size: .86rem; }
.summary-card.warning-surface { border-color: color-mix(in srgb, var(--warning) 48%, var(--line)); background: color-mix(in srgb, var(--warning) 8%, var(--theme-card-background)); }

.financial-overview-heading { margin-bottom: .8rem; }
.financial-filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(9rem, 1fr)) auto;
    gap: .75rem;
    align-items: end;
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: var(--theme-surface-soft);
}
.financial-filter-form label { margin: 0; }
.financial-filter-form input,
.financial-filter-form select { width: 100%; }
.financial-filter-actions { display: flex; gap: .45rem; align-items: center; }
.financial-filter-actions button { min-height: 2.65rem; margin: 0; white-space: nowrap; }
.financial-overview-content { display: grid; gap: 1rem; margin-top: .8rem; }
.financial-currency-section {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: color-mix(in srgb, var(--theme-card-background) 94%, transparent);
}
.financial-currency-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.financial-currency-heading h3,
.financial-subsection h4 { margin: 0; color: var(--text); }
.financial-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-top: .8rem; }
.financial-metric-card strong { font-size: clamp(1.05rem, 2vw, 1.35rem); }
.financial-subsection { margin-top: 1rem; }
.financial-aging-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; margin-top: .6rem; }
.financial-aging-grid .summary-card { padding: .8rem; }
.financial-aging-grid .summary-card strong { font-size: 1rem; }
.financial-table-shell { margin-top: .6rem; }
.financial-table { min-width: 68rem; }
.financial-invoice-table { min-width: 62rem; }
.financial-overdue-label { display: block; margin-top: .2rem; color: var(--danger); }
.financial-empty-state { margin-top: 0; }
.overview-context-grid { margin-top: 1rem; }

.card-kicker { color: var(--cyan); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.next-step-card { position: relative; overflow: hidden; margin-top: .85rem; }
.next-step-card::after { position: absolute; top: -3rem; right: -2rem; width: 10rem; height: 10rem; border-radius: 50%; background: color-mix(in srgb, var(--tenant-brand-accent) 6%, transparent); content: ""; }
.next-step-card h2 { margin: .4rem 0 0; font-size: 1.2rem; }
.next-step-card p { margin-bottom: 0; color: var(--muted); }

.section-heading h2, .retention-policy h4 { margin: 0; color: var(--text); }
.section-heading p { margin: .35rem 0 1rem; }
.profile-tabs {
    display: flex;
    gap: .35rem;
    overflow-x: auto;
    margin-top: .25rem;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: var(--theme-tab-background);
    scrollbar-width: thin;
}
button.profile-tab {
    flex: 0 0 auto;
    min-height: 2.65rem;
    margin: 0;
    padding: .58rem .9rem;
    border-color: transparent;
    color: var(--muted);
    background: transparent;
    box-shadow: none;
    white-space: nowrap;
}
button.profile-tab:hover { border-color: var(--line); color: var(--text); background: var(--theme-tab-background-hover); box-shadow: none; transform: none; }
button.profile-tab[aria-selected="true"] { border-color: var(--line-strong); color: var(--cyan-bright); background: color-mix(in srgb, var(--tenant-brand-deep) 30%, transparent); }
.profile-tab-panel { padding-top: 1.4rem; }
.profile-tab-panel:focus { outline: none; }
.profile-tab-panel:focus-visible { outline: 2px solid color-mix(in srgb, var(--tenant-brand-highlight) 32%, transparent); outline-offset: .35rem; }
.record-tabs {
    display: flex;
    gap: .35rem;
    overflow-x: auto;
    margin: .25rem 0 1.25rem;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: var(--theme-tab-background);
    scrollbar-width: thin;
}
.record-tab {
    flex: 0 0 auto;
    min-height: 2.65rem;
    padding: .58rem .9rem;
    border: 1px solid transparent;
    border-radius: var(--theme-radius-control);
    color: var(--muted);
    background: transparent;
    font-weight: 750;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
}
.record-tab:hover,
.record-tab:focus-visible { border-color: var(--line); color: var(--text); background: var(--theme-tab-background-hover); text-decoration: none; }
.record-tab.active,
.record-tab[aria-current="page"],
.record-tab[aria-selected="true"] { border-color: var(--line-strong); color: var(--cyan-bright); background: color-mix(in srgb, var(--tenant-brand-deep) 30%, transparent); }
.record-panel { padding-top: .15rem; }
.record-panel[hidden] { display: none; }
.record-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .85rem; }
.record-summary-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-card-background); }
.record-summary-card .card-kicker,
.record-summary-card strong,
.record-summary-card span { display: block; }
.record-summary-card strong { margin-top: .35rem; overflow-wrap: anywhere; }
.record-summary-card span:last-child { margin-top: .25rem; color: var(--muted); font-size: .78rem; }
.record-section { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-card-background); }
.record-section > h2,
.record-section > h3 { margin-top: 0; }
.record-actions-card .record-section-heading h2 { margin-top: 0; }
.record-actions-card .validation-blockers,
.record-actions-card .document-actions,
.record-actions-card .inline-form { margin-top: 1rem; }
.empty-table-cell { padding: 1.2rem !important; color: var(--muted); text-align: center; }
.money-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.status-badge[data-tone="success"] { border-color: var(--theme-success-line); color: var(--theme-info-text); background: var(--theme-info-surface); }
.status-badge[data-tone="danger"] { border-color: var(--theme-danger-line); color: var(--danger); background: var(--theme-danger-surface); }
.profile-section { margin: 0; padding: 0; border: 0; }
.profile-section + .profile-section { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.subsection-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.subsection-heading h3 { margin: 0; }
.subsection-heading p { margin: .35rem 0 0; }
.legal-profile-form { margin-top: .75rem; }
.company-tax-setting { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.company-tax-setting h4 { margin: 0; }
.company-tax-setting > p { margin: .35rem 0 .85rem; }
.company-tax-setting form { max-width: 42rem; }
.company-logo-layout { display: grid; grid-template-columns: minmax(14rem, .72fr) minmax(18rem, 1.28fr); gap: 1.25rem; align-items: start; margin-top: 1rem; }
.company-logo-preview-shell {
    display: grid;
    min-height: 12rem;
    padding: 1.25rem;
    place-items: center;
    overflow: hidden;
    border: 1px dashed var(--line-strong);
    border-radius: var(--theme-radius-card);
    background: var(--theme-card-background);
}
.company-logo-preview { display: block; width: auto; max-width: 100%; height: auto; max-height: 10rem; object-fit: contain; }
.company-logo-placeholder { margin: 0; color: var(--muted); font-size: .85rem; text-align: center; }
.company-logo-form { margin-top: 0; }
.company-logo-form label { margin-top: 0; }
.company-logo-form .button-row { flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid-wide { grid-template-columns: minmax(0, 3fr) minmax(5rem, 1fr); }
.form-checkbox-row {
    display: grid;
    grid-template-columns: 1.1rem minmax(0, 1fr);
    gap: .35rem .55rem;
    align-items: center;
    margin: 1rem 0;
}
.form-checkbox-row > input,
.form-checkbox-row > label { margin: 0; }
.form-checkbox-row > label { cursor: pointer; }
.form-checkbox-row > .form-help,
.form-checkbox-row > ul { grid-column: 2; }
.form-field-action { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding-bottom: 1rem; }
.input-label { display: block; margin-bottom: .45rem; color: var(--theme-text-label); font-size: .78rem; font-weight: 650; }
.optional { color: var(--muted); font-size: .72rem; font-weight: 500; }
.input-help { display: block; margin-top: .4rem; color: var(--muted); font-size: .72rem; font-weight: 500; line-height: 1.4; }
.input-help.proposal { color: var(--warning); }
.field-hint { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; }
.registry-lookup-results { margin-top: .75rem; }
.registry-lookup-status { margin: 0; padding: .75rem .85rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); color: var(--muted); background: var(--surface-soft); font-size: .82rem; }
.registry-company-card {
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--theme-radius-card);
    background: var(--theme-card-background);
    box-shadow: var(--theme-shadow-panel);
}
.registry-company-card.applied { border-color: var(--theme-success-line); }
.registry-company-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); background: var(--theme-surface-soft); }
.registry-company-heading h3 { margin: .22rem 0 0; color: var(--text); font-size: 1rem; }
.registry-company-context { display: block; color: var(--cyan-bright); font-size: .68rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.registry-company-heading .status-badge { flex: 0 0 auto; margin: 0; }
.registry-company-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 0; margin: 0; }
.registry-company-details > div { min-width: 0; padding: .8rem 1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--theme-card-background); }
.registry-company-details > div.wide { grid-column: 1 / -1; border-right: 0; }
.registry-company-details dt { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.registry-company-details dd { margin: .28rem 0 0; overflow-wrap: anywhere; color: var(--text); font-size: .86rem; font-weight: 650; white-space: pre-line; }
.registry-company-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem 1rem; background: var(--theme-surface-soft); }
.registry-company-actions p { max-width: 42rem; margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.registry-company-actions .registry-company-confirmation { color: var(--theme-info-text); font-weight: 650; }
.registry-company-apply { flex: 0 0 auto; margin: 0; }
.record-section-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.record-section-heading h2 { margin-bottom: .2rem; }
.record-section-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.billing-context-editor { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.validation-blockers { margin: .75rem 0 1rem; }
.validation-blockers strong { display: block; }
.validation-blockers ul { margin: .45rem 0 0; padding-left: 1.2rem; }
.validation-blockers p { margin: .45rem 0 0; color: inherit; }
.customer-routing-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--surface-soft); }
.customer-routing-summary strong { font-size: .84rem; }
.customer-routing-summary .field-hint { overflow-wrap: anywhere; }
.customer-routing-search-actions { margin-top: 1rem; }
.customer-routing-options-section { margin-top: 1rem; }
.customer-routing-options { display: grid; gap: .65rem; margin-top: .6rem; }
.customer-routing-option { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; align-items: start; width: 100%; margin: 0; padding: .85rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--theme-radius-control); color: var(--text); background: var(--surface-soft); box-shadow: none; text-align: left; cursor: pointer; }
.customer-routing-option:hover,
.customer-routing-option:focus-visible { border-color: var(--cyan); color: var(--text); background: color-mix(in srgb, var(--tenant-brand-accent) 10%, var(--surface-soft)); box-shadow: none; transform: none; }
.customer-routing-option:has(input:checked) { border-color: var(--cyan); background: color-mix(in srgb, var(--tenant-brand-deep) 38%, var(--surface-soft)); }
.customer-routing-option input { grid-row: 1 / span 3; margin-top: .2rem; }
.customer-routing-option strong, .customer-routing-option span { overflow-wrap: anywhere; }
.customer-routing-option span { color: var(--muted); font-size: .76rem; }
.customer-routing-option .customer-routing-requirements { color: var(--warning); }
.validation-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-top: 1rem; }
.validation-item { padding: .7rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--surface-soft); }
.validation-item strong, .validation-item span { display: block; }
.validation-item strong { font-size: .8rem; }
.validation-item span { margin-top: .22rem; color: var(--muted); font-size: .74rem; }
.validation-item.valid { border-color: color-mix(in srgb, var(--tenant-brand-accent) 34%, transparent); }
.validation-item.invalid { border-color: var(--theme-danger-line-strong); }
.validation-item.unavailable { border-color: var(--theme-warning-line); }
.active-profile-summary { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-md); background: var(--theme-active-summary-background); color: var(--muted); font-size: .82rem; }
.active-profile-summary strong { color: var(--text); }
.retention-policies { display: grid; gap: .8rem; }
.retention-policy header { display: flex; justify-content: space-between; gap: 1rem; }
.retention-policy h4 { font-size: 1rem; }
.retention-policy p { margin: .55rem 0; color: var(--theme-support-text); font-size: .88rem; }
.policy-duration { flex: 0 0 auto; color: var(--cyan-bright); font-weight: 800; white-space: nowrap; }
.policy-meta { display: flex; flex-wrap: wrap; gap: .4rem .8rem; color: var(--theme-meta-text); font-size: .76rem; }
.policy-form { display: grid; grid-template-columns: minmax(8rem, 1fr) auto auto; align-items: end; gap: .55rem; margin-top: .8rem; }
.policy-form label, .policy-form button { margin: 0; }
.policy-form button { min-height: 3rem; }

.customers-heading { align-items: center; }
.customers-heading button { flex: 0 0 auto; margin: 0 0 1rem; }
.customer-search-form {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) auto auto;
    align-items: end;
    gap: .8rem;
    margin: .5rem 0 1rem;
}
.customer-search-form label,
.customer-search-form button { margin: 0; }
.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 3rem;
    margin: 0;
    font-weight: 600;
}
.checkbox-field input { width: 1.1rem; min-height: 1.1rem; margin: 0; accent-color: var(--tenant-brand-accent); }

.trusted-devices-list { display: grid; gap: .7rem; margin-top: 1.25rem; }
.trusted-device-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-control);
    background: var(--theme-surface-soft);
}
.trusted-device-card strong, .trusted-device-card span { display: block; }
.trusted-device-card span { margin-top: .25rem; color: var(--muted); font-size: .8rem; }
.trusted-device-card button { flex: 0 0 auto; margin: 0; }
.trusted-devices-empty { margin-top: 1rem; color: var(--muted); }
.trusted-devices-actions { justify-content: space-between; }
.compact-button { min-height: 2.4rem; margin: 0; padding: .45rem .7rem; }
.form-section {
    margin: 1.4rem 0 0;
    padding: .25rem 1rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: var(--theme-surface-soft);
}
.form-section legend { padding: 0 .45rem; color: var(--cyan-bright); font-size: .85rem; font-weight: 750; }
.customer-public-profile { margin-top: .45rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.customer-public-profile h3 { margin: 0; font-size: .95rem; }
.customer-public-profile .form-grid { max-width: 42rem; }
.duplicate-warning {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--theme-warning-line);
    border-radius: var(--theme-radius-md);
    color: var(--theme-warning-text);
    background: var(--theme-duplicate-surface);
}
.duplicate-warning strong { color: var(--theme-warning-text); }
.duplicate-warning ul { margin: .7rem 0; padding-left: 1.25rem; color: var(--theme-text-soft); }
.danger-action { border-color: var(--theme-danger-line-strong); color: var(--danger); }
.danger-action:hover { border-color: var(--danger); color: var(--danger); }

.catalog-heading { align-items: center; }
.catalog-heading button { flex: 0 0 auto; margin: 0 0 1rem; }
.catalog-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }
.page-context { display: block; margin-bottom: .28rem; color: var(--cyan-bright); font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.catalog-detail-page { width: 100%; }
.catalog-detail-page .subsection-heading { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.catalog-detail-page .subsection-heading h2 { margin: 0; }
.catalog-detail-page form { margin-top: 1.15rem; }
.business-table-shell { width: 100%; margin-top: 1rem; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-card-background); }
.business-table { width: 100%; min-width: 58rem; border-collapse: collapse; color: var(--theme-text); font-size: .82rem; }
.business-table th { padding: .7rem .8rem; color: var(--theme-text-subtle); background: var(--theme-surface-soft); font-size: .68rem; letter-spacing: .045em; text-align: left; text-transform: uppercase; }
.business-table td { padding: .72rem .8rem; border-top: 1px solid var(--line); vertical-align: middle; }
.business-table tbody tr:hover { background: color-mix(in srgb, var(--tenant-brand-accent) 6%, transparent); }
.business-table td strong,
.business-table td small { display: block; }
.business-table td small { margin-top: .2rem; font-size: .68rem; }
.business-table td code { color: var(--cyan-bright); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .76rem; }
.business-table .status-badge { min-height: 1.55rem; margin: 0; padding: .15rem .5rem; font-size: .65rem; }
.business-table th[data-sortable-column] { padding: 0; }
.table-sort {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: .7rem .8rem;
    border: 0;
    border-radius: 0;
    color: inherit;
    background: transparent;
    box-shadow: none;
    font-size: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}
.table-sort:hover,
.table-sort.active { color: var(--cyan-bright); background: color-mix(in srgb, var(--tenant-brand-accent) 7%, transparent); box-shadow: none; transform: none; }
.table-sort:focus-visible { position: relative; z-index: 1; outline-offset: -3px; }
.table-sort-indicator { flex: 0 0 auto; min-width: .75rem; color: var(--theme-text-subtle); text-align: center; }
.table-sort.active .table-sort-indicator { color: var(--cyan-bright); }
.table-sort-mobile { display: none; }
.catalog-kind-badge { display: inline-flex; align-items: center; min-height: 1.55rem; padding: .15rem .5rem; border: 1px solid var(--line); border-radius: var(--theme-radius-pill); color: var(--theme-text-soft); background: var(--theme-surface-soft); font-size: .65rem; font-weight: 750; white-space: nowrap; }
.business-table-action { width: 1%; text-align: right; white-space: nowrap; }
.business-table-action button { min-height: 2rem; padding: .32rem .58rem; font-size: .72rem; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.setup-card { padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-card-background); }
.setup-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.setup-card-header h3 { margin: .15rem 0 0; font-size: 1.05rem; }
.setup-card-header .status-badge { margin: 0; }
.reference-policy-form { margin-top: .6rem; }
.reference-policy-form button { margin-bottom: 0; }
.catalog-actions { flex-wrap: wrap; }
.catalog-draft-flag { color: var(--warning); }

.quote-lines-section { margin: 1.35rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface-soft); }
.quote-lines-heading { align-items: center; }
.quote-lines-heading h3 { margin: 0; }
.quote-lines-table-shell { margin-top: .75rem; }
.quote-lines-table { min-width: 72rem; }
.quote-lines-table td { vertical-align: top; }
.quote-lines-table input,
.quote-lines-table select,
.quote-lines-table textarea { min-height: 2.4rem; margin: 0; padding: .45rem .55rem; font-size: .76rem; }
.quote-lines-table textarea { min-width: 15rem; resize: vertical; }
.quote-lines-table .quote-line-quantity { width: 6rem; }
.quote-lines-table .quote-line-unit { width: 7rem; }
.quote-lines-table .quote-line-price,
.quote-lines-table .quote-line-discount { width: 7.5rem; }
.quote-lines-table .quote-line-tax { min-width: 12rem; }
.invoice-lines-table { min-width: 60rem; }
.invoice-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.invoice-selection-table { min-width: 66rem; }
.invoice-selection-table input[type="checkbox"] { width: 1.15rem; min-height: 1.15rem; margin: 0; }
.invoice-selection-table input[type="text"] { width: 8rem; min-height: 2.35rem; margin: 0; padding: .4rem .5rem; }
.invoice-selection-table tr.is-selected td { background: color-mix(in srgb, var(--tenant-brand-accent) 8%, var(--theme-card-background)); }
.invoice-selection-table input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .35; }
.quote-line-source { display: block; margin-top: .3rem; color: var(--muted); font-size: .66rem; }
.quote-totals { display: flex; justify-content: flex-end; gap: 1rem; margin-top: .8rem; }
.quote-total-card { min-width: 8rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-card-background); text-align: right; }
.quote-total-card span,
.quote-total-card strong { display: block; }
.quote-total-card span { color: var(--muted); font-size: .67rem; text-transform: uppercase; }
.quote-total-card strong { margin-top: .2rem; color: var(--text); }
.quote-form-actions { flex-wrap: wrap; }
.quote-history { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.quote-history h3 { margin: 0 0 .75rem; }
.quote-history-list { display: grid; gap: .5rem; }
.quote-history-item { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.quote-history-item span { color: var(--muted); font-size: .75rem; }
.quote-history-item p { margin: .25rem 0 0; color: var(--theme-text-soft); font-size: .78rem; }
.app-dialog.wide-dialog { width: min(78rem, calc(100vw - 2rem)); max-width: none; }
.wide-dialog .app-dialog-card { width: 100%; max-height: calc(100vh - 2rem); overflow-y: auto; }
.quote-line-dialog .app-dialog-card { max-height: calc(100vh - 2rem); overflow-y: auto; }
.app-dialog.dunning-dialog { width: min(68rem, calc(100vw - 2rem)); max-width: none; }
.dunning-dialog-card { width: 100%; max-height: calc(100vh - 2rem); overflow-y: auto; }
.warning-text { color: var(--theme-warning-text); }
.quote-line-selection-grid { grid-template-columns: minmax(10rem, .35fr) minmax(20rem, 1fr); }
.quick-catalog-grid { grid-template-columns: repeat(4, minmax(9rem, 1fr)); }
.quick-catalog-create { margin-top: 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); }
.quick-catalog-create summary { color: var(--cyan-bright); cursor: pointer; font-weight: 700; }
.quick-catalog-create form { margin-top: .75rem; }
.direct-invoice-lines { display: grid; gap: .75rem; }
.billing-context-section { margin-block: 1rem; }
.billing-context-section > summary { cursor: pointer; font-weight: 700; color: var(--text-strong, #dce9f5); }
.billing-context-section[open] > summary { margin-bottom: .75rem; }
.nested-form-section { margin-top: .9rem; padding: .9rem; border: 1px solid rgba(123, 161, 194, .24); border-radius: .65rem; }
.direct-invoice-line {
    display: grid;
    grid-template-columns: minmax(8rem, .65fr) minmax(14rem, 1.4fr) minmax(6rem, .45fr) minmax(8rem, .55fr) minmax(7rem, .55fr) minmax(7rem, .5fr) minmax(11rem, .8fr) auto;
    gap: .65rem;
    align-items: end;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-control);
    background: var(--theme-surface-soft);
}
.direct-invoice-line label { min-width: 0; }
.direct-invoice-line input,
.direct-invoice-line select { width: 100%; min-width: 0; }
.direct-invoice-line .direct-line-description { grid-column: 1 / -1; }
.direct-invoice-line .direct-line-remove { align-self: end; }

.workspace-section-header,
.toolbar-form,
.document-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.workspace-section-header { margin-bottom: 1.25rem; }
.workspace-section-header h1 { margin: .2rem 0 0; }
.toolbar-form {
    justify-content: flex-start;
    margin-bottom: 1rem;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-control);
    background: var(--theme-surface-soft);
}
.toolbar-form label { margin: 0; }
.toolbar-form input { flex: 1 1 18rem; width: auto; margin: 0; }
.toolbar-form button { margin: 0; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: .9rem; }
.resource-card,
.editor-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--theme-radius-card);
    background: var(--theme-card-background);
}
.resource-card-wide,
.editor-card { margin-top: 1rem; }
.resource-card h2,
.editor-card h2 { margin-top: 0; }
.editor-card > summary { color: var(--cyan-bright); cursor: pointer; font-weight: 750; }
.editor-card[open] > summary { margin-bottom: 1rem; }
.resource-details { display: grid; gap: .55rem; margin: 0 0 1rem; }
.resource-details > div { min-width: 0; padding-bottom: .5rem; border-bottom: 1px solid var(--theme-line-subtle); }
.resource-details dt { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.resource-details dd { min-width: 0; margin: .2rem 0 0; overflow-wrap: anywhere; }
.resource-details.nested { margin: .45rem 0 0; padding-left: .65rem; border-left: 2px solid var(--line); }
.resource-value { white-space: pre-wrap; }
.status-chip { display: inline-flex; padding: .12rem .45rem; border-radius: var(--theme-radius-pill); font-size: .7rem; font-weight: 750; }
.status-chip.success { color: var(--theme-info-text); background: var(--theme-info-surface); }
.status-chip.muted { color: var(--muted); background: var(--theme-surface-soft); }
.editor-card .form-grid { margin-top: .75rem; }
.full-width { grid-column: 1 / -1; }
.document-actions { justify-content: flex-start; margin-top: 1rem; }
.document-actions form,
.document-actions button { margin: 0; }
.document-lines { display: grid; gap: .85rem; margin: 1.25rem 0; }
.document-lines-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.document-lines-heading h2,
.document-lines-heading button { margin: 0; }
.quotation-create-section,
.invoice-create-section,
.credit-note-create-section { padding: 1.15rem; }
.quotation-create-main-grid,
.invoice-create-main-grid { grid-template-columns: minmax(16rem, 1.6fr) repeat(3, minmax(10rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.credit-note-create-main-grid { grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
.quotation-create-copy-grid { gap: 1rem; margin-top: 1rem; }
.quotation-create-main-grid label,
.invoice-create-main-grid label,
.credit-note-create-main-grid label,
.quotation-create-copy-grid label { min-width: 0; margin: 0; }
.quotation-create-main-grid small,
.invoice-create-main-grid small,
.credit-note-create-main-grid small,
.quotation-create-copy-grid small { display: block; margin-top: .4rem; color: var(--muted); font-size: .72rem; font-weight: 500; line-height: 1.4; }
.credit-note-create-main-grid > label:first-child { max-width: 22rem; }
.credit-note-source-summary { margin-top: 1rem; }
.quotation-create-copy-grid textarea { min-height: 8rem; resize: vertical; }
.rich-text-field { min-width: 0; }
.rich-text-field > label { display: block; margin: 0 0 .45rem; color: var(--theme-text-label); font-weight: 700; }
.rich-text-field > small { display: block; margin-top: .45rem; color: var(--muted); font-size: .72rem; font-weight: 500; line-height: 1.4; }
.rich-text-toolbar { display: block; margin: 0; padding: .35rem; border: 1px solid var(--theme-field-border); border-bottom: 0; border-radius: var(--theme-radius-control) var(--theme-radius-control) 0 0; background: var(--theme-surface-soft); }
.rich-text-toolbar .trix-button-row { justify-content: flex-start; gap: .35rem; overflow-x: auto; }
.rich-text-toolbar .trix-button-group { flex: 0 0 auto; margin: 0; border-color: var(--theme-field-border); background: var(--theme-field-background); }
.rich-text-toolbar .trix-button-group:not(:first-child) { margin-left: 0; }
.rich-text-toolbar .trix-button { width: 2.45rem; max-width: none; min-height: 2.2rem; border-color: var(--theme-field-border); color: var(--theme-text); }
.rich-text-toolbar .trix-button::before { filter: none; opacity: .68; }
:root[data-theme="dark"] .rich-text-toolbar .trix-button::before { filter: invert(1); }
.rich-text-toolbar .trix-button:not(:disabled):hover,
.rich-text-toolbar .trix-button.trix-active { color: var(--theme-info-text); background: var(--theme-info-surface); }
.rich-text-toolbar .trix-dialog { top: calc(100% + .35rem); padding: .75rem; border: 1px solid var(--theme-field-border); border-top: 2px solid var(--tenant-brand-accent); color: var(--theme-text); background: var(--theme-surface-raised); box-shadow: var(--theme-shadow-floating); }
.rich-text-toolbar .trix-dialog__link-fields { gap: .5rem; }
.rich-text-toolbar .trix-input--dialog { min-width: 12rem; margin: 0; color: var(--theme-text); background: var(--theme-field-background); border-color: var(--theme-field-border); }
.rich-text-toolbar .trix-button--dialog { width: auto; min-height: 2.35rem; padding-inline: .65rem; text-indent: 0; }
.rich-text-editor { min-height: 8.5rem; margin: 0; padding: .8rem; overflow-y: auto; border: 1px solid var(--theme-field-border); border-radius: 0 0 var(--theme-radius-control) var(--theme-radius-control); color: var(--theme-text); background: var(--theme-field-background); font-synthesis: weight style; line-height: 1.55; }
.rich-text-editor:hover { border-color: var(--theme-field-border-hover); }
.rich-text-editor:focus { border-color: var(--theme-focus); box-shadow: 0 0 0 3px var(--theme-focus-ring); }
.rich-text-editor[contenteditable] { cursor: text; }
.rich-text-editor ul,
.rich-text-editor ol,
.rich-text-content ul,
.rich-text-content ol { margin: .5rem 0 .5rem 1.35rem; padding-left: .85rem; }
.rich-text-content { white-space: normal; font-synthesis: weight style; line-height: 1.6; }
.rich-text-editor em,
.rich-text-content em { font-style: italic; }
.rich-text-content div,
.rich-text-content p { margin: 0 0 .55rem; }
.rich-text-content div:last-child,
.rich-text-content p:last-child { margin-bottom: 0; }
.rich-text-content a { color: var(--tenant-brand-highlight); text-decoration: underline; text-underline-offset: .12em; }
.rich-text-field--compact .rich-text-editor { min-height: 6.25rem; }
.quotation-create-lines,
.invoice-create-lines { margin-block: 1rem; background: var(--theme-card-background); }
.document-line,
.credit-line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface-soft); }
.document-line legend,
.credit-line legend { padding: 0 .4rem; color: var(--cyan-bright); font-weight: 750; }
.document-line label,
.credit-line label { margin-top: 0; }
.document-line button { align-self: end; margin: 0; }
.credit-note-create-lines { margin-block: 1rem; background: var(--theme-card-background); }
.credit-note-line-form { display: block; padding: 0; overflow: hidden; border-color: var(--theme-line-strong); background: var(--theme-card-background); box-shadow: var(--theme-shadow-panel); transition: border-color var(--theme-motion-fast), opacity var(--theme-motion-fast); }
.credit-note-line-form.is-selected { border-color: color-mix(in srgb, var(--tenant-brand-accent) 55%, var(--theme-line-strong)); }
.credit-note-line-form.is-unavailable { opacity: .72; }
.credit-note-line-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.25rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--theme-line-subtle); background: linear-gradient(135deg, var(--theme-surface-soft), var(--theme-card-background)); }
.credit-note-line-heading h3 { margin: .18rem 0 .25rem; color: var(--theme-text); font-size: 1.08rem; }
.credit-note-line-heading .table-line-description { max-width: 46rem; color: var(--muted); font-size: .78rem; }
.credit-note-line-choice { flex: 0 0 auto; min-height: 2.4rem; padding: .35rem .65rem; border: 1px solid var(--theme-field-border); border-radius: var(--theme-radius-control); background: var(--theme-field-background); }
.credit-note-line-choice:has(input:checked) { border-color: var(--tenant-brand-accent); background: color-mix(in srgb, var(--tenant-brand-accent) 8%, var(--theme-field-background)); }
.credit-note-line-choice:has(input:disabled) { cursor: not-allowed; }
.credit-note-line-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, .28fr); gap: 1rem; align-items: end; padding: 1.2rem 1.25rem 1.3rem; }
.credit-note-line-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; margin: 0; }
.credit-note-line-facts > div { min-width: 0; padding: .7rem .75rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.credit-note-line-facts dt { color: var(--muted); font-size: .66rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.credit-note-line-facts dd { margin: .25rem 0 0; color: var(--theme-text); font-weight: 750; overflow-wrap: anywhere; }
.credit-note-line-entry label { margin: 0; }
.credit-note-line-entry small { display: block; margin-top: .38rem; color: var(--muted); font-size: .7rem; font-weight: 500; }
.quotation-line-form,
.invoice-line-form { display: block; padding: 0; overflow: hidden; border-color: var(--theme-line-strong); background: var(--theme-card-background); box-shadow: var(--theme-shadow-panel); }
.quotation-line-form-heading,
.invoice-line-form-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.25rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--theme-line-subtle); background: linear-gradient(135deg, var(--theme-surface-soft), var(--theme-card-background)); }
.quotation-line-form-heading h3,
.invoice-line-form-heading h3 { margin: .18rem 0 .25rem; color: var(--theme-text); font-size: 1.08rem; }
.quotation-line-form-heading p,
.invoice-line-form-heading p { max-width: 44rem; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.quotation-line-form-heading .status-chip,
.quotation-line-form-heading button,
.invoice-line-form-heading button { flex: 0 0 auto; align-self: center; }
.quotation-line-form-section,
.invoice-line-form-section { padding: 1.2rem 1.25rem 1.3rem; }
.quotation-line-form-section + .quotation-line-form-section,
.invoice-line-form-section + .invoice-line-form-section { border-top: 1px solid var(--theme-line-subtle); }
.quotation-line-section-heading,
.invoice-line-section-heading { display: flex; align-items: flex-start; gap: .7rem; margin-bottom: 1rem; }
.quotation-line-section-heading > span,
.invoice-line-section-heading > span { display: inline-grid; flex: 0 0 1.75rem; width: 1.75rem; height: 1.75rem; place-items: center; border: 1px solid var(--theme-line-strong); border-radius: 50%; color: var(--theme-info-text); background: var(--theme-info-surface); font-size: .72rem; font-weight: 800; }
.quotation-line-section-heading h4,
.invoice-line-section-heading h4 { margin: 0; color: var(--theme-text); font-size: .92rem; }
.quotation-line-section-heading p,
.invoice-line-section-heading p { margin: .14rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.quotation-line-fields,
.invoice-line-fields { display: grid; gap: 1rem; }
.quotation-line-fields label,
.invoice-line-fields label { min-width: 0; margin: 0; }
.quotation-line-fields label > small,
.invoice-line-fields label > small { display: block; margin-top: .38rem; color: var(--muted); font-size: .7rem; font-weight: 500; line-height: 1.35; }
.quotation-line-identity-grid,
.invoice-line-identity-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.quotation-line-field--catalog,
.invoice-line-field--catalog { grid-column: span 4; }
.quotation-line-field--kind,
.invoice-line-field--kind { grid-column: span 2; }
.quotation-line-field--label,
.invoice-line-field--label { grid-column: span 6; }
.quotation-line-pricing-grid,
.invoice-line-pricing-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.invoice-line-fields textarea { min-height: 7rem; resize: vertical; }
.invoice-line-fields .invoice-line-catalog-save { display: flex; align-items: flex-start; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); color: var(--theme-text); background: var(--theme-info-surface); cursor: pointer; }
.invoice-line-fields .invoice-line-catalog-save[hidden] { display: none; }
.invoice-line-catalog-save input { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin: .14rem 0 0; }
.invoice-line-catalog-save span { display: grid; gap: .18rem; }
.invoice-line-catalog-save strong { font-size: .8rem; }
.invoice-line-fields .invoice-line-catalog-save small { margin: 0; }
.input-with-suffix { display: flex; min-width: 0; }
.input-with-suffix input { min-width: 0; border-radius: var(--theme-radius-control) 0 0 var(--theme-radius-control); }
.input-with-suffix span { display: inline-grid; min-width: 2.5rem; place-items: center; border: 1px solid var(--theme-field-border); border-left: 0; border-radius: 0 var(--theme-radius-control) var(--theme-radius-control) 0; color: var(--theme-text-label); background: var(--theme-surface-soft); font-size: .78rem; font-weight: 750; }
.table-line-description { max-width: 36rem; margin-top: .28rem; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.table-line-description div,
.table-line-description p { margin-bottom: .2rem; }
.table-line-description ul,
.table-line-description ol { margin-block: .2rem; }
.invoice-source-lines-table { min-width: 48rem; }
.invoice-source-quantity { width: 100%; min-width: 8rem; max-width: 11rem; margin: 0; }
.invoice-source-actions { margin-top: 1.4rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem; padding: .55rem .9rem; border: 1px solid transparent; border-radius: var(--theme-radius-control); color: var(--theme-button-primary-text); background: var(--theme-button-primary-background); font-weight: 750; text-decoration: none; }
.button-link.secondary { border-color: var(--line); color: var(--theme-text); background: var(--theme-surface-soft); }
.button-link:hover { text-decoration: none; transform: translateY(-1px); }

.app-footer {
    border-top: 1px solid var(--theme-line-subtle);
    background: var(--theme-footer-surface);
    backdrop-filter: blur(16px);
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-height: 4.5rem;
    margin: 0 auto;
    padding: .55rem clamp(1rem, 3vw, 2.5rem);
    font-size: .8rem;
}
.corporate-signature { display: flex; align-items: center; gap: .55rem; text-transform: uppercase; letter-spacing: .09em; font-size: .62rem; }
.corporate-logo-plate { display: inline-grid; width: 5.4rem; height: 3.4rem; place-items: center; overflow: hidden; border-radius: var(--theme-radius-xs); background: var(--theme-logo-plate); }
.corporate-logo-plate img { width: 4.25rem; height: auto; }
@media (max-width: 820px) {
    .invoice-summary-grid { grid-template-columns: 1fr; }
    .workspace,
    .workspace.sidebar-active { grid-template-columns: minmax(0, 1fr); }
    .workspace.sidebar-active .panel { grid-column: 1; grid-row: 1; }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 40;
        width: min(88vw, 21rem);
        height: 100vh;
        height: 100dvh;
        max-height: none;
        overflow: hidden;
        border-width: 0 1px 0 0;
        border-radius: 0;
        box-shadow: var(--theme-shadow-sidebar-mobile);
        transform: translateX(-105%);
        transition: transform var(--theme-motion-medium);
    }
    .app-sidebar.mobile-open { transform: translateX(0); }
    .sidebar-close { display: inline-grid; place-items: center; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 35;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: var(--theme-overlay-surface);
        box-shadow: none;
        backdrop-filter: blur(3px);
    }
    .sidebar-overlay:hover { background: var(--theme-overlay-surface); box-shadow: none; transform: none; }
    .customer-search-form { grid-template-columns: 1fr; align-items: stretch; }
    .catalog-heading { flex-direction: column; }
    .catalog-heading-actions { justify-content: flex-start; width: 100%; }
    .catalog-heading-actions button { margin-bottom: 0; }
    .setup-grid { grid-template-columns: 1fr; }
    .quote-totals { justify-content: stretch; flex-wrap: wrap; }
    .quote-total-card { flex: 1 1 8rem; }
    .quote-line-selection-grid,
    .quick-catalog-grid,
    .company-logo-layout { grid-template-columns: 1fr; }
    .financial-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .financial-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .financial-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .financial-aging-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .direct-invoice-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .direct-invoice-line .direct-line-description { grid-column: 1 / -1; }
    .quotation-line-identity-grid,
    .invoice-line-identity-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .quotation-line-field--catalog,
    .invoice-line-field--catalog { grid-column: 1 / -1; }
    .quotation-line-field--kind,
    .invoice-line-field--kind { grid-column: span 4; }
    .quotation-line-field--label,
    .invoice-line-field--label { grid-column: span 8; }
    .quotation-line-pricing-grid,
    .invoice-line-pricing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 821px) {
    .sidebar-toggle { display: none !important; }
}

@media (max-width: 620px) {
    .header-inner { min-height: 4.2rem; }
    .content { padding: 1rem 0 1.5rem; }
    .panel { border-radius: var(--theme-radius-panel-mobile); }
    .recovery-codes, .summary-grid { grid-template-columns: 1fr; }
    .dashboard-heading, .section-heading, .subsection-heading, .retention-policy header { display: block; }
    .status-badge { margin-top: .5rem; }
    .policy-duration { display: block; margin-top: .4rem; }
    .policy-form { grid-template-columns: 1fr; }
    .form-grid, .form-grid-wide, .validation-summary { grid-template-columns: 1fr; }
    .customer-routing-summary { align-items: stretch; flex-direction: column; }
    .direct-invoice-line { grid-template-columns: 1fr; }
    .document-line,
    .credit-line { grid-template-columns: 1fr; }
    .credit-note-line-facts { grid-template-columns: 1fr; }
    .quotation-line-form-heading,
    .invoice-line-form-heading { align-items: stretch; flex-direction: column; padding: 1rem; }
    .quotation-line-form-heading button,
    .invoice-line-form-heading button { align-self: flex-start; }
    .quotation-line-form-section,
    .invoice-line-form-section { padding: 1rem; }
    .quotation-line-identity-grid,
    .invoice-line-identity-grid,
    .quotation-line-pricing-grid,
    .invoice-line-pricing-grid { grid-template-columns: 1fr; }
    .quotation-line-field--catalog,
    .invoice-line-field--catalog,
    .quotation-line-field--kind,
    .invoice-line-field--kind,
    .quotation-line-field--label,
    .invoice-line-field--label { grid-column: auto; }
    .direct-invoice-line .direct-line-description { grid-column: auto; }
    .corporate-signature > span:first-child { display: none; }
    .trusted-device-card { align-items: stretch; flex-direction: column; }
    .trusted-device-card button,
    .trusted-devices-actions button { width: 100%; }
    .trusted-devices-actions { flex-direction: column-reverse; }
    .financial-filter-form,
    .financial-kpi-grid,
    .financial-aging-grid { grid-template-columns: 1fr; }
    .financial-filter-actions { grid-column: auto; flex-direction: column-reverse; align-items: stretch; }
    .financial-filter-actions button { width: 100%; }
    .financial-currency-heading { align-items: flex-start; flex-direction: column; }
    .app-dialog.dunning-dialog { width: calc(100vw - 1rem); }
    .dunning-dialog-card { max-height: calc(100vh - 1rem); padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Codisys 2026 interface --------------------------------------------------- */

html { font-size: 16px; scroll-behavior: smooth; }
body {
    color: var(--theme-text-body);
    background: var(--theme-page-background);
    font-size: 1rem;
    line-height: 1.5;
}
body::before { display: none; }

.skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 20000;
    padding: .65rem .9rem;
    border-radius: var(--theme-radius-control);
    color: var(--theme-button-primary-text);
    background: var(--theme-button-primary-background);
    font-weight: 750;
    text-decoration: none;
    transform: translateY(-180%);
}
.skip-link:focus { outline: 3px solid var(--theme-focus-ring); outline-offset: 2px; transform: translateY(0); }

a { color: var(--theme-info); text-underline-offset: .18em; }
a:hover { color: var(--tenant-brand-highlight); }
a:focus-visible,
summary:focus-visible { outline: 3px solid var(--theme-focus-ring); outline-offset: 2px; }

h1 { font-size: clamp(2rem, 3vw, 2.5rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.5rem; line-height: 1.34; letter-spacing: -.02em; }
h3 { font-size: 1.125rem; line-height: 1.45; }
p { line-height: 1.5; }

button,
.button,
.button-link {
    min-height: 2.5rem;
    border-radius: var(--theme-radius-control);
    box-shadow: none;
    font-weight: 700;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem .9rem;
    border: 1px solid var(--tenant-brand-accent);
    color: var(--theme-button-primary-text);
    background: var(--theme-button-primary-background);
    text-decoration: none;
}
button:hover,
.button:hover,
.button-link:hover { box-shadow: none; transform: none; }
.button:hover { color: var(--theme-button-primary-text); background: var(--theme-button-primary-background-hover); }

input,
textarea,
select { min-height: 2.5rem; padding: .55rem .75rem; }
input[type="checkbox"],
input[type="radio"] { width: 1.125rem; height: 1.125rem; min-height: 1.125rem; }
input:focus,
textarea:focus,
select:focus { border-color: var(--theme-focus); outline: 3px solid var(--theme-focus-ring); outline-offset: 1px; }

.panel { border-color: var(--theme-line); background: var(--theme-surface); backdrop-filter: none; }
.flash-stack { top: 4.75rem; }
.flash-message { color: var(--theme-success); background: color-mix(in srgb, var(--theme-success) 10%, var(--theme-surface)); }
.flash-message[data-tone="error"] { color: var(--theme-danger); }

/* Authenticated shell */
.workspace-shell {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--theme-page-background);
}
.workspace-main { min-width: 0; }
.workspace-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 4rem;
    padding: 0 clamp(1rem, 2vw, 2rem);
    border-bottom: 1px solid var(--theme-line-subtle);
    background: var(--theme-header-surface);
    box-shadow: var(--theme-shadow-header);
    backdrop-filter: blur(12px);
}
.workspace-header-context { display: grid; min-width: 0; gap: .05rem; }
.workspace-header-context span { color: var(--muted); font-size: .7rem; line-height: 1.25; }
.workspace-header-context strong { overflow: hidden; color: var(--text); font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.workspace-header-actions { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; }
.service-status { display: inline-flex; align-items: center; gap: .45rem; color: var(--theme-success); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.service-status > span { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent); }
.workspace-header-user { display: flex; align-items: center; gap: .55rem; color: var(--text); font-size: .8rem; font-weight: 700; }
.workspace-header-avatar { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; color: #fff; background: var(--tenant-brand-deep); }
.workspace-content { width: 100%; margin: 0; padding: clamp(1rem, 2.4vw, 2rem); outline: none; }
.workspace-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }

.workspace-shell .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    align-self: start;
    width: 15.5rem;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: var(--theme-sidebar-surface);
    box-shadow: none;
}
.sidebar-header {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    min-height: 4rem;
    padding: .7rem 1rem;
    background: transparent;
}
.sidebar-brand-logo { display: block; width: 2rem; height: auto; padding: .18rem; border-radius: 6px; background: #fff; }
.sidebar-organization-copy strong { color: #fff; font-size: .84rem; }
.sidebar-organization-copy span { color: var(--theme-sidebar-nav-muted); font-size: .62rem; }
.sidebar-nav { gap: 1.15rem; padding: 1rem .7rem; }
.sidebar-nav-item { min-height: 2.75rem; padding: .55rem .7rem; border-radius: 8px; }
.sidebar-nav-item::before { width: .42rem; height: .42rem; }
.sidebar-nav-item > span { font-size: .85rem; }
.sidebar-nav-item small { font-size: .65rem; }
.sidebar-nav-item.active {
    border-color: rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .11);
    box-shadow: inset 3px 0 0 var(--tenant-brand-accent);
}
.sidebar-settings { padding-top: 1rem; }
.sidebar-settings > summary { min-height: 2.75rem; }
.sidebar-account { display: block; min-height: 4.3rem; background: rgba(0, 0, 0, .12); }
.sidebar-account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.sidebar-account-actions form { min-width: 0; }
.sidebar-account-actions .sidebar-logout { display: flex; width: 100%; min-height: 2.75rem; gap: .4rem; padding: .35rem .4rem; font-size: .6rem; line-height: 1.2; }
.sidebar-account-actions .sidebar-logout svg { flex: 0 0 auto; }
.sidebar-toggle { display: none; min-width: 2.75rem; min-height: 2.75rem; margin: 0; padding: .55rem; }

.dashboard-heading,
.section-heading,
.subsection-heading { margin-bottom: 1.25rem; }
.dashboard-heading p,
.section-heading p,
.subsection-heading p { max-width: 52rem; color: var(--muted); }
.page-context { color: var(--tenant-brand-highlight); }
.summary-card,
.record-summary-card,
.resource-card,
.editor-card,
.record-section,
.appearance-card { box-shadow: 0 1px 2px rgba(18, 52, 91, .035); }
.summary-card,
.record-summary-card { min-height: 7.5rem; }
.dashboard-shortcuts { margin-top: 2rem; }
.workspace-module-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.workspace-module-grid .resource-card { display: flex; flex-direction: column; min-height: 11rem; }
.workspace-module-grid .resource-card h2 { margin: 0; font-size: 1.125rem; }
.workspace-module-grid .resource-card p { flex: 1 1 auto; color: var(--muted); font-size: .875rem; }
.workspace-module-grid .resource-card .button-link { align-self: flex-start; }
.status-badge { color: var(--theme-info); background: color-mix(in srgb, var(--theme-info) 10%, var(--theme-surface)); }
.status-badge[data-tone="success"] { color: var(--theme-success); background: color-mix(in srgb, var(--theme-success) 10%, var(--theme-surface)); }
.status-badge[data-tone="danger"] { color: var(--theme-danger); }
.status-badge.warning { color: var(--theme-warning-text); }

.record-tabs,
.profile-tabs { gap: .15rem; padding: .25rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.record-tab,
button.profile-tab { border-radius: 6px 6px 0 0; }
.record-tab.active,
.record-tab[aria-current="page"],
.record-tab[aria-selected="true"],
button.profile-tab[aria-selected="true"] { border-color: transparent; color: var(--tenant-brand-highlight); background: var(--theme-info-surface); box-shadow: inset 0 -2px 0 var(--tenant-brand-accent); }

.business-table-shell { border-color: var(--theme-line); background: var(--theme-surface); box-shadow: 0 1px 2px rgba(18, 52, 91, .035); }
.business-table { font-size: .875rem; line-height: 1.4; }
.business-table th { padding: .75rem 1rem; color: var(--theme-text-muted); background: var(--theme-surface-soft); font-size: .75rem; }
.business-table td { padding: .85rem 1rem; }
.business-table tbody tr:hover { background: color-mix(in srgb, var(--tenant-brand-accent) 5%, var(--theme-surface)); }
.business-table .compact-button { min-height: 2.25rem; }
a.compact-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .45rem .7rem;
    border: 1px solid var(--theme-button-secondary-border);
    border-radius: var(--theme-radius-control);
    color: var(--theme-button-secondary-text);
    background: var(--theme-button-secondary-background);
    font-weight: 700;
    text-decoration: none;
}
a.compact-button:hover { border-color: var(--tenant-brand-accent); color: var(--theme-button-secondary-text); background: var(--theme-button-secondary-background-hover); }
.button-link.secondary { border-color: var(--theme-button-secondary-border); color: var(--theme-button-secondary-text); background: var(--theme-button-secondary-background); }

/* Authentication — style aligné sur Suivi-Web (base/) */
body.auth-shell {
    background: var(--theme-page-background);
}
body.auth-shell::before { display: none; }

.auth-page {
    width: min(calc(100% - 2rem), 1000px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 2rem 0 3rem;
}
.auth-page .flash-stack {
    position: static;
    top: auto;
    margin: 0 0 1rem;
}
.login-wrap {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    align-items: center;
    gap: 7vw;
    min-height: 65vh;
    margin: 35px auto 0;
}
.login-intro .brand-mark { margin-bottom: .35rem; }
.login-intro .eyebrow {
    margin: 0 0 7px;
    color: var(--tenant-brand-accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
}
.login-intro h1 {
    margin: 8px 0 18px;
    color: var(--text);
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.1;
    letter-spacing: -.045em;
}
.login-intro .muted {
    max-width: 27.5rem;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}
.auth-page .brand-mark {
    display: inline-grid;
    flex-shrink: 0;
    width: 2.625rem;
    height: 2.625rem;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: var(--tenant-brand-deep);
    font-weight: 800;
    letter-spacing: -.04em;
}
.auth-page .brand-mark-large {
    width: 3.875rem;
    height: 3.875rem;
    font-size: 1.3rem;
}
.card.login-card,
.auth-form-card {
    width: min(100%, 26rem);
    margin: 0;
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--theme-surface);
    box-shadow: 0 5px 20px rgba(32, 43, 61, .035);
}
.auth-form-card h1,
.auth-form-card h2 {
    margin: 0 0 .35rem;
    color: var(--text);
    font-size: 1.2rem;
    letter-spacing: -.02em;
}
.auth-introduction,
.auth-form-card > .muted {
    margin: -.5rem 0 1.5rem;
    color: var(--muted);
}
.auth-form-card form,
.auth-form-card form.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}
.auth-form-card form > label:not(.checkbox-field) {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin: 0;
    color: var(--theme-text-label);
    font-size: .82rem;
    font-weight: 650;
}
.auth-form-card form input:not([type="checkbox"]):not([type="radio"]),
.auth-form-card form textarea,
.auth-form-card form select {
    min-height: 2.65rem;
    padding: .7rem .75rem;
    border: 1px solid color-mix(in srgb, var(--theme-field-border) 85%, #d8dee8);
    border-radius: 9px;
    box-shadow: none;
}
.auth-form-card form input:not([type="checkbox"]):not([type="radio"]):focus,
.auth-form-card form textarea:focus,
.auth-form-card form select:focus {
    border-color: color-mix(in srgb, var(--tenant-brand-accent) 55%, #8197d2);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-brand-accent) 14%, transparent);
}
.auth-form-card label.checkbox-field {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: .65rem;
    margin: 0;
    font-size: .82rem;
    font-weight: 500;
}
.auth-form-card .hint,
.auth-form-card .input-help {
    margin: -.35rem 0 0;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 400;
    line-height: 1.55;
}
.auth-submit,
.button.button-primary.button-wide,
.button.button-wide.auth-submit {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: .8rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #fff;
    background: var(--tenant-brand-deep);
    box-shadow: none;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.auth-submit:hover,
.button.button-primary.button-wide:hover,
.button.button-wide.auth-submit:hover {
    background: color-mix(in srgb, var(--tenant-brand-deep) 88%, #000);
    box-shadow: none;
    transform: none;
}
.auth-secondary-action {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
}
.auth-trust-device { margin-top: 0; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 5.5rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: .35rem;
    min-height: 2rem;
    margin: 0;
    padding: .25rem .55rem;
    border: 0;
    color: var(--theme-info);
    background: transparent;
    box-shadow: none;
    font-size: .75rem;
    font-weight: 600;
    transform: translateY(-50%);
}
.password-toggle:hover {
    color: var(--tenant-brand-highlight);
    background: var(--theme-surface-soft);
    box-shadow: none;
    transform: translateY(-50%);
}
.otp-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.otp-fieldset legend { color: var(--theme-text-label); font-weight: 700; }
.otp-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; margin-top: .55rem; }
.otp-cells input { width: 100%; min-width: 0; height: 3.4rem; padding: .25rem; text-align: center; font: 750 1.35rem/1 var(--theme-font-mono); }
.otp-recovery label { margin-top: 0; }
.otp-mode-toggle { display: block; min-height: 2.5rem; margin: 1rem auto 0; padding: .35rem .6rem; border: 0; color: var(--theme-info); background: transparent; font-weight: 600; }
.otp-mode-toggle:hover { color: var(--tenant-brand-highlight); background: var(--theme-surface-soft); }
.auth-legal { margin: 1.25rem 0 0; color: var(--muted); font-size: .72rem; text-align: center; }
.auth-secret { margin-top: 1rem; }
.auth-form-card .page-context {
    display: block;
    margin: 0 0 .5rem;
    color: var(--tenant-brand-accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.tenant-list form { margin: 0; }

/* Appearance */
.appearance-card { display: grid; gap: 1.25rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.appearance-card h2 { margin: 0; }
.appearance-card > div p { margin-bottom: 0; }
.appearance-form { margin: 0; }
.appearance-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.appearance-option { display: grid; grid-template-columns: 1.2rem 6rem minmax(0, 1fr); align-items: center; gap: .75rem; margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); cursor: pointer; }
.appearance-option:has(input:checked) { border-color: var(--tenant-brand-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tenant-brand-accent) 14%, transparent); }
.appearance-option input { grid-column: 1; margin: 0; }
.appearance-option-copy { display: grid; gap: .25rem; }
.appearance-option-copy small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.appearance-preview { grid-column: 2; display: grid; grid-template-columns: 30% 1fr; grid-template-rows: repeat(2, 1fr); gap: .3rem; height: 4.8rem; padding: .45rem; overflow: hidden; border: 1px solid #c9d5df; border-radius: 6px; background: #f5f7fa; }
.appearance-preview span:first-child { grid-row: 1 / -1; background: #12345b; }
.appearance-preview span { border-radius: 3px; background: #fff; }
.appearance-preview-dark { border-color: #294055; background: #07111c; }
.appearance-preview-dark span:first-child { background: #07192b; }
.appearance-preview-dark span { background: #122334; }
.appearance-preview-auto { background: linear-gradient(110deg, #f5f7fa 0 50%, #07111c 50%); }
.appearance-preview-auto span { background: linear-gradient(110deg, #fff 0 50%, #122334 50%); }
.appearance-actions { align-items: center; margin-top: 1rem; }
.appearance-actions button { margin: 0; }
.appearance-status { padding: .7rem 1rem; border: 1px solid var(--theme-success-line); border-radius: var(--theme-radius-control); color: var(--theme-success); background: color-mix(in srgb, var(--theme-success) 8%, var(--theme-surface)); font-size: .8rem; }

/* Platform administration */
.platform-shell { min-height: 100vh; min-height: 100dvh; }
.platform-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 4.8rem;
    padding: .8rem clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid var(--theme-line-subtle);
    background: var(--theme-header-surface);
    box-shadow: var(--theme-shadow-header);
    backdrop-filter: blur(16px);
}
.platform-brand { display: flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; }
.platform-brand img { width: 2.35rem; height: auto; }
.platform-brand span { display: grid; gap: .05rem; }
.platform-brand strong { font-size: 1rem; }
.platform-brand small { color: var(--muted); font-size: .7rem; letter-spacing: .025em; }
.platform-header-actions { display: flex; align-items: center; gap: 1rem; }
.platform-navigation { display: flex; align-items: center; gap: .25rem; }
.platform-navigation a { padding: .45rem .65rem; border-radius: var(--theme-radius-control); color: var(--muted); font-size: .76rem; font-weight: 750; text-decoration: none; }
.platform-navigation a:hover { color: var(--text); background: var(--theme-surface-soft); }
.platform-logout { margin: 0; }
.platform-logout button { min-height: 2.35rem; margin: 0; padding: .45rem .75rem; }
.platform-content { width: min(100%, 96rem); margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.5rem); }
.platform-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 1.25rem; }
.platform-page-heading h1 { margin-bottom: .35rem; }
.platform-page-heading p { max-width: 54rem; margin: 0; color: var(--muted); }
.platform-result-count { flex: 0 0 auto; color: var(--muted); font-size: .8rem; font-weight: 700; }
.platform-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.platform-kpi-grid article { padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--surface); box-shadow: var(--theme-shadow-panel); }
.platform-kpi-grid span, .platform-kpi-grid strong, .platform-kpi-grid small { display: block; }
.platform-kpi-grid span { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.platform-kpi-grid strong { margin-top: .25rem; color: var(--text); font-size: 1.65rem; font-variant-numeric: tabular-nums; }
.platform-kpi-grid small { margin-top: .15rem; color: var(--muted); font-size: .72rem; }
.platform-kpi-grid article[data-tone="success"] { border-color: var(--theme-success-line); }
.platform-kpi-grid article[data-tone="warning"] { border-color: var(--theme-warning-line); }
.platform-kpi-grid article[data-tone="danger"] { border-color: var(--theme-danger-line); }
.platform-card { margin-bottom: 1rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--surface); box-shadow: var(--theme-shadow-panel); }
.platform-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.platform-card > header h2 { margin: .15rem 0 0; font-size: 1.05rem; }
.platform-card .card-kicker { display: block; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.platform-connector-grid { display: grid; grid-template-columns: minmax(13rem, .8fr) repeat(2, minmax(15rem, 1fr)); gap: .8rem; }
.platform-connector-grid dl, .platform-connector-grid article { margin: 0; padding: .85rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.platform-connector-grid dl { display: grid; gap: .45rem; }
.platform-connector-grid dl div { display: flex; justify-content: space-between; gap: 1rem; }
.platform-connector-grid dt { color: var(--muted); font-size: .73rem; }
.platform-connector-grid dd { margin: 0; font-size: .75rem; font-weight: 750; }
.platform-connector-grid article { display: grid; align-content: start; justify-items: start; gap: .5rem; }
.platform-connector-grid article .status-badge { margin: 0; }
.platform-connector-grid article small { color: var(--muted); line-height: 1.45; }
.platform-search-form { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(12rem, .35fr) auto auto; align-items: end; gap: .75rem; margin: 0 0 1rem; }
.platform-search-form label { margin: 0; }
.platform-search-form label > span { display: block; margin-bottom: .4rem; }
.platform-search-form button, .platform-search-form .button-link { min-height: 3rem; margin: 0; }
.platform-table-shell { margin: 0; }
.platform-tenant-table { min-width: 68rem; }
.platform-tenant-name { display: grid; min-width: 15rem; }
.platform-tenant-name small { margin-top: .2rem; overflow: hidden; max-width: 24rem; color: var(--muted); font: .68rem var(--theme-font-mono); text-overflow: ellipsis; white-space: nowrap; }
.button-link.compact { min-height: 2.2rem; padding: .4rem .65rem; font-size: .75rem; }
.platform-tenant-heading { align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--surface); box-shadow: var(--theme-shadow-panel); }
.platform-tenant-heading .eyebrow { margin-bottom: .35rem; }
.platform-tenant-heading h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.platform-tenant-heading p { font: .72rem var(--theme-font-mono); }
.platform-detail-grid, .platform-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.platform-detail-grid .platform-card, .platform-history-grid .platform-card { min-width: 0; }
.platform-lifecycle-action > p { margin: 0; color: var(--muted); }
.platform-lifecycle-action form { display: grid; grid-template-columns: minmax(15rem, 1fr) auto; align-items: end; gap: .75rem; margin-top: 1rem; }
.platform-lifecycle-action label { margin: 0; }
.platform-lifecycle-action select { margin-top: .4rem; }
.platform-lifecycle-action button { margin: 0; }
button.danger-button { border-color: var(--theme-danger-line); color: var(--danger); background: var(--theme-danger-surface); box-shadow: none; }
button.danger-button:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--theme-danger-surface)); }
.platform-timeline { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.platform-timeline li { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--theme-line-subtle); }
.platform-timeline li:last-child { padding-bottom: 0; border-bottom: 0; }
.platform-timeline li div { display: grid; min-width: 0; }
.platform-timeline strong { overflow-wrap: anywhere; font-size: .78rem; }
.platform-timeline small { margin-top: .2rem; color: var(--muted); font-size: .7rem; }
.platform-timeline time { flex: 0 0 auto; color: var(--muted); font-size: .7rem; }
.platform-empty-state { max-width: 44rem; margin: 4rem auto; text-align: center; }
.platform-empty-state p { color: var(--muted); }
.platform-empty-state .button-link { margin-top: 1rem; }
.platform-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.platform-form-grid label { min-width: 0; margin: 0; }
.platform-form-grid label > span { display: block; margin-bottom: .35rem; }
.platform-form-grid input, .platform-form-grid select { width: 100%; }
.field-help-tooltip {
    position: relative;
    display: inline-grid;
    width: 1rem;
    height: 1rem;
    margin-left: .22rem;
    border: 1px solid var(--theme-field-border);
    border-radius: 50%;
    place-items: center;
    color: var(--muted);
    background: var(--theme-surface-soft);
    font-size: .66rem;
    font-style: normal;
    font-weight: 850;
    line-height: 1;
    cursor: help;
    vertical-align: .08rem;
}
.field-help-tooltip::after {
    position: absolute;
    bottom: calc(100% + .45rem);
    left: 50%;
    z-index: 30;
    width: max-content;
    max-width: min(18rem, 80vw);
    padding: .5rem .65rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--theme-radius-sm);
    color: var(--text);
    background: var(--theme-button-secondary-background);
    box-shadow: var(--theme-shadow-tooltip);
    content: attr(data-tooltip);
    font-size: .74rem;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    text-transform: none;
    transform: translate(-50%, .2rem);
    transition: opacity var(--theme-motion-tooltip), transform var(--theme-motion-tooltip);
}
.field-help-tooltip:hover::after,
.field-help-tooltip:focus::after { opacity: 1; transform: translate(-50%, 0); }
.field-help-tooltip:focus-visible { border-color: var(--cyan); outline: 3px solid color-mix(in srgb, var(--tenant-brand-accent) 16%, transparent); }
.platform-field-wide { grid-column: 1 / -1; }
.platform-checkbox { display: flex; align-items: center; gap: .6rem; }
.platform-checkbox input { flex: 0 0 auto; width: auto; margin: 0; }
.platform-checkbox > span { margin: 0 !important; }
.platform-subscription-management form > button, .platform-card > form > button { margin: .9rem 0 0; }
.platform-subscription-details .business-table { min-width: 30rem; }
.table-cell-note { display: block; margin-top: .2rem; color: var(--muted); font-size: .68rem; }
.platform-offer-versions { display: grid; gap: 1rem; }
.platform-offer-version { margin-bottom: 0; }
.platform-version-status { display: grid; justify-items: end; gap: .35rem; color: var(--muted); font-size: .7rem; }
.platform-version-metadata { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1rem; }
.platform-version-metadata > div { display: grid; grid-template-columns: 1fr; gap: .15rem; }
.platform-catalog-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.platform-catalog-columns > section { min-width: 0; padding: .8rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.platform-catalog-columns h3, .platform-catalog-editors h3 { margin: 0 0 .65rem; font-size: .85rem; }
.platform-compact-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.platform-compact-list li { display: flex; justify-content: space-between; gap: .75rem; min-width: 0; padding-bottom: .4rem; border-bottom: 1px solid var(--theme-line-subtle); font-size: .72rem; }
.platform-compact-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.platform-compact-list li > span { display: grid; min-width: 0; }
.platform-compact-list code { overflow-wrap: anywhere; }
.platform-compact-list small { color: var(--muted); }
.platform-compact-list b { flex: 0 0 auto; }
.platform-catalog-editors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.platform-catalog-editors form { min-width: 0; padding: .8rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); }
.platform-catalog-editors form > button { margin: .75rem 0 0; }
.platform-catalog-editors .platform-entitlement-editor { grid-column: 1 / -1; order: 1; padding: 1rem; }
.platform-entitlement-editor > .input-help { margin: -.25rem 0 1rem; }
.platform-entitlement-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.platform-entitlement-item { min-width: 0; padding: .75rem; border: 1px solid var(--theme-line-subtle); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); transition: border-color var(--theme-motion-fast), background var(--theme-motion-fast); }
.platform-entitlement-item:has(.platform-entitlement-toggle input:checked) { border-color: color-mix(in srgb, var(--tenant-brand-accent) 55%, var(--line)); background: color-mix(in srgb, var(--tenant-brand-accent) 5%, var(--theme-surface)); }
.platform-entitlement-toggle { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .65rem; margin: 0; cursor: pointer; }
.platform-entitlement-toggle > input { margin-top: .12rem; }
.platform-entitlement-toggle > span { display: grid; min-width: 0; gap: .3rem; }
.platform-entitlement-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; }
.platform-entitlement-heading strong { font-size: .8rem; }
.platform-entitlement-heading code { color: var(--muted); font-size: .64rem; overflow-wrap: anywhere; }
.platform-entitlement-toggle small { color: var(--muted); font-size: .7rem; font-weight: 550; line-height: 1.45; }
.platform-entitlement-limit { display: grid; grid-template-columns: minmax(0, 1fr) 7rem; align-items: center; gap: .65rem; margin: .7rem 0 0 1.75rem; padding-top: .65rem; border-top: 1px solid var(--theme-line-subtle); font-size: .72rem; }
.platform-entitlement-limit span { display: grid; gap: .15rem; }
.platform-entitlement-limit small { color: var(--muted); font-size: .64rem; font-weight: 550; }
.platform-entitlement-limit input { min-height: 2.35rem; padding: .4rem .55rem; }
.platform-publish-form { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.platform-publish-form p { margin: 0; color: var(--muted); font-size: .76rem; }
.platform-publish-form button { flex: 0 0 auto; margin: 0; }

@media (max-width: 900px) {
    .platform-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .platform-connector-grid { grid-template-columns: 1fr; }
    .platform-search-form { grid-template-columns: 1fr 1fr; }
    .platform-detail-grid, .platform-history-grid { grid-template-columns: 1fr; }
    .platform-catalog-columns, .platform-catalog-editors, .platform-entitlement-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .platform-header { position: static; align-items: flex-start; }
    .platform-header-actions { justify-content: flex-end; flex-wrap: wrap; }
    .platform-header-actions .service-status, .platform-header-actions .workspace-header-user { display: none; }
    .platform-navigation { order: 3; width: 100%; }
    .platform-page-heading { align-items: flex-start; flex-direction: column; gap: .5rem; }
    .platform-kpi-grid, .platform-search-form, .platform-lifecycle-action form, .platform-form-grid { grid-template-columns: 1fr; }
    .platform-field-wide { grid-column: auto; }
    .platform-publish-form { align-items: stretch; flex-direction: column; }
}

/* Dashboard */
.dashboard-heading { align-items: center; }
.dashboard-heading h1 { margin-bottom: .25rem; }
.dashboard-heading p { margin: 0; }
.dashboard-timezone { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .78rem; }
.dashboard-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; }
.dashboard-kpi-card { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: .75rem; min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.dashboard-kpi-icon { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border-radius: 50%; color: var(--theme-info); background: color-mix(in srgb, var(--theme-info) 12%, var(--theme-surface)); font-weight: 850; }
.dashboard-kpi-card[data-tone="success"] .dashboard-kpi-icon { color: var(--theme-success); background: color-mix(in srgb, var(--theme-success) 13%, var(--theme-surface)); }
.dashboard-kpi-card[data-tone="warning"] .dashboard-kpi-icon { color: var(--theme-warning); background: color-mix(in srgb, var(--theme-warning) 13%, var(--theme-surface)); }
.dashboard-kpi-card[data-tone="danger"] .dashboard-kpi-icon { color: var(--theme-danger); background: color-mix(in srgb, var(--theme-danger) 12%, var(--theme-surface)); }
.dashboard-kpi-card div { display: grid; min-width: 0; }
.dashboard-kpi-card div > span { color: var(--muted); font-size: .76rem; }
.dashboard-kpi-card strong { margin-top: .25rem; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.dashboard-kpi-card small { margin-top: .15rem; color: var(--muted); }
.dashboard-kpi-card > a { grid-column: 2; align-self: end; margin-top: .6rem; font-size: .75rem; font-weight: 700; }
.dashboard-currency-note { color: var(--muted); font-size: .75rem; }
.pilotage-summary { margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.pilotage-summary-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .85rem; }
.pilotage-summary-heading h2 { margin: .15rem 0 0; font-size: 1.05rem; }
.pilotage-summary-controls { display: flex; justify-content: flex-end; align-items: flex-end; flex: 0 0 auto; }
.pilotage-currency-form { display: flex; align-items: flex-end; gap: .5rem; padding: .45rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.pilotage-currency-form label { min-width: 7rem; margin: 0; color: var(--muted); font-size: .68rem; font-weight: 700; }
.pilotage-currency-form select { min-height: 2.15rem; margin-top: .2rem; padding: .35rem 2rem .35rem .5rem; font-size: .78rem; }
.pilotage-currency-form button { margin: 0; }
.pilotage-summary-grid { gap: .7rem; }
.pilotage-summary-grid .record-summary-card { min-height: 0; background: var(--theme-surface-soft); box-shadow: none; }
.pilotage-summary-grid .record-summary-card[data-tone="danger"] { border-color: var(--theme-danger-line); }
.pilotage-summary-grid .record-summary-card[data-tone="warning"] { border-color: var(--theme-warning-line); }
.pilotage-card-link { color: inherit; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.pilotage-card-link::after { display: block; margin-top: .55rem; color: var(--tenant-brand-highlight); font-size: .7rem; font-weight: 750; content: "Afficher les éléments →"; }
.pilotage-card-link:hover { border-color: var(--tenant-brand-highlight); box-shadow: 0 8px 20px rgb(15 23 42 / 8%); transform: translateY(-1px); }
.pilotage-card-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--tenant-brand-highlight) 28%, transparent); outline-offset: 2px; }
.pilotage-active-filter { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: -.25rem 0 1rem; padding: .7rem .85rem; border: 1px solid var(--tenant-brand-highlight); border-radius: var(--theme-radius-control); background: color-mix(in srgb, var(--tenant-brand-highlight) 8%, var(--theme-surface)); font-size: .78rem; }
.pilotage-active-filter a { font-weight: 750; }
.pilotage-note { margin: .75rem 0 0; color: var(--muted); font-size: .75rem; }
.dashboard-commercial { margin-top: .9rem; padding: 1rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.pilotage-period-form { display: flex; align-items: end; gap: .55rem; padding: .65rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.pilotage-period-form label { min-width: 8.5rem; color: var(--muted); font-size: .68rem; font-weight: 700; }
.pilotage-period-form select,
.pilotage-period-form input { min-height: 2.15rem; margin-top: .2rem; padding: .35rem .5rem; font-size: .78rem; }
.dashboard-commercial-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .65rem; margin-bottom: 1rem; }
.dashboard-commercial-kpis article,
.dashboard-commercial-kpis .pilotage-kpi-link { min-width: 0; padding: .75rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.dashboard-commercial-kpis .pilotage-kpi-link { color: inherit; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease; }
.dashboard-commercial-kpis .pilotage-kpi-link:hover { border-color: var(--tenant-brand-highlight); box-shadow: 0 6px 16px rgb(15 23 42 / 7%); }
.dashboard-commercial-kpis span,
.dashboard-commercial-kpis strong,
.dashboard-commercial-kpis small { display: block; }
.dashboard-commercial-kpis span { color: var(--muted); font-size: .72rem; }
.dashboard-commercial-kpis strong { margin-top: .2rem; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.dashboard-commercial-kpis small { margin-top: .15rem; color: var(--muted); font-size: .7rem; }
.dashboard-commercial-kpis small[data-trend="up"] { color: var(--theme-success); }
.dashboard-commercial-kpis small[data-trend="down"] { color: var(--theme-danger); }
.pilotage-objectives { margin: .85rem 0 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-surface-soft); }
.pilotage-objectives h3 { margin: 0; font-size: .95rem; }
.pilotage-objective-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .65rem; }
.pilotage-objective-grid article { padding: .75rem; border: 1px solid var(--line); border-radius: var(--theme-radius-control); background: var(--theme-surface); }
.pilotage-objective-grid span,
.pilotage-objective-grid strong,
.pilotage-objective-grid small { display: block; }
.pilotage-objective-grid span { color: var(--muted); font-size: .72rem; }
.pilotage-objective-grid strong { margin-top: .2rem; font-size: 1rem; }
.pilotage-objective-grid progress { width: 100%; height: .45rem; margin: .65rem 0 .25rem; accent-color: var(--tenant-brand-highlight); }
.pilotage-objective-grid small { color: var(--muted); font-size: .68rem; }
.pilotage-objective-editor { margin-top: .75rem; }
.pilotage-objective-editor > summary { color: var(--tenant-brand-highlight); font-size: .75rem; font-weight: 750; cursor: pointer; }
.pilotage-objective-editor form { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.compact-empty-state { min-height: 0; margin: 0; padding: .7rem; }
.pilotage-chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .65rem; color: var(--muted); font-size: .75rem; }
.pilotage-chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.pilotage-chart-legend span::before { width: .7rem; height: .7rem; border-radius: 2px; background: var(--tenant-brand-highlight); content: ""; }
.pilotage-chart-legend span[data-series="forecast"]::before { background: var(--theme-warning); }
.pilotage-bar-chart { display: grid; grid-template-columns: repeat(12, minmax(3.25rem, 1fr)); gap: .35rem; min-width: 0; min-height: 11rem; padding: .75rem .25rem .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.pilotage-chart-month { display: grid; grid-template-rows: 8.5rem auto; gap: .45rem; min-width: 0; text-align: center; }
.pilotage-chart-month > strong { color: var(--muted); font-size: .68rem; font-weight: 700; }
.pilotage-chart-bars { display: flex; justify-content: center; align-items: flex-end; gap: .28rem; min-height: 0; }
.pilotage-chart-bar { width: 1.05rem; height: 8.5rem; margin: 0; overflow: hidden; border: 0; border-radius: 4px 4px 2px 2px; appearance: none; direction: rtl; writing-mode: vertical-lr; background: var(--theme-surface-soft); }
.pilotage-chart-bar::-webkit-progress-bar { border-radius: inherit; background: var(--theme-surface-soft); }
.pilotage-chart-bar.realized::-webkit-progress-value { border-radius: inherit; background: var(--tenant-brand-highlight); }
.pilotage-chart-bar.forecast::-webkit-progress-value { border-radius: inherit; background: var(--theme-warning); }
.pilotage-chart-bar.realized::-moz-progress-bar { border-radius: inherit; background: var(--tenant-brand-highlight); }
.pilotage-chart-bar.forecast::-moz-progress-bar { border-radius: inherit; background: var(--theme-warning); }
.pilotage-chart-details { margin-top: .75rem; }
.pilotage-chart-details > summary { color: var(--tenant-brand-highlight); font-size: .75rem; font-weight: 700; cursor: pointer; }
.pilotage-chart-details .business-table-shell { margin-top: .65rem; }
.dashboard-lower-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(15rem, .85fr); gap: .9rem; margin-top: .9rem; }
.dashboard-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.dashboard-card > header { padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.dashboard-card > header h2 { margin: 0; font-size: 1rem; }
.dashboard-card .business-table-shell { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.dashboard-activity-table { min-width: 44rem; }
.dashboard-card-footer { display: block; padding: .75rem 1rem; border-top: 1px solid var(--line); font-size: .75rem; font-weight: 700; }
.activity-document-icon { display: grid; width: 1.55rem; height: 1.55rem; place-items: center; border: 1px solid var(--line); border-radius: 4px; color: var(--theme-info); font-size: .68rem; font-weight: 850; }
.dashboard-quick-actions nav { display: grid; }
.dashboard-quick-actions nav a { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr) auto; align-items: center; gap: .65rem; min-height: 3.25rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); color: var(--text); font-size: .82rem; text-decoration: none; }
.dashboard-quick-actions nav a:hover { color: var(--tenant-brand-highlight); background: var(--theme-surface-soft); }
.dashboard-quick-actions nav a > span { color: var(--theme-info); font-size: 1.15rem; text-align: center; }
.dashboard-quick-actions nav a > strong { color: var(--muted); }

/* Customer directory and record */
.customer-search-field input { width: 100%; }
.customer-filter-button::before { margin-right: .4rem; content: "☷"; }
.customer-name-cell { display: flex; align-items: center; gap: .7rem; }
.customer-row-icon,
.customer-record-icon { display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--tenant-brand-deep); background: var(--theme-surface-soft); font-size: 1.25rem; }
.customer-row-icon { width: 2rem; height: 2rem; }
.customer-name-cell > span:last-child,
.stacked-identifier { display: grid; }
.customer-name-cell small,
.stacked-identifier small { overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; }
.routing-state { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.routing-state > span { width: .5rem; height: .5rem; border-radius: 50%; background: var(--theme-warning); }
.routing-state.active { color: var(--text); }
.routing-state.active > span { background: var(--theme-success); }
.record-breadcrumb { display: flex; align-items: center; gap: .65rem; margin: 0 0 .8rem; color: var(--muted); font-size: .75rem; }
.record-breadcrumb strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.customer-record-header,
.invoice-record-header,
.inbound-record-header { display: grid; grid-template-columns: auto minmax(14rem, 1.1fr) minmax(24rem, 1.5fr) auto; align-items: center; gap: 1rem; margin-bottom: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.customer-record-icon { width: 3.25rem; height: 3.25rem; font-size: 1.6rem; }
.customer-record-identity div,
.invoice-record-title > div,
.inbound-record-title > div { display: flex; align-items: center; gap: .65rem; }
.customer-record-identity h1,
.invoice-record-title h1,
.inbound-record-title h1 { margin: 0; font-size: 1.35rem; }
.customer-record-identity > small,
.invoice-record-title > small,
.inbound-record-title > small { display: block; margin-top: .18rem; color: var(--muted); font-size: .72rem; }
.customer-record-facts,
.invoice-record-header > dl,
.inbound-record-header > dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0; }
.customer-record-facts div,
.invoice-record-header > dl div,
.inbound-record-header > dl div { min-width: 0; }
.customer-record-facts dt,
.invoice-record-header dt,
.inbound-record-header dt { color: var(--muted); font-size: .64rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.customer-record-facts dd,
.invoice-record-header dd,
.inbound-record-header dd { margin: .15rem 0 0; overflow-wrap: anywhere; font-size: .78rem; font-weight: 700; }
.customer-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding-top: .8rem; }
.customer-overview-grid:not([hidden]) { display: grid; }
.customer-overview-card { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.customer-overview-card h2 { margin: 0 0 .8rem; font-size: .92rem; }
.record-definition-list { display: grid; gap: .55rem; margin: 0; }
.record-definition-list > div { display: grid; grid-template-columns: minmax(8rem, .42fr) minmax(0, 1fr); gap: .75rem; }
.record-definition-list dt { color: var(--muted); font-size: .75rem; }
.record-definition-list dd { margin: 0; overflow-wrap: anywhere; font-size: .78rem; }
.customer-overview-card p { margin: 0; }
.customer-overview-card p small,
.customer-overview-card > a { display: block; margin-top: .4rem; font-size: .78rem; }
.customer-overview-card address { color: var(--theme-text-body); font-size: .8rem; font-style: normal; line-height: 1.65; }
.customer-commercial-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .35rem 0 .15rem; }
.customer-commercial-heading h2 { margin: 0; font-size: 1.1rem; }
.customer-commercial-heading p { max-width: 52rem; margin: .35rem 0 0; color: var(--muted); font-size: .82rem; }
.customer-commercial-summary { margin-top: 1rem; }
.customer-commercial-table { min-width: 48rem; }
.customer-commercial-permissions { margin-top: 1rem; }

/* Invoice and inbound detail */
.invoice-record-header,
.inbound-record-header { grid-template-columns: minmax(16rem, 1.2fr) minmax(24rem, 1.4fr) auto; }
.delivery-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem; }
.delivery-summary-card { display: grid; align-content: start; min-width: 0; min-height: 9rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.delivery-summary-card strong { margin-top: .4rem; overflow-wrap: anywhere; }
.delivery-summary-card > span:last-of-type { margin-top: .3rem; color: var(--muted); font-size: .78rem; }
.delivery-summary-card > a { justify-self: start; margin-top: 1rem; }
.inbound-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; }
.inbound-kpi-card { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
.inbound-kpi-card > span { display: grid; width: 2.6rem; height: 2.6rem; place-items: center; border-radius: 50%; color: var(--theme-info); background: color-mix(in srgb, var(--theme-info) 12%, var(--theme-surface)); font-weight: 850; }
.inbound-kpi-card[data-tone="warning"] > span { color: var(--theme-warning); background: color-mix(in srgb, var(--theme-warning) 12%, var(--theme-surface)); }
.inbound-kpi-card[data-tone="danger"] > span { color: var(--theme-danger); background: color-mix(in srgb, var(--theme-danger) 12%, var(--theme-surface)); }
.inbound-kpi-card strong { font-size: 1.4rem; }
.inbound-kpi-card p { margin: 0; font-size: .82rem; font-weight: 700; }
.inbound-kpi-card small { color: var(--muted); font-size: .7rem; }
.lifecycle-timeline { display: grid; gap: 0; margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); list-style: none; }
.lifecycle-timeline li { position: relative; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .75rem; min-height: 4.25rem; }
.lifecycle-timeline li:not(:last-child)::after { position: absolute; top: 1.75rem; bottom: 0; left: .85rem; width: 2px; background: var(--line); content: ""; }
.lifecycle-timeline li > span { position: relative; z-index: 1; display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border: 2px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--theme-surface); font-size: .7rem; font-weight: 850; }
.lifecycle-timeline li[data-state="complete"] > span { border-color: var(--theme-success); color: #fff; background: var(--theme-success); }
.lifecycle-timeline li[data-state="current"] > span { border-color: var(--theme-info); color: var(--theme-info); }
.lifecycle-timeline li[data-state="complete"]:not(:last-child)::after { background: var(--theme-success); }
.lifecycle-timeline strong,
.lifecycle-timeline small { display: block; }
.lifecycle-timeline small { margin-top: .25rem; color: var(--muted); }

@media (max-width: 1099px) {
    .quotation-create-main-grid,
    .invoice-create-main-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-shell { grid-template-columns: minmax(0, 1fr); }
    .workspace-shell .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 18rem);
        transform: translateX(-105%);
        transition: transform var(--theme-motion-medium);
    }
    .workspace-shell .app-sidebar.mobile-open { transform: translateX(0); }
    .sidebar-toggle { display: inline-grid !important; place-items: center; }
    .sidebar-close { display: inline-grid; place-items: center; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 35; display: block; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--theme-overlay-surface); box-shadow: none; }
    .appearance-card { grid-template-columns: 1fr; }
    .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customer-record-header,
    .invoice-record-header,
    .inbound-record-header { grid-template-columns: auto minmax(0, 1fr); }
    .customer-record-facts,
    .invoice-record-header > dl,
    .inbound-record-header > dl { grid-column: 1 / -1; }
    .customer-edit-action,
    .invoice-record-header > a,
    .inbound-record-header > a { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 767px) {
    .quotation-create-main-grid,
    .invoice-create-main-grid,
    .credit-note-create-main-grid,
    .quotation-create-copy-grid { grid-template-columns: 1fr; }
    .credit-note-line-heading { align-items: stretch; flex-direction: column; padding: 1rem; }
    .credit-note-line-choice { align-self: flex-start; }
    .credit-note-line-content { grid-template-columns: 1fr; padding: 1rem; }
    .credit-note-line-facts { grid-template-columns: 1fr; }
    .rich-text-toolbar .trix-dialog__link-fields { align-items: stretch; flex-direction: column; }
    .rich-text-toolbar .trix-input--dialog { width: 100%; min-width: 0; }
    button,
    .button,
    .button-link,
    input,
    textarea,
    select { min-height: 2.75rem; }
    .workspace-header { padding: 0 .75rem; }
    .workspace-header-actions { gap: .5rem; }
    .service-status { width: .6rem; overflow: hidden; }
    .service-status > span { flex: 0 0 auto; }
    .workspace-header-user > span:last-child { display: none; }
    .workspace-content { padding: 1rem .75rem 1.5rem; }
    .dashboard-heading,
    .section-heading,
    .subsection-heading { display: grid; }
    .section-heading > .button,
    .subsection-heading > .button-link,
    .subsection-heading > a { justify-self: start; }
    .record-tabs { margin-inline: -.75rem; padding-inline: .75rem; border-radius: 0; }
    .auth-page { width: calc(100% - 1.5rem); padding: 1rem 0 2rem; }
    .login-wrap { grid-template-columns: 1fr; gap: 1.5rem; min-height: 0; margin: .75rem auto 0; }
    .login-intro h1 { font-size: 2.125rem; }
    .card.login-card,
    .auth-form-card { width: 100%; padding: 1.25rem; }
    .appearance-options { grid-template-columns: 1fr; }
    .appearance-option { grid-template-columns: 1.2rem 5.5rem minmax(0, 1fr); }
    .appearance-preview { grid-column: 2; height: 3.8rem; }
    .dashboard-kpi-grid,
    .dashboard-lower-grid,
    .customer-overview-grid:not([hidden]),
    .delivery-summary-grid,
    .inbound-kpi-grid { grid-template-columns: 1fr; }
    .dashboard-kpi-card > a { justify-self: start; }
    .pilotage-summary-heading { display: grid; }
    .pilotage-summary-heading .status-chip,
    .pilotage-summary-controls { justify-self: start; }
    .pilotage-summary-controls,
    .pilotage-currency-form { width: 100%; }
    .pilotage-currency-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .pilotage-period-form { display: grid; grid-template-columns: 1fr; width: 100%; }
    .pilotage-period-form label { min-width: 0; }
    .pilotage-active-filter { align-items: flex-start; flex-direction: column; }
    .customer-record-header,
    .invoice-record-header,
    .inbound-record-header { grid-template-columns: 1fr; align-items: start; }
    .customer-record-icon { display: none; }
    .customer-record-facts,
    .invoice-record-header > dl,
    .inbound-record-header > dl { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
    .customer-edit-action,
    .invoice-record-header > a,
    .inbound-record-header > a { grid-column: auto; width: 100%; }
    .record-definition-list > div { grid-template-columns: 1fr; gap: .15rem; }
    .otp-cells { gap: .38rem; }
    .otp-cells input { height: 3rem; font-size: 1.15rem; }
    .business-table { font-size: .82rem; }
    .table-sort-mobile { display: flex; align-items: flex-end; gap: .65rem; margin-bottom: .75rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); }
    .table-sort-mobile label { flex: 1 1 auto; margin: 0; color: var(--theme-text-subtle); font-size: .7rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
    .table-sort-mobile select { min-height: 2.35rem; margin: .3rem 0 0; padding: .42rem .55rem; font-size: .78rem; text-transform: none; }
    .table-sort-mobile .table-sort-direction { flex: 0 0 auto; min-height: 2.35rem; margin: 0; }
    .business-table-shell:has(.responsive-business-table) { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .responsive-business-table,
    .responsive-business-table tbody,
    .responsive-business-table tr,
    .responsive-business-table td { display: block; width: 100%; min-width: 0; }
    .responsive-business-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .responsive-business-table tbody { display: grid; gap: .75rem; }
    .responsive-business-table tr { padding: .85rem; border: 1px solid var(--line); border-radius: var(--theme-radius-card); background: var(--theme-surface); box-shadow: 0 1px 2px rgba(18, 52, 91, .04); }
    .responsive-business-table td { display: grid; grid-template-columns: minmax(6.5rem, .38fr) minmax(0, 1fr); gap: .75rem; padding: .45rem 0; border: 0; }
    .responsive-business-table td::before { color: var(--muted); content: attr(data-label); font-size: .7rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
    .responsive-business-table .responsive-table-action { display: block; padding-top: .75rem; border-top: 1px solid var(--line); }
    .responsive-business-table .responsive-table-action::before { content: none; }
    .responsive-business-table .responsive-table-action a { width: 100%; }
    .responsive-business-table .customer-name-cell { display: grid; grid-template-columns: 2rem minmax(0, 1fr); }
    .responsive-business-table .customer-name-cell::before { display: none; }
    .responsive-business-table .customer-name-cell .customer-row-icon { grid-column: 1; }
    .responsive-business-table .customer-name-cell > span:last-child { grid-column: 2; }
    .responsive-business-table .customer-name-cell + td { padding-top: 0; }
    .responsive-business-table .customer-name-cell ~ .responsive-table-action { display: flex; justify-content: flex-end; margin-top: -.2rem; padding-top: .4rem; }
    .responsive-business-table .customer-name-cell ~ .responsive-table-action a { width: auto; min-width: 2.75rem; }
    .responsive-business-table .empty-table-cell { display: block; text-align: center; }
    .responsive-business-table .empty-table-cell::before { content: none; }
}

@media (min-width: 1440px) {
    .workspace-shell { grid-template-columns: 15.5rem minmax(0, 1fr); }
    .workspace-content { padding-inline: 2.5rem; }
}
