:root {
    color-scheme: light;
    --ink: #1f2933;
    --muted: #5b6574;
    --line: #d6dde8;
    --soft-line: #e9edf3;
    --surface: #ffffff;
    --surface-alt: #f4f6f9;
    --navy: #233b63;
    --navy-dark: #1d2836;
    --purple: #7250a8;
    --purple-soft: #f2edf9;
    --gold: #b17c00;
    --green: #22855d;
    --green-soft: #eaf7f0;
    --orange: #c9681b;
    --orange-soft: #fff4ea;
    --red: #b63834;
    --red-soft: #fff0ef;
    --blue-soft: #edf4fb;
    --queue-header: #34485f;
    --queue-row-alt: #f3f6fa;
    --queue-row-selected: #eee8f8;
    --shadow: 0 16px 38px rgba(31, 41, 51, .09);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--surface-alt);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--surface-alt);
    color: var(--ink);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button,
label[for="pdf-input"] {
    touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
label[for="pdf-input"]:focus-within {
    outline: 3px solid rgba(114, 80, 168, .28);
    outline-offset: 2px;
}

button:disabled,
input:disabled {
    cursor: default;
    opacity: .6;
}

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

.app-header {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) auto;
    align-items: center;
    gap: 22px;
    min-height: 72px;
    padding: 7px 16px;
    border-bottom: 3px solid var(--gold);
    background: linear-gradient(100deg, #1d242e, #2c3541 58%, #263b43);
    box-shadow: 0 12px 29px rgba(20, 26, 34, .22);
}

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

.brand-mark {
    display: block;
    width: 52px;
    height: 52px;
    overflow: hidden;
    flex: 0 0 auto;
}

.brand-mark img {
    display: block;
    width: auto;
    max-width: none;
    height: 52px;
}

.brand-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    line-height: 1;
}

.brand-company {
    color: #fff;
    font-family: "Bahnschrift Condensed", "Arial Narrow", "Segoe UI", sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand-company span:last-child,
.brand-tagline b {
    color: #d9a21b;
}

.brand-tagline {
    color: #c9d0d8;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .21em;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand-product {
    display: grid;
    min-width: 0;
    gap: 2px;
    min-height: 42px;
    margin-left: 3px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, .22);
}

.brand-product h1 {
    margin: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1.2;
}

.brand-product span {
    color: #cbd2da;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.workspace-lock {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 6px 11px;
    border: 1px solid #74b995;
    border-radius: 999px;
    background: #1f704f;
    color: #fff;
}

.workspace-lock::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8ee3b5;
    content: "";
}

.workspace-lock > strong {
    color: #fff;
    font-size: 12px;
    letter-spacing: .02em;
}

.header-statuses {
    display: inline-flex;
    align-items: center;
    justify-self: end;
    gap: 7px;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.primary-button {
    border: 1px solid var(--purple);
    background: var(--purple);
    color: #fff;
}

.primary-button:hover {
    background: #634493;
}

.secondary-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--navy);
}

.secondary-button:hover {
    border-color: #aeb9c8;
    background: #f8fafc;
}

.header-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-user-label {
    max-width: min(240px, 30vw);
    overflow: hidden;
    color: #e8edf4;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-user-label[hidden] {
    display: none;
}

.current-user-label.current-user-switch-host {
    max-width: none;
    overflow: visible;
}

.admin-user-switch {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
    color: #dce5ef;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .035em;
}

.admin-user-switch select {
    width: min(240px, 42vw);
    min-width: 0;
    max-width: none;
    min-height: 32px;
    padding: 4px 26px 4px 8px;
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 6px;
    background: #243448;
    color: #fff;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    appearance: none;
}

.admin-user-switch::after {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #dce5ef;
    border-bottom: 1.5px solid #dce5ef;
    content: "";
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}

.admin-user-switch select:hover,
.admin-user-switch select:focus-visible {
    border-color: rgba(255, 255, 255, .75);
    outline: none;
}

.app-menu {
    position: relative;
}

.app-menu > summary {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    list-style: none;
}

.app-menu > summary::-webkit-details-marker {
    display: none;
}

.app-menu > summary:hover,
.app-menu > summary:focus-visible,
.app-menu[open] > summary {
    border-color: rgba(255, 255, 255, .75);
    background: rgba(255, 255, 255, .1);
}

.app-menu > summary svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.app-menu-panel {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: 236px;
    overflow: hidden;
    padding: 7px;
    border: 1px solid #cbd4df;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .26);
}

.app-menu-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
    padding: 5px 6px 9px;
    border-bottom: 1px solid #e2e8f0;
}

.app-menu-status .application-version {
    min-height: 26px;
    border-color: #cbd5e1;
    color: #475569;
}

.app-menu-status .workspace-lock {
    padding: 4px 8px;
}

.app-menu-panel > a,
.app-menu-panel > button {
    display: flex;
    min-height: 36px;
    align-items: center;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--navy);
    font: inherit;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.app-menu-panel > a:hover,
.app-menu-panel > a:focus-visible,
.app-menu-panel > button:hover,
.app-menu-panel > button:focus-visible {
    background: #eef3f8;
}

.header-navigation .secondary-button {
    border-color: rgba(255, 255, 255, .35);
    background: transparent;
    color: #fff;
    text-decoration: none;
}

.header-navigation .secondary-button:hover {
    border-color: rgba(255, 255, 255, .7);
    background: rgba(255, 255, 255, .08);
}

.workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    width: 100%;
    height: calc(100vh - 72px);
    min-height: calc(100vh - 72px);
    margin: 0;
    padding: 8px;
}

.queue-screen,
.detail-screen {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.queue-screen[hidden],
.detail-screen[hidden] {
    display: none !important;
}

.queue-panel,
.detail-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.queue-panel {
    display: flex;
    min-height: 0;
    align-self: stretch;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-self: stretch;
    overflow: hidden;
}

.detail-command-bar {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 12px;
    min-height: 43px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--line);
    background: #f7f8fb;
}

.detail-command-bar .secondary-button {
    min-height: 31px;
    padding: 5px 10px;
}

.detail-command-bar p {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-heading,
.detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--soft-line);
}

.queue-stage-strip {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 12px;
    min-height: 58px;
    padding: 0 20px;
    border-bottom: 1px solid #d1d8e2;
    background: #fff;
}

.queue-command-strip {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(140px, 190px) auto;
    grid-template-areas: "search snapshot refresh";
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    min-height: 54px;
    padding: 12px 20px 8px;
    border-bottom: 1px solid #c8d2df;
    background: #f4f7fa;
}

.queue-columns-menu {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.queue-columns-menu > summary {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #fff;
    list-style: none;
    cursor: pointer;
}

.queue-columns-menu > summary::-webkit-details-marker { display: none; }

.queue-columns-menu[open] > summary,
.queue-columns-menu.layout-save-error > summary {
    border-color: rgba(255, 255, 255, .65);
    background: rgba(255, 255, 255, .14);
}

.queue-columns-menu.layout-save-error > summary { color: #ffd4d1; }

.queue-columns-menu > summary:hover,
.queue-columns-menu > summary:focus-visible {
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .1);
}

.queue-columns-trigger svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
}

.queue-columns-panel {
    position: fixed;
    z-index: 1100;
    width: 286px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #bdc9d8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(21, 36, 56, .22);
    color: var(--ink);
    font-weight: 400;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
}

.queue-columns-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 3px 4px 8px;
    border-bottom: 1px solid #e1e7ef;
    color: var(--navy);
    font-size: 12px;
}

.queue-columns-heading span { color: var(--muted); font-size: 10px; }

.queue-column-list { display: grid; gap: 2px; padding: 5px 0; }

.queue-column-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 31px;
    padding: 2px 3px;
    border-radius: 5px;
    color: #263a52;
    font-size: 12px;
}

