/* Shared workspace tokens; this sheet follows each module's CSS. */
:root { --ws-gray: var(--ws-background); --ws-accent: #87629e; --ws-button-bg: var(--ws-lavender); --ws-button-text: #0e4646; --ws-danger: #b42318; }
.ws-sidebar, .ws-topbar, .ws-app-card, .ws-count, .ws-pharmacy-picker select,
.ws-enhanced .ws-menu-toggle, .ws-sidebar-heading button { background: var(--ws-surface); }
.ws-button { background: var(--ws-button-bg); color: var(--ws-button-text); }
:root[data-ws-color-scheme="dark"] {
    color-scheme: dark;
    --ws-ink: #e4eeeb;
    /* Global shop typography also styles workspace headings and plain links. */
    --fg: var(--ws-ink);
    --fg-muted: var(--ws-muted);
    --ws-muted: #adbfbb;
    --ws-lavender: #c5abdb;
    --ws-sage: #304743;
    --ws-line: #3c5350;
    --ws-background: #172725;
    --ws-surface: #223633;
    --ws-gray: #192c29;
    --ws-accent: #c5abdb;
    --ws-menu-accent: #9bdbe7;
    --ws-danger: #ff929b;
    --ws-button-bg: #c5abdb;
    --ws-button-text: #0e4646;
    --c-schiefer-300: #adbfbb;
    --c-schiefer-100: #3c5350;
    --c-border-control: #708984;
}
/* Keep title navigation readable when the global brand link hover applies. */
[data-ws-color-scheme="dark"] :is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) a:hover,
[data-ws-color-scheme="dark"] a.ws-card-action:hover { color: var(--ws-ink); }
[data-ws-color-scheme="dark"] :is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) a:focus-visible,
[data-ws-color-scheme="dark"] a.ws-card-action:focus-visible { outline: 2px solid var(--ws-ink); outline-offset: 3px; }
[data-ws-color-scheme="dark"] .ws-nav-item { color: var(--ws-muted); }
[data-ws-color-scheme="dark"] :is(.ws-nav-item:hover, .ws-app-locked, .wm-table thead,
.wm-table tbody tr:hover, .wm-table tr.is-selected, .wm-record-tile:hover, .wm-amounts,
.wm-request-card, .wm-lock-note, .wm-form-note, .wm-layout-switch a:hover) { background: var(--ws-sage); }
[data-ws-color-scheme="dark"] :is(.wm-label, .wm-stat, .wm-panel, .wm-secondary,
.wm-record-tile, .wm-filters input, .wm-filters select, .wm-action-form textarea,
.wm-form-field input, .wm-form-field select, .wm-form-field textarea, .ws-login-card,
.ws-login-field input) { background: var(--ws-surface); color: var(--ws-ink); }
[data-ws-color-scheme="dark"] :is(.wm-table td, .wm-access-table tbody th,
.ws-card-action, .wm-amounts .wm-amount-total, .wm-timeline li) { border-color: var(--ws-line); }
[data-ws-color-scheme="dark"] :is(.ws-avatar, .ws-app-icon, .wm-step-title > span) { background: #443854; color: #e1cdee; }
[data-ws-color-scheme="dark"] .ws-app-locked .ws-app-icon { background: var(--ws-sage); color: var(--ws-muted); }
[data-ws-color-scheme="dark"] :is(.ws-available, .wm-status-open, .wm-status-received) { background: #31493b; color: #c8e3b6; }
[data-ws-color-scheme="dark"] :is(.wm-status-approved, .wm-status-reviewed) { background: #28483e; color: #b0e1ca; }
[data-ws-color-scheme="dark"] .wm-status-pending { background: #4a3e29; color: #f1d799; }
[data-ws-color-scheme="dark"] :is(.wm-status-rejected, .wm-error) { background: #4b3032; color: #ffc0bd; }
[data-ws-color-scheme="dark"] .wm-status:not(.wm-status-open, .wm-status-received, .wm-status-approved, .wm-status-reviewed, .wm-status-pending, .wm-status-rejected) { background: var(--ws-sage); color: var(--ws-muted); }
[data-ws-color-scheme="dark"] .wm-source-note { background: #3b3045; border-color: #695473; }
[data-ws-color-scheme="dark"] .wm-source-note :is(strong, span) { color: #dfc9ec; }
[data-ws-color-scheme="dark"] :is(.wm-button, .ws-button) { background: var(--ws-button-bg); color: var(--ws-button-text); }
[data-ws-color-scheme="dark"] :is(.wm-button, .ws-button):hover { background: #d9c2eb; }
[data-ws-color-scheme="dark"] .wm-granted { color: #b0e1ca; }
[data-ws-color-scheme="dark"] :is(.wm-toggle-status, .wm-editor .errorlist, .wm-toggle-error) { color: var(--ws-ink); }
[data-ws-color-scheme="dark"] .ws-card-action { border-color: var(--ws-line); }
[data-ws-color-scheme="dark"] .ws-login-page { background: var(--ws-background); }
[data-ws-color-scheme="dark"] :is(.ws-login-card, .ws-login-field input, .wm-filters input,
.wm-filters select, .wm-action-form textarea, .wm-form-field input,
.wm-form-field select, .wm-form-field textarea) { border-color: var(--c-border-control); }
[data-ws-color-scheme="dark"] :is(.ws-login-note, .ws-login-card .errorlist) { color: var(--ws-muted); }

/* Navigation, actions and statuses have deliberately distinct presentation. */
.ws-area-chip { background: var(--ws-surface); border-radius: 999px; border-color: var(--ws-line); }
.ws-area-chip.is-active { background: var(--ws-sage); border-color: var(--ws-ink); font-weight: 600; }
a.ws-area-chip:hover { background: var(--ws-sage); border-color: var(--ws-ink); }
.ws-area-chip.is-pending { background: transparent; border-style: dashed; }
:is(.wm-button, .ws-button, .wm-secondary) { min-height: 34px; padding: 8px 12px; border-radius: 4px; font-size: 13px; font-weight: 600; line-height: 1.4; text-decoration: none; }
:is(.wm-button, .ws-button) { border: 1px solid transparent; background: var(--ws-button-bg); color: var(--ws-button-text); }
.wm-secondary { background: var(--ws-surface); color: var(--ws-ink); border: 1px solid var(--ws-ink); }
:is(.wm-button, .ws-button):not(:disabled):not([aria-disabled="true"]):hover { background: #d9c2eb; color: var(--ws-button-text); }
.wm-secondary:not(:disabled):not([aria-disabled="true"]):hover { background: var(--ws-sage); color: var(--ws-ink); }
.wm-secondary.wm-danger { color: var(--ws-danger); border-color: var(--ws-danger); }
.wm-secondary.wm-danger:not(:disabled):not([aria-disabled="true"]):hover { color: var(--ws-danger); background: color-mix(in srgb, var(--ws-danger) 10%, var(--ws-surface)); }
:is(.wm-button, .ws-button, .wm-secondary, a.ws-area-chip):focus-visible { outline: 2px solid var(--ws-ink); outline-offset: 3px; }
:is(.wm-button, .ws-button, .wm-secondary):is(:disabled, [aria-disabled="true"]) { opacity: .5; cursor: not-allowed; }
a:is(.wm-button, .ws-button, .wm-secondary)[aria-disabled="true"] { pointer-events: none; }
:is(.wm-label, .ws-count, .wm-status, .ws-available, .wm-result-count) { border: 0; box-shadow: none; cursor: default; }
:is(.wm-label, .ws-count, .wm-result-count) { min-width: 0; width: auto; height: auto; padding: 3px 6px; border-radius: 3px; background: transparent; color: var(--ws-muted); font-size: 11px; }
.wm-status { font-size: 11px; padding: 2px 6px; border-radius: 3px; }
.wm-layout-switch { gap: 0; padding: 0; overflow: hidden; background: var(--ws-surface); }
.wm-layout-switch a { border-radius: 0; }
.wm-layout-switch a + a { border-left: 1px solid var(--ws-line); }
.wm-layout-switch a[aria-current="true"] { background: var(--ws-sage); font-weight: 700; }
.wm-layout-switch a:focus-visible { outline-offset: -3px; }

.ws-area-app-header { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 18px; }
.ws-area-app-header .ws-app-icon { flex-shrink: 0; }
.ws-area-app-header h3 { min-width: 0; margin: 0; overflow-wrap: anywhere; }
:is(.wm-button, .ws-button):is(:disabled, [aria-disabled="true"]):hover { background: var(--ws-button-bg); color: var(--ws-button-text); }
.wm-secondary:is(:disabled, [aria-disabled="true"]):hover { background: var(--ws-surface); color: var(--ws-ink); }
.wm-secondary.wm-danger:is(:disabled, [aria-disabled="true"]):hover { background: var(--ws-surface); color: var(--ws-danger); }

.wm-heading-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-left: auto; }
.wm-header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.wm-header-overflow { position: relative; }
.wm-header-overflow summary { display: inline-flex; gap: 8px; cursor: pointer; list-style: none; }
.wm-header-overflow summary::-webkit-details-marker { display: none; }
.wm-header-actions-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; max-width: calc(100vw - 32px); padding: 5px; border: 1px solid var(--ws-line); border-radius: 4px; background: var(--ws-surface); box-shadow: 0 6px 20px #0e46461a; }
.wm-header-actions-panel a, .wm-header-actions-panel button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 3px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.wm-header-actions-panel form { margin: 0; }
.wm-header-actions-panel > :not(:first-child) { border-top: 1px solid var(--ws-line); margin-top: 4px; padding-top: 4px; }
.wm-header-actions-panel a:hover, .wm-header-actions-panel button:hover { background: var(--ws-sage); }
.wm-header-actions-panel .wm-danger { color: var(--ws-danger); }
.wm-header-actions-panel .wm-danger:hover { background: color-mix(in srgb, var(--ws-danger) 10%, var(--ws-surface)); }
.wm-header-overflow summary:focus-visible, .wm-header-actions-panel a:focus-visible, .wm-header-actions-panel button:focus-visible { outline: 2px solid var(--ws-ink); outline-offset: 2px; }
@media (max-width: 640px) {
    .wm-heading { flex-wrap: wrap; }
    .wm-heading-tools { width: 100%; }
    .wm-header-actions { margin-left: auto; }
}

.wm-attribute-tabs { display: flex; flex-wrap: wrap; gap: 12px 0; margin: 16px 0; }
.wm-attribute-tabs a { padding: 0 14px; color: var(--ws-ink); }
.wm-attribute-tabs a:first-child { padding-left: 0; }
.wm-attribute-tabs a + a { border-left: 1px solid var(--ws-line); }
.wm-attribute-tabs a:hover, .wm-attribute-tabs a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.wm-attribute-tabs a[aria-current="page"] { font-weight: 700; }
.wm-attribute-tabs a:focus-visible { outline: 2px solid var(--ws-ink); outline-offset: 4px; }
.wm-list-panels { display: grid; gap: 16px; }
.wm-filter-panel .wm-list-toolbar { padding: 16px; }
.wm-filter-panel .wm-catalogue-loading { margin: 0 16px; }
@media (max-width: 1000px) {
    .wm-attribute-tabs { gap: 12px 20px; }
    .wm-attribute-tabs a, .wm-attribute-tabs a:first-child { padding: 0; border: 0; }
}

.wm-order-table :is(th, td):first-child { width: 1%; white-space: nowrap; }
.wm-order-table td:nth-child(2) { min-width: 180px; }
.wm-order-customer-email { display: block; margin-top: 3px; color: var(--ws-muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }

.wm-order-customer-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.wm-order-customer-link:focus-visible { outline: 2px solid var(--ws-ink); outline-offset: 3px; }
.wm-heading-back { margin-bottom: 12px; }
.wm-order-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.wm-order-actions .wm-form-note { margin: 0; }

/* Text links in tables, record fields and station headings share one treatment. */
.ws-main :is(table tbody :is(td, th), .wm-record-fields dd, .ws-station-workspace .wo-section-heading h2) a[href]:not(:is(.wm-button, .wm-secondary, .ws-button, [role="button"])) {
    color: var(--ws-accent);
    font-weight: 600;
    text-decoration: none;
}
.ws-main :is(table tbody :is(td, th), .wm-record-fields dd, .ws-station-workspace .wo-section-heading h2) a[href]:not(:is(.wm-button, .wm-secondary, .ws-button, [role="button"])):is(:hover, :focus-visible) {
    color: #624678;
    text-decoration: underline;
    text-underline-offset: 3px;
}
[data-ws-color-scheme="dark"] .ws-main :is(table tbody :is(td, th), .wm-record-fields dd, .ws-station-workspace .wo-section-heading h2) a[href]:not(:is(.wm-button, .wm-secondary, .ws-button, [role="button"])):is(:hover, :focus-visible) {
    color: #e1cdee;
}

/* This sheet loads last; keep custom arrows after the surface background rules. */
:is(.wm-list-toolbar, .wm-form-field, .wm-page-size, .ws-pharmacy-picker) select:not([multiple]) {
    appearance: none;
    padding-right: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 10'%3E%3Cpath d='M2 2l5 5 5-5' fill='none' stroke='%230e4646' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 20px center;
    background-size: 14px 10px;
    background-repeat: no-repeat;
}
:root[data-ws-color-scheme="dark"] :is(.wm-list-toolbar, .wm-form-field, .wm-page-size, .ws-pharmacy-picker) select:not([multiple]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 10'%3E%3Cpath d='M2 2l5 5 5-5' fill='none' stroke='%23e4eeeb' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (forced-colors: active) {
    :is(.wm-list-toolbar, .wm-form-field, .wm-page-size, .ws-pharmacy-picker) select:not([multiple]) { appearance: auto; background-image: none !important; }
}

.ws-help-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }

.wm-form-note.wm-form-warning { background:#fff3d6; color:#7c4a0b; }
[data-ws-color-scheme="dark"] .wm-form-note.wm-form-warning { background:#4a3e29; color:#f1d799; }

.ws-footer { display: flex; justify-content: flex-end; max-width: 1800px; margin: 0 auto; padding: 0 24px 24px; }

.wm-button-slate { --ws-button-bg: #0e4646; --ws-button-text: #fff; }
.wm-button.wm-button-slate:not(:disabled):not([aria-disabled="true"]):hover { background: color-mix(in srgb, var(--ws-button-bg) 90%, #000); color: var(--ws-button-text); }
