:root {
    --success-ink: #176044;
    --success-fill: #e5f5ec;
    --success-line: #b7dbc6;
    --attention-ink: #794b0a;
    --attention-fill: #fff3da;
    --attention-line: #e8cb93;
    --danger-ink: #a52c3b;
    --danger-fill: #fcebef;
    --danger-line: #ebb8c2;
    --approval-ink: #6542a1;
    --approval-fill: #f0eafa;
    --moderation-ink: #086468;
    --moderation-fill: #def4f1;
}

body { min-width: 0; }

.button.secondary {
    color: var(--p-accent);
    background: var(--theme-mist);
    border-color: var(--theme-line);
}
.button.secondary:hover { background: var(--theme-line); border-color: var(--p-accent); }
.button.action-success { color: #fff; background: var(--success-ink); }
.button.action-danger { color: #fff; background: var(--danger-ink); }
.button.action-attention { color: var(--attention-ink); background: var(--attention-fill); border-color: var(--attention-line); }
.button.action-danger-outline { color: var(--danger-ink); background: var(--danger-fill); border-color: var(--danger-line); }
.button.action-success:hover:enabled { background: #104c35; }
.button.action-danger:hover:enabled { background: #84212e; }
.button.action-attention:hover { border-color: var(--attention-ink); }
.button.action-danger-outline:hover { border-color: var(--danger-ink); }
.text-attention { color: var(--attention-ink); }
.text-danger { color: var(--danger-ink); }

.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0 6px;
    border-bottom: 1px solid var(--rail-line);
}
.sidebar .brand { border-bottom: 0; }
.workflow-nav a { gap: 9px; }
.workflow-nav a::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--nav-accent, var(--theme-highlight));
}
.workflow-nav [data-section="approval"] { --nav-accent: #d3b9ff; }
.workflow-nav [data-section="execution"] { --nav-accent: #8de3ba; }
.workflow-nav [data-section="moderation"] { --nav-accent: #88e0d9; }
.workflow-nav [data-section="attention"] { --nav-accent: #f1cc82; }
.workflow-nav [data-section="danger"] { --nav-accent: #ffabb7; }
.workflow-nav a[aria-current] {
    color: var(--nav-accent, var(--theme-highlight));
    background: color-mix(in srgb, currentColor 15%, var(--rail));
    box-shadow: inset 2px 0 currentColor;
}
.menu-close { color: var(--rail-ink); background: transparent; padding-inline: 8px; }
.menu-close:hover { background: #ffffff13; }
.menu-scrim[hidden] { display: none !important; }
.topbar .logout-button { color: var(--p-ink); background: var(--paper); border-color: var(--control-line); }
.topbar .logout-button:hover { color: var(--p-accent); background: var(--theme-mist); }
.topbar-account { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.topbar-account .avatar { color: var(--p-accent); background: var(--theme-mist); }
.topbar-account-name { max-width: 176px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.notification-link { position: relative; flex: none; width: 44px; min-height: 44px; padding: 0; }
.notification-link[aria-current] { color: var(--p-accent-ink); background: var(--p-accent); }
.notification-link[aria-current]:hover { background: color-mix(in srgb, var(--p-accent), black 12%); }
.notification-count {
    position: absolute;
    inset: 3px 3px auto auto;
    min-width: 17px;
    padding-inline: 3px;
    border-radius: 12px;
    color: var(--p-accent-ink);
    background: var(--danger-ink);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    line-height: 17px;
    text-align: center;
}
.role-pending { background: #fffbf2; }
.role-pending:hover { background: var(--attention-fill); }
.draft-list { margin-bottom: 16px; }
.draft-list h2 { margin: 0 0 16px; }
.draft-list .choice { justify-content: space-between; flex-wrap: wrap; }

.status {
    padding: 3px 9px;
    border-radius: 99px;
    background: var(--stone);
}
.status.active { color: var(--p-accent); background: var(--theme-mist); }
.status.done { color: var(--success-ink); background: var(--success-fill); }
.status.attention { color: var(--attention-ink); background: var(--attention-fill); }
.status.danger { color: var(--danger-ink); background: var(--danger-fill); }
.status[data-status="approval"] { color: var(--approval-ink); background: var(--approval-fill); }
.status[data-status="moderation"] { color: var(--moderation-ink); background: var(--moderation-fill); }
.status[data-status="execution"] { color: var(--success-ink); background: var(--success-fill); }

.notification-heading { align-items: center; }
.notification-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; }
.notification-tabs { gap: 0 16px; }
.notification-feed { margin: 0; padding: 0; border-radius: inherit; list-style: none; }
.notification-entry {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) max-content max-content;
    grid-template-areas: "icon info date action";
    align-items: center;
    gap: 12px clamp(16px, 2.2vw, 32px);
    padding: 16px var(--panel-inset);
    border-inline-start: 3px solid transparent;
}
.notification-entry:last-child { border-end-start-radius: inherit; border-end-end-radius: inherit; }
.notification-entry + .notification-entry { border-top: 1px solid var(--line); }
.notification-entry.unread { background: #f4f6ff; border-inline-start-color: var(--p-accent); }
.notification-entry > form { display: flex; grid-area: action; justify-content: flex-end; gap: 8px; }
.notification-entry .notification-mark { flex: none; width: 44px; padding: 0; }
.notification-entry > .notification-icon { grid-area: icon; }
.notification-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--event-ink, var(--p-accent));
    background: var(--event-fill, var(--theme-mist));
}
[data-event]:is([data-event="checked"], [data-event="approved"], [data-event="executed"], [data-event="completed"], [data-event="aml_allowed"], [data-event="cancel_kept"]) {
    --event-ink: var(--success-ink);
    --event-fill: var(--success-fill);
}
[data-event]:is([data-event="returned"], [data-event="waiting"], [data-event="cancel_requested"], [data-event="stage_reminder"]) {
    --event-ink: var(--attention-ink);
    --event-fill: var(--attention-fill);
}
[data-event]:is([data-event="cancelled"], [data-event="rejected"], [data-event="closed"], [data-event="stage_escalation"]) {
    --event-ink: var(--danger-ink);
    --event-fill: var(--danger-fill);
}
.notification-info { display: grid; grid-area: info; min-width: 0; justify-items: start; gap: 6px; }
.notification-copy { min-width: 0; overflow-wrap: anywhere; }
.notification-stage { max-width: 100%; overflow-wrap: anywhere; }
.notification-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.notification-copy p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.notification-new {
    padding: 2px 8px;
    border-radius: 99px;
    color: var(--p-accent);
    background: var(--theme-mist);
    font-size: 11px;
    font-weight: 650;
}
.notification-entry time {
    display: flex;
    flex-wrap: wrap;
    grid-area: date;
    gap: 2px 8px;
    color: var(--p-ink);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.notification-entry time span { white-space: nowrap; }
.notification-empty { display: grid; justify-items: center; gap: 10px; text-align: center; }

@container workspace (min-width: 960px) {
    .notification-entry {
        grid-template-columns: auto minmax(0, 1fr) minmax(0, .85fr) max-content max-content;
        grid-template-areas: "icon copy stage date action";
    }
    .notification-info { display: contents; }
    .notification-copy { grid-area: copy; }
    .notification-stage { grid-area: stage; justify-self: start; }
}

.request-picker { position: relative; z-index: 2; flex: none; }
.request-picker summary { list-style: none; }
.request-picker summary::-webkit-details-marker { display: none; }
.request-picker > .panel {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline-end: 0;
    width: min(390px, calc(100vw - 32px));
    box-shadow: 0 12px 30px #17181d18;
}
.request-picker .choice { color: var(--p-ink); text-decoration: none; }
.content a.choice {
    background: var(--p-surface);
    border-color: var(--theme-line);
    color: var(--p-accent);
    justify-content: space-between;
}
.content a.choice:hover { background: var(--theme-mist); border-color: var(--p-accent); text-decoration: none; }
.requests-table time { font-variant-numeric: tabular-nums; }
.requests-table th { background: var(--p-surface); }
.requests-table .row-title { color: var(--p-accent); }

.request-main { min-width: 0; }
.request-detail .facts:last-child { margin-bottom: 0; }
.stage-values { margin-top: 21px; }
.stage-values h3 { margin-bottom: 8px; }
.request-layout .route-panel { min-width: 0; }
.request-layout :is(#workflow-action, #assignment-action) { scroll-margin-top: 16px; }
.timeline .skipped .step-marker { border-color: var(--line); background: var(--canvas); }
.timeline [data-run="waiting"], .timeline [data-run="returned"] { background: var(--attention-fill); }
.timeline :is([data-run="waiting"], [data-run="returned"]) .step-marker {
    color: var(--attention-ink);
    background: var(--attention-fill);
    border-color: var(--attention-line);
}
.timeline [data-run="stopped"] .step-marker { color: var(--danger-ink); background: var(--danger-fill); border-color: var(--danger-line); }
.history a, .facts a { overflow-wrap: anywhere; }
.history li > strong { color: var(--event-ink, var(--p-ink)); }
.facts dt, .facts dd, .history p { overflow-wrap: anywhere; }
.facts > .table-fact { grid-template-columns: minmax(0, 1fr); }
.request-detail .tabs { gap: 0 8px; }
.request-detail .tabs a { padding-inline: 8px; }
.request-detail .tabs a[aria-current] { background: var(--p-surface); }
.cancel-form summary { justify-self: start; gap: 10px; list-style: none; }
.cancel-form summary::-webkit-details-marker { display: none; }
.cancel-form summary::after {
    content: "";
    width: 7px;
    height: 7px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: translateY(-2px) rotate(45deg);
}
.cancel-form[open] summary::after { transform: translateY(2px) rotate(225deg); }
.cancel-form form { margin-top: 14px; }
.decision-actions { align-items: stretch; }
.decision-actions .button { max-width: 100%; }

#workflow-fields:empty { display: none; }
#workflow-fields .form-row { display: grid; min-width: 0; align-content: start; gap: 7px; }
#workflow-fields .form-row > label { font-size: 13px; font-weight: 600; }
.payment-fields, .payment-fields label { display: grid; min-width: 0; gap: 7px; }
.payment-fields { gap: 12px; }
.payment-fields label { font-size: 13px; font-weight: 600; }
#workflow-fields .form-row > p { font-size: 13px; color: var(--muted); }
#workflow-fields .form-row:has(> input[type="file"], > div > table) { grid-column: 1 / -1; }
#workflow-fields .form-row > div:has(> table), .scroll-table { overflow-x: auto; }
#workflow-fields .form-row > div > button { margin-top: 8px; }
#workflow-fields fieldset { min-width: 0; margin: 0; border: 0; padding: 0; display: grid; gap: 8px; }
#workflow-fields fieldset label { display: grid; gap: 3px; }
#workflow-fields .needs-review { padding-inline-start: 10px; border-inline-start: 3px solid #96703c; }
mark { color: #694513; background: #f5efe3; border-radius: 3px; padding: 0 4px; }

.notice-attention { color: var(--attention-ink); background: var(--attention-fill); border-color: var(--attention-line); }
.notice-error, .errorlist, .errornote, [aria-invalid="true"] { color: var(--danger-ink); }
.notice-error { background: var(--danger-fill); border-color: var(--danger-line); }
.errorlist { margin: 0; padding-inline-start: 20px; font-size: 13px; }
#workflow-fields [aria-invalid="true"] { border-color: var(--danger-ink); }
.feedback { color: var(--muted); font-size: 13px; }
.feedback:empty { display: none; }
.wizard-form > .feedback:not(:empty) { margin-top: 14px; }

.content.standalone { max-width: 36rem; margin-inline: auto; padding-inline: var(--gutter); }

@container workspace (max-width: 680px) {
    .notification-entry {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "icon info info" "date date action";
        gap: 8px 12px;
        padding-block: 14px;
    }
    .notification-entry .button:not(.notification-mark) { padding-inline: 12px; }
}

@container workspace (max-width: 365px) {
    .notification-entry { grid-template-areas: "icon info info" "date date date" "action action action"; }
}

@media (max-width: 620px) {
    .topbar-account-name { display: none; }
    .request-picker { flex: auto; max-width: 100%; }
    .request-picker > .panel { position: static; width: auto; margin-top: 8px; box-shadow: none; }
    .decision-actions > .primary:not(:only-child) { width: 100%; }
    :is(#workflow-fields, .scroll-table) table { display: table; }
    :is(#workflow-fields, .scroll-table) thead {
        display: table-header-group;
        position: static;
        clip-path: none;
        width: auto;
        height: auto;
    }
    :is(#workflow-fields, .scroll-table) tbody { display: table-row-group; }
    :is(#workflow-fields, .scroll-table) tr { display: table-row; }
    :is(#workflow-fields, .scroll-table) td { display: table-cell; padding: 6px; min-width: 104px; }
    :is(#workflow-fields, .scroll-table) td::before { content: none; }
}
.request-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    background: var(--p-surface);
    border-color: var(--theme-line);
}

.request-filters label {
    display: grid;
    gap: 4px;
}

.request-filters input,
.request-filters select {
    max-width: 100%;
}

.request-filters :is(input:not([type="hidden"])[value]:not([value=""]), select:has(option:checked:not([value=""], [value="all"]))) {
    border-color: var(--p-accent);
    color: var(--p-accent);
}

@container workspace (min-width: 1100px) {
    .request-filters:has(select[name="state"]):has(input[name="number"]) {
        grid-template-columns: minmax(170px, 1.3fr) minmax(72px, .6fr) minmax(115px, 1fr)
            minmax(134px, 1.25fr) repeat(2, minmax(122px, .9fr)) minmax(100px, .8fr);
    }
}