.queue-column-option:hover,
.queue-column-option.dragging { background: #eef3f8; }

.queue-column-drag { color: #8795a7; cursor: grab; font-size: 12px; }

.queue-column-option label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    cursor: pointer;
}

.queue-column-option input { width: 15px; height: 15px; margin: 0; }
.queue-column-move { display: inline-flex; gap: 2px; }

.queue-column-move button {
    width: 25px;
    height: 25px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #405873;
    cursor: pointer;
}

.queue-column-move button:hover:not(:disabled) { border-color: #c5d0de; background: #fff; }
.queue-column-move button:disabled { opacity: .25; cursor: default; }

.queue-reset-columns {
    width: 100%;
    min-height: 31px;
    border: 1px solid #c7d1de;
    border-radius: 5px;
    background: #f7f9fb;
    color: #314760;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.queue-view-switcher {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    min-width: 0;
}

.queue-primary-views {
    display: flex;
    align-self: stretch;
    align-items: center;
    gap: 30px;
    min-width: 0;
}

.queue-selector {
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: center;
    width: auto;
    min-width: 0;
    margin-left: 0;
    padding-left: 24px;
}

.queue-selector::before {
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 0;
    width: 1px;
    content: "";
    background: #d8dee7;
}

.workflow-scope-host {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-left: auto;
}

.queue-selector-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 52px;
    padding: 6px 2px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #738094;
    cursor: pointer;
    font-size: 14px;
    font-weight: 550;
    list-style: none;
}

.queue-selector-summary::-webkit-details-marker {
    display: none;
}

.queue-selector-summary:focus-visible {
    outline: 3px solid rgba(114, 80, 168, .28);
    outline-offset: 2px;
}

.queue-selector-chevron {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s ease;
}

.queue-selector[open] .queue-selector-chevron {
    transform: rotate(225deg) translate(-2px, -2px);
}

.queue-selector[open] .queue-selector-summary {
    background: transparent;
    color: #34465c;
    box-shadow: none;
}

.queue-selector-current > .queue-selector-summary {
    border-radius: 0;
    color: #111827;
    font-weight: 650;
    box-shadow: inset 0 -2px 0 #7250a8;
}

.eyebrow {
    margin: 0 0 5px;
    color: #68518f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

h2,
h3,
p {
    margin-top: 0;
}

h2 {
    margin-bottom: 0;
    color: var(--navy);
    font-size: 18px;
}

h3 {
    margin-bottom: 5px;
    color: var(--navy);
    font-size: 15px;
}

.snapshot-status {
    max-width: 290px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    text-align: right;
}

.snapshot-meta {
    display: grid;
    justify-items: end;
    gap: 3px;
}

.snapshot-status.error {
    color: var(--red);
    font-weight: 700;
}

.upload-box {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
    margin: 6px 10px;
    padding: 6px 8px;
    border: 1px dashed #c7b6df;
    border-radius: 9px;
    background: #fbf9fe;
}

.queue-stage-strip .upload-box {
    justify-self: end;
    flex: 0 0 auto;
    min-width: 0;
    gap: 7px;
    margin: 0;
    padding: 4px 0 4px 10px;
    border: 0;
    border-left: 1px solid #d5dce6;
    border-radius: 0;
    background: transparent;
}

.queue-stage-strip .upload-box.drag-active {
    border: 1px dashed var(--purple);
    border-color: var(--purple);
    border-radius: 7px;
    background: #eee6fa;
    box-shadow: 0 0 0 3px rgba(114, 80, 168, .12);
}

.queue-stage-strip .upload-box .primary-button {
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.upload-drop-copy {
    padding-right: 5px;
    color: #6b5a83;
    font-size: 10px;
    white-space: nowrap;
}

.upload-box > div {
    flex: 1 1 auto;
}

.receive-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.receive-summary h3 {
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px;
}

.queue-stage-strip .receive-summary h3 {
    display: none;
}

.intake-help {
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
}

.intake-help > summary {
    width: fit-content;
    color: #684395;
    cursor: pointer;
    font-weight: 750;
    white-space: nowrap;
}

.intake-help[open] {
    padding: 6px 8px;
    border: 1px solid var(--soft-line);
    border-radius: 6px;
    background: #fff;
}

.intake-help[open] > summary {
    margin-bottom: 5px;
}

.upload-box p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.upload-box .intake-queue-note {
    display: none;
}

.upload-box .primary-button.disabled,
.upload-box .primary-button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .52;
    pointer-events: none;
}

#pdf-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.upload-list {
    display: grid;
    gap: 7px;
    margin: 0 16px 12px;
    padding: 0;
    list-style: none;
    max-height: 108px;
    overflow-y: auto;
}

.current-upload-session {
    flex: 0 0 auto;
    margin: 0 10px 6px;
}

.current-upload-session:not([data-has-jobs="true"]) {
    display: none;
}

.current-upload-session[data-dismissed="true"] {
    display: none;
}

.upload-session-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.upload-session-heading > div {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.current-upload-session h3 {
    margin: 0 0 6px;
    color: #68518f;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.current-upload-session .upload-list {
    margin: 0;
}

.upload-summary,
.upload-view-summary,
.upload-authority-status {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.upload-summary {
    color: #30445f;
    font-weight: 750;
}

.upload-job {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--soft-line);
    border-radius: 7px;
    background: #fff;
}

.upload-job > strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-job-status {
    font-size: 11px;
    font-weight: 800;
}

.upload-job-status.success {
    color: #237548;
}

.upload-job-status.error {
    color: var(--red);
}

.upload-job-status.active {
    color: #6b5a83;
}

.upload-failure-details {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11px;
}

.upload-failure-details > summary {
    width: fit-content;
    cursor: pointer;
    color: #8b322b;
    font-weight: 750;
}

.upload-failure-details p {
    margin: 5px 0 0;
}

.upload-session-controls {
    display: grid;
    grid-template-columns: minmax(150px, .55fr) minmax(220px, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

.upload-session-controls label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.upload-session-controls select,
.upload-session-controls input {
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--soft-line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.upload-view-summary {
    margin-bottom: 6px;
}

.upload-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

.upload-authority-status {
    margin-top: 7px;
}

.current-upload-session .intake-help {
    margin-top: 7px;
}

.current-upload-session .intake-help p {
    margin: 4px 0 0;
    line-height: 1.35;
}

.upload-authority-status.error {
    color: var(--red);
    font-weight: 700;
}

.queue-command-strip .snapshot-meta {
    grid-area: snapshot;
    min-width: 0;
    gap: 1px;
}

.queue-command-strip .snapshot-status {
    width: 100%;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-command-strip .snapshot-status {
    color: #314159;
    font-size: 11px;
    font-weight: 750;
}

.queue-command-strip .snapshot-status.live {
    display: inline-flex;
    width: auto;
    align-items: center;
    justify-self: end;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid #b7d8c5;
    border-radius: 999px;
    background: linear-gradient(180deg, #f4fbf7 0%, #eaf6ef 100%);
    box-shadow: 0 1px 2px rgba(29, 79, 52, .08);
    color: #286344;
    font-size: 10px;
    letter-spacing: .01em;
}

.queue-command-strip .snapshot-status.live::before {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #26a269;
    box-shadow: 0 0 0 3px rgba(38, 162, 105, .12);
    content: "";
}

.queue-refresh {
    grid-area: refresh;
    min-height: 36px;
    padding: 6px 10px;
    border-color: #b9c5d4;
    border-radius: 6px;
    font-size: 10px;
    white-space: nowrap;
}

.upload-job {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 9px 11px;
    border: 1px solid var(--soft-line);
    border-radius: 8px;
    background: var(--surface-alt);
    font-size: 12px;
}

.upload-job strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-job span {
    color: var(--muted);
}

.upload-job[data-status="failed"] {
    border-color: #efc5c2;
    background: var(--red-soft);
}

.upload-job[data-status="registered"] {
    border-color: #bfe1cf;
    background: var(--green-soft);
}

.compact-button {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 11px;
}

.upload-job button {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    padding: 4px 9px;
    border: 1px solid #d3a4a1;
    border-radius: 6px;
    background: #fff;
    color: var(--red);
    font-weight: 700;
    cursor: pointer;
}

.queue-secondary-tabs {
    position: absolute;
    z-index: 8;
    top: calc(100% + 5px);
    right: 0;
    display: grid;
    width: min(280px, calc(100vw - 28px));
    gap: 3px;
    padding: 6px;
    border: 1px solid #bcc7d5;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(31, 41, 51, .18);
}

.queue-selector-search {
    width: 100%;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid #b9c5d4;
    border-radius: 6px;
    background: #fff;
    color: #26364c;
    font: inherit;
    font-size: 12px;
}

.queue-selector-search:focus {
    border-color: #8669b1;
    outline: 2px solid rgba(114, 80, 168, .16);
}

.queue-selector:not([open]) > .queue-secondary-tabs {
    display: none;
}

.queue-tab {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    color: #26364c;
    cursor: pointer;
}

.queue-tab:hover {
    border-color: #d7ddea;
    background: #f7f4fb;
}

.queue-tab.active {
    border-color: transparent;
    background: transparent;
    color: #533381;
    font-weight: 700;
}

.queue-stage-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
    text-align: left;
}

.queue-tab strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 18px;
    padding: 2px 5px;
    border-radius: 999px;
    border: 1px solid #d4dbe4;
    background: transparent;
    color: #69798b;
    font-size: 11px;
}

.queue-tab.active strong {
    border-color: var(--purple);
    background: var(--purple);
    color: #fff;
}

.queue-primary-tab {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    align-self: stretch;
    min-height: 52px;
    padding: 6px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #647286;
    font-size: 14px;
    font-weight: 550;
}

.queue-primary-tab .queue-stage-label {
    font-size: inherit;
    font-weight: inherit;
}

.queue-primary-tab strong {
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #7a8796;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.queue-primary-tab.active {
    border-color: transparent;
    background: transparent;
    color: #111827;
    font-size: 15.5px;
    font-weight: 650;
    box-shadow: inset 0 -2px 0 #7250a8;
}

.queue-primary-tab.active strong {
    min-width: 28px;
    min-height: 21px;
    padding: 2px 7px;
    border: 0;
    border-radius: 999px;
    background: #f0eaff;
    color: #6540d8;
    font-size: 11px;
    font-weight: 750;
}

.queue-primary-tab:hover {
    border-color: transparent;
    background: transparent;
    color: #25384e;
}

.queue-secondary-tabs .queue-tab.active {
    background: #f1edf8;
    color: #533381;
}

.workflow-only-heading {
    margin: 0;
    color: #26364c;
    font-size: 15px;
    font-weight: 800;
}

.workflow-only-user .queue-primary-tab {
    display: none !important;
}

.queue-action-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 5px 8px 0;
    padding: 5px 8px;
    border: 1px solid #b9ddca;
    border-radius: 8px;
    background: #f2faf6;
    color: #285f46;
}

.queue-action-notice[hidden] {
    display: none;
}

.queue-action-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
    font-size: 11px;
}

.queue-action-copy strong {
    font-size: 12px;
}

.queue-tools {
    display: flex;
    grid-area: search;
    align-items: center;
    justify-content: stretch;
    min-width: 0;
    min-height: 0;
}

#queue-search {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 7px 11px 7px 32px;
    border: 1px solid #b8c5d5;
    border-radius: 6px;
    background:
        linear-gradient(45deg, transparent 46%, #718096 47%, #718096 53%, transparent 54%)
            20px 21px / 7px 7px no-repeat,
        radial-gradient(circle, transparent 42%, #718096 44%, #718096 55%, transparent 57%)
            12px 10px / 11px 11px no-repeat,
        #fff;
    color: var(--ink);
    font-size: 12px;
}

.row-summary {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #34445a;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-frame {
    flex: 1 1 260px;
    max-height: none;
    min-height: 0;
    overflow: auto;
    border-top: 1px solid var(--soft-line);
}

.queue-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 14px;
    min-height: 38px;
    padding: 4px 10px;
    border-top: 1px solid var(--soft-line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.queue-pagination-controls {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.queue-pagination .secondary-button {
    min-height: 28px;
    padding: 4px 9px;
}

.queue-pagination button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

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

.queue-table th {
    position: sticky;
    z-index: 1;
    top: 0;
    height: 34px;
    padding: 5px 10px;
    border-bottom: 1px solid #23364e;
    background: var(--queue-header);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .055em;
    text-align: left;
    text-transform: uppercase;
}

.queue-column-resizer {
    position: absolute;
    z-index: 4;
    top: 4px;
    right: -4px;
    width: 9px;
    height: calc(100% - 8px);
    cursor: col-resize;
    touch-action: none;
}

.queue-column-resizer::after {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 4px;
    width: 1px;
    content: "";
    background: rgba(255, 255, 255, .22);
}

.queue-table th.resizing .queue-column-resizer::after,
.queue-column-resizer:hover::after { width: 2px; background: #fff; }

html.queue-column-resizing,
html.queue-column-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.queue-table [hidden] { display: none !important; }

.queue-table th:nth-child(1) { width: 112px; }
.queue-table th:nth-child(2) { width: 86px; }
.queue-table th:nth-child(3) { width: 13%; }
.queue-table th:nth-child(4) { width: 108px; }
.queue-table th:nth-child(5) { width: 20%; }
.queue-table th:nth-child(6) { width: 112px; }
.queue-table th:nth-child(7) { width: 112px; }
.queue-table th:nth-child(8) { width: 112px; }
.queue-table th:nth-child(9) { width: 108px; }
.queue-table th:nth-child(10) { width: 124px; }
.queue-table th:nth-child(11) { width: 42px; }

.queue-sort-button {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-align: left;
    text-transform: inherit;
    white-space: nowrap;
}

.queue-sort-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.queue-sort-indicator {
    min-width: 9px;
    color: #f4cf72;
    font-size: 13px;
    line-height: 1;
}

.queue-filter-header {
    padding-right: 30px !important;
}

.queue-filter-button {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 21px;
    height: 21px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #dce7f5;
    cursor: pointer;
    font-size: 13px;
    line-height: 18px;
}

.queue-filter-button::before {
    display: block;
    width: 11px;
    height: 11px;
    margin: auto;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 62% 45%, 62% 100%, 38% 82%, 38% 45%);
    content: "";
}

.queue-filter-button:hover,
.queue-filter-button:focus-visible {
    border-color: rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .12);
    outline: none;
}

.queue-filter-button.active {
    border-color: #f1c55c;
    background: #f1c55c;
    color: #27364a;
}

.queue-filter-popover {
    position: absolute;
    z-index: 1000;
    display: grid;
    gap: 12px;
    max-height: min(480px, calc(100vh - 24px));
    padding: 14px;
    overflow: auto;
    border: 1px solid #aebed1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(28, 45, 68, .22);
    color: #24364d;
    font-size: 13px;
    text-transform: none;
}

.queue-filter-title {
    font-size: 14px;
}

.queue-filter-statuses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 12px;
}

.queue-filter-vendors {
    display: grid;
    gap: 3px;
    max-height: 260px;
    padding: 3px;
    overflow: auto;
    border: 1px solid #d7e0ea;
    border-radius: 6px;
    background: #fbfcfe;
}

.queue-filter-vendor-choice {
    min-height: 29px;
    padding: 4px 6px;
    border-radius: 4px;
}

.queue-filter-vendor-choice:hover,
.queue-filter-vendor-choice:has(input:focus-visible) {
    background: #eef3f8;
}

.queue-filter-select-visible {
    padding: 2px 4px;
    color: #455b74;
    font-weight: 750;
}

.queue-filter-choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.queue-filter-choice-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-filter-choice-count {
    min-width: 24px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #edf1f6;
    color: #40546c;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.queue-filter-input {
    width: 100%;
    min-height: 34px;
}

.queue-filter-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.queue-filter-range label {
    display: grid;
    gap: 4px;
    color: #52657c;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.queue-filter-date-shortcuts {
    display: flex;
    align-items: center;
    gap: 5px;
}

.queue-filter-shortcut-label {
    margin-right: 2px;
    color: #61738a;
    font-size: 11px;
    font-weight: 700;
}

.queue-filter-shortcut {
    min-width: 36px;
    min-height: 26px;
    padding: 3px 8px;
    border: 1px solid #c5d0dc;
    border-radius: 5px;
    background: #f7f9fb;
    color: #344a63;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.queue-filter-shortcut:hover,
.queue-filter-shortcut:focus-visible {
    border-color: #8fa3ba;
    background: #edf2f7;
    outline: none;
}

.queue-filter-missing-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid #c9d4df;
    border-radius: 6px;
    background: #f6f8fa;
    color: #2f435a;
    font-weight: 750;
    cursor: pointer;
}

.queue-filter-missing-choice:has(input:checked) {
    border-color: #8c6ab8;
    background: #f3eef9;
    color: #563b7c;
}

.queue-filter-missing-choice input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--purple);
}

.queue-filter-readiness-label {
    display: block;
    min-width: 0;
    margin: 0;
    gap: 5px;
    padding-top: 9px;
    border-top: 1px solid #dbe3ec;
    color: #34485f;
    font-size: 11px;
    font-weight: 750;
}

.queue-filter-readiness-label legend {
    padding: 0;
}

.queue-readiness-choices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 6px;
}

.queue-readiness-choice {
    position: relative;
    min-width: 0;
    cursor: pointer;
}

.queue-readiness-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.queue-readiness-choice span {
    display: block;
    padding: 5px 7px;
    border: 1px solid #c9d4e0;
    border-radius: 5px;
    background: #fff;
    color: #40546b;
    text-align: center;
}

.queue-readiness-choice input:checked + span {
    border-color: #6d5a91;
    background: #f0ebf7;
    color: #3f2b64;
    box-shadow: inset 0 0 0 1px rgba(109, 90, 145, .12);
}

.queue-readiness-choice input:focus-visible + span {
    outline: 2px solid rgba(84, 107, 138, .3);
    outline-offset: 2px;
}

.queue-filter-input:disabled,
.queue-filter-shortcut:disabled {
    cursor: default;
    opacity: .48;
}

.queue-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.button-icon {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.queue-filter-actions {
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid #dbe3ec;
}

.queue-filter-actions .quiet-button {
    margin-left: auto;
}

.queue-batch-toolbar {
    position: fixed;
    z-index: 40;
    top: 16px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    max-width: calc(100vw - 28px);
    padding: 5px 7px 5px 12px;
    border: 1px solid #aebccc;
    border-radius: 10px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 8px 22px rgba(31, 41, 51, .18);
    transform: translateX(-50%);
    animation: queue-selection-bar-enter .15s ease-out;
    overflow: visible;
    white-space: nowrap;
}

.queue-batch-toolbar[hidden] {
    display: none;
}

.queue-selection-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.queue-batch-count {
    color: #23364c;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.selection-summary-separator {
    color: #96a4b3;
}

.batch-clear-button,
.batch-select-all-matching {
    min-height: 28px;
    padding: 3px 5px;
    border: 0;
    background: transparent;
    color: #365a80;
    font: inherit;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

.batch-clear-button:hover:not(:disabled),
.batch-select-all-matching:hover:not(:disabled) {
    color: #1d4168;
    text-decoration: underline;
}

.batch-select-all-matching {
    margin-left: 2px;
    color: #5b3f88;
}

.queue-batch-divider {
    align-self: stretch;
    width: 1px;
    min-height: 26px;
    background: #d4dce5;
}

.queue-batch-toolbar > button {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 11px;
}

.queue-batch-overflow {
    position: relative;
    flex: 0 0 auto;
}

.queue-batch-overflow > summary {
    display: inline-grid;
    width: 30px;
    min-height: 30px;
    place-items: center;
    padding: 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #52657b;
    cursor: pointer;
    list-style: none;
}

.queue-batch-overflow > summary::-webkit-details-marker {
    display: none;
}

.queue-batch-overflow > summary:hover,
.queue-batch-overflow[open] > summary {
    border-color: #c2ccd7;
    background: #f0f3f7;
    color: #293d55;
}

.queue-batch-overflow-panel {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    width: 150px;
    padding: 5px;
    border: 1px solid #bcc7d5;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 41, 51, .18);
}

.queue-batch-overflow:not([open]) > .queue-batch-overflow-panel {
    display: none;
}

.queue-batch-overflow-panel button {
    width: 100%;
    min-height: 32px;
    justify-content: flex-start;
}

@keyframes queue-selection-bar-enter {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.erp-posting-banner {
    min-height: 28px;
    padding: 6px 12px;
    border-bottom: 1px solid #e6cf9b;
    background: #fff9eb;
    color: #72500a;
    font-size: 11px;
    font-weight: 700;
}

.batch-send-button,
.batch-delete-button {
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.batch-send-button {
    border: 1px solid #1f7045;
    border-radius: 6px;
    background: #267a4d;
    color: #fff;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.batch-send-button:hover:not(:disabled),
.batch-send-button:focus-visible {
    border-color: #175d38;
    background: #1e6942;
    color: #fff;
}

.batch-delete-button {
    border: 1px solid #d5a0a5;
    color: #a12e37;
}

.batch-delete-button:hover:not(:disabled),
.batch-delete-button:focus-visible {
    border-color: #be5961;
    background: #fff3f4;
    color: #87252d;
}

.batch-send-button:focus-visible,
.batch-delete-button:focus-visible,
.batch-clear-button:focus-visible,
.batch-select-all-matching:focus-visible,
.queue-batch-overflow > summary:focus-visible {
    outline: 2px solid rgba(84, 107, 138, .24);
    outline-offset: 2px;
}

.batch-send-button:disabled,
.batch-delete-button:disabled,
.batch-clear-button:disabled,
.batch-select-all-matching:disabled {
    cursor: default;
    opacity: .5;
}

.queue-select-column,
.queue-select-cell {
    width: 38px !important;
    padding-right: 6px !important;
    padding-left: 9px !important;
    cursor: pointer;
    text-align: center !important;
}

.queue-row-checkbox,
#queue-select-all {
    appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    display: inline-grid;
    place-content: center;
    border: 1px solid #8c9bad;
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
}

.queue-row-checkbox:checked,
#queue-select-all:checked,
#queue-select-all:indeterminate {
    border-color: #2675c7;
    background: #2675c7;
}

.queue-row-checkbox:checked::before,
#queue-select-all:checked::before {
    width: 8px;
    height: 4px;
    content: "";
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    transform: translateY(-1px) rotate(-45deg);
}

#queue-select-all:indeterminate::before {
    width: 8px;
    height: 2px;
    content: "";
    border-radius: 1px;
    background: #fff;
}

.queue-row-checkbox:focus-visible,
#queue-select-all:focus-visible {
    outline: 2px solid rgba(38, 117, 199, .35);
    outline-offset: 2px;
}

.queue-table th:nth-child(1) { width: 38px; }
.queue-table th:nth-child(2) { width: 112px; }
.queue-table th:nth-child(3) { width: 120px; }
.queue-table th:nth-child(4) { width: 13%; }
.queue-table th:nth-child(5) { width: 120px; }
.queue-table th:nth-child(6) { width: 108px; }
.queue-table th:nth-child(7) { width: 20%; }
.queue-table th:nth-child(8) { width: 112px; }
.queue-table th:nth-child(9) { width: 136px; }
.queue-table th:nth-child(10) { width: 112px; }
.queue-table th:nth-child(11) { width: 108px; }
.queue-table th:nth-child(12) { width: 124px; }
.queue-table th:nth-child(13) { width: 42px; }

.queue-row {
    cursor: pointer;
}

.queue-row:hover {
    background: #f3eefb;
}

.queue-row.selected {
    background: var(--queue-row-selected);
    box-shadow: inset 4px 0 var(--purple);
}

.queue-row:nth-child(even):not(.selected) {
    background: var(--queue-row-alt);
}

.queue-row:nth-child(even):not(.selected):hover {
    background: #f3eefb;
}

.queue-row td {
    height: 36px;
    max-height: 36px;
    padding: 4px 9px;
    border-bottom: 1px solid #d3dbe5;
    color: #24364d;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.queue-row:focus-visible {
    outline: 3px solid rgba(114, 80, 168, .25);
    outline-offset: -3px;
}

.queue-action-cell {
    position: sticky;
    z-index: 2;
    right: 0;
    background: #fff;
    box-shadow: -5px 0 8px -8px rgba(35, 59, 99, .8);
    text-align: right;
}

.queue-action-column {
    right: 0;
    z-index: 3 !important;
    padding: 3px !important;
    text-align: center !important;
}

.queue-table th:first-child {
    left: 0;
    z-index: 3 !important;
}

.queue-row td:first-child {
    position: sticky;
    z-index: 2;
    left: 0;
    background: #fff;
}

.queue-row:nth-child(even):not(.selected) .queue-action-cell,
.queue-row:nth-child(even):not(.selected) td:first-child {
    background: var(--queue-row-alt);
}

.queue-row:hover .queue-action-cell,
.queue-row:hover td:first-child {
    background: #f3eefb;
}

.queue-row.selected .queue-action-cell,
.queue-row.selected td:first-child {
    background: var(--queue-row-selected);
}

.queue-open-button {
    min-width: 28px;
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid #cbbbe0;
    border-radius: 6px;
    background: #fff;
    color: #654290;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.queue-open-button:hover {
    border-color: var(--purple);
    background: var(--purple-soft);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #eaf3ff;
    color: #1458a6;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.status-pill::before {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 999px;
    background: #2f83e6;
    content: "";
}

.supplier-number-cell,
.supplier-cell {
    font-weight: 750;
}

.invoice-number-cell {
    font-weight: 600;
}

.status-pill[data-category="new"],
.status-pill[data-category="review"],
.status-pill[data-category="review-neutral"] {
    background: #eaf3ff;
    color: #1458a6;
}

.status-pill[data-category="new"]::before,
.status-pill[data-category="review"]::before,
.status-pill[data-category="review-neutral"]::before {
    background: #2f83e6;
}

.status-pill[data-category="processing"] {
    background: #e8f6f7;
    color: #0d6870;
}

.status-pill[data-category="processing"]::before {
    background: #20a0aa;
}

.status-pill[data-category="ready"] {
    background: #e8f7ee;
    color: #18794e;
}

.status-pill[data-category="ready"]::before {
    background: #30a46c;
}

.status-pill[data-category="posted"] {
    background: #f0f1f6;
    color: #4d5878;
}

.status-pill[data-category="posted"]::before {
    background: #7180a6;
}

.status-pill[data-category="po-missing"],
.status-pill[data-category="po-setup"],
.status-pill[data-category="po-required"],
.status-pill[data-category="po-vendor-review"],
.status-pill[data-category="po-variance"],
.status-pill[data-category="template-needed"],
.status-pill[data-category="duplicate"],
.status-pill[data-category="supplier"],
.status-pill[data-category="required-field"],
.status-pill[data-category="amount"],
.status-pill[data-category="split-pdf"],
.status-pill[data-category="business-rule"],
.status-pill[data-category="coding"] {
    background: #fff4d8;
    color: #8a5900;
}

.status-pill[data-category="po-missing"]::before,
.status-pill[data-category="po-setup"]::before,
.status-pill[data-category="po-required"]::before,
.status-pill[data-category="po-vendor-review"]::before,
.status-pill[data-category="po-variance"]::before,
.status-pill[data-category="template-needed"]::before,
.status-pill[data-category="duplicate"]::before,
.status-pill[data-category="supplier"]::before,
.status-pill[data-category="required-field"]::before,
.status-pill[data-category="amount"]::before,
.status-pill[data-category="split-pdf"]::before,
.status-pill[data-category="business-rule"]::before,
.status-pill[data-category="coding"]::before {
    background: #d99b00;
}

.status-pill[data-category="posting-error"],
.status-pill[data-category="setup-error"],
.status-pill[data-category="file-error"],
.status-pill[data-category="read-error"],
.status-pill[data-category="error"] {
    background: #fdebec;
    color: #b4232d;
}

.status-pill[data-category="posting-error"]::before,
.status-pill[data-category="setup-error"]::before,
.status-pill[data-category="file-error"]::before,
.status-pill[data-category="read-error"]::before,
.status-pill[data-category="error"]::before {
    background: #e5484d;
}

.queue-status-cell {
    white-space: nowrap;
}

.erp-readiness-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 18px;
    margin-left: 5px;
    border: 0;
    background: transparent;
    font-size: 0;
    line-height: 1;
    vertical-align: middle;
    cursor: help;
}

