:root {
    --ink: #202744;
    --muted: #7b8298;
    --line: #d9dde7;
    --surface: #f7f8fb;
    --surface-soft: #f1f3f7;
    --surface-muted: #e9edf2;
    --surface-hover: #edf1f4;
    --surface-glass: rgba(247,248,251,.94);
    --canvas: #e9ecf3;
    --primary: #5146c7;
    --primary-dark: #3b32a5;
    --accent: #d18a28;
    --danger: #b83b3b;
    --success: #237b58;
    --warning: #9a6209;
    --control-border: #bdc6cf;
    --soft-text: #56636f;
    --shadow-color: rgba(37,43,78,.10);
    --focus-ring: rgba(81,70,199,.18);
    --on-primary: #ffffff;
    --radius: 14px;
    color-scheme: light;
    font-family: Inter, Aptos, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

.confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(15 23 42 / 58%);
    backdrop-filter: blur(3px);
}

.confirm-dialog {
    width: min(100%, 30rem);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 24px 70px rgb(15 23 42 / 30%);
}

.confirm-dialog h2 { margin: 0 0 .4rem; }
.confirm-dialog p { margin: 0; color: var(--muted); line-height: 1.55; }
.confirm-dialog .form-actions { grid-column: 1 / -1; justify-content: flex-end; margin-top: .5rem; }
.confirm-dialog-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: .8rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.confirm-dialog-icon.permanent {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.confirm-dialog-icon .action-icon { width: 1.4rem; height: 1.4rem; }
.application-error-state { width: min(100%, 720px); display: grid; grid-template-columns: auto minmax(0,1fr); gap: 1rem; margin: 2rem auto; padding: 1.35rem; border: 1px solid color-mix(in srgb,var(--danger) 32%,var(--line)); border-radius: var(--radius); color: var(--ink); background: var(--surface); box-shadow: 0 16px 38px var(--shadow-color); }
.application-error-state h1, .application-error-state h2 { margin-bottom: .35rem; }
.application-error-state p { margin-bottom: .9rem; color: var(--muted); }
.application-error-state small { display: block; margin-top: .8rem; color: var(--muted); }
.application-error-icon { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: .8rem; color: var(--danger); background: color-mix(in srgb,var(--danger) 12%,transparent); }
.application-error-icon .action-icon { width: 1.4rem; height: 1.4rem; }
.icon-action-button {
    width: 2rem;
    min-height: 2rem;
    display: inline-grid;
    place-items: center;
    padding: .35rem;
}

:root[data-theme="dark"] {
    --ink: #edf0ff;
    --muted: #a3aac2;
    --line: #343b58;
    --surface: #1d2236;
    --surface-soft: #232941;
    --surface-muted: #272e48;
    --surface-hover: #292f49;
    --surface-glass: rgba(29,34,54,.94);
    --canvas: #121624;
    --primary: #897af4;
    --primary-dark: #b4aaff;
    --accent: #f0b35b;
    --danger: #ef7777;
    --success: #62c99c;
    --warning: #e5b45e;
    --control-border: #46506d;
    --soft-text: #bac0d4;
    --shadow-color: rgba(0,0,0,.28);
    --focus-ring: rgba(137,122,244,.28);
    --on-primary: #ffffff;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: var(--canvas); }
body { font-size: 15px; line-height: 1.5; transition: color .2s ease, background-color .2s ease; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.035em; }
h1:focus { outline: none; }
h2 { margin-bottom: .25rem; font-size: 1.15rem; }
h3 { margin-bottom: .2rem; font-size: 1rem; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 2rem; min-height: 68px; padding: 0 2.2rem; color: white; background: #12303a; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.brand { display: flex; align-items: center; gap: .75rem; color: white; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark, .login-brand { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: white; background: var(--primary); font-size: .82rem; font-weight: 900; letter-spacing: .08em; }
.main-nav { display: flex; align-self: stretch; align-items: center; gap: .25rem; }
.main-nav a { display: flex; align-items: center; height: 100%; padding: 0 .8rem; border-bottom: 3px solid transparent; color: #d7e3e6; font-weight: 650; }
.main-nav a:hover, .main-nav a.active { color: white; border-color: #48b2bd; text-decoration: none; }
.account-menu { display: flex; align-items: center; gap: 1rem; margin-left: auto; font-size: .9rem; }
.account-menu a, .account-menu .link-button { color: #d7e3e6; }
.account-menu form { margin: 0; }
.page-container { width: min(1540px, 100%); margin: 0 auto; padding: 2.3rem; }
.narrow-page { width: min(760px, 100%); margin: 0 auto; }

.page-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.request-list-toolbar { justify-content: space-between; }
.request-stage-note { max-width: 52rem; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.heading-actions, .form-actions, .card-actions, .row-actions, .report-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.eyebrow { display: block; margin-bottom: .35rem; color: var(--primary); font-size: .75rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small-text { font-size: .82rem; }
.clamp { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: 360px; }

.panel { margin-bottom: 1.25rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 32px var(--shadow-color); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.panel-heading p { margin: 0; color: var(--muted); }
.panel-heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
.loading, .empty-state { padding: 2.5rem 1rem; color: var(--muted); text-align: center; }
.alert { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid; border-radius: 10px; }
.alert.success { color: #175a3f; border-color: #a9d8c5; background: #ecf8f2; }
.alert.error { color: #8b2828; border-color: #e5b5b5; background: #fff0f0; }
.alert.warning { color: #75500d; border-color: #ead199; background: #fff8e7; }

.button, button.primary, button.secondary, button.danger-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: .58rem .9rem; border: 1px solid transparent; border-radius: 9px; font-weight: 750; line-height: 1; text-decoration: none; }
.button:hover { text-decoration: none; }
.button.primary, button.primary { color: var(--on-primary); background: var(--primary); }
.button.primary:hover, button.primary:hover { background: var(--primary-dark); }
.button.secondary, button.secondary { color: var(--ink); border-color: var(--control-border); background: var(--surface); }
button.danger-button, .button.danger { color: var(--on-primary); background: var(--danger); }
button.danger-button:hover, .button.danger:hover { filter: brightness(.92); }
button.small, .button.small { min-height: 32px; padding: .4rem .6rem; font-size: .82rem; }
button.full, .button.full { width: 100%; }
.action-icon { display: block; flex: 0 0 auto; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-button, .row-actions a, .card-actions a, .action-menu a, .action-menu summary { display: inline-flex; align-items: center; gap: .35rem; }
.link-button { padding: 0; border: 0; color: var(--primary-dark); background: transparent; }
.file-upload-button { display: inline-flex; grid-auto-flow: column; align-items: center; justify-content: center; gap: .45rem; width: fit-content; min-height: 40px; padding: .58rem .9rem; border: 1px solid var(--control-border); border-radius: 9px; color: var(--ink); background: var(--surface); cursor: pointer; }
.file-upload-button:hover { color: var(--primary); border-color: var(--primary); }
.visually-hidden-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .6; }

.stack-form { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; color: var(--soft-text); font-size: .86rem; font-weight: 700; }
input:not([type=checkbox]), select, textarea { width: 100%; min-height: 42px; padding: .62rem .72rem; border: 1px solid var(--control-border); border-radius: 8px; color: var(--ink); background: var(--surface); outline: none; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.valid.modified:not([type=checkbox]) { border-color: var(--success); }
.invalid { border-color: var(--danger) !important; }
.validation-message, .validation-errors { color: var(--danger); }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1.25rem; }
.check-field, .permission-grid label { display: inline-flex; flex: 0 0 auto; align-items: center; justify-self: start; width: fit-content; inline-size: fit-content; min-width: 0; max-width: 100%; gap: .5rem; }
.check-field { white-space: nowrap; }
.check-field input { width: 17px; height: 17px; }
fieldset { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 .35rem; font-weight: 800; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.department-checkbox-list { display: grid; gap: .8rem; }
.department-checkbox-all-row { padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.department-checkbox-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; row-gap: .75rem; }
.department-checkbox-all-row label, .department-checkbox-options label { display: inline-flex; align-items: center; justify-self: start; width: fit-content; inline-size: fit-content; max-width: 100%; gap: .5rem; }
.signature-preview { width: 220px; height: 80px; object-fit: contain; border: 1px solid var(--line); background: var(--surface); }
.sticky-actions { position: sticky; bottom: 1rem; z-index: 5; justify-content: flex-end; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-glass); box-shadow: 0 8px 28px var(--shadow-color); backdrop-filter: blur(8px); }

.toolbar, .filter-grid { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .9rem; margin-bottom: 1rem; }
.filter-grid > label { min-width: 150px; }
.filter-grid .wide { flex: 1 1 320px; }
.search-field { min-width: 280px; flex: 1; }
.list-filter-toolbar { align-items: flex-end; }
.list-search-field { flex: 0 1 50%; width: 50%; }
.list-inactive-toggle { align-self: flex-end; min-height: 40px; }
label:has(> input[type=checkbox]) { display: inline-flex; flex: 0 0 auto; align-items: center; justify-self: start; width: fit-content; inline-size: fit-content; min-width: 0; max-width: 100%; min-height: 0; padding: 0; gap: .5rem; cursor: pointer; }
label:has(> input[type=checkbox]) > input[type=checkbox] { flex: 0 0 auto; cursor: pointer; }
label:has(> input[type=checkbox]:disabled) { cursor: not-allowed; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .72rem .65rem; color: var(--soft-text); background: var(--surface-muted); font-size: .76rem; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
td { padding: .8rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td > small, .table-secondary-text { display: block; margin-top: .32rem; color: var(--muted); line-height: 1.35; }
tbody tr:hover { background: var(--surface-hover); }
td.number, th.number { text-align: right; white-space: nowrap; }
.request-number { color: var(--primary-dark); font-weight: 850; }
.request-number-tag { display: inline-flex; align-items: center; width: fit-content; padding: .14rem .44rem; border: 1px solid color-mix(in srgb,var(--primary) 28%,var(--line)); border-radius: 999px; color: var(--primary-dark); background: color-mix(in srgb,var(--primary) 10%,var(--surface)); font-size: .72rem; font-weight: 850; line-height: 1.2; letter-spacing: .015em; white-space: nowrap; }
.request-number-tag:hover { border-color: color-mix(in srgb,var(--primary) 55%,var(--line)); color: var(--primary); background: color-mix(in srgb,var(--primary) 16%,var(--surface)); text-decoration: none; }
.request-number-tag:focus-visible { outline: 2px solid color-mix(in srgb,var(--primary) 65%,transparent); outline-offset: 2px; }
.request-linked-text { display: inline; }
.attachment-mark { display: inline-block; margin-top: .25rem; color: var(--muted); font-size: .78rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.tag-list span { padding: .12rem .38rem; border-radius: 5px; background: #eaf0f2; color: #45545f; font-size: .72rem; }
.tag-list .confidential { color: #6c3d84; background: #f4eafa; }

.status, .approval-dot { display: inline-flex; width: fit-content; padding: .22rem .48rem; border-radius: 999px; font-size: .73rem; font-weight: 800; white-space: nowrap; }
.status.pendingapproval, .status.pending, .approval-dot.pending { color: #85590a; background: #fff1cc; }
.status.approved, .approval-dot.approved, .status.paid { color: #166344; background: #dff4e9; }
.status.exempted { color: #125a71; background: #dff2f7; }
.status.paymentpreparation, .status.paymentapproval { color: #125a71; background: #dff2f7; }
.status.cancelled, .approval-dot.rejected { color: #8b2828; background: #fae2e2; }
.approval-dot.notrequired { color: #65717b; background: #e9edef; }
.approval-stack { display: grid; gap: .25rem; }
.action-menu { position: relative; }
.action-menu summary { cursor: pointer; color: var(--primary-dark); font-weight: 750; list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu > div { position: absolute; left: auto; right: 0; z-index: 12; display: grid; min-width: 210px; padding: .45rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 12px 34px var(--shadow-color); }
.action-menu > div > * { display: flex; align-items: center; justify-content: flex-start; gap: .4rem; width: 100%; padding: .48rem .55rem; text-align: left; }
.approval-action-form { display: inline-flex; margin: 0; }
.action-menu > div > .approval-action-form { width: 100%; padding: 0; }
.action-menu > div > .approval-action-form > button { width: 100%; padding: .48rem .55rem; justify-content: flex-start; }
.table-action-menu > div > .receive-action-form { width: 100%; }
.request-table .action-menu > summary { display: grid; width: 34px; min-height: 34px; padding: 0; place-items: center; border-radius: 8px; color: var(--muted); }
.request-table .action-menu > summary:hover, .request-table .action-menu[open] > summary { color: var(--primary); background: color-mix(in srgb,var(--primary) 10%,var(--surface)); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.metric { display: grid; gap: .35rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.metric span { color: var(--muted); font-size: .84rem; }
.metric strong { color: var(--primary-dark); font-size: 2rem; }
.metric.accent { border-color: #dbbe86; background: #fffaf0; }
.metric.accent strong { color: #8b5b09; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .8fr); gap: 1.25rem; }
.request-cards { display: grid; gap: .65rem; }
.request-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; padding: .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.request-card p { margin: 0; color: var(--muted); }
.request-card .card-actions { grid-column: 1 / -1; justify-content: flex-end; }
.request-meta { display: grid; align-content: start; justify-items: end; gap: .25rem; white-space: nowrap; }
.request-meta span { color: var(--muted); font-size: .8rem; }
.link-card { color: inherit; }
.link-card:hover { border-color: #82b8c0; text-decoration: none; }

.vendor-summary { display: grid; gap: .2rem; padding: .7rem; border-left: 3px solid var(--primary); color: var(--muted); background: var(--surface-soft); }
.line-editor { display: grid; grid-template-columns: 160px minmax(180px,1fr) minmax(160px,1fr) minmax(180px,1.4fr) 130px auto; align-items: end; gap: .75rem; margin: 1rem 0; }
.line-editor > *, .compact-line-editor > * { min-width: 0; }
.line-editor input[type=date], .compact-line-editor input[type=date] { min-width: 0; }
.total { color: var(--primary-dark); font-size: 1.25rem; }
.file-list { margin-bottom: 0; }
.file-list li { margin: .3rem 0; }
.file-list span { margin-left: .5rem; color: var(--muted); }

.request-compact-form { display: grid; gap: .75rem; }
.request-compact-grid { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(280px,.75fr); gap: .75rem; }
.compact-request-panel { margin: 0; padding: 1rem; }
.compact-request-panel h2 { margin: 0; font-size: 1rem; }
.compact-panel-heading { margin-bottom: .7rem; }
.compact-panel-heading p { margin-top: .15rem; font-size: .72rem; }
.compact-request-editor label { gap: .25rem; font-size: .75rem; }
.compact-request-editor input:not([type=checkbox]), .compact-request-editor select, .compact-request-editor textarea { min-height: 36px; padding: .48rem .58rem; }
.compact-request-editor input[readonly] { color: var(--muted); background: var(--surface-muted); cursor: not-allowed; }
.compact-request-editor textarea { min-height: 66px; }
.request-number-chip { padding: .3rem .55rem; border-radius: 999px; color: var(--primary-dark); background: color-mix(in srgb,var(--primary) 10%,var(--surface)); font-size: .68rem; font-weight: 750; white-space: nowrap; }
.compact-payment-grid { display: grid; grid-template-columns: minmax(0,1fr) 155px; align-items: end; gap: .65rem; }
.compact-field-grid { gap: .65rem; margin-top: .65rem; }
.compact-vendor-summary { grid-template-columns: minmax(0,1fr) minmax(130px,.35fr); gap: .65rem; margin-top: .55rem; padding: .55rem .65rem; }
.compact-vendor-summary > div { display: grid; gap: .1rem; min-width: 0; }
.compact-vendor-summary span { font-size: .65rem; font-weight: 750; text-transform: uppercase; }
.compact-vendor-summary strong { overflow: hidden; color: var(--ink); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.approval-route-list { display: grid; gap: .6rem; }
.approval-select-row { display: grid; grid-template-columns: minmax(0,1fr) 36px; align-items: end; gap: .4rem; }
.approval-pool-row { display: grid; grid-template-columns: minmax(0,1fr) 36px; align-items: center; gap: .4rem; min-height: 58px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface-soft); }
.approval-pool-row > div { display: grid; gap: .08rem; min-width: 0; }
.approval-pool-row span { color: var(--muted); font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.approval-pool-row strong { color: var(--ink); font-size: .8rem; }
.approval-pool-row small { color: var(--muted); font-size: .68rem; line-height: 1.25; }
.approval-pool-row > .action-icon { width: 22px; height: 22px; color: var(--primary); justify-self: center; }
button.compact-icon-button { width: 36px; min-height: 36px; padding: 0; }
.compact-line-editor { display: grid; grid-template-areas: "date payee type description amount actions"; grid-template-columns: 155px minmax(180px,1fr) minmax(155px,.9fr) minmax(180px,1.25fr) 120px auto; align-items: end; column-gap: .75rem; row-gap: .6rem; }
.line-date-field { grid-area: date; }
.line-payee-field { grid-area: payee; }
.line-type-field { grid-area: type; }
.line-description-field { grid-area: description; }
.line-amount-field { grid-area: amount; }
.line-editor-actions { display: flex; align-items: center; gap: .35rem; }
.compact-line-editor .line-editor-actions { grid-area: actions; }
.line-editor-actions button { white-space: nowrap; }
.compact-line-table { margin-top: .75rem; }
.compact-line-table th, .compact-line-table td { padding: .55rem .6rem; }
.compact-line-table tr.selected-row { background: color-mix(in srgb,var(--primary) 10%,var(--surface)); box-shadow: inset 3px 0 0 var(--primary); }
.floating-table-action-menu.is-floating > div,
.table-action-menu.is-floating > div { position: fixed; top: var(--floating-menu-top); left: var(--floating-menu-left); right: auto; z-index: 1000; visibility: visible; }
.floating-table-action-menu.positioning > div,
.table-action-menu.positioning > div { visibility: hidden; }
.compact-empty-state { margin-top: .7rem; padding: .75rem; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); background: var(--surface-soft); font-size: .75rem; text-align: center; }
.request-attachments-panel .file-upload-button { min-height: 36px; padding: .45rem .7rem; }
.pending-attachment-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: .6rem; }
.pending-attachment-card { display: grid; grid-template-columns: 48px minmax(0,1fr) 30px; align-items: center; gap: .5rem; padding: .45rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.pending-attachment-card img { width: 48px; height: 48px; border-radius: 7px; object-fit: cover; background: var(--surface-muted); }
.pending-file-preview { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 7px; background: color-mix(in srgb,var(--primary) 10%,var(--surface-muted)); color: var(--primary); }
.pending-file-preview .action-icon { width: 20px; height: 20px; }
.pending-file-preview span { font-size: .55rem; font-weight: 800; letter-spacing: .04em; }
.pending-attachment-card > div { display: grid; min-width: 0; }
.pending-attachment-card strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.pending-attachment-card span { color: var(--muted); font-size: .66rem; }
.pending-attachment-card button.attachment-remove-button { display: grid; grid-column: 3; grid-row: 1; width: 30px; min-height: 30px; padding: 0; place-items: center; color: var(--danger); }
.request-compact-form .sticky-actions { bottom: .5rem; margin-top: 0; padding: .55rem .7rem; }

.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.summary-strip > div { display: grid; gap: .2rem; padding: 1rem; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border: 0; }
.summary-strip span:first-child { color: var(--muted); font-size: .78rem; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(360px,.9fr); gap: 1.25rem; }
.detail-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .9rem; }
.detail-list div { display: grid; gap: .15rem; }
.detail-list .full { grid-column: 1 / -1; }
.detail-list dt { color: var(--muted); font-size: .78rem; }
.detail-list dd { margin: 0; font-weight: 650; }
.link-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; margin-top: 1.2rem; }
.link-grid a { display: inline-flex; align-items: center; gap: .4rem; }
.timeline { display: grid; }
.timeline-item { position: relative; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; gap: .65rem; padding-bottom: 1.25rem; }
.timeline-item::before { content: ""; position: absolute; left: 6px; top: 13px; bottom: 0; width: 2px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-marker { position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 4px; border: 3px solid var(--surface); border-radius: 50%; outline: 2px solid #aeb9bf; background: #aeb9bf; }
.timeline-item.approved .timeline-marker { outline-color: var(--success); background: var(--success); }
.timeline-item.rejected .timeline-marker { outline-color: var(--danger); background: var(--danger); }
.timeline-item p { margin: 0; color: var(--muted); }
.timeline-item small { color: var(--muted); }
.activity-history .activity-title,
.activity-history .activity-metadata { display: block; }
.activity-history .activity-metadata { margin-top: .22rem; }
.request-comments { margin-top: 1rem; }
.comment-composer { display: grid; gap: .5rem; margin-bottom: 1rem; padding: .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.comment-composer > label { font-size: .78rem; font-weight: 700; }
.comment-input-wrap { position: relative; }
.comment-mention-editor { position: relative; }
.comment-input-wrap textarea { width: 100%; min-height: 94px; resize: vertical; }
.comment-mention-editor-rich { display: none; width: 100%; min-height: 94px; max-height: 280px; overflow-y: auto; padding: .62rem .72rem; border: 1px solid var(--control-border); border-radius: 8px; color: var(--ink); background: var(--surface); outline: none; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-mention-editor-rich:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.comment-mention-editor-rich:empty::before { color: var(--muted); content: attr(data-placeholder); pointer-events: none; }
.comment-mention-editor[data-enhanced="true"] .comment-mention-editor-rich { display: block; }
.comment-mention-editor[data-enhanced="true"] .comment-mention-editor-fallback { display: none; }
.comment-mention-editor.force-fallback .comment-mention-editor-rich { display: none; }
.comment-mention-editor.force-fallback .comment-mention-editor-fallback { display: block; }
.comment-mention-editor-rich .comment-mention-editor-tag { margin: 0 .08rem; padding: .08rem .42rem; font-size: .86rem; line-height: 1.35; cursor: default; user-select: all; }
.mention-suggestions { position: absolute; top: calc(100% + .35rem); left: 0; right: 0; z-index: 70; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 16px 40px var(--shadow-color); }
.mention-suggestions[hidden] { display: none; }
.comment-mention-editor[data-enhanced="true"] .comment-mention-server-suggestions { display: none; }
.mention-suggestions button { width: 100%; display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: .65rem; padding: .65rem .75rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; text-align: left; }
.mention-suggestions button:last-child { border-bottom: 0; }
.mention-suggestions button:hover { background: var(--surface-hover); }
.mention-suggestions button > span:last-child { min-width: 0; display: grid; }
.mention-suggestions small { overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.mention-avatar,
.comment-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--primary); font-weight: 800; }
.mention-avatar { width: 32px; height: 32px; font-size: .65rem; }
.comment-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.comment-actions > span { color: var(--muted); font-size: .7rem; }
.comment-actions button { display: inline-flex; align-items: center; gap: .4rem; }
.comment-permission-note { margin: 0 0 1rem; }
.comment-empty { padding: 1rem; }
.comment-thread { display: grid; gap: .75rem; }
.comment-item { display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: start; gap: .75rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.comment-item:first-child { border-top: 0; }
.comment-avatar { width: 38px; height: 38px; font-size: .72rem; }
.comment-content { min-width: 0; }
.comment-content header { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.comment-content time { flex: 0 0 auto; color: var(--muted); font-size: .7rem; }
.comment-content p { margin: .3rem 0 0; overflow-wrap: anywhere; color: var(--soft-text); line-height: 1.5; white-space: pre-wrap; }
.comment-mention-tag { display: inline-flex; align-items: center; margin: 0 .06rem; padding: .06rem .38rem; border: 1px solid color-mix(in srgb,var(--primary) 30%,var(--line)); border-radius: 999px; color: var(--primary-dark); background: color-mix(in srgb,var(--primary) 11%,var(--surface)); font-size: .78rem; font-weight: 800; line-height: 1.3; white-space: nowrap; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: 1px solid color-mix(in srgb,var(--danger) 42%,var(--line)); border-radius: 12px; background: color-mix(in srgb,var(--danger) 8%,var(--surface)); }
.danger-zone p { margin: 0; color: var(--muted); }

.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 1rem; }
.attachment-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.attachment-card img { display: block; width: 100%; height: 210px; object-fit: contain; background: var(--surface-muted); }
.attachment-preview-link { display: block; }
.attachment-file-preview { display: grid; height: 210px; place-content: center; justify-items: center; gap: .65rem; background: var(--surface-muted); color: var(--primary); }
.attachment-file-preview .action-icon { width: 42px; height: 42px; }
.attachment-file-preview span { font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.attachment-card > div { display: grid; padding: .7rem .85rem; }
.attachment-card > div span { color: var(--muted); font-size: .8rem; }
.attachment-card .card-actions { display: flex; justify-content: space-between; border-top: 1px solid var(--line); }

.report-toolbar { justify-content: flex-end; margin-bottom: 1rem; }
.print-report { width: min(980px,100%); margin: 0 auto; padding: 2.2rem; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 10px 35px var(--shadow-color); }
.print-report > header { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding-bottom: 1rem; border-bottom: 3px solid var(--ink); }
.print-report h1 { margin: 0; font-size: 1.8rem; text-transform: uppercase; }
.report-logo { display: grid; place-items: center; width: 58px; height: 58px; color: white; background: var(--primary); font-weight: 900; }
.report-number { display: grid; text-align: right; }
.report-number .request-number-tag { justify-self: end; margin: .12rem 0; }
.report-section { display: grid; grid-template-columns: 1.4fr .8fr; gap: 0; margin: 1rem 0; border: 1px solid #aeb8bd; }
.report-section > div { display: grid; padding: .5rem .65rem; border-right: 1px solid #c7d0d5; border-bottom: 1px solid #c7d0d5; }
.report-section .wide { grid-column: 1 / -1; }
.report-section span, .signature-grid span { color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.report-lines th, .report-lines td { border: 1px solid #aeb8bd; }
.report-lines td:last-child, .report-lines th:last-child { text-align: right; }
.total-row { font-weight: 800; }
.total-row td:first-child { text-align: right; }
.signature-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: .8rem; margin-top: 1.5rem; }
.signature-grid > div { display: grid; min-height: 120px; align-content: end; padding: .8rem; border: 1px solid #bdc6ca; text-align: center; }
.report-signature { width: 120px; height: 50px; margin: 0 auto; object-fit: contain; }

.login-shell { position: relative; display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: radial-gradient(circle at 25% 15%,color-mix(in srgb,var(--primary) 30%,transparent),transparent 35%),linear-gradient(145deg,color-mix(in srgb,#0e3440 88%,var(--canvas)),color-mix(in srgb,#0b5964 82%,var(--canvas))); }
.login-card { width: min(430px,100%); padding: 2rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 25px 80px rgba(0,0,0,.28); }
.login-card .login-brand { margin-bottom: 1rem; }
.login-app-icon { width: 72px; height: 72px; overflow: hidden; border-radius: 22px; background: transparent; box-shadow: 0 12px 28px rgba(13,117,132,.24); }
.login-app-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.login-product-subtitle { margin-bottom: 1.5rem; font-weight: 650; }
.login-theme-toggle { position: absolute; top: 1.25rem; right: 1.25rem; z-index: 2; color: var(--ink); background: var(--surface-glass); }
/* Modern application shell */
.modern-shell { display: grid; grid-template-columns: 272px minmax(0,1fr); min-height: 100vh; overflow-x: clip; background: var(--canvas); }
.modern-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 1.35rem 1rem 1rem; border-right: 1px solid var(--line); background: var(--surface); box-shadow: 8px 0 30px var(--shadow-color); }
.sidebar-brand { display: flex; align-items: center; gap: .8rem; min-height: 60px; margin: 0 .35rem 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { width: 45px; height: 45px; border-radius: 14px; box-shadow: 0 8px 18px rgba(13,117,132,.18); }
.sidebar-brand span { display: grid; line-height: 1.2; }
.sidebar-brand strong { font-size: 1rem; }
.sidebar-brand small { margin-top: .25rem; color: var(--muted); font-size: .73rem; }
.sidebar-navigation { display: grid; flex: 1 1 auto; grid-auto-rows: max-content; align-content: start; gap: .2rem; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.sidebar-label { margin: 1rem .75rem .35rem; color: var(--muted); font-size: .66rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.sidebar-link, .sidebar-group > summary { display: flex; align-items: center; gap: .85rem; width: 100%; min-height: 47px; padding: .65rem .75rem; border: 0; border-radius: 11px; color: var(--muted); background: transparent; font-weight: 650; line-height: 1.25; list-style: none; text-align: left; }
.sidebar-link:hover, .sidebar-group > summary:hover { color: var(--primary); background: color-mix(in srgb,var(--primary) 11%,var(--surface)); text-decoration: none; }
.sidebar-link.active { color: var(--on-primary); background: linear-gradient(135deg,#6258d8,#493dbb); box-shadow: 0 9px 22px rgba(81,70,199,.24); }
.nav-glyph { display: block; flex: 0 0 26px; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-group { display: block; }
.sidebar-group > summary { cursor: pointer; }
.sidebar-group > summary::-webkit-details-marker { display: none; }
.group-chevron { margin-left: auto; font-size: 1.2rem; transition: transform .2s ease; }
.sidebar-group[open] .group-chevron { transform: rotate(90deg); }
.sidebar-submenu { display: grid; gap: .1rem; margin: .15rem 0 .35rem 2.25rem; padding-left: .65rem; border-left: 1px solid var(--line); }
.sidebar-submenu a { padding: .48rem .55rem; border-radius: 8px; color: var(--muted); font-size: .79rem; font-weight: 600; }
.sidebar-submenu a:hover { color: var(--primary); background: color-mix(in srgb,var(--primary) 9%,var(--surface)); text-decoration: none; }
.sidebar-submenu a.active { color: var(--primary-dark); background: color-mix(in srgb,var(--primary) 14%,var(--surface)); box-shadow: inset 3px 0 0 var(--primary); font-weight: 750; text-decoration: none; }
.confidential-group > summary { color: color-mix(in srgb,#b04c88 68%,var(--ink)); }
.sidebar-footer { display: grid; gap: .15rem; margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--line); }
.mobile-menu-button, .sidebar-scrim { display: none; }
.modern-main { display: grid; grid-template-rows: auto minmax(0,1fr); min-width: 0; }
.modern-topbar { position: sticky; top: 0; z-index: 35; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 78px; padding: .8rem 2.2rem; border-bottom: 1px solid var(--line); background: var(--surface-glass); box-shadow: 0 5px 24px var(--shadow-color); backdrop-filter: blur(12px); }
.topbar-page-heading { min-width: 0; margin-right: auto; line-height: 1.1; }
.topbar-page-heading .eyebrow { margin-bottom: .35rem; font-size: .58rem; letter-spacing: .13em; }
.topbar-page-heading .topbar-request-number { margin-left: .42rem; padding: .08rem .34rem; font-size: .58rem; letter-spacing: .025em; vertical-align: middle; }
.topbar-page-heading h1 { overflow: hidden; margin: 0; font-size: 1.35rem; font-weight: 800; line-height: 1.05; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.topbar-alert-region { position: absolute; left: 50%; z-index: 2; width: min(42vw, 38rem); transform: translateX(-50%); pointer-events: none; }
.topbar-alert-message { display: flex; align-items: center; justify-content: center; gap: .7rem; min-height: 50px; padding: .55rem .9rem; border: 1px solid; border-radius: 12px; text-align: left; box-shadow: 0 8px 24px var(--shadow-color); pointer-events: auto; }
.topbar-alert-icon { width: 2rem; height: 2rem; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; }
.topbar-alert-icon .action-icon { width: 1.15rem; height: 1.15rem; }
.topbar-alert-copy { min-width: 0; display: grid; gap: .08rem; }
.topbar-alert-copy strong { font-size: .74rem; line-height: 1; letter-spacing: .035em; text-transform: uppercase; }
.topbar-alert-copy > span { overflow: hidden; font-size: .84rem; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.topbar-alert-message.success { color: #175a3f; border-color: #a9d8c5; background: #ecf8f2; }
.topbar-alert-message.success .topbar-alert-icon { background: #ccebdc; }
.topbar-alert-message.error { color: #8b2828; border-color: #e5b5b5; background: #fff0f0; }
.topbar-alert-message.error .topbar-alert-icon { background: #f4d1d1; }
.topbar-alert-message.warning { color: #75500d; border-color: #ead199; background: #fff8e7; }
.topbar-alert-message.warning .topbar-alert-icon { background: #f3e2b6; }
.topbar-account { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.topbar-notification-menu { position: relative; }
.topbar-notification-menu > summary { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-soft); box-shadow: 0 5px 16px var(--shadow-color); cursor: pointer; list-style: none; }
.topbar-notification-menu > summary::-webkit-details-marker { display: none; }
.topbar-notification-menu > summary:hover, .topbar-notification-menu[open] > summary { color: var(--primary); border-color: color-mix(in srgb,var(--primary) 45%,var(--line)); }
.topbar-notification-menu > summary .action-icon { width: 20px; height: 20px; }
.notification-badge { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--surface); border-radius: 999px; color: #fff; background: var(--danger); font-size: .63rem; font-weight: 850; line-height: 1; }
.notification-popover { position: absolute; top: calc(100% + .65rem); right: 0; z-index: 85; width: min(390px,calc(100vw - 2rem)); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 20px 55px var(--shadow-color); }
.notification-popover > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.notification-popover > header > div { display: grid; }
.notification-popover > header small { margin-top: .1rem; color: var(--muted); font-size: .72rem; }
.notification-popover > header .link-button { padding: .35rem; white-space: nowrap; }
.notification-mark-all-form { display: inline-flex; margin: 0; }
.notification-list { max-height: min(480px,70vh); overflow-y: auto; overscroll-behavior: contain; }
.notification-item { position: relative; width: 100%; display: grid; grid-template-columns: 34px minmax(0,1fr) 8px; align-items: start; gap: .7rem; margin: 0; padding: .85rem 1rem; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: var(--surface); text-align: left; }
.notification-item:last-child { border-bottom: 0; }
.notification-item:hover { background: var(--surface-hover); }
.notification-item.unread { background: color-mix(in srgb,var(--primary) 7%,var(--surface)); }
.notification-item-hit { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; text-decoration: none; }
.notification-item-hit:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
.notification-item > span { position: relative; z-index: 2; pointer-events: none; }
.notification-kind { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: color-mix(in srgb,var(--primary) 12%,var(--surface)); }
.notification-kind .action-icon { width: 18px; height: 18px; }
.notification-copy { min-width: 0; display: grid; }
.notification-item strong { overflow-wrap: anywhere; font-size: .82rem; line-height: 1.35; }
.notification-item small { margin-top: .18rem; overflow: hidden; color: var(--soft-text); font-size: .72rem; line-height: 1.35; text-overflow: ellipsis; }
.notification-item time { margin-top: .35rem; color: var(--muted); font-size: .65rem; }
.unread-dot { align-self: center; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.notification-empty { display: grid; place-items: center; gap: .55rem; padding: 2rem 1rem; color: var(--muted); }
.notification-empty .action-icon { width: 24px; height: 24px; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-width: 42px; height: 42px; padding: 0 .7rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-soft); box-shadow: 0 5px 16px var(--shadow-color); }
.theme-toggle:hover { color: var(--primary); border-color: color-mix(in srgb,var(--primary) 45%,var(--line)); }
.theme-toggle-icon { font-size: 1.15rem; line-height: 1; }
.theme-toggle-when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle-when-light { display: none; }
:root[data-theme="dark"] .theme-toggle-when-dark { display: inline-flex; }
.user-avatar, .mini-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--on-primary); background: linear-gradient(145deg,#5c51d1,#8b81ea); font-weight: 850; }
.user-avatar { width: 42px; height: 42px; border: 3px solid color-mix(in srgb,var(--primary) 18%,var(--surface)); font-size: .78rem; }
.user-copy { display: grid; min-width: 125px; line-height: 1.15; }
.user-copy small { color: var(--muted); font-size: .68rem; }
.user-copy strong { margin-top: .22rem; font-size: .82rem; }
.topbar-user-menu { position: relative; }
.topbar-user-menu > summary { display: flex; align-items: center; gap: .65rem; min-height: 50px; padding: .25rem .45rem; border-radius: 14px; cursor: pointer; list-style: none; }
.topbar-user-menu > summary::-webkit-details-marker { display: none; }
.topbar-user-menu > summary:hover, .topbar-user-menu[open] > summary { background: color-mix(in srgb,var(--primary) 10%,var(--surface)); }
.topbar-user-menu > summary:hover .user-copy strong, .topbar-user-menu[open] > summary .user-copy strong { color: var(--primary-dark); }
:root[data-theme="dark"] .topbar-user-menu > summary:hover, :root[data-theme="dark"] .topbar-user-menu[open] > summary { background: var(--surface-soft); }
:root[data-theme="dark"] .topbar-user-menu > summary:hover .user-copy strong, :root[data-theme="dark"] .topbar-user-menu[open] > summary .user-copy strong { color: var(--ink); }
.user-menu-popover { position: absolute; top: calc(100% + .55rem); right: 0; z-index: 80; min-width: 245px; padding: .45rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 45px var(--shadow-color); }
.user-menu-popover a { display: flex; align-items: center; gap: .75rem; padding: .7rem .75rem; border-radius: 10px; color: var(--ink); }
.user-menu-popover a:hover { color: var(--primary); background: color-mix(in srgb,var(--primary) 10%,var(--surface)); text-decoration: none; }
.user-menu-popover form { margin: 0; }
.user-menu-popover .user-menu-entry { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .7rem .75rem; border: 0; border-radius: 10px; color: var(--ink); background: transparent; text-align: left; }
.user-menu-popover .user-menu-entry:hover { color: var(--primary); background: color-mix(in srgb,var(--primary) 10%,var(--surface)); }
.user-menu-popover :is(a,.user-menu-entry) > .action-icon { flex: 0 0 auto; width: 30px; height: 30px; padding: 6px; border-radius: 9px; color: var(--primary); background: color-mix(in srgb,var(--primary) 12%,var(--surface)); }
.user-menu-popover :is(a,.user-menu-entry) > span:last-child { display: grid; line-height: 1.2; }
.user-menu-popover small { margin-top: .2rem; color: var(--muted); font-size: .68rem; }
.modern-content { min-width: 0; padding: 2rem 2.2rem 2.5rem; }
.modern-content > section { width: min(1560px,100%); margin-inline: auto; }

/* Modern dashboard */
.modern-metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; margin-bottom: 1.35rem; }
.modern-metric-grid.without-approval { grid-template-columns: repeat(3,minmax(0,1fr)); }
.modern-metric-card { position: relative; display: grid; grid-template-columns: 48px minmax(0,1fr); gap: .9rem; min-height: 138px; padding: 1.15rem; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 12px 30px var(--shadow-color); }
a.modern-metric-card:hover { border-color: #d6d2f5; transform: translateY(-2px); text-decoration: none; box-shadow: 0 15px 34px rgba(53,47,128,.1); }
.modern-metric-card::after { position: absolute; right: -25px; bottom: -35px; width: 110px; height: 110px; border-radius: 50%; content: ""; opacity: .08; background: currentColor; }
.metric-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: var(--on-primary); font-size: 1.15rem; font-weight: 850; }
.modern-metric-card.violet { color: #5649c7; }.modern-metric-card.violet .metric-icon { background: linear-gradient(145deg,#6256d7,#4e41bb); }
.modern-metric-card.coral { color: #e06d75; }.modern-metric-card.coral .metric-icon { background: linear-gradient(145deg,#f28a91,#d95d68); }
.modern-metric-card.amber { color: #d58a2d; }.modern-metric-card.amber .metric-icon { background: linear-gradient(145deg,#f2ad4f,#ca7821); }
.modern-metric-card.blue { color: #3686d9; }.modern-metric-card.blue .metric-icon { background: linear-gradient(145deg,#54a1ec,#2777cb); }
.modern-metric-card.green { color: #31a879; }.modern-metric-card.green .metric-icon { background: linear-gradient(145deg,#50c996,#279b6e); }
.modern-metric-card > div { display: grid; align-content: start; }
.modern-metric-card small { color: var(--muted); font-size: .75rem; font-weight: 650; }
.modern-metric-card strong { margin: .1rem 0; color: var(--ink); font-size: 1.85rem; line-height: 1.1; }
.modern-metric-card p { margin: .25rem 0 0; color: var(--muted); font-size: .7rem; }
.dashboard-scope-links { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.dashboard-scope-links a { display: inline-flex; align-items: center; gap: .32rem; padding: .2rem .42rem; border: 1px solid var(--line); border-radius: 999px; color: var(--soft-text); background: var(--surface-soft); font-size: .64rem; font-weight: 700; line-height: 1.2; }
.dashboard-scope-links a:hover { color: var(--primary); border-color: color-mix(in srgb,var(--primary) 40%,var(--line)); text-decoration: none; }
.modern-metric-card .dashboard-scope-links strong { margin: 0; color: var(--ink); font-size: .68rem; line-height: 1; }
.dashboard-view-links { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.dashboard-view-links a { padding: .28rem .5rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); font-size: .7rem; font-weight: 750; }
.modern-dashboard-grid { display: grid; grid-template-columns: minmax(0,1fr) 330px; align-items: start; gap: 1.25rem; }
.dashboard-primary-column, .dashboard-secondary-column { display: grid; gap: 1.25rem; min-width: 0; }
.dashboard-primary-column .panel, .dashboard-secondary-column .panel { margin: 0; }
.dashboard-table-card { min-width: 0; padding: 1.45rem; overflow: hidden; }
.dashboard-table-card .table-wrap { max-width: 100%; }
.modern-request-table { min-width: 790px; }
.modern-request-table th { padding: .65rem .7rem; border-bottom: 1px solid var(--line); color: var(--muted); background: transparent; font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; }
.modern-request-table td { padding: .8rem .7rem; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.modern-request-table tr:last-child td { border-bottom: 0; }
.modern-request-table td small { display: block; max-width: 245px; margin-top: .15rem; overflow: hidden; color: var(--muted); font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.modern-request-table td:nth-child(2) strong { color: var(--ink); }
.table-action-menu { position: relative; }
.table-action-menu > summary { display: grid; place-items: center; padding: .2rem .4rem; color: var(--muted); cursor: pointer; list-style: none; }
.table-action-menu > summary::-webkit-details-marker { display: none; }
.table-action-menu > div { position: absolute; top: 100%; left: auto; right: 0; z-index: 25; display: grid; min-width: 180px; padding: .35rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 13px 32px var(--shadow-color); }
.table-action-menu a, .table-action-menu button { display: flex; align-items: center; justify-content: flex-start; gap: .4rem; width: 100%; min-height: 32px; padding: .42rem .6rem; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: .76rem; text-align: left; }
.table-action-menu a:hover, .table-action-menu button:hover { color: var(--primary); background: color-mix(in srgb,var(--primary) 10%,var(--surface)); text-decoration: none; }
.table-action-menu button.danger, .action-menu button.danger { color: var(--danger); background: transparent; }
.table-action-menu button.danger:hover, .action-menu button.danger:hover { color: var(--danger); background: color-mix(in srgb,var(--danger) 10%,var(--surface)); }
.vendor-accreditation-warning { margin: .55rem 0 0; padding: .55rem .7rem; font-size: .75rem; }
.approval-work-card { padding: 1.35rem 1.45rem; }
.queue-count { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 11px; color: var(--primary); background: color-mix(in srgb,var(--primary) 14%,var(--surface)); font-weight: 850; }
.approval-work-list { display: grid; }
.approval-work-list > article { display: grid; grid-template-columns: auto minmax(150px,1fr) auto auto minmax(135px,.65fr) auto; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.approval-work-list > article:last-child { border-bottom: 0; }
.mini-avatar { width: 36px; height: 36px; font-size: .7rem; }
.approval-work-list p { margin: .15rem 0 0; color: var(--muted); font-size: .69rem; }
.approval-stage { padding: .28rem .5rem; border-radius: 999px; color: #8a6314; background: #fff2d7; font-size: .68rem; font-weight: 750; }
.approval-previous { display: grid; min-width: 0; gap: .12rem; }
.approval-previous small { color: var(--muted); font-size: .58rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.approval-previous strong { overflow: hidden; color: var(--ink); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.approval-previous span { color: var(--muted); font-size: .66rem; }
.approval-amount { color: var(--ink); font-size: .82rem; }
.approval-buttons { display: flex; gap: .4rem; }
.budget-overview-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 12px 30px var(--shadow-color); }
.budget-overview-card > header { padding: 1.2rem 1.25rem; color: var(--on-primary); background: linear-gradient(135deg,#5a4ecb,#4539ae); }
.budget-overview-card h2 { margin: 0; font-size: 1rem; }
.budget-overview-card header p { margin: .2rem 0 0; color: #c8c4f1; font-size: .7rem; }
.budget-chart-empty { padding: 2rem 1.25rem; color: var(--muted); font-size: .78rem; text-align: center; }
.budget-chart-key { display: flex; justify-content: flex-end; gap: .8rem; padding: .85rem 1.2rem 0; color: var(--muted); font-size: .68rem; }
.budget-chart-key span { display: inline-flex; align-items: center; gap: .35rem; }
.budget-key-dot, .expense-key-dot, .available-key-dot, .excess-key-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.budget-key-dot { background: #584bc9; }
.expense-key-dot { background: #42bf83; }
.available-key-dot { background: #8b80ec; }
.excess-key-dot { background: #d55252; }
.budget-comparison-chart { display: grid; gap: 1rem; max-height: 390px; padding: .9rem 1.2rem 1.1rem; overflow-y: auto; }
.budget-chart-row { display: grid; gap: .42rem; }
.budget-chart-label { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.budget-chart-label strong { overflow: hidden; color: var(--ink); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.budget-chart-label small { flex: 0 0 auto; color: var(--muted); font-size: .65rem; }
.budget-chart-row.over-budget .budget-chart-label small { color: var(--danger); font-weight: 800; }
.budget-consumption-bar { display: flex; width: 100%; height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.budget-bar-segment { display: block; height: 100%; }
.budget-bar-segment.expenses { background: linear-gradient(90deg,#289c6c,#53c895); }
.budget-bar-segment.available { background: linear-gradient(90deg,#7468d8,#9a90ed); }
.budget-bar-segment.excess { background: linear-gradient(90deg,#d55252,#ef7777); }
.budget-chart-values { display: flex; justify-content: space-between; gap: .7rem; color: var(--muted); font-size: .64rem; }
.budget-chart-values strong { color: var(--danger); }
.budget-chart-summary { display: grid; padding: 0 1.2rem 1.15rem; }
.budget-chart-summary > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; padding: .65rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.budget-chart-summary strong { color: var(--ink); }
.quick-actions-card { padding: 1.25rem; }
.quick-action-list { display: grid; gap: .55rem; }
.quick-action-list > a { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: .7rem; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-soft); }
.quick-action-list > a:hover { border-color: color-mix(in srgb,var(--primary) 40%,var(--line)); background: color-mix(in srgb,var(--primary) 8%,var(--surface)); text-decoration: none; }
.quick-action-list > a > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--primary); background: color-mix(in srgb,var(--primary) 14%,var(--surface)); font-size: 1rem; font-weight: 850; }
.quick-action-list div { display: grid; }.quick-action-list small { margin-top: .15rem; color: var(--muted); font-size: .66rem; }
.dashboard-loading { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
.dashboard-loading span { height: 138px; border-radius: 16px; background: linear-gradient(90deg,var(--surface-muted),var(--surface),var(--surface-muted)); background-size: 200% 100%; animation: dashboard-shimmer 1.4s infinite; }
@keyframes dashboard-shimmer { to { background-position: -200% 0; } }

@media (max-width: 1500px) {
    .modern-metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-metric-grid.without-approval { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-secondary-column { grid-template-columns: minmax(280px,.75fr) minmax(320px,1.25fr); }
}

@media (max-width: 860px) {
    .modern-shell { grid-template-columns: 1fr; }
    .modern-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 70; width: min(320px,86vw); height: 100dvh; padding: 1rem; transform: translateX(-105%); transition: transform .22s ease; }
    .modern-sidebar.mobile-open { transform: translateX(0); }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 60; display: block; width: 100%; height: 100%; border: 0; background: rgba(27,31,55,.42); backdrop-filter: blur(2px); }
    .sidebar-brand { min-height: 48px; margin-bottom: .5rem; padding-bottom: .65rem; }
    .sidebar-brand img { width: 38px; height: 38px; }
    .sidebar-navigation { grid-template-columns: 1fr; overflow-y: auto; }
    .sidebar-label { margin-top: .5rem; }
    .sidebar-group { min-width: 0; }
    .sidebar-submenu { margin-left: 1rem; }
    .sidebar-footer { grid-template-columns: 1fr; margin-top: auto; }
    .modern-topbar { position: relative; padding: .75rem 1rem; }
    .topbar-alert-region { position: fixed; top: .75rem; width: min(calc(100vw - 2rem), 32rem); }
    .mobile-menu-button { display: grid; flex: 0 0 auto; place-content: center; gap: 4px; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 5px 15px var(--shadow-color); }
    .mobile-menu-button span { display: block; width: 18px; height: 2px; border-radius: 4px; background: var(--soft-text); }
    .user-copy { display: none; }
    .modern-content { padding: 1.2rem 1rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .modern-sidebar { transition: none; }
}

@media (max-width: 650px) {
    .topbar-page-heading h1 { font-size: 1.15rem; }
    .modern-metric-grid, .dashboard-loading { grid-template-columns: 1fr; }
    .modern-metric-grid.without-approval { grid-template-columns: 1fr; }
    .modern-metric-card { min-height: 120px; }
    .dashboard-secondary-column { grid-template-columns: 1fr; }
    .approval-work-list > article { grid-template-columns: auto 1fr auto; }
    .approval-stage, .approval-amount { display: none; }
    .approval-previous { grid-column: 2 / -1; }
    .approval-buttons { grid-column: 2 / -1; }
    .modern-topbar { gap: .6rem; }
    .theme-toggle { width: 40px; min-width: 40px; padding: 0; }
}

/* Theme-aware semantic colors used by every page. */
:root[data-theme="dark"] .alert.success { color: #9ee7c5; border-color: #2f765a; background: #183b30; }
:root[data-theme="dark"] .alert.error { color: #ffaaaa; border-color: #844545; background: #462626; }
:root[data-theme="dark"] .alert.warning { color: #f2d18e; border-color: #765e32; background: #3d321e; }
:root[data-theme="dark"] .topbar-alert-message.success { color: #9ee7c5; border-color: #2f765a; background: #183b30; }
:root[data-theme="dark"] .topbar-alert-message.success .topbar-alert-icon { background: #265c48; }
:root[data-theme="dark"] .topbar-alert-message.error { color: #ffaaaa; border-color: #844545; background: #462626; }
:root[data-theme="dark"] .topbar-alert-message.error .topbar-alert-icon { background: #663434; }
:root[data-theme="dark"] .topbar-alert-message.warning { color: #f2d18e; border-color: #765e32; background: #3d321e; }
:root[data-theme="dark"] .topbar-alert-message.warning .topbar-alert-icon { background: #5b4929; }
:root[data-theme="dark"] .tag-list span { color: #c4ccdf; background: #313950; }
:root[data-theme="dark"] .tag-list .confidential { color: #e4b9ef; background: #49304f; }
:root[data-theme="dark"] .status.pendingapproval,
:root[data-theme="dark"] .status.pending,
:root[data-theme="dark"] .approval-dot.pending,
:root[data-theme="dark"] .approval-stage { color: #f4d18b; background: #4a3b20; }
:root[data-theme="dark"] .status.approved,
:root[data-theme="dark"] .approval-dot.approved,
:root[data-theme="dark"] .status.paid { color: #9ce6c2; background: #1e4638; }
:root[data-theme="dark"] .status.exempted { color: #9bdcf0; background: #1d4050; }
:root[data-theme="dark"] .status.paymentpreparation,
:root[data-theme="dark"] .status.paymentapproval { color: #9bdcf0; background: #1d4050; }
:root[data-theme="dark"] .status.cancelled,
:root[data-theme="dark"] .approval-dot.rejected { color: #ffaaaa; background: #4b292d; }
:root[data-theme="dark"] .approval-dot.notrequired { color: #bdc4d6; background: #343b4d; }
:root[data-theme="dark"] .metric.accent { border-color: #705b31; background: #352d1f; }
:root[data-theme="dark"] .metric.accent strong { color: #f0c876; }

/* Main window shell: mirrors the original WPF menu, workspace, and status bar. */
.desktop-shell { display: grid; grid-template-rows: auto minmax(0,1fr) auto; min-height: 100vh; background: var(--canvas); }
.desktop-header { position: relative; z-index: 50; border-bottom: 1px solid #aeb7bb; box-shadow: 0 2px 7px rgba(0,0,0,.12); }
.desktop-titlebar { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: .2rem .75rem; color: white; background: #0b7180; font-size: .82rem; }
.desktop-brand { display: flex; align-items: center; gap: .45rem; color: white; font-weight: 800; }
.desktop-brand:hover { text-decoration: none; }
.desktop-brand img { width: 25px; height: 25px; border-radius: 50%; }
.desktop-menu-bar { display: flex; align-items: stretch; min-height: 38px; padding: 0 .3rem; color: #20272b; background: #f7f7f7; }
.desktop-menu { position: relative; display: block; }
.desktop-menu > summary, .desktop-menu-link { display: flex; align-items: center; min-height: 38px; padding: 0 .78rem; color: #20272b; cursor: default; font-weight: 500; list-style: none; }
.desktop-menu > summary::-webkit-details-marker { display: none; }
.desktop-menu > summary:hover, .desktop-menu[open] > summary, .desktop-menu-link:hover { color: #102d34; background: #d9edf0; text-decoration: none; }
.desktop-menu-popup { position: absolute; top: 100%; left: 0; z-index: 60; display: grid; min-width: 230px; padding: .3rem; border: 1px solid #aeb8bd; background: #fff; box-shadow: 4px 7px 18px rgba(0,0,0,.2); }
.desktop-menu-popup a, .desktop-menu-popup button { display: block; width: 100%; min-height: 32px; padding: .42rem .7rem; border: 0; border-radius: 0; color: #20272b; background: transparent; font-weight: 400; line-height: 1.25; text-align: left; white-space: nowrap; }
.desktop-menu-popup a:hover, .desktop-menu-popup button:hover { background: #d9edf0; text-decoration: none; }
.desktop-menu-popup form { margin: 0; }
.desktop-menu-popup hr { width: 100%; margin: .25rem 0; border: 0; border-top: 1px solid #d2d8db; }
.confidential-menu > summary { color: #852c2c; }
.desktop-workspace { min-width: 0; padding: 2rem; background: var(--canvas); }
.desktop-statusbar { display: flex; justify-content: space-between; gap: 1rem; min-height: 27px; padding: .25rem .65rem; border-top: 1px solid #aeb7bb; color: #27343a; background: #f4f4f4; font-size: .8rem; }

.legacy-dashboard { position: relative; min-height: calc(100vh - 131px); margin: -2rem; padding: 20px; overflow: hidden; background: #118497; }
.dashboard-logo { position: absolute; top: 50%; left: 50%; width: 250px; height: 250px; transform: translate(-50%,-50%); object-fit: contain; }
.pinned-request-board { position: relative; z-index: 2; width: min(760px,calc(100% - 20px)); min-width: 400px; max-height: calc(100vh - 175px); margin: 0; padding: 1rem 1.2rem 1.3rem; overflow-x: hidden; overflow-y: auto; border: 2px solid #737b7e; border-radius: 25px 0 25px 0; background: #f5f0d7; box-shadow: 7px 9px 22px rgba(0,0,0,.22); }
.pinned-request-board .pin-image { position: absolute; top: -4px; right: -4px; width: 40px; height: 40px; }
.pinned-request-board > h1 { margin: .15rem 2.5rem 1rem; color: #0d6674; font-size: 1.3rem; font-weight: 500; letter-spacing: 0; text-align: center; }
.board-section h2 { margin: 0; color: #8e3434; font-size: 1rem; font-weight: 500; }
.board-section:last-child h2 { color: #0d6674; }
.board-heading { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: .35rem; }
.board-heading > :last-child { margin-left: auto; }
.board-refresh, .board-heading a { min-height: auto; padding: .15rem .35rem; border: 0; color: #075763; background: transparent; font-size: .78rem; font-weight: 700; }
.board-empty { margin: .45rem 0; color: #c22727; font-size: .82rem; font-style: italic; text-align: center; }
.board-separator { margin: .9rem 0; border: 0; border-top: 1px solid #c4bfa9; }
.desktop-request-list { border: 1px solid #b8b4a5; background: rgba(255,255,255,.52); }
.desktop-request-row { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: stretch; min-height: 34px; border-bottom: 1px solid #aaa99f; }
.desktop-request-row:last-child { border-bottom: 0; }
.row-main { display: grid; grid-template-columns: minmax(180px,1fr) auto auto auto auto; align-items: center; gap: .55rem; min-width: 0; padding: .35rem .5rem; color: #20272b; font-size: .82rem; }
.row-main:hover { background: #fffce9; text-decoration: none; }
.row-main > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-divider { color: #7a7e7f; }
.desktop-request-row .row-actions { position: relative; display: block; }
.desktop-request-row .row-actions > summary { display: grid; place-items: center; width: 34px; height: 100%; color: transparent; cursor: pointer; list-style: none; }
.desktop-request-row .row-actions > summary::after { content: "⋮"; color: #29434a; font-size: 1.25rem; }
.desktop-request-row .row-actions > summary::-webkit-details-marker { display: none; }
.desktop-request-row .row-actions[open] > summary, .desktop-request-row .row-actions > summary:hover { background: #d9edf0; }
.desktop-request-row .row-actions > div { position: absolute; top: 100%; left: auto; right: 0; z-index: 20; display: grid; min-width: 190px; padding: .25rem; border: 1px solid #aeb8bd; background: white; box-shadow: 3px 6px 14px rgba(0,0,0,.2); }
.desktop-request-row .row-actions a, .desktop-request-row .row-actions button { display: flex; align-items: center; justify-content: flex-start; gap: .4rem; width: 100%; min-height: 30px; padding: .35rem .6rem; border: 0; border-radius: 0; color: #20272b; background: white; font-size: .82rem; font-weight: 400; text-align: left; }
.desktop-request-row .row-actions a:hover, .desktop-request-row .row-actions button:hover { background: #d9edf0; text-decoration: none; }
.desktop-request-row .row-actions hr { width: 100%; margin: .2rem 0; border: 0; border-top: 1px solid #d4dadd; }
.about-panel { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 1.5rem; }
.about-panel > img { width: 130px; height: 130px; }

#blazor-error-ui { position: fixed; right: 1rem; bottom: 1rem; z-index: 1000; display: none; padding: .8rem 1rem; color: white; border-radius: 8px; background: #8b2828; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 1rem; }

@media (max-width: 1350px) {
    .compact-line-editor { grid-template-areas: "date payee type amount" "description description description actions"; grid-template-columns: minmax(155px,.75fr) minmax(180px,1.25fr) minmax(155px,1fr) minmax(120px,.75fr); }
    .compact-line-editor .line-editor-actions { justify-content: flex-end; }
}

@media (max-width: 1050px) {
    .topbar { flex-wrap: wrap; padding: .8rem 1.2rem; }
    .main-nav { order: 3; width: 100%; overflow-x: auto; }
    .main-nav a { min-height: 38px; }
    .dashboard-grid, .detail-layout, .form-layout { grid-template-columns: 1fr; }
    .line-editor { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .request-compact-grid { grid-template-columns: 1fr; }
    .compact-line-editor { grid-template-areas: "date payee type" "description description amount" "actions actions actions"; grid-template-columns: repeat(3,minmax(0,1fr)); }
    .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 650px) {
    .desktop-titlebar > span { display: none; }
    .desktop-menu-bar { flex-wrap: wrap; }
    .desktop-menu > summary, .desktop-menu-link { min-height: 34px; padding: 0 .58rem; font-size: .82rem; }
    .desktop-menu-popup { position: fixed; top: 72px; right: .5rem; left: .5rem; min-width: 0; }
    .desktop-workspace { padding: 1rem; }
    .desktop-statusbar { align-items: flex-start; flex-direction: column; gap: 0; }
    .legacy-dashboard { min-height: calc(100vh - 153px); margin: -1rem; padding: .7rem; overflow: auto; }
    .dashboard-logo { width: 180px; height: 180px; opacity: .35; }
    .pinned-request-board { width: 100%; min-width: 0; max-height: none; margin: 0; padding: 1rem .65rem; }
    .row-main { grid-template-columns: 1fr auto; gap: .2rem .5rem; }
    .row-main .row-divider { display: none; }
    .row-main > span:last-child { grid-column: 1 / -1; color: var(--muted); }
    .about-panel { grid-template-columns: 1fr; text-align: center; }
    .about-panel > img { margin: 0 auto; }
    .page-container { padding: 1.2rem .8rem; }
    .form-grid.two, .form-grid.three, .permission-grid, .summary-strip, .metric-grid, .detail-list, .link-grid { grid-template-columns: 1fr; }
    .summary-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .line-editor { grid-template-columns: 1fr; }
    .compact-payment-grid { grid-template-columns: 1fr; }
    .compact-line-editor { grid-template-areas: "date" "payee" "type" "description" "amount" "actions"; grid-template-columns: 1fr; }
    .line-editor-actions { justify-content: flex-end; }
    .request-number-chip { display: none; }
    .account-menu span { display: none; }
    .request-card { grid-template-columns: 1fr; }
    .request-meta { justify-items: start; }
}

@media print {
    :root, :root[data-theme="dark"] { --ink: #202744; --muted: #5e6a74; --line: #aeb8bd; --surface: #ffffff; --surface-muted: #f5f7f8; color-scheme: light; }
    .topbar, .desktop-header, .desktop-statusbar, .modern-sidebar, .modern-topbar, .report-toolbar, #blazor-error-ui { display: none !important; }
    .modern-shell, .modern-main { display: block; min-height: 0; }
    .modern-content { padding: 0; }
    body, .page-container { padding: 0; color: var(--ink); background: white; }
    .print-report { width: 100%; padding: 0; border: 0; box-shadow: none; }
    [data-page="budget-reports"] .topbar-page-heading { display: none !important; }
    .budget-report-document { padding: 0 !important; border: 0 !important; box-shadow: none !important; }
    .budget-report-table { font-size: .7rem !important; }
}

.table-pager {
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.table-pager > div {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.table-pager-summary { flex-wrap: wrap; }

.page-size-control {
    align-items: center;
    display: flex;
    gap: .4rem;
    white-space: nowrap;
}

.page-size-control select {
    min-height: 34px;
    min-width: 68px;
    padding: .35rem 1.7rem .35rem .55rem;
    width: auto;
}

.table-pager strong {
    color: var(--ink);
    font-size: .85rem;
}

@media (max-width: 640px) {
    .list-search-field { flex-basis: 100%; min-width: 100%; width: 100%; }
    .comment-content header { align-items: flex-start; flex-direction: column; gap: .1rem; }
    .comment-actions { align-items: flex-end; }
    .table-pager {
        align-items: stretch;
        flex-direction: column;
        gap: .75rem;
    }

    .table-pager > div {
        justify-content: space-between;
    }
}

/* Budget and expense management */
.master-detail-grid { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.email-settings-grid { grid-template-columns: minmax(375px, 488px) minmax(0, 1fr); }
.email-queue-panel { margin-top: 1.2rem; }
.email-queue-metrics { margin-bottom: 1rem; }
.email-queue-table { min-width: 1180px; }
.email-queue-table td { vertical-align: top; }
.email-queue-table td:nth-child(4), .email-queue-table td:nth-child(5), .email-queue-table td:nth-child(9) { overflow-wrap: anywhere; }
.status.queued { color: #85590a; background: #fff1cc; }
.status.processing { color: #125a71; background: #dff2f7; }
.status.sent { color: #166344; background: #dff4e9; }
.status.failed { color: #8b2828; background: #fae2e2; }
.master-detail-grid > .panel { margin: 0; }
.compact-form-panel { padding: 1.1rem; }
.compact-form-panel .panel-heading { margin-bottom: .8rem; }
.compact-form-panel textarea { min-height: 86px; }
.toolbar-inline { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .75rem; }
.toolbar-inline label { min-width: 130px; }
.budget-period-filter { justify-content: flex-end; }
.budget-period-filter label { width: min(360px, 100%); }
.budget-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.budget-metric-grid.dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.budget-metric-grid article { display: grid; gap: .25rem; min-height: 105px; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 28px var(--shadow-color); }
.budget-metric-grid article small { color: var(--muted); font-weight: 700; }
.budget-metric-grid article strong { align-self: end; color: var(--ink); font-size: 1.35rem; }
.budget-metric-grid article.remaining { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), #7568dd); }
.budget-metric-grid article.remaining small, .budget-metric-grid article.remaining strong { color: #fff; }
.budget-monitor-table .over-budget td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.report-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.report-summary-grid .panel { display: grid; gap: .25rem; }
.report-summary-grid small, .report-summary-grid span { color: var(--muted); }
.report-summary-grid strong { color: var(--ink); font-size: 1.55rem; }
.report-summary-grid .danger-card { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.report-grid > .panel { margin-bottom: 0; }
.budget-dashboard-sections { margin-top: 1.2rem; }
.budget-dashboard-alerts { margin-top: 1.2rem; }
.budget-report-toolbar { align-items: flex-end; justify-content: flex-end; }
.budget-report-toolbar label { width: min(360px, 100%); }
.budget-report-toolbar .budget-report-type-field { width: min(240px, 100%); }
.budget-report-document { padding: 1.4rem; }
.budget-report-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.budget-report-header h2 { margin: .25rem 0; font-size: 1.35rem; }
.budget-report-header p { margin: 0; color: var(--muted); }
.budget-report-meta { display: grid; gap: .2rem; text-align: right; }
.budget-report-meta span { color: var(--muted); font-size: .8rem; }
.budget-report-table { margin-top: 1rem; }
.budget-report-table tfoot td { border-top: 2px solid var(--line); font-weight: 800; }
.budget-report-table .over-budget td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.report-bar-row { display: grid; grid-template-columns: minmax(100px, .8fr) minmax(120px, 1.5fr) minmax(130px, auto); gap: .75rem; align-items: center; margin: .75rem 0; font-size: .82rem; }
.report-bar-row > div { height: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.report-bar-row i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #8c80ec); }
.report-bar-row strong { text-align: right; }
.danger-text { color: var(--danger); font-weight: 800; }
.success-empty { color: var(--success); }
.reference-tag { display: inline-flex; align-items: center; width: fit-content; padding: .22rem .5rem; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line)); border-radius: 999px; color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); font-size: .76rem; font-weight: 850; text-decoration: none; }
.reference-tag:hover { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); text-decoration: none; }
.expense-entry-form { display: grid; gap: 1rem; }
.expense-entry-form > .panel { margin: 0; }
.available-budget { display: grid; justify-items: end; color: var(--muted); font-size: .75rem; }
.available-budget strong { color: var(--ink); font-size: 1.05rem; }
.workflow-note { display: flex; align-items: center; gap: .55rem; padding: .7rem .8rem; border-radius: 9px; color: var(--muted); background: var(--surface-muted); font-size: .8rem; }
.workflow-note .action-icon { flex: 0 0 auto; color: var(--primary); }
.sticky-actions { position: sticky; bottom: .75rem; z-index: 5; width: fit-content; margin-left: auto; padding: .55rem; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: 0 12px 30px var(--shadow-color); backdrop-filter: blur(10px); }
.attachment-list { display: grid; gap: .65rem; }
.attachment-list article { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: .7rem; align-items: center; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.attachment-list article > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.attachment-list article div { display: grid; min-width: 0; }
.attachment-list article strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-list article small { color: var(--muted); }
button.icon-button { display: inline-grid; width: 34px; min-height: 34px; padding: 0; place-items: center; border: 1px solid var(--control-border); border-radius: 9px; color: var(--muted); background: var(--surface); }
button.icon-button.danger-icon { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.expense-detail-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, .8fr); gap: 1.2rem; align-items: start; }
.expense-detail-grid > div, .expense-detail-grid > aside { min-width: 0; }
.description-block { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.description-block small { color: var(--muted); font-weight: 750; }
.description-block p { margin-bottom: 0; white-space: pre-wrap; }
.expense-route { display: grid; }
.expense-route article { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: .7rem; min-height: 88px; }
.expense-route article:not(:last-child)::after { position: absolute; top: 32px; bottom: 0; left: 16px; width: 2px; content: ""; background: var(--line); }
.expense-route article > span { z-index: 1; display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--surface); }
.expense-route article.approved > span { color: var(--success); border-color: var(--success); }
.expense-route article.rejected > span { color: var(--danger); border-color: var(--danger); }
.expense-route article div { display: grid; align-content: start; gap: .12rem; }
.expense-route article small, .expense-route article em { color: var(--muted); font-size: .76rem; font-style: normal; }
.expense-route article p { margin: .35rem 0 0; font-size: .8rem; }
.decision-actions { display: grid; gap: .55rem; margin-top: .8rem; }
.action-panel p { color: var(--muted); font-size: .82rem; }
.activity-timeline { display: grid; gap: .8rem; }
.activity-timeline article { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: .7rem; }
.activity-timeline article > span { width: 10px; height: 10px; margin-top: .3rem; border: 2px solid var(--primary); border-radius: 50%; background: var(--surface); }
.activity-timeline article div { display: grid; gap: .12rem; }
.activity-timeline article small { color: var(--muted); }
.status.open { color: #166344; background: #dff4e9; }
.status.draft, .status.closed { color: var(--muted); background: var(--surface-muted); }

@media (max-width: 1100px) {
    .budget-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .budget-metric-grid.dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .master-detail-grid, .expense-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .budget-metric-grid, .report-summary-grid, .report-grid { grid-template-columns: 1fr; }
    .budget-metric-grid.dashboard-metrics { grid-template-columns: 1fr; }
    .budget-report-header { flex-direction: column; }
    .budget-report-meta { text-align: left; }
    .report-bar-row { grid-template-columns: 90px minmax(80px, 1fr); }
    .report-bar-row strong { grid-column: 2; }
    .attachment-list article { grid-template-columns: 34px minmax(0, 1fr) auto; }
    .attachment-list article .button { grid-column: 2; justify-self: start; }
}

:root[data-theme="dark"] .status.open { color: #9ce6c2; background: #1e4638; }
:root[data-theme="dark"] .status.queued { color: #f4d18b; background: #4a3b20; }
:root[data-theme="dark"] .status.processing { color: #9bdcf0; background: #1d4050; }
:root[data-theme="dark"] .status.sent { color: #9ce6c2; background: #1e4638; }
:root[data-theme="dark"] .status.failed { color: #ffaaaa; background: #4b292d; }