.erp-readiness-badge::before {
    font-size: 13px;
    font-weight: 900;
}

.erp-readiness-badge[data-state="ready"]::before {
    content: "\2713";
    color: #196f4a;
}

.erp-readiness-badge[data-state="blocked"]::before {
    content: "\26A0";
    color: #d89400;
}

.file-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.file-cell .file-name {
    min-width: 0;
}

.ocr-tag {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 1.15rem;
    padding: 0.05rem 0.32rem;
    border: 1px solid #aebbc8;
    border-radius: 0.3rem;
    background: #f2f5f7;
    color: #526272;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
}

.queue-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amount-column,
.amount-cell {
    text-align: right !important;
}

.row-error {
    display: block;
    margin-top: 4px;
    color: var(--red);
    font-size: 10px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.received-cell {
    white-space: nowrap;
    font-size: 11px !important;
    font-weight: 650;
}

.table-message {
    height: 150px;
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.table-message.error {
    color: var(--red);
    font-weight: 700;
}

.detail-root {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.detail-root.detail-loaded {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.empty-detail,
.detail-message {
    display: grid;
    place-content: center;
    min-height: 360px;
    padding: 44px;
    color: var(--muted);
    text-align: center;
}

.empty-detail p:last-child,
.detail-message p {
    max-width: 420px;
    margin: 10px auto 0;
    line-height: 1.55;
}

.detail-message.error h2,
.detail-message.error p {
    color: var(--red);
}

.detail-heading {
    flex: 0 0 auto;
    align-items: center;
    min-height: 48px;
    padding: 5px 10px;
    background: #fff;
}

.detail-heading .eyebrow {
    margin-bottom: 1px;
    font-size: 11px;
}

.detail-heading h2 {
    overflow: hidden;
    max-width: min(70vw, 900px);
    font-size: 16px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-heading .status-pill {
    flex: 0 0 auto;
}

.detail-heading p:last-child {
    margin: 1px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.detail-body {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 4px;
}

.detail-priority {
    display: grid;
    gap: 5px;
    max-height: none;
    overflow: visible;
}

.detail-workspace {
    display: grid;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-alt);
}

.fullscreen-detail-layout {
    grid-template-columns: minmax(320px, .95fr) minmax(480px, 1.15fr);
}

.detail-pdf-column {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    border-right: 1px solid var(--line);
    background: #eef1f5;
}

.detail-pdf-column .source-pdf-section {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    border: 0;
    border-radius: 0;
}

.detail-pdf-column .source-pdf-frame {
    flex: 1 1 auto;
    min-height: 560px;
}

.detail-review-column {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 5px;
    background: #f1f4f8;
}

.detail-review-section {
    display: grid;
    min-width: 0;
    gap: 5px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--line);
}

.detail-review-section:first-of-type {
    margin-top: 4px;
}

.detail-review-section-title {
    margin: 0;
    padding: 1px 2px;
    color: #4f386f;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .025em;
}

.detail-secondary-disclosure {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.detail-secondary-summary {
    display: grid;
    grid-template-columns: 13px max-content minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 5px 8px;
    color: var(--navy);
    cursor: pointer;
    list-style: none;
}

.detail-secondary-summary::-webkit-details-marker {
    display: none;
}

.detail-secondary-summary::before {
    color: #7654a5;
    content: "\25b8";
    font-size: 12px;
}

.detail-secondary-disclosure[open] > .detail-secondary-summary::before {
    content: "\25be";
}

.detail-secondary-summary strong {
    font-size: 12px;
}

.detail-secondary-summary span {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-secondary-disclosure[open] > .detail-secondary-summary {
    border-bottom: 1px solid var(--soft-line);
    background: #f7f8fa;
}

.detail-secondary-disclosure:not([open]) > .detail-secondary-content {
    display: none;
}

.detail-secondary-content {
    min-width: 0;
}

.header-field-section > .detail-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.header-field-section .field-row {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-rows: auto minmax(28px, auto);
    align-content: start;
    min-height: 60px;
    padding: 6px 7px;
}

.header-field-section .field-definition {
    grid-column: 1;
    grid-row: 1;
}

.header-field-section .field-editor,
.header-field-section .field-value,
.header-field-section .field-authority-values {
    grid-column: 1 / -1;
    grid-row: 2;
}

.header-field-section .field-edit-restriction {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 2px;
    line-height: 1.25;
}

.header-field-section .field-evidence {
    grid-column: 2;
    grid-row: 1;
}

.header-field-section .field-evidence[open] {
    grid-column: 1 / -1;
    grid-row: auto;
}

.accounting-section-stack {
    display: grid;
    gap: 7px;
}

.accounting-section-group {
    min-width: 0;
    border: 1px solid var(--soft-line);
    border-radius: 7px;
    background: #fff;
    overflow: hidden;
}

.accounting-section-title {
    margin: 0;
    padding: 6px 8px;
    border-bottom: 1px solid var(--soft-line);
    background: #f7f8fa;
    color: var(--navy);
    font-size: 11px;
    text-transform: uppercase;
}

.source-pdf-help {
    margin: 0;
    overflow: hidden;
    padding: 6px 10px;
    border-bottom: 1px solid var(--soft-line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-pdf-frame {
    display: block;
    width: 100%;
    min-height: 520px;
    border: 0;
    border-bottom: 1px solid var(--soft-line);
    background: #f5f6f8;
}

.source-pdf-open {
    display: inline-block;
    padding: 7px 10px;
    color: #684395;
    font-size: 11px;
    font-weight: 700;
}

.error-card,
.proof-card,
.workflow-card,
.detail-section {
    border: 1px solid var(--soft-line);
    border-radius: 9px;
    background: #fff;
}

.error-card,
.proof-card {
    padding: 8px 10px;
}

.detail-priority > .error-card,
.detail-priority > .proof-card {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 10px;
    padding: 6px 8px;
    border-radius: 6px;
}

.detail-priority > .error-card h3,
.detail-priority > .proof-card h3,
.detail-priority > .error-card p,
.detail-priority > .proof-card p {
    margin: 0;
}

.detail-priority > .error-card h3,
.detail-priority > .proof-card h3 {
    font-size: 12px;
}

.detail-priority > .error-card p,
.detail-priority > .proof-card p {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error-card {
    border-color: #e6aaa6;
    background: var(--red-soft);
    color: var(--red);
}

.error-card h3,
.error-card p {
    color: inherit;
}

.error-card p,
.proof-card p {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.45;
}

.proof-card.confirmed {
    border-color: #b9ddca;
    background: var(--green-soft);
}

.proof-card.warning {
    border-color: #e2bd76;
    border-left: 4px solid #d89b12;
    background: #fffaf0;
    color: #7a5200;
}

.proof-card.pending {
    background: var(--surface-alt);
}

.erp-posting-status {
    position: relative;
}

.erp-posting-heading {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.erp-posting-spinner {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border: 2px solid #c7b8dc;
    border-top-color: #684395;
    border-radius: 50%;
    animation: erp-posting-spin 0.8s linear infinite;
}

.erp-posting-failed .erp-posting-message,
.erp-posting-uncertain .erp-posting-message {
    font-weight: 600;
}

@keyframes erp-posting-spin {
    to { transform: rotate(360deg); }
}

.erp-posting-guard[hidden] {
    display: none;
}

.erp-posting-guard {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 88px 16px 16px;
    background: rgba(244, 246, 249, .18);
    cursor: wait;
}

.erp-posting-guard-card {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(520px, calc(100vw - 32px));
    padding: 14px 18px;
    border: 1px solid #b9a4d5;
    border-left: 4px solid var(--purple);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(31, 41, 51, .22);
    color: var(--ink);
}

.erp-posting-guard-card .erp-posting-spinner {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.erp-posting-guard-card div {
    display: grid;
    gap: 2px;
}

.erp-posting-guard-card strong {
    color: #51317d;
    font-size: 15px;
}

.erp-posting-guard-card span:last-child {
    color: var(--muted);
    font-size: 13px;
}

.review-extraction-card {
    border-color: #e2bd76;
    background: var(--orange-soft);
}

.review-extraction-card .selection-missing {
    color: var(--red);
    font-weight: 800;
}

.review-extraction-card p {
    overflow-wrap: anywhere;
}

.review-extraction-card .review-extraction-recovery {
    margin-top: 10px;
}

.review-extraction-recovery-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.review-extraction-recovery-links .secondary-button {
    min-height: 32px;
    padding: 6px 10px;
    text-decoration: none;
}

.review-extraction-readonly {
    margin: 0;
    padding: 9px 10px;
    border: 1px solid #e2bd76;
    border-radius: 6px;
    background: var(--orange-soft);
    color: #72521e;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.4;
}

.workflow-card {
    padding: 7px 8px;
    border-color: #d9ccec;
    background: #fbf9fe;
}

.detail-priority > .workflow-card {
    display: grid;
    grid-template-columns: minmax(250px, .95fr) minmax(250px, 1.05fr);
    align-items: end;
    gap: 6px 10px;
    border-radius: 6px;
}

.workflow-card.resolve-routing-card {
    border-color: #e2bd76;
    background: var(--orange-soft);
}

.resolve-routing-card .review-extraction-recovery-links {
    margin: 10px 0;
}

.workflow-card h3 {
    grid-column: 1 / -1;
    margin-bottom: 0;
    font-size: 12px;
}

.vendor-override-control {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(165px, 1fr) minmax(165px, 220px) auto;
    align-items: end;
    gap: 5px 8px;
    margin-bottom: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--soft-line);
}

.vendor-override-control summary {
    grid-column: 1;
    align-self: center;
    color: var(--navy);
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.vendor-override-control:not([open]) {
    display: block;
    grid-column: 1 / -1;
    margin-bottom: 0;
    padding-bottom: 5px;
}

.vendor-override-control p {
    margin-top: 5px;
}

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

.vendor-override-label {
    display: grid;
    grid-column: 2;
    gap: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.vendor-override-input {
    min-height: 30px;
    padding: 5px 7px;
    border: 1px solid #b7a4d3;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.vendor-override-input:focus {
    outline: 2px solid #d7c4f0;
    outline-offset: 1px;
}

.erp-site-control {
    display: grid;
    max-width: 240px;
    gap: 3px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.erp-site-input {
    min-height: 30px;
    padding: 5px 7px;
    border: 1px solid #b7a4d3;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    text-transform: uppercase;
}

.erp-site-input:focus {
    outline: 2px solid #d7c4f0;
    outline-offset: 1px;
}

.review-approval-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: end;
    justify-content: start;
    gap: 6px;
    margin-bottom: 0;
}

.review-approval-row .erp-site-control {
    width: 100%;
    max-width: none;
    margin: 0;
}

.workflow-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 6px;
}

.primary-action,
.secondary-action,
.danger-action {
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

.primary-action {
    border: 1px solid var(--purple);
    background: var(--purple);
    color: #fff;
}

.primary-action:hover:not(:disabled) {
    background: #634493;
}

.secondary-action {
    border: 1px solid #b7a4d3;
    background: #fff;
    color: #5e4089;
}

.secondary-action:hover:not(:disabled) {
    background: var(--purple-soft);
}

.danger-action {
    border: 1px solid #b83e47;
    background: #fff0f1;
    color: #912c34;
}

.danger-action:hover:not(:disabled) {
    background: #f8dadd;
}

.primary-action:disabled {
    border-color: #d5abb0;
    background: #ead7d8;
    color: #7e5054;
    opacity: 1;
}

.workflow-help {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.workflow-help.blocked {
    color: var(--red);
    font-weight: 700;
}

.detail-section > h3 {
    margin: 0;
    padding: 7px 9px;
    border-bottom: 1px solid var(--soft-line);
    font-size: 13px;
}

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

.detail-pair {
    min-width: 0;
    padding: 6px 9px;
    border-right: 1px solid var(--soft-line);
    border-bottom: 1px solid var(--soft-line);
}

.detail-pair:nth-child(even) {
    border-right: 0;
}

.detail-pair dt {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.detail-pair dd {
    margin: 0;
    color: var(--ink);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.detail-list,
.routing-list,
.event-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 7px;
    list-style: none;
}

.blank-state {
    margin: 0;
    padding: 14px;
    color: var(--muted);
    font-size: 12px;
}

.field-row {
    display: grid;
    grid-template-columns: minmax(120px, .72fr) minmax(180px, 1.28fr) max-content;
    column-gap: 7px;
    row-gap: 0;
    align-items: center;
    min-height: 36px;
    padding: 3px 7px;
    border: 1px solid var(--soft-line);
    border-radius: 8px;
    background: #fbfcfd;
}

.field-edit-restriction {
    grid-column: 2 / -1;
    color: var(--muted);
    font-size: 10px;
}

.field-definition {
    min-width: 0;
}

.field-definition strong,
.field-definition span {
    display: block;
}

.field-definition strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-definition span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.field-definition .field-restriction {
    color: #8a5a18;
    line-height: 1.4;
}

.field-value {
    min-width: 0;
    color: var(--ink);
    font-size: 13px;
    overflow-x: auto;
    white-space: nowrap;
}

.field-value.blank {
    color: var(--muted);
    font-style: italic;
}

.field-editor {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
}

.field-editor.unsaved {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.field-editor.unsaved input,
.field-editor.unsaved textarea {
    border-color: #d99b24;
    background: #fff9e8;
}

.field-editor input,
.field-editor textarea {
    min-width: 0;
    flex: 1 1 auto;
    height: 28px;
    padding: 4px 7px;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
}

.field-editor textarea {
    min-height: 28px;
    resize: vertical;
    line-height: 18px;
    overflow: auto;
    white-space: nowrap;
}

.field-editor button {
    flex: 0 0 auto;
    height: 28px;
    padding: 4px 8px;
    border: 1px solid #b9a4d8;
    border-radius: 6px;
    background: var(--purple-soft);
    color: #5e4089;
    font-weight: 700;
    cursor: pointer;
}

.field-editor button:disabled {
    border-color: #d8dbe0;
    background: #f1f2f4;
    color: #89909a;
    cursor: default;
}

.field-unsaved-note {
    margin: 0;
    color: #8a5a18;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.field-unsaved-note[hidden] {
    display: none;
}

.field-validation-error {
    max-width: min(26vw, 280px);
    margin: 0;
    color: var(--red);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    overflow-x: auto;
    white-space: nowrap;
}

.field-evidence {
    grid-column: 3;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--muted);
    font-size: 10px;
    justify-self: end;
}

.field-evidence-summary {
    width: fit-content;
    color: #684395;
    cursor: pointer;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.field-evidence-panel {
    min-width: 0;
}

.field-evidence:not([open]) > .field-evidence-panel {
    display: none;
}

.field-technical-details,
.field-evidence .field-restriction {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.field-evidence .field-restriction {
    color: #8a5a18;
}

.field-evidence[open] .field-evidence-summary {
    margin-bottom: 7px;
}

.field-evidence[open] {
    grid-column: 1 / -1;
    width: 100%;
    padding-top: 6px;
    border-top: 1px dashed var(--line);
    justify-self: stretch;
}

.field-authority-values {
    display: flex;
    min-width: 0;
    margin: 0;
    padding: 0;
    gap: 6px;
    overflow-x: auto;
    list-style: none;
    white-space: nowrap;
}

.field-authority-values li + li::before {
    margin-right: 6px;
    color: var(--muted);
    content: "\2022";
}

.field-authority-values .field-value {
    flex: 0 0 auto;
    overflow: visible;
}

.field-evidence-list {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 20px;
}

.field-evidence-row span {
    display: block;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.field-evidence-value {
    color: var(--ink);
    font-weight: 700;
}

.candidate-card {
    overflow: hidden;
    border: 1px solid var(--soft-line);
    border-radius: 8px;
    background: #fbfcfd;
}

.event-card,
.attempt-card {
    padding: 11px;
    border: 1px solid var(--soft-line);
    border-radius: 8px;
    background: #fbfcfd;
}

.candidate-card.matched {
    border-color: #b9ddca;
    background: #f5fbf8;
}

.candidate-card.partial {
    border-color: #e5c66e;
    background: #fffaf0;
}

.candidate-card.selected {
    box-shadow: inset 3px 0 0 var(--green);
}

.routing-candidate-disclosure,
.routing-vendor-evidence-disclosure {
    margin: 0;
}

.candidate-summary,
.vendor-evidence-summary {
    display: grid;
    gap: 8px;
    align-items: center;
    min-height: 36px;
    padding: 3px 9px;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
}

.candidate-summary {
    grid-template-columns: 11px auto minmax(130px, .9fr) minmax(110px, .75fr) minmax(150px, 1.2fr);
}

.candidate-summary::-webkit-details-marker,
.vendor-evidence-summary::-webkit-details-marker {
    display: none;
}

.candidate-summary::before,
.vendor-evidence-summary::before {
    content: "\25b8";
    color: #7654a5;
    font-size: 12px;
}

.routing-candidate-disclosure[open] > .candidate-summary::before,
.routing-vendor-evidence-disclosure[open] > .vendor-evidence-summary::before {
    content: "\25be";
}

.candidate-summary > *,
.vendor-evidence-summary > * {
    min-width: 0;
}

.candidate-summary-identity,
.candidate-summary-vendor,
.candidate-summary-result {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.candidate-summary-identity {
    color: var(--navy);
    font-size: 12px;
}

.candidate-summary-vendor,
.candidate-summary-result {
    font-size: 11px;
}

.candidate-summary-result {
    color: #596272;
}

.candidate-detail {
    padding: 8px 10px 10px;
    border-top: 1px solid var(--soft-line);
    background: rgba(255, 255, 255, .72);
}

.vendor-evidence-card {
    overflow: hidden;
    border: 1px solid var(--soft-line);
    border-radius: 8px;
    background: #fbfcfd;
}

.vendor-evidence-card.conflict {
    border-color: #e7b4b4;
    background: #fff8f8;
}

.vendor-evidence-summary {
    grid-template-columns: 11px auto minmax(80px, .55fr) minmax(150px, 1.35fr) minmax(150px, 1fr);
}

.vendor-evidence-kind,
.vendor-evidence-text,
.vendor-evidence-binding {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vendor-evidence-kind {
    color: var(--navy);
    font-size: 12px;
}

.vendor-evidence-text,
.vendor-evidence-binding {
    color: #596272;
    font-size: 11px;
}

.vendor-evidence-detail {
    border-top: 1px solid var(--soft-line);
    background: rgba(255, 255, 255, .72);
}

.candidate-binding {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.classifier-open-link {
    display: inline-flex;
    width: fit-content;
    margin: 2px 0 8px;
    color: #5e4089;
    font-size: 11px;
    font-weight: 800;
}

.event-heading,
.attempt-heading,
.rule-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.event-heading strong,
.attempt-heading strong {
    color: var(--navy);
    font-size: 12px;
}

.pass-badge,
.partial-badge,
.fail-badge {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.pass-badge {
    background: var(--green-soft);
    color: var(--green);
}

.partial-badge {
    background: #fff0cf;
    color: #8b5d09;
}

.fail-badge {
    background: var(--red-soft);
    color: var(--red);
}

.candidate-reason,
.rule-diagnostic,
.event-card p,
.attempt-card p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.erp-response-success {
    color: #17633f;
    background: #edf8f2;
    border-left: 3px solid #2d8a5f;
    border-radius: 4px;
    padding: 0.55rem 0.7rem;
}

.rule-list {
    display: grid;
    gap: 7px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.rule-card {
    padding: 9px;
    border-left: 3px solid #cfd7e3;
    border-radius: 5px;
    background: #fff;
}

.rule-card.passed {
    border-left-color: var(--green);
}

.rule-card.failed {
    border-left-color: var(--red);
}

.rule-heading strong {
    font-size: 11px;
    line-height: 1.4;
}

.rule-provenance {
    margin: 6px 0 0;
    color: #6a7483;
    font-size: 10px;
}

.routing-rule-technical {
    margin-top: 7px;
    border-top: 1px dashed #e1dbea;
}

.routing-rule-technical-summary {
    padding-top: 7px;
    color: #69508f;
    font-size: 10px;
    font-weight: 750;
    cursor: pointer;
}

.routing-rule-technical[open] .routing-rule-technical-summary {
    margin-bottom: 5px;
}

.evidence-list {
    display: grid;
    gap: 5px;
    margin: 7px 0 0;
    padding: 0;
    list-style: none;
}

.evidence-list li {
    padding: 7px 8px;
    border: 1px solid #e7e2ef;
    border-radius: 5px;
    background: #faf8fd;
    color: #4f5764;
    font-size: 10px;
    line-height: 1.45;
}

.routing-summary {
    padding: 12px 14px;
    border-bottom: 1px solid var(--soft-line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.routing-summary strong {
    color: var(--navy);
}

.accounting-pane-content,
.accounting-distributions,
.accounting-rule-traces,
.accounting-group-traces {
    display: grid;
    gap: 12px;
}

.distribution-bucket-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--soft-line);
    background: #f7f8fa;
}

.distribution-bucket-total {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 6px;
    border: 1px solid var(--soft-line);
    border-radius: 5px;
    background: #fff;
    font-size: 12px;
}

.distribution-field-table {
    min-width: 0;
    overflow: visible;
}

.accounting-distributions {
    min-width: 0;
    overflow-x: auto;
}

.distribution-field-table-row {
    display: grid;
    grid-template-columns: minmax(104px, 1.4fr) minmax(72px, .8fr)
        repeat(5, minmax(40px, .55fr));
    min-width: 0;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    font-size: 12px;
}

.distribution-field-table-header,
.accounting-distribution-table-header {
    color: var(--muted);
    background: #f7f8fa;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.distribution-field-disclosure {
    min-width: 0;
    border-top: 1px solid var(--soft-line);
    background: #fff;
}

.distribution-field-disclosure > summary {
    cursor: pointer;
    list-style: none;
}

.distribution-field-disclosure > summary::-webkit-details-marker {
    display: none;
}

.distribution-field-disclosure > summary:hover {
    background: #faf8fd;
}

.accounting-distribution > summary {
    cursor: pointer;
}

.distribution-field-disclosure[open] > summary,
.accounting-distribution[open] > summary {
    background: #f6f1fd;
}

.distribution-field-evidence {
    display: grid;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid var(--soft-line);
}

.distribution-field-editor-panel {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.distribution-field-editor {
    width: min(100%, 560px);
}

.distribution-field-editor textarea {
    min-height: 54px;
    white-space: pre;
}

.distribution-field-edit-copy,
.distribution-field-edit-restriction {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.distribution-field-edit-restriction {
    color: #8a5a18;
}

.distribution-charge-summary,
.distribution-field-name,
.distribution-amount {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.distribution-charge-summary {
    display: grid;
    gap: 1px;
}

.distribution-charge-meta {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.distribution-field-table-row > .accounting-code {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.distribution-amount.blank {
    color: var(--muted);
    font-style: italic;
}

.accounting-distribution-row {
    display: grid;
    grid-template-columns: 78px minmax(170px, 1.35fr) minmax(95px, .75fr)
        repeat(5, minmax(62px, .55fr)) minmax(100px, .8fr);
    min-width: 900px;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    font-size: 11px;
}

.accounting-distribution-source,
.accounting-distribution-amount {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.accounting-toolbar {
    padding-bottom: 12px;
}

.accounting-toolbar > h3 {
    display: none;
}

.accounting-toolbar-heading,
.accounting-distribution-heading,
.accounting-trace-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.accounting-toolbar-heading {
    padding: 12px 14px;
    border-bottom: 1px solid var(--soft-line);
}

.accounting-toolbar-heading h3,
.accounting-distribution-heading h4,
.accounting-trace-heading h4,
.accounting-group-trace h5 {
    margin: 0;
}

.accounting-toolbar-heading p,
.accounting-distribution-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.accounting-actions,
.accounting-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px 0;
}

.accounting-edit-warning,
.accounting-section-copy,
.accounting-validation,
.accounting-pin-help,
.accounting-po-note {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.accounting-edit-warning,
.accounting-section-copy,
.accounting-validation {
    padding: 10px 14px 0;
}

.accounting-edit-warning,
.accounting-validation.error {
    color: var(--red);
    font-weight: 700;
}

.accounting-validation.unsaved {
    color: #8a5a18;
    font-weight: 750;
}

.accounting-pane-content.has-unsaved-accounting .accounting-distributions,
.detail-root.has-unsaved-accounting .accounting-distributions {
    padding: 6px;
    border: 2px solid #d99b24;
    border-radius: 10px;
    background: #fff9e8;
}

.accounting-receipt-status {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--soft-line);
    background: #f7f8fa;
    font-size: 12px;
}

.accounting-receipt-status span {
    color: var(--muted);
    text-align: right;
}

.accounting-receipt-status.passed,
.accounting-receipt-status.applied,
.accounting-receipt-status.succeeded {
    background: var(--green-soft);
}

.accounting-receipt-status.failed,
.accounting-receipt-status.validationfailed {
    background: var(--red-soft);
    color: var(--red);
}

.accounting-technical {
    margin: 10px 12px 12px;
    border: 1px solid var(--soft-line);
    border-radius: 7px;
    background: #fafbfc;
}

.accounting-technical > summary {
    padding: 9px 11px;
    color: #5e4089;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.accounting-technical-grid {
    border-top: 1px solid var(--soft-line);
}

.accounting-pin-list,
.accounting-finding-list,
.accounting-effect-list,
.accounting-condition-traces {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 12px;
    list-style-position: inside;
}

.accounting-pin-item,
.accounting-finding-item,
.accounting-effect-item,
.accounting-condition-trace {
    padding: 10px 12px;
    border: 1px solid var(--soft-line);
    border-radius: 8px;
    background: #fbfcfd;
    font-size: 12px;
}

.accounting-pin-item > strong,
.accounting-pin-item > span,
.accounting-effect-change {
    display: block;
}

.accounting-pin-item > span,
.accounting-effect-change {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.accounting-distribution,
.accounting-rule-trace,
.accounting-group-trace {
    border: 1px solid var(--soft-line);
    border-radius: 9px;
    background: #fff;
}

.accounting-distribution-heading,
.accounting-trace-heading,
.accounting-group-trace > h5 {
    padding: 11px 12px;
    border-bottom: 1px solid var(--soft-line);
}

.accounting-mode,
.accounting-match {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eceef2;
    color: #5b6370;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.accounting-mode.gl,
.accounting-match.matched {
    background: var(--green-soft);
    color: #236044;
}

.accounting-mode.po {
    background: #e9eff9;
    color: #355b92;
}

.accounting-match.not-matched {
    background: #f0f1f3;
    color: #747b86;
}

.accounting-po-note,
.accounting-pin-help {
    padding: 9px 12px;
    border-bottom: 1px solid var(--soft-line);
}

.accounting-coding-grid {
    display: grid;
    grid-template-columns: 62px minmax(72px, .75fr) minmax(105px, 1fr) minmax(190px, 1.4fr);
    align-items: stretch;
    border-bottom: 1px solid var(--soft-line);
}

.accounting-coding-grid > * {
    min-width: 0;
    padding: 8px;
    border-right: 1px solid var(--soft-line);
    border-bottom: 1px solid var(--soft-line);
}

.accounting-coding-grid > *:nth-child(4n) {
    border-right: 0;
}

.accounting-coding-header {
    background: #f7f8fa;
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.accounting-coding-field,
.accounting-code,
.accounting-read-only {
    font-size: 11px;
    overflow-wrap: anywhere;
}

.accounting-code.changed {
    background: #fff5d8;
    color: #76500a;
    font-weight: 750;
}

.accounting-pin-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    align-items: center;
}

.accounting-pin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #5e4089;
    font-size: 10px;
    font-weight: 750;
}

.accounting-pin-input {
    width: 100%;
    min-width: 0;
    padding: 6px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-size: 11px;
    text-transform: uppercase;
}

.accounting-pin-input:disabled {
    background: #f1f2f4;
    color: #858b95;
}

.accounting-rule-traces,
.accounting-distributions {
    padding: 7px;
}

.accounting-explanation {
    margin: 8px 12px;
    color: var(--ink);
    font-size: 11px;
    line-height: 1.5;
}

.accounting-group-traces {
    padding: 0 12px 12px;
}

.accounting-condition-trace.matched {
    border-left: 4px solid #69a985;
}

.accounting-condition-trace.not-matched {
    border-left: 4px solid #bfc3ca;
}

@media (min-width: 1181px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }
}

@media (max-width: 1180px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .app-header {
        grid-template-columns: minmax(220px, 1fr) auto;
        gap: 10px;
        height: 72px;
        min-height: 72px;
        padding: 6px 10px;
    }

    .brand-copy {
        display: none;
    }

    .brand-product h1,
    .brand-product span {
        white-space: nowrap;
    }

    .header-refresh {
        display: none;
    }

    .workbench {
        grid-template-columns: minmax(0, 1fr);
        height: calc(100vh - 72px);
        min-height: 0;
    }

    .queue-command-strip {
        grid-template-columns: minmax(220px, 1fr) minmax(140px, 190px) auto;
        grid-template-areas: "search snapshot refresh";
        min-height: 48px;
    }

    .table-frame {
        flex-basis: 260px;
        max-height: none;
        min-height: 0;
    }

    .detail-root {
        height: auto;
        max-height: none;
        overflow: hidden;
    }

    .queue-table {
        min-width: 1380px;
    }

    .queue-table th:nth-child(1) { width: 38px; }
    .queue-table th:nth-child(2) { width: 108px; }
    .queue-table th:nth-child(3) { width: 120px; }
    .queue-table th:nth-child(4) { width: 120px; }
    .queue-table th:nth-child(5) { width: 120px; }
    .queue-table th:nth-child(6) { width: 104px; }
    .queue-table th:nth-child(7) { width: 210px; }
    .queue-table th:nth-child(8) { width: 105px; }
    .queue-table th:nth-child(9) { width: 136px; }
    .queue-table th:nth-child(10) { width: 108px; }
    .queue-table th:nth-child(11) { width: 100px; }
    .queue-table th:nth-child(12) { width: 120px; }
    .queue-table th:nth-child(13) { width: 42px; }

    .queue-command-strip .snapshot-meta {
        min-width: 0;
        max-width: none;
    }

    .snapshot-status {
        max-width: 100%;
    }
}

@media (max-width: 960px) {
    .app-header {
        height: 60px;
        min-height: 60px;
        padding-block: 4px;
    }

    .brand-copy,
    .workspace-lock small {
        display: none;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }

    .brand-mark img {
        height: 42px;
    }

    .brand-product {
        min-height: 38px;
        padding-left: 10px;
    }

    .brand-product h1 {
        font-size: 19px;
    }

    .brand-product span {
        font-size: 10px;
    }

    .app-menu-status .workspace-lock { padding: 4px 8px; }

    .workbench {
        height: calc(100vh - 60px);
        padding: 6px;
    }

    .queue-command-strip {
        grid-template-columns: minmax(220px, 1fr) minmax(120px, 170px) auto;
        grid-template-areas: "search snapshot refresh";
        gap: 5px;
        min-height: 46px;
        padding-block: 4px;
    }

    .queue-command-strip .snapshot-meta {
        max-width: 100%;
    }

    .queue-secondary-tabs {
        grid-template-columns: minmax(0, 1fr);
    }

    .queue-tab {
        min-height: 34px;
    }

    .queue-table {
        min-width: 1160px;
    }

    .queue-open-button {
        min-width: 28px;
        padding-inline: 6px;
    }

    .queue-row td {
        height: 32px;
        max-height: 32px;
        padding-block: 3px;
        font-size: 12px;
    }

    .header-field-section > .detail-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fullscreen-detail-layout {
        grid-template-columns: minmax(280px, .85fr) minmax(380px, 1.15fr);
    }

    .detail-priority > .workflow-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .vendor-override-control {
        grid-column: 1;
        grid-template-columns: minmax(150px, 1fr) auto;
    }

    .vendor-override-control summary {
        grid-column: 1 / -1;
    }

    .vendor-override-label {
        grid-column: 1;
    }
}

@media (max-width: 720px) {
    .app-header {
        gap: 10px;
        padding: 8px 10px;
    }

    .brand-copy {
        display: none;
    }

    .workbench {
        padding: 8px;
    }

    .panel-heading,
    .detail-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .snapshot-status {
        max-width: none;
        text-align: left;
    }

    .snapshot-meta {
        justify-items: start;
    }

    .queue-command-strip {
        grid-template-columns: minmax(180px, 1fr) minmax(110px, 150px) auto;
        grid-template-areas: "search snapshot refresh";
        min-height: 46px;
    }

    .queue-stage-strip .upload-box {
        align-items: center;
        flex-direction: row;
    }

    .queue-stage-strip .upload-drop-copy {
        display: none;
    }

    .upload-session-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-summary {
        text-align: left;
    }

    .upload-session-controls {
        grid-template-columns: 1fr;
    }

    .queue-tools {
        display: flex;
        justify-content: stretch;
        gap: 8px;
    }

    #queue-search {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
    }

    .row-summary {
        text-align: left;
    }

    .queue-table {
        min-width: 920px;
    }

    .detail-root.detail-loaded {
        display: block;
        overflow: auto;
    }

    .detail-priority > .error-card,
    .detail-priority > .proof-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-priority > .error-card p,
    .detail-priority > .proof-card p {
        white-space: normal;
    }

    .detail-body {
        overflow: visible;
    }

    .fullscreen-detail-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        overflow: visible;
    }

    .detail-pdf-column,
    .detail-review-column {
        overflow: visible;
    }

    .detail-pdf-column {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .detail-pdf-column .source-pdf-frame {
        min-height: 420px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-pair,
    .detail-pair:nth-child(even) {
        border-right: 0;
    }

    .field-row {
        grid-template-columns: minmax(80px, .65fr) minmax(0, 1.35fr) max-content;
        column-gap: 5px;
    }

    .field-editor {
        gap: 3px;
    }

    .field-editor button {
        padding-inline: 6px;
    }

    .field-editor.invalid,
    .field-editor.unsaved {
        flex-wrap: wrap;
    }

    .field-editor .field-validation-error,
    .field-editor.unsaved .field-unsaved-note {
        flex: 1 0 100%;
        max-width: none;
        overflow-x: visible;
        white-space: normal;
    }

    .candidate-summary,
    .vendor-evidence-summary {
        grid-template-columns: 11px auto minmax(0, 1fr);
        padding-block: 7px;
    }

    .candidate-summary-vendor,
    .candidate-summary-result {
        grid-column: 2 / -1;
        white-space: normal;
    }

    .vendor-evidence-text,
    .vendor-evidence-binding {
        grid-column: 2 / -1;
        white-space: normal;
    }

    .review-approval-row {
        grid-template-columns: 1fr;
    }

    .accounting-toolbar-heading,
    .accounting-distribution-heading,
    .accounting-trace-heading,
    .accounting-receipt-status {
        align-items: stretch;
        flex-direction: column;
    }

    .accounting-receipt-status span {
        text-align: left;
    }

    .accounting-actions,
    .accounting-edit-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .accounting-coding-grid {
        grid-template-columns: 62px minmax(80px, .8fr) minmax(110px, 1.2fr);
    }

    .accounting-coding-header:nth-child(4) {
        display: none;
    }

    .accounting-coding-grid > * {
        border-right: 1px solid var(--soft-line);
    }

    .accounting-coding-grid > .accounting-pin-control {
        grid-column: 1 / -1;
        border-right: 0;
    }

    .accounting-pin-control {
        grid-template-columns: 82px minmax(0, 1fr);
    }
}

@media (max-width: 620px) {
    html,
    body {
        height: auto;
        overflow: auto;
    }

    .app-header {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .header-statuses {
        justify-self: start;
    }

    .header-navigation {
        flex-wrap: wrap;
    }

    .workbench {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .queue-command-strip {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "search refresh"
            "snapshot snapshot";
        min-height: 68px;
    }

    .queue-stage-strip {
        min-height: 48px;
    }

    .queue-view-switcher {
        flex: 1 1 auto;
        gap: 12px;
    }

    .queue-primary-tab {
        padding-inline: 2px;
    }

    .queue-selector {
        flex: 0 0 auto;
        width: auto;
    }

    .queue-selector-summary {
        padding-inline: 4px;
    }

    .queue-refresh {
        justify-self: stretch;
    }

    .queue-stage-strip .upload-box .primary-button {
        flex: 1 1 auto;
    }

    .header-field-section > .detail-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-secondary-summary {
        grid-template-columns: 13px minmax(0, 1fr);
    }

    .detail-secondary-summary span {
        display: none;
    }

    .table-frame {
        flex: 0 1 clamp(190px, 42vh, 340px);
        min-height: 0;
        max-height: 340px;
    }

    .detail-root {
        height: auto;
        max-height: none;
        overflow: auto;
    }

    .queue-screen,
    .detail-screen {
        height: auto;
    }

    .empty-detail,
    .detail-message {
        min-height: 180px;
        padding: 24px;
    }
}

@media (max-width: 430px) {
    .queue-stage-strip {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .queue-view-switcher {
        flex-basis: 100%;
    }

    .queue-primary-views {
        gap: 14px;
    }
}

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

/* Workflow design preview. This surface is enabled only by
   ?workflow-preview=1 and deliberately reuses the production queue and
   invoice-detail geometry while the workflow contract is still being designed. */
.workflow-preview-enabled .workflow-preview-tab { display: grid; }

.workflow-inbox-active .upload-box,
.workflow-inbox-active .current-upload-session,
.workflow-inbox-active #queue-batch-toolbar,
.workflow-inbox-active #queue-action-notice,
.workflow-inbox-active #erp-posting-banner,
.workflow-inbox-active .queue-refresh {
    display: none !important;
}

.workflow-inbox-active .queue-command-strip {
    grid-template-columns: minmax(280px, 520px) minmax(180px, 1fr);
    grid-template-areas: "search snapshot";
}

.workflow-inbox-active .queue-tools {
    gap: 9px;
}

.workflow-scope-toggle {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    padding: 2px;
    border: 1px solid #aebaca;
    border-radius: 7px;
    background: #f2f5f8;
}

.workflow-inbox-active .workflow-scope-toggle {
    display: inline-flex;
}

.workflow-scope-toggle button {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #46566d;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.workflow-scope-toggle button[hidden] {
    display: none !important;
}

.workflow-scope-toggle button:hover {
    background: rgba(255, 255, 255, .62);
}

.workflow-scope-toggle button.active {
    background: #e9e1f6;
    color: #4f367e;
    box-shadow: none;
}

.workflow-scope-toggle button:focus-visible {
    outline: 2px solid #7659b7;
    outline-offset: 1px;
}


.workflow-preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid #ddc77b;
    border-radius: 7px;
    background: #fff9e8;
    color: #5d4a11;
    font-size: 12px;
}

.workflow-preview-banner strong {
    color: #423408;
}

.workflow-preview-grid .queue-select-column,
.workflow-preview-grid .queue-select-cell {
    display: none;
}

.workflow-preview-grid {
    min-width: 1660px !important;
}

.workflow-tag-filter, .workflow-tag-column { display: none; }
.workflow-inbox-active .workflow-tag-filter { display: inline-flex; align-items: center; gap: .5rem; }
.workflow-preview-grid .workflow-tag-column { display: table-cell; min-width: 120px; }
.workflow-tag-filter select { padding: .35rem; }
[data-workflow-tag] { display: flex; align-items: end; gap: .75rem; margin-bottom: 1rem; }

.workflow-preview-grid .queue-filter-button {
    display: none;
}

.workflow-preview-grid .queue-filter-header {
    padding-right: 10px !important;
}

.workflow-preview-grid th:nth-child(2) { width: 120px; }
.workflow-preview-grid th:nth-child(3) { width: 155px; }
.workflow-preview-grid th:nth-child(4) { width: 112px; }
.workflow-preview-grid th:nth-child(5) { width: 130px; }
.workflow-preview-grid th:nth-child(6) { width: 180px; }
.workflow-preview-grid th:nth-child(7) { width: 190px; }
.workflow-preview-grid th:nth-child(8) { width: 120px; }
.workflow-preview-grid th:nth-child(9) { width: 110px; }
.workflow-preview-grid th:nth-child(10) { width: 118px; }
.workflow-preview-grid th:nth-child(11) { width: 110px; }
.workflow-preview-grid th:nth-child(12) { width: 120px; }

.workflow-preview-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #fff0c7;
    color: #76500b;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.workflow-preview-status::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c68218;
    content: "";
}

.workflow-preview-assignee {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
}

.workflow-preview-avatar {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #e2daf8;
    color: #4c347a;
    font-size: 9px;
    font-weight: 850;
}

.workflow-preview-assignee strong,
.workflow-preview-request strong {
    display: block;
    overflow: hidden;
    font-size: 11px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-preview-assignee span,
.workflow-preview-request span,
.workflow-preview-age small {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-preview-age strong {
    display: block;
    font-size: 11px;
}

.workflow-preview-modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(20, 31, 47, .52);
}

.workflow-preview-modal {
    width: min(620px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid #bfc8d6;
    border-radius: 10px;
    background: #fff;
    color: #27364a;
    box-shadow: 0 24px 70px rgba(18, 32, 50, .25);
}

.workflow-preview-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid #dce1e9;
}

.workflow-preview-modal-header h2 {
    margin: 0 0 3px;
    color: #243c5c;
    font-size: 19px;
}

.workflow-preview-modal-header p,
.workflow-preview-modal-copy {
    margin: 0;
    color: #687587;
    font-size: 12px;
}

.workflow-preview-modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid #cbd2dd;
    border-radius: 4px;
    background: #fff;
    color: #43536a;
    font-size: 18px;
    cursor: pointer;
}

.workflow-preview-modal-body {
    display: grid;
    gap: 13px;
    padding: 16px 18px;
}

.workflow-preview-recipient-picker {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.workflow-preview-recipient-picker legend {
    margin-bottom: 6px;
    color: #34445a;
    font-size: 11px;
    font-weight: 750;
}

.workflow-preview-recipient-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.workflow-preview-recipient-options button {
    min-width: 0;
    min-height: 58px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #c1cad7;
    border-radius: 6px;
    background: #fff;
    color: #34445a;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.workflow-preview-recipient-options button:hover:not(:disabled) {
    border-color: #8b72bf;
    background: #fbf9ff;
}

.workflow-preview-recipient-options button.active {
    border-color: #7659b7;
    background: #f6f2ff;
    box-shadow: inset 0 0 0 1px #7659b7;
}

.workflow-preview-recipient-options button:focus-visible {
    outline: 2px solid #7659b7;
    outline-offset: 2px;
}

.workflow-preview-recipient-options button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.workflow-preview-recipient-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e3e8ef;
    color: #43536a;
    font-size: 11px;
    font-weight: 850;
}

.workflow-preview-recipient-options button.active .workflow-preview-recipient-icon {
    background: #dcd1f4;
    color: #4f347d;
}

.workflow-preview-recipient-options strong,
.workflow-preview-recipient-options small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-preview-recipient-options strong {
    font-size: 11px;
}

.workflow-preview-recipient-options small {
    margin-top: 2px;
    color: #6b788a;
    font-size: 9px;
}

.workflow-preview-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.workflow-preview-field {
    display: grid;
    gap: 5px;
    color: #34445a;
    font-size: 11px;
    font-weight: 750;
}
.workflow-preview-field[hidden] { display: none; }

.workflow-preview-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.workflow-preview-request-default {
    position: relative;
    font-weight: 600;
}

.workflow-preview-request-default summary {
    padding: 2px 5px;
    border-radius: 3px;
    color: #65409a;
    font-size: 10px;
    cursor: pointer;
    list-style: none;
}

.workflow-preview-request-default summary::-webkit-details-marker {
    display: none;
}

.workflow-preview-request-default summary:hover,
.workflow-preview-request-default summary:focus-visible,
.workflow-preview-request-default[open] summary {
    background: #f0e9fa;
    outline: none;
}

.workflow-preview-request-default-menu {
    position: absolute;
    z-index: 4;
    top: calc(100% + 5px);
    right: 0;
    width: min(380px, calc(100vw - 64px));
    padding: 12px;
    border: 1px solid #c9badf;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(39, 25, 58, .2);
}

.workflow-preview-request-default-menu strong {
    display: block;
    margin-bottom: 7px;
    color: #27364a;
    font-size: 11px;
}

.workflow-preview-request-default-menu textarea {
    min-height: 82px;
}

.workflow-preview-request-default-menu p {
    min-height: 15px;
    margin: 5px 0 8px;
    color: #687587;
    font-size: 10px;
    font-weight: 500;
}

.workflow-preview-request-default-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}

.workflow-preview-request-default-actions button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 10px;
}

.workflow-preview-reassign {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.5fr) auto;
    gap: 10px;
    align-items: end;
    margin: 12px 0;
    padding: 10px;
    border: 1px solid #d7e0eb;
    border-radius: 7px;
    background: #f7f9fc;
}

.queue-filter-default-vendors {
    display: grid;
    gap: 8px;
    margin: 8px 0 10px;
    padding: 9px;
    border: 1px solid #d7e0eb;
    border-radius: 6px;
    background: #f7f9fc;
    color: #53657a;
    font-size: 12px;
}

.workflow-preview-field input,
.workflow-preview-field select,
.workflow-preview-field textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #bfc8d6;
    border-radius: 5px;
    background: #fff;
    color: #27364a;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
}

.workflow-preview-field textarea {
    min-height: 92px;
    resize: vertical;
}

.workflow-preview-email-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #536176;
    font-size: 11px;
}

.workflow-preview-email-option input {
    margin-top: 2px;
}

.workflow-preview-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 13px 18px;
    border-top: 1px solid #dce1e9;
    background: #f7f8fb;
}

#detail-screen .workflow-preview-summary-card {
    border-color: #c8b9eb;
    border-left: 4px solid #7659b7;
    background: #fbf9ff;
}

#detail-screen .workflow-preview-summary-card h3 {
    color: #4e367f;
}

#detail-screen .workflow-preview-detail {
    display: grid;
    gap: 12px;
}

#detail-screen .workflow-preview-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    border: 1px solid #d8d0ec;
    border-radius: 4px;
    background: #fbf9ff;
}

#detail-screen .workflow-preview-detail-head h3 {
    margin: 0 0 3px;
    color: #4e367f;
    font-size: 13px;
}

#detail-screen .workflow-preview-detail-head p {
    margin: 0;
    color: #6a5d82;
    font-size: 11px;
}

#detail-screen .workflow-preview-conversation,
#detail-screen .workflow-preview-system-log {
    display: grid;
    gap: 8px;
}

#detail-screen .workflow-preview-conversation h3,
#detail-screen .workflow-preview-system-log h3 {
    margin: 0;
    color: #243c5c;
    font-size: 12px;
}

#detail-screen .workflow-preview-message,
#detail-screen .workflow-preview-system-message {
    padding: 9px 10px;
    border: 1px solid #dce1e9;
    border-radius: 4px;
    background: #fff;
    font-size: 11px;
}

#detail-screen .workflow-preview-message strong,
#detail-screen .workflow-preview-system-message strong {
    display: block;
    margin-bottom: 3px;
    color: #34445a;
}

#detail-screen .workflow-preview-message p,
#detail-screen .workflow-preview-system-message p {
    margin: 0;
    color: #5f6d80;
}

#detail-screen .workflow-preview-system-message {
    background: #f3f5f8;
}

@media (max-width: 760px) {
    .workflow-preview-modal-backdrop {
        align-items: start;
        padding: 12px;
    }

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

    .workflow-preview-recipient-options {
        grid-template-columns: 1fr;
    }
}

/* Invoice review redesign. Scoped to the detail screen so the tested queue,
   Setup, and Classifier Manager visual contracts remain unchanged. */
#detail-screen {
    --detail-pane-columns: minmax(430px, 45%) minmax(520px, 55%);
    --detail-navy: #243c5c;
    --detail-blue: #3478f6;
    --detail-blue-hover: #2868dc;
    --detail-workspace: #f7f8fb;
    --detail-band: #f1f2f7;
    --detail-row: #f8f9fc;
    --detail-border: #dce1e9;
    --detail-border-strong: #cbd2dd;
    --detail-text: #27364a;
    --detail-muted: #6c7888;
    color: var(--detail-text);
    background: #fff;
}

#detail-screen .detail-command-bar {
    min-height: 52px;
    display: grid;
    grid-template-columns: var(--detail-pane-columns);
    align-items: center;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid var(--detail-border);
    background: #fff;
}

#detail-screen .detail-command-context {
    min-width: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 12px;
}

#detail-screen #detail-back-button {
    flex: 0 0 auto;
    white-space: nowrap;
    align-self: stretch;
    padding: 0 17px;
    border: 0;
    border-right: 1px solid var(--detail-border);
    border-radius: 0;
    background: #fff;
    color: var(--detail-navy);
    font-weight: 750;
}

#detail-screen #detail-back-button:hover {
    background: var(--detail-band);
}

#detail-screen .detail-command-file {
    min-width: 0;
    flex: 1 1 auto;
    margin: 0;
    overflow: hidden;
    color: #707b8a;
    font-size: 11px;
    font-weight: 550;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .detail-command-navigation {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
}

#detail-screen #detail-split-button {
    flex: 0 0 auto;
    margin: 0;
}

/* Share the document/details tracks, rather than centering a button group. */
#detail-screen .detail-command-review {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 7px 12px;
    padding: 6px 12px 6px 0;
}

#detail-screen .detail-command-actions {
    min-width: 0;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    flex-wrap: nowrap;
}

#detail-screen .detail-secondary-actions {
    display: none;
}

#detail-screen .detail-more-button {
    display: inline-block;
}

#detail-screen .detail-secondary-actions:popover-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    position: fixed;
    inset: auto;
    width: 200px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--detail-border-strong);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 6px 24px #243c5c30;
}
#detail-screen .detail-secondary-actions .detail-command-action { text-align: left; }
#detail-screen .detail-secondary-actions button[hidden] { display: none !important; }

#detail-screen .detail-more-button[hidden] { display: none !important; }

#detail-screen .detail-erp-compact { display: none; }
#detail-screen .detail-person-compact { display: none; }
#detail-screen .detail-nav-arrow { display: none; }

#detail-screen .detail-command-divider {
    width: 1px;
    height: 24px;
    margin: 0 3px;
    background: var(--detail-border-strong);
}

#detail-screen .detail-command-action {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--detail-border-strong);
    border-radius: 3px;
    background: #fff;
    color: var(--detail-navy);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#detail-screen .detail-command-action:hover:not(:disabled) {
    border-color: #91a5bf;
    background: #f5f7fa;
}

#detail-screen .detail-command-action.save {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-color: var(--detail-blue);
    background: var(--detail-blue);
    color: #fff;
}

#detail-screen .detail-command-action.save:hover:not(:disabled) {
    border-color: var(--detail-blue-hover);
    background: var(--detail-blue-hover);
}

#detail-screen .detail-command-action.approve {
    border-color: #348362;
    background: #348362;
    color: #fff;
}

#detail-screen .detail-command-action.danger {
    border-color: #cf8c8c;
    color: #9d3030;
}

#detail-screen .detail-command-action.danger:hover:not(:disabled) {
    border-color: #b83b3b;
    background: #fff4f4;
}

#detail-screen .detail-command-action.previous,
#detail-screen .detail-command-action.next {
    border-color: #9ab5dc;
    color: #2f65af;
}

#detail-screen .detail-command-action.previous:hover:not(:disabled),
#detail-screen .detail-command-action.next:hover:not(:disabled) {
    border-color: var(--detail-blue);
    background: #f2f6ff;
}

#detail-screen .detail-command-action:disabled {
    border-color: #dde1e8;
    background: #eef0f4;
    color: #9aa3af;
    cursor: not-allowed;
}

#detail-screen .detail-unsaved-count {
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #fff;
    color: var(--detail-blue);
    font-size: 10px;
}

#detail-screen .detail-unsaved-count[hidden] {
    display: none;
}

#detail-screen .detail-root,
#detail-screen .detail-body {
    min-height: 0;
}

#detail-screen .detail-body {
    padding: 0;
}

#detail-screen .detail-root.detail-loaded {
    padding: 0;
    overflow: hidden;
}

#detail-screen .detail-workspace {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--detail-pane-columns);
    border: 0;
    border-radius: 0;
    background: #fff;
}

#detail-screen .detail-pdf-column,
#detail-screen .detail-review-column {
    min-width: 0;
    min-height: 0;
}

#detail-screen .detail-pdf-column {
    border-right: 1px solid var(--detail-border);
    background: #fff;
}

#detail-screen .source-pdf-section {
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #6a727d;
}

#detail-screen .source-pdf-frame {
    width: 100%;
    height: calc(100% - 34px);
    min-height: 560px;
    border: 0;
    border-radius: 0;
    background: #6a727d;
}

#detail-screen .source-pdf-open {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid #53606d;
    background: var(--detail-navy);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

#detail-screen .detail-review-column {
    padding: 10px 12px 24px;
    overflow: auto;
    overflow-anchor: none;
    background: var(--detail-workspace);
}

#detail-screen .detail-priority {
    display: grid;
    gap: 7px;
}

#detail-screen .detail-priority > [hidden] {
    display: none !important;
}

#detail-screen .detail-priority > .error-card,
#detail-screen .detail-priority > .proof-card,
#detail-screen .detail-priority > .workflow-card {
    margin: 0;
    padding: 9px 11px;
    border-radius: 3px;
    box-shadow: none;
}

#detail-screen .detail-priority > .error-card {
    border-color: #e5b7af;
    border-left: 4px solid #ce5748;
    background: #fff8f6;
}

#detail-screen .detail-priority > .erp-recovery-card {
    display: grid;
    grid-template-columns: minmax(180px, max-content) minmax(240px, 1fr) auto;
    align-items: center;
    gap: 7px 12px;
}

#detail-screen .erp-recovery-card .erp-recovery-message {
    margin: 0;
}

#detail-screen .erp-recovery-card .workflow-controls {
    justify-self: end;
}

#detail-screen .erp-technical-details {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding-top: 6px;
    border-top: 1px solid #e8cbc6;
    color: var(--detail-navy);
}

#detail-screen .erp-technical-details summary {
    width: max-content;
    cursor: pointer;
    color: #5d3b87;
    font-size: 11px;
    font-weight: 750;
}

#detail-screen .erp-technical-body {
    display: grid;
    gap: 5px;
    margin-top: 7px;
    padding: 8px;
    border-radius: 4px;
    background: #fff;
}

#detail-screen .erp-technical-body p {
    margin: 0;
    overflow-wrap: anywhere;
}

#detail-screen .erp-technical-body .erp-retry-warning {
    color: var(--red);
    font-weight: 700;
}

#detail-screen .erp-advanced-controls {
    justify-self: start;
}

@media (max-width: 980px) {
    #detail-screen .detail-priority > .erp-recovery-card {
        grid-template-columns: 1fr;
    }

    #detail-screen .erp-recovery-card .workflow-controls {
        justify-self: start;
    }
}

#detail-screen .detail-priority > .erp-posting-status {
    display: block;
    min-width: 0;
}

#detail-screen .erp-posting-status .erp-posting-heading,
#detail-screen .erp-posting-status .erp-posting-message,
#detail-screen .erp-posting-status .erp-posting-authority,
#detail-screen .erp-posting-status .erp-policy-authority {
    max-width: 100%;
    overflow-wrap: anywhere;
}

#detail-screen .detail-priority > .approval-block-card p {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

#detail-screen .detail-priority h3 {
    margin: 0;
    font-size: 12px;
}

#detail-screen .detail-priority p {
    margin: 4px 0 0;
    overflow: visible;
    font-size: 11px;
    line-height: 1.4;
    text-overflow: clip;
    white-space: normal;
}

#detail-screen .compact-workflow-card {
    border-color: var(--detail-border);
    background: #fff;
}

#detail-screen .review-extraction-recovery-links {
    margin-top: 7px;
}

#detail-screen .approval-context-card {
    display: grid;
    grid-template-columns: auto minmax(130px, 190px) minmax(0, 1fr);
    align-items: end;
    gap: 8px 12px;
}

#detail-screen .approval-context-card h3 {
    align-self: center;
}

#detail-screen .approval-context-card .erp-site-control {
    display: grid;
    gap: 3px;
}

#detail-screen .approval-context-card .erp-site-control span {
    color: var(--detail-muted);
    font-size: 10px;
    font-weight: 700;
}

#detail-screen .approval-context-card .workflow-help {
    align-self: center;
    margin: 0;
}

#detail-screen .detail-review-tabs {
    display: flex;
    gap: 0;
    margin-top: 10px;
    padding: 0;
    border: 1px solid var(--detail-border);
    border-bottom: 0;
    border-radius: 3px 3px 0 0;
    background: #fff;
}

#detail-screen .detail-review-tabs button {
    min-height: 39px;
    padding: 8px 16px 6px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #647184;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#detail-screen .detail-review-tabs button:hover {
    background: var(--detail-row);
    color: var(--detail-navy);
}

#detail-screen .detail-review-tabs button.active {
    border-bottom-color: var(--detail-blue);
    background: #f5f7fc;
    color: var(--detail-navy);
}

#detail-screen .detail-review-tabs button:focus-visible {
    outline: 2px solid var(--detail-blue);
    outline-offset: -2px;
}

#detail-screen .detail-tab-panel {
    padding: 12px;
    border: 1px solid var(--detail-border);
    border-top: 0;
    border-radius: 0 0 3px 3px;
    background: #fff;
}

#detail-screen .detail-tab-panel[hidden] {
    display: none;
}

#detail-screen .invoice-section {
    margin: 0 0 11px;
    padding: 0 12px 12px;
    border: 1px solid var(--detail-border);
    border-radius: 3px;
    background: #fff;
    box-shadow: none;
}

#detail-screen .invoice-section:last-child {
    margin-bottom: 0;
}

#detail-screen .section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -12px 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--detail-border);
    border-radius: 2px 2px 0 0;
    background: var(--detail-band);
}

#detail-screen .section-title-row h3,
#detail-screen .rules-heading h3 {
    margin: 0;
    color: var(--detail-navy);
    font-size: 13px;
}

#detail-screen .invoice-mode,
#detail-screen .section-count {
    padding: 3px 7px;
    border-radius: 999px;
    background: #e7e9f0;
    color: #59677a;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

#detail-screen button.invoice-mode-action {
    border: 1px solid #c5ccd7;
    cursor: pointer;
}

#detail-screen button.invoice-mode-action:hover:not(:disabled) {
    border-color: #7d8ca2;
    background: #f4f5f8;
}

#detail-screen button.invoice-mode-action:disabled {
    opacity: .58;
    cursor: not-allowed;
}

#detail-screen .notes-section {
    min-height: 280px;
}

#detail-screen .vendor-field,
#detail-screen .account-control,
#detail-screen .manual-distribution-coding-cell {
    position: relative;
}

#detail-screen .vendor-default-trigger {
    position: absolute;
    z-index: 3;
    top: 3px;
    right: 3px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #b9c2cf;
    border-radius: 4px;
    background: #fff;
    color: #405675;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

#detail-screen .account-control:hover .vendor-default-trigger,
#detail-screen .manual-distribution-coding-cell:hover .vendor-default-trigger,
#detail-screen .vendor-default-trigger:focus-visible,
#detail-screen .vendor-default-trigger[aria-expanded="true"] {
    opacity: 1;
}

#detail-screen .vendor-default-trigger:hover,
#detail-screen .vendor-default-trigger:focus-visible {
    border-color: #6f7cf5;
    outline: none;
    box-shadow: 0 0 0 2px rgb(94 75 219 / 12%);
}

#detail-screen .account-control > .distribution-account-input,
#detail-screen .manual-distribution-coding-cell > .manual-distribution-account {
    padding-right: 29px;
}

.vendor-default-popover {
    position: fixed;
    z-index: 1200;
    width: min(680px, calc(100vw - 24px));
    min-width: min(520px, calc(100vw - 24px));
    max-height: min(520px, calc(100vh - 24px));
    display: grid;
    gap: 10px;
    padding: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid #aeb9ca;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 14px 32px rgb(31 48 71 / 22%);
    color: #1f3047;
    white-space: normal;
}

.vendor-default-heading,
.vendor-default-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.vendor-default-heading > div {
    display: grid;
    gap: 2px;
}

.vendor-default-heading span,
.vendor-default-proof span,
.vendor-default-status {
    color: #617087;
    font-size: 10px;
}

.vendor-default-close {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #53637a;
    font-size: 18px;
    cursor: pointer;
}

.vendor-default-proof {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 5px 8px;
    padding: 8px;
    border: 1px solid #e1e6ed;
    border-radius: 4px;
    background: #f7f9fc;
}

.vendor-default-fields {
    display: grid;
    grid-template-columns: minmax(190px, 1.45fr) repeat(4, minmax(84px, 1fr));
    gap: 7px;
}

.vendor-default-fields label {
    min-width: 0;
    display: grid;
    gap: 4px;
    color: #56667c;
    font-size: 9px;
    font-weight: 750;
}

.vendor-default-input {
    min-width: 0;
    width: 100%;
    height: 30px;
    padding: 5px 7px;
    border: 1px solid #b9c2cf;
    border-radius: 3px;
    background: #fff;
    color: #1f3047;
    font: inherit;
    font-size: 11px;
    text-transform: uppercase;
}

.vendor-default-account-field {
    position: relative;
}

.vendor-default-account-options.lookup-suggestion-menu {
    position: fixed;
    z-index: 1210;
    top: auto;
    left: auto;
    width: min(360px, calc(100vw - 24px));
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #bfc7d2;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 48, 71, .16);
}

.vendor-default-account-options.lookup-suggestion-menu[hidden] {
    display: none;
}

.vendor-default-account-options .lookup-suggestion {
    width: 100%;
    display: grid;
    gap: 2px;
    padding: 7px 9px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #1f3047;
    text-align: left;
    cursor: pointer;
}

.vendor-default-account-options .lookup-suggestion:hover,
.vendor-default-account-options .lookup-suggestion.keyboard-active {
    background: #eef2ff;
}

.vendor-default-account-options .lookup-suggestion span {
    color: #69778c;
    font-size: 10px;
}

.vendor-default-status {
    min-height: 14px;
    margin: 0;
}

.vendor-default-status.success { color: #27714d; }
.vendor-default-status.error { color: #a33a32; }

@media (max-width: 900px) {
    .vendor-default-popover {
        min-width: min(320px, calc(100vw - 24px));
    }

    .vendor-default-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vendor-default-account-field {
        grid-column: 1 / -1;
    }
}

#detail-screen .lookup-suggestion-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    width: min(420px, 100%);
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #bfc7d2;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 48, 71, .16);
}

#detail-screen .lookup-suggestion-menu[hidden] {
    display: none;
}

#detail-screen .lookup-suggestion-menu.floating-lookup-suggestion-menu {
    position: fixed;
    z-index: 1000;
    right: auto;
    bottom: auto;
}

#detail-screen .lookup-suggestion {
    width: 100%;
    display: grid;
    gap: 2px;
    padding: 7px 9px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #26384f;
    text-align: left;
    cursor: pointer;
}

#detail-screen .lookup-suggestion + .lookup-suggestion {
    border-top: 1px solid #edf0f4;
}

#detail-screen .lookup-suggestion:hover,
#detail-screen .lookup-suggestion:focus-visible,
#detail-screen .lookup-suggestion.keyboard-active {
    outline: none;
    background: #eef3f8;
}

#detail-screen .lookup-suggestion strong {
    color: #1e3047;
    font-size: 11px;
}

#detail-screen .lookup-suggestion span {
    overflow: hidden;
    color: #68768a;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .vendor-suggestion-menu {
    width: min(520px, 100%);
}

#detail-screen .invoice-field-grid.notes-field-grid {
    grid-template-columns: minmax(0, 1fr);
}

#detail-screen .notes-field-grid .field-row {
    grid-template-columns: minmax(0, 1fr);
}

#detail-screen .notes-field-grid .field-definition,
#detail-screen .notes-field-grid .invoice-field-editor {
    grid-column: 1 / -1;
}

#detail-screen .notes-field-label {
    display: block;
    margin-bottom: 7px;
    color: var(--detail-muted);
    font-size: 11px;
    font-weight: 700;
}

#detail-screen .notes-input,
#detail-screen .notes-field-grid textarea {
    width: 100%;
    min-height: 210px;
    resize: vertical;
}

#detail-screen .notes-input:disabled {
    border-color: var(--detail-border);
    background: #f7f8fb;
    color: var(--detail-muted);
}

#detail-screen .notes-availability {
    margin: 8px 0 0;
    color: var(--detail-muted);
    font-size: 11px;
    line-height: 1.45;
}

.application-version {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 8px;
    border: 1px solid #cbd4df;
    border-radius: 999px;
    background: #f5f7fa;
    color: #41546b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    white-space: nowrap;
}

#detail-screen .invoice-primary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

#detail-screen .invoice-field-grid {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    list-style: none;
}

#detail-screen .invoice-field {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 7px;
    border: 1px solid transparent;
    border-radius: 3px;
}

#detail-screen .terms-and-discounts-field {
    padding: 7px 9px;
    border-color: var(--detail-border);
    background: #f8fafc;
}

#detail-screen .terms-and-discounts-section {
    padding: 0;
    overflow: hidden;
}

#detail-screen .terms-and-discounts-summary {
    min-height: 34px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #1f3047;
    background: var(--detail-section-heading, #f1f4f8);
    font-size: 13px;
}

#detail-screen .terms-and-discounts-summary-value {
    color: var(--detail-muted);
    font-size: 10px;
    font-weight: 650;
}

#detail-screen .terms-and-discounts-summary {
    border-bottom: 1px solid var(--detail-border);
}

#detail-screen .terms-and-discounts-section > .terms-and-discounts-field {
    margin: 0;
    border: 0;
    border-radius: 0;
}

#detail-screen .terms-and-discounts-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
}

#detail-screen .terms-load-error {
    margin-top: 2px;
}

#detail-screen .terms-value-cell {
    min-width: 0;
    display: grid;
    gap: 5px;
}

#detail-screen .terms-value-cell input[readonly] {
    background: #eef2f7;
    color: var(--detail-muted);
}

#detail-screen .vendor-field {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    column-gap: 9px;
}

#detail-screen .vendor-field .field-definition,
#detail-screen .vendor-field .vendor-current-identity,
#detail-screen .vendor-field .field-unsaved-note {
    grid-column: 1 / -1;
}

/* Keep optional workflow metadata beside the vendor, not above the invoice. */
#detail-screen .vendor-field:has(.invoice-workflow-tag) > .field-definition,
#detail-screen .vendor-field:has(.invoice-workflow-tag) > .vendor-current-identity,
#detail-screen .vendor-field:has(.invoice-workflow-tag) > .field-unsaved-note {
    grid-column: 1;
}

#detail-screen .invoice-workflow-tag {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: start;
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    display: grid;
    gap: 5px;
    padding: 0;
}

#detail-screen .field-definition {
    color: var(--detail-muted);
    font-size: 10px;
    font-weight: 700;
}

#detail-screen .invoice-field input,
#detail-screen .invoice-field textarea,
#detail-screen .invoice-field select,
#detail-screen .amount-input,
#detail-screen .distribution-amount-input,
#detail-screen .distribution-account-input,
#detail-screen .distribution-unit-select,
#detail-screen .erp-site-input {
    min-width: 0;
    width: 100%;
    height: 31px;
    padding: 5px 7px;
    border: 1px solid var(--detail-border-strong);
    border-radius: 3px;
    background: #fff;
    color: #1f3047;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
}

#detail-screen .invoice-field textarea {
    height: auto;
    min-height: 52px;
    resize: vertical;
}

#detail-screen .invoice-field input:focus,
#detail-screen .invoice-field textarea:focus,
#detail-screen .invoice-field select:focus,
#detail-screen .amount-input:focus,
#detail-screen .distribution-amount-input:focus,
#detail-screen .distribution-account-input:focus,
#detail-screen .distribution-unit-select:focus,
#detail-screen .erp-site-input:focus {
    border-color: var(--detail-blue);
    outline: 0;
    box-shadow: 0 0 0 2px rgb(52 120 246 / 13%);
}

#detail-screen .vendor-current-identity,
#detail-screen .field-edit-restriction,
#detail-screen .field-reference-status {
    color: var(--detail-muted);
    font-size: 9px;
    line-height: 1.35;
}

#detail-screen .field-reference-status.valid {
    color: #2f7256;
}

#detail-screen .field-reference-status.invalid,
#detail-screen .field-validation-error {
    color: #aa3e32;
}

#detail-screen .coding-reference-status {
    grid-column: 1 / -1;
    color: var(--detail-muted);
    font-size: 9px;
    line-height: 1.3;
}

#detail-screen .coding-reference-status.invalid {
    color: #aa3e32;
}

#detail-screen .inline-custom-fields {
    margin: 12px 7px 0;
    padding-top: 10px;
    border-top: 1px dashed #aeb8c6;
}

#detail-screen .inline-subsection-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#detail-screen .inline-subsection-title h4 {
    margin: 0;
    color: #314b65;
    font-size: 10px;
}

#detail-screen .empty-inline {
    margin: 6px 0 0;
    color: var(--detail-muted);
    font-size: 11px;
}

#detail-screen .custom-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
}

#detail-screen .modified {
    border-color: #e3b15a;
    background: #fff8e9;
    box-shadow: inset 3px 0 0 #d7982d;
}

#detail-screen .field-unsaved-note {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#detail-screen .field-unsaved-note[hidden] {
    display: none;
}

#detail-screen .amount-summary {
    display: grid;
    grid-template-columns: 1.55fr repeat(3, .85fr) 1fr;
    overflow: hidden;
    border: 1px solid var(--detail-border);
    border-radius: 3px;
    background: #fff;
}

#detail-screen .amount-summary-item {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 10px 11px;
    border: 0;
    border-right: 1px solid var(--detail-border);
    border-radius: 0;
}

#detail-screen .amount-summary-item:last-child {
    border-right: 0;
}

#detail-screen .amount-summary-item.total {
    background: var(--detail-band);
}

#detail-screen .amount-label {
    color: var(--detail-muted);
    font-size: 10px;
    font-weight: 700;
}

#detail-screen .amount-summary strong {
    color: #1e2e44;
    font-size: 16px;
}

#detail-screen .amount-input {
    border: 0;
    padding-inline: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 750;
}

#detail-screen .amount-reconciliation {
    margin: 7px 2px 0;
    color: #3e7359;
    font-size: 10px;
    font-weight: 700;
}

#detail-screen .amount-reconciliation.mismatch {
    color: #a35a13;
}

#detail-screen .po-coverage-row {
    display: grid;
    grid-template-columns: minmax(110px, .7fr) minmax(360px, 2.5fr) minmax(230px, 1.4fr);
    align-items: center;
    gap: 12px;
    margin-top: 9px;
    padding: 9px 11px;
    border: 1px solid #d8dde5;
    border-left: 4px solid #d99b24;
    border-radius: 4px;
    background: #f8f9fb;
}

#detail-screen .po-coverage-row.covered.fresh,
#detail-screen .po-coverage-row.notapplicable.fresh {
    border-left-color: #2f8a5e;
}

#detail-screen .po-coverage-heading,
#detail-screen .po-coverage-value {
    display: grid;
    gap: 2px;
}

#detail-screen .po-coverage-heading strong,
#detail-screen .po-coverage-value strong {
    color: #1e2e44;
    font-size: 11px;
}

#detail-screen .po-coverage-status {
    color: #8a5a18;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

#detail-screen .po-coverage-row.covered.fresh .po-coverage-status,
#detail-screen .po-coverage-row.notapplicable.fresh .po-coverage-status {
    color: #236c4a;
}

#detail-screen .po-coverage-values {
    display: grid;
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    gap: 12px;
}

#detail-screen .po-coverage-value small,
#detail-screen .po-coverage-message {
    color: var(--detail-muted);
    font-size: 9px;
}

#detail-screen .po-coverage-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

#detail-screen .po-coverage-message {
    line-height: 1.3;
    text-align: right;
}

#detail-screen .po-coverage-refresh {
    min-height: 27px;
    white-space: nowrap;
}

@media (max-width: 1250px) {
    #detail-screen .po-coverage-row {
        grid-template-columns: 110px 1fr;
    }

    #detail-screen .po-coverage-actions {
        grid-column: 1 / -1;
    }
}

#detail-screen .section-subtitle {
    color: var(--detail-muted);
    font-size: 10px;
}

#detail-screen .distribution-title-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#detail-screen .po-line-review-section .section-title-row {
    align-items: center;
}

#detail-screen .po-allocation-title {
    display: flex;
    align-items: baseline;
    gap: 9px;
    min-width: 0;
}

#detail-screen .po-allocation-number {
    color: var(--detail-muted);
    font-size: 10px;
    font-weight: 700;
}

#detail-screen .po-line-header-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    color: var(--detail-muted);
    font-size: 9px;
    text-align: right;
}

#detail-screen .po-drop-ship-reference {
    white-space: nowrap;
}

#detail-screen .po-allocation-bar {
    display: grid;
    grid-template-columns: minmax(105px, 1.1fr) repeat(5, minmax(74px, 1fr)) auto auto;
    align-items: stretch;
    margin-bottom: 7px;
    overflow: hidden;
    border: 1px solid var(--detail-border);
    border-left: 3px solid #2f8d5b;
    border-radius: 3px;
    background: #fff;
}

#detail-screen .po-allocation-bar[data-status="refresh"],
#detail-screen .po-allocation-bar[data-status="unallocated"],
#detail-screen .po-allocation-bar[data-status="short"],
#detail-screen .po-allocation-bar[data-status="over"] {
    border-left-color: #d69a13;
}

#detail-screen .po-allocation-status,
#detail-screen .po-allocation-kpi {
    display: grid;
    align-content: center;
    min-width: 0;
    min-height: 42px;
    padding: 5px 9px;
    border-right: 1px solid var(--detail-border);
    white-space: nowrap;
}

#detail-screen .po-allocation-status {
    color: #236c4a;
    font-size: 10px;
    text-transform: uppercase;
}

#detail-screen .po-allocation-bar:not([data-status="covered"]) .po-allocation-status {
    color: #8a5a18;
}

#detail-screen .po-allocation-kpi small {
    overflow: hidden;
    color: var(--detail-muted);
    font-size: 8px;
    font-weight: 700;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

#detail-screen .po-allocation-kpi strong {
    overflow: hidden;
    color: #20334b;
    font-size: 11px;
    text-overflow: ellipsis;
}

#detail-screen .po-move-difference {
    padding: 2px 4px;
    margin-top: 3px;
    min-height: 22px;
    font-size: 10px;
    white-space: normal;
}

#detail-screen .po-adjustment-notice {
    margin: 6px 0;
    font-size: 12px;
}

#detail-screen .po-allocation-bar .po-coverage-refresh,
#detail-screen .po-allocation-bar .po-allocation-all {
    align-self: center;
    margin: 0 7px;
}

#detail-screen .po-allocation-bar .po-allocation-all {
    margin-right: 0;
    white-space: nowrap;
}

#detail-screen .po-line-visibility-toggle {
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 9px;
    white-space: nowrap;
}

#detail-screen .po-drop-ship-tag,
#detail-screen .po-standard-tag {
    padding: 3px 7px;
    border-radius: 999px;
    background: #e9f3ed;
    color: #24633e;
    font-size: 9px;
    letter-spacing: .03em;
}

#detail-screen .po-standard-tag {
    background: #edf0f4;
    color: #59677a;
}

#detail-screen .po-line-review-table {
    overflow-x: auto;
    border: 1px solid var(--detail-border);
    border-radius: 3px;
}

#detail-screen .po-line-review-row {
    min-width: 960px;
    display: grid;
    grid-template-columns:
        30px 42px minmax(130px, 1.6fr) minmax(72px, .9fr)
        66px 72px 100px 110px 72px 56px 66px;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border-top: 1px solid var(--detail-border);
    color: #35465c;
    font-size: 10px;
}

#detail-screen .po-line-po-unit-cost {
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

#detail-screen .po-line-invoice-cost-cell {
    display: grid;
    gap: 2px;
}

#detail-screen .po-line-cost-warning {
    color: #9a5a00;
    font-size: 8px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

#detail-screen .po-line-review-row.cost-variance-warning {
    background: #fff9e8;
}

#detail-screen .po-line-review-row:first-child {
    border-top: 0;
}

#detail-screen .po-line-review-row > * {
    min-width: 0;
}

#detail-screen .po-line-review-row.selected {
    background: #f8fbff;
    box-shadow: inset 3px 0 #4b79b5;
}

#detail-screen .po-line-review-row[hidden],
#detail-screen .po-line-availability-empty[hidden] {
    display: none;
}

#detail-screen .po-line-availability-empty {
    margin: 0;
    padding: 12px;
    color: var(--detail-muted);
    font-size: 10px;
    text-align: center;
}

#detail-screen .po-line-review-header {
    background: var(--detail-band);
    color: #626f82;
    font-size: 9px;
    font-weight: 800;
}

#detail-screen .po-line-review-header > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .po-line-identity,
#detail-screen .po-line-item,
#detail-screen .po-line-destination,
#detail-screen .po-line-available {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .po-line-identity {
    display: grid;
    gap: 1px;
}

#detail-screen .po-line-item,
#detail-screen .po-line-destination,
#detail-screen .po-line-available {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .po-line-review-row small {
    color: var(--detail-muted);
    font-size: 8px;
}

#detail-screen .po-line-use,
#detail-screen .po-line-auto-receive {
    width: 16px;
    height: 16px;
    margin: auto;
    accent-color: #366ca8;
}

#detail-screen .po-line-number-input {
    width: 100%;
    min-width: 0;
    height: 29px;
    padding: 4px 6px;
    border: 1px solid #b9c2cf;
    border-radius: 3px;
    background: #fff;
    color: #20334b;
    font: inherit;
}

#detail-screen .po-line-number-input:focus {
    outline: 2px solid rgba(54, 108, 168, .2);
    border-color: #5e86b4;
}

#detail-screen .po-line-extended-amount {
    color: #1f3047;
    text-align: right;
}

#detail-screen .po-line-serial-cell {
    min-width: 0;
    text-align: center;
}

#detail-screen .po-line-serial-editor {
    position: relative;
}

#detail-screen .po-line-serial-editor > summary {
    cursor: pointer;
    color: #285f9d;
    font-weight: 800;
    white-space: nowrap;
}

#detail-screen .po-line-serial-editor > summary.invalid {
    color: #b42318;
}

#detail-screen .po-line-serial-editor[open] {
    z-index: 4;
    min-width: 180px;
    padding: 6px;
    border: 1px solid #aebdce;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(30, 48, 71, .16);
    text-align: left;
}

#detail-screen .po-line-serial-editor[open][aria-invalid="true"] {
    border-color: #dc2626;
    background: #fff7f7;
}

#detail-screen .po-line-serial-option {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
    white-space: nowrap;
}

#detail-screen .po-line-serial-input {
    width: 100%;
    min-height: 62px;
    margin-top: 5px;
    padding: 5px;
    border: 1px solid #b9c2cf;
    border-radius: 3px;
    resize: vertical;
    font: inherit;
}

#detail-screen .po-line-serial-error {
    display: block;
    max-width: 18rem;
    padding-top: 5px;
    color: #991b1b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

#detail-screen .po-line-serial-error[hidden] {
    display: none;
}

#detail-screen .po-line-serial-empty {
    display: block;
    padding-top: 5px;
    color: #a14e00;
    white-space: nowrap;
}

@media (max-width: 1050px) {
    #detail-screen .po-allocation-bar {
        overflow-x: auto;
        grid-template-columns: 105px repeat(5, 82px) auto auto;
    }
}

#detail-screen .add-distribution {
    min-height: 26px;
    padding: 0 8px;
}

#detail-screen .invoice-distribution-table {
    overflow-x: auto;
    border: 1px solid var(--detail-border);
    border-radius: 3px;
}

#detail-screen .invoice-distribution-row {
    min-width: 760px;
    display: grid;
    grid-template-columns:
        minmax(150px, 1.45fr)
        minmax(104px, .95fr)
        minmax(74px, .66fr)
        minmax(78px, .72fr)
        repeat(4, minmax(58px, .55fr))
        48px;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-top: 1px solid var(--detail-border);
    color: #3c4c62;
    font-size: 11px;
}

#detail-screen .invoice-distribution-row:first-child {
    border-top: 0;
}

#detail-screen .invoice-distribution-row.distribution-header {
    background: var(--detail-band);
    color: #626f82;
    font-size: 9px;
    font-weight: 800;
}

#detail-screen .distribution-name-cell {
    min-width: 0;
    display: grid;
    gap: 2px;
}

#detail-screen .distribution-name-cell strong {
    overflow: hidden;
    color: #1f3047;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .distribution-name-cell small,
#detail-screen .distribution-bucket {
    color: var(--detail-muted);
    font-size: 9px;
}

#detail-screen .manual-distribution-row.modified {
    background: #fffaf0;
    box-shadow: inset 3px 0 #d89b27;
}

#detail-screen .manual-distribution-name,
#detail-screen .manual-distribution-bucket,
#detail-screen .manual-distribution-account,
#detail-screen .manual-distribution-unit {
    width: 100%;
    min-width: 0;
    height: 30px;
    border: 1px solid #b9c2cf;
    border-radius: 3px;
    background: #fff;
    color: #23354c;
    font: inherit;
}

#detail-screen .manual-distribution-coding-cell {
    min-width: 0;
    display: grid;
    gap: 4px;
}

#detail-screen .distribution-action-cell {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#detail-screen .distribution-delete-action {
    min-height: 27px;
    padding: 0 7px;
    border: 1px solid #d2a0a0;
    border-radius: 3px;
    background: #fff;
    color: #9d3030;
    font: inherit;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
}

#detail-screen .material-distribution-row {
    background: #f7f8fa;
}

#detail-screen .distribution-coding-readonly {
    min-width: 0;
    overflow: hidden;
    color: #667386;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .manual-distribution-name,
#detail-screen .manual-distribution-bucket,
#detail-screen .manual-distribution-account,
#detail-screen .manual-distribution-unit,
#detail-screen .distribution-account-input,
#detail-screen .distribution-unit-select,
#detail-screen .distribution-amount-input {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detail-screen .distribution-unit-select:disabled,
#detail-screen .distribution-account-input:disabled {
    background: #eef0f4;
    color: #8a94a2;
}

#detail-screen .rules-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--detail-border);
    border-radius: 3px;
    background: var(--detail-band);
}

#detail-screen .rules-heading p {
    margin: 4px 0 0;
    color: var(--detail-muted);
    font-size: 11px;
}

#detail-screen .rules-heading-actions {
    display: flex;
    gap: 7px;
}

#detail-screen .rules-tab-panel .rule-list {
    display: grid;
    gap: 8px;
}

#detail-screen .rules-tab-panel .rule-card {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 11px;
    border: 1px solid var(--detail-border);
    border-radius: 3px;
    background: #fff;
}

#detail-screen .rule-status-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #e4f3eb;
    color: #26704d;
    font-size: 11px;
    font-weight: 800;
}

#detail-screen .rule-status-icon.warning {
    background: #fff0cf;
    color: #8b5d09;
}

#detail-screen .rule-status-icon.neutral {
    background: #eceff3;
    color: #6f7a89;
}

#detail-screen .rule-copy h4 {
    margin: 2px 0 0;
    color: var(--detail-navy);
    font-size: 12px;
}

#detail-screen .rule-copy p,
#detail-screen .rule-change-list {
    margin: 5px 0 0;
    color: #5f6d80;
    font-size: 11px;
}

#detail-screen .rule-type {
    color: var(--detail-muted);
    font-size: 9px;
    font-weight: 700;
}

#detail-screen .rule-technical-details summary,
#detail-screen .rules-technical-trace > summary {
    color: #2f65af;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

#detail-screen .rules-technical-trace {
    margin-top: 10px;
}

#detail-screen .routing-tab-panel > .routing-section,
#detail-screen .routing-tab-panel .routing-section {
    margin: 0;
}

#detail-screen .routing-card,
#detail-screen .routing-decision,
#detail-screen .classifier-result,
#detail-screen .routing-candidate {
    border-color: var(--detail-border);
    border-radius: 3px;
    box-shadow: none;
}

#detail-screen .routing-card.partial,
#detail-screen .routing-decision.partial,
#detail-screen [data-state="partial"] {
    border-left-color: #d3a32d;
    background: #fffaf0;
}

#detail-screen .routing-tab-panel details,
#detail-screen .audit-tab-panel details {
    border-color: var(--detail-border);
}

#detail-screen .audit-tab-panel .detail-section {
    margin: 10px 0 0;
    border-color: var(--detail-border);
    box-shadow: none;
}

@media (max-width: 1180px) {
    #detail-screen {
        --detail-pane-columns: minmax(0, 42%) minmax(0, 58%);
    }

    #detail-screen .invoice-field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #detail-screen .terms-and-discounts-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #detail-screen .amount-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #detail-screen .amount-summary-item {
        border-bottom: 1px solid var(--detail-border);
    }
}

@media (max-width: 1500px) {
    #detail-screen .detail-command-review { gap: 7px; padding-right: 8px; }
    #detail-screen .detail-command-divider { display: none; }
    #detail-screen .detail-more-button { display: inline-block; }
    #detail-screen .detail-secondary-actions:not(:popover-open) { display: none; }
    #detail-screen .detail-secondary-actions:popover-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        position: fixed;
        inset: auto;
        width: 200px;
        margin: 0;
        padding: 8px;
        border: 1px solid var(--detail-border-strong);
        border-radius: 6px;
        background: #fff;
        box-shadow: 0 6px 24px #243c5c30;
    }
    #detail-screen .detail-secondary-actions .detail-command-action { text-align: left; }
}

@media (max-width: 1050px) {
    #detail-screen .detail-command-action { padding-inline: 6px; font-size: 11px; }
}

@media (max-width: 800px) {
    #detail-screen .detail-command-bar {
        grid-template-columns: minmax(32px, 1fr) auto;
        padding: 0;
    }

    #detail-screen .detail-command-context {
        gap: 6px;
    }

    #detail-screen .detail-command-review {
        gap: 6px;
        padding: 6px;
    }

    #detail-screen #detail-back-button {
        align-self: auto;
        min-height: 32px;
        border: 1px solid var(--detail-border);
        padding: 0 4px;
        font-size: 0;
    }

    #detail-screen #detail-back-button::before { content: "←"; font-size: 16px; }
    #detail-screen .detail-nav-label { display: none; }
    #detail-screen .detail-nav-arrow { display: inline; }

    #detail-screen .detail-command-file {
        display: none;
    }

    #detail-screen .detail-command-navigation {
        gap: 5px;
    }

    #detail-screen .detail-command-actions {
        gap: 5px;
    }

    #detail-screen .detail-workspace {
        display: block;
        overflow: auto;
    }

    #detail-screen .detail-pdf-column {
        min-height: 430px;
        border-right: 0;
        border-bottom: 1px solid var(--detail-border);
    }

    #detail-screen .source-pdf-frame {
        min-height: 395px;
    }

    #detail-screen .detail-review-column {
        overflow: visible;
    }

    #detail-screen .approval-context-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    #detail-screen .detail-command-file {
        max-width: 100%;
        flex: 1 1 180px;
    }

    #detail-screen .detail-command-action {
        flex: 0 0 auto;
        padding-inline: 6px;
    }

    #detail-screen .detail-more-button { font-size: 0; }
    #detail-screen .detail-more-button::after { content: "⋯"; font-size: 16px; }
    #detail-screen .detail-erp-label { display: none; }
    #detail-screen .detail-erp-compact { display: inline; }
    #detail-screen .detail-person-label { display: none; }
    #detail-screen .detail-person-compact { display: inline; }
    #detail-screen .detail-command-action { padding-inline: 4px; min-width: 28px; }

    #detail-screen .detail-command-review { gap: 3px; padding-inline: 3px; }
    #detail-screen .detail-command-actions,
    #detail-screen .detail-command-navigation { gap: 3px; }

    #detail-screen .detail-review-tabs {
        overflow-x: auto;
    }

    #detail-screen .invoice-field-grid,
    #detail-screen .custom-field-grid,
    #detail-screen .amount-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    #detail-screen .vendor-field {
        grid-template-columns: minmax(0, 1fr);
    }

    #detail-screen .vendor-field > * {
        grid-column: 1;
    }

    #detail-screen .vendor-field > .invoice-workflow-tag {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
    }
}
/* Typeable account-unit controls retain compact grid sizing. */
.unit-code-combobox { position: relative; display: flex; min-width: 0; width: 100%; }
.unit-code-combobox > select[hidden] { display: none !important; }
.unit-code-combobox .unit-code-input { min-width: 0; width: 100%; padding-right: 24px; }
.unit-code-combobox .unit-code-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 22px; padding: 0; border: 0; background: transparent; color: inherit; }
.unit-code-combobox .unit-code-input[aria-invalid="true"] { border-color: #c53d32; }
.workflow-tag-filter-menu { display: inline-block; }
.workflow-preview-grid .workflow-tag-filter-menu > .queue-filter-button { display: block; }
.workflow-preview-grid .workflow-tag-column.queue-filter-header { padding-right: 34px !important; }
.workflow-preview-grid th:nth-child(13) { width: 150px; white-space: nowrap; }
.workflow-preview-grid th:nth-child(14) { width: 42px; }
.workflow-tag-filter-menu:not([open]) > .workflow-tag-filter { display: none; }
.workflow-tag-filter-menu > summary { list-style: none; }
.workflow-tag-filter-menu > summary::-webkit-details-marker { display: none; }
.workflow-tag-filter-menu[open] > .workflow-tag-filter {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 20;
    padding: 12px;
    background: white;
    color: #22364d;
    border: 1px solid #d4dce8;
    border-radius: 6px;
    box-shadow: 0 4px 14px #172b4d26;
}
