/* Approval topic workspaces. Every selector is locally scoped for safe incremental integration. */
.oa-approval-workspace {
    display: grid;
    gap: 16px;
    min-width: 0;
    color: #263247;
}

.oa-approval-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 4px 2px;
}

.oa-approval-hero span,
.oa-approval-modal > header > div > span {
    color: #5967d8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.oa-approval-hero h2 {
    margin: 5px 0 8px;
    color: #172033;
    font-size: 26px;
}

.oa-approval-hero p {
    max-width: 780px;
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.65;
}

.oa-capability-boundary {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid #cad7eb;
    border-radius: 12px;
    background: #f5f8fd;
    color: #526078;
    font-size: 12px;
    line-height: 1.6;
}

.oa-capability-boundary strong {
    flex: 0 0 auto;
    color: #344054;
}

.oa-approval-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dfe6ef;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(35, 49, 75, .045);
}

.oa-approval-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 170px 170px auto auto minmax(105px, auto);
    gap: 10px;
    align-items: end;
    padding: 14px 16px;
    border-bottom: 1px solid #e7ebf1;
    background: #fbfcfe;
}

.oa-approval-filters label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
}

.oa-approval-filters input,
.oa-approval-filters select,
.oa-approval-pagination select {
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #d3dbe7;
    border-radius: 9px;
    background: #fff;
    color: #2f394b;
    font: inherit;
}

.oa-approval-filters small {
    justify-self: end;
    align-self: center;
    color: #7b8495;
    font-size: 11px;
}

.oa-text-button {
    padding: 6px;
    border: 0;
    background: transparent;
    color: #4c5eca;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.oa-text-button:hover {
    text-decoration: underline;
}

.oa-approval-table-wrap {
    width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}

.oa-approval-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.oa-approval-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 11px 12px;
    border-bottom: 1px solid #dde4ee;
    background: #f6f8fb;
    color: #667085;
    font-size: 11px;
    font-weight: 750;
    text-align: left;
    white-space: nowrap;
}

.oa-approval-table td {
    height: 48px;
    max-width: 250px;
    box-sizing: border-box;
    padding: 11px 12px;
    border-bottom: 1px solid #edf0f4;
    color: #485466;
    font-size: 12px;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oa-approval-table tbody tr:hover {
    background: #fafbff;
}

.oa-approval-table tbody tr:last-child td {
    border-bottom: 0;
}

.oa-approval-table td strong,
.oa-approval-table td small {
    display: block;
}

.oa-approval-table td strong {
    color: #273247;
}

.oa-approval-table td small {
    margin-top: 2px;
    color: #8490a2;
    font-size: 10px;
}

.oa-status,
.oa-risk {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f0f2f6;
    color: #596579;
    font-size: 10px;
    font-weight: 750;
}

.oa-status.approved,
.oa-risk.low {
    background: #eaf8f1;
    color: #177151;
}

.oa-status.rejected,
.oa-risk.high {
    background: #fff0f1;
    color: #a62f3d;
}

.oa-status.returned,
.oa-risk.medium {
    background: #fff6e6;
    color: #956018;
}

.oa-status.submitted,
.oa-status.in_review {
    background: #edf4ff;
    color: #2f5d9a;
}

.oa-approval-pagination {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 18px;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e7ebf1;
    background: #fbfcfe;
    color: #737e90;
    font-size: 12px;
}

.oa-approval-pagination label,
.oa-approval-pagination > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.oa-approval-pagination select {
    width: 68px;
    min-height: 34px;
    padding: 5px 7px;
}

.oa-workspace-state {
    display: grid;
    place-items: center;
    gap: 7px;
    min-height: 270px;
    padding: 38px;
    color: #7b8495;
    text-align: center;
}

.oa-workspace-state.compact {
    min-height: 150px;
    padding: 24px;
}

.oa-workspace-state strong {
    color: #30384a;
    font-size: 17px;
}

.oa-workspace-state p {
    max-width: 560px;
    margin: 0 0 8px;
    line-height: 1.6;
}

.oa-workspace-state.error strong {
    color: #a62f3d;
}

.oa-loading-mark {
    width: 26px;
    height: 26px;
    border: 3px solid #dbe1ed;
    border-top-color: #5967d8;
    border-radius: 50%;
    animation: oa-workspace-spin .75s linear infinite;
}

@keyframes oa-workspace-spin {
    to { transform: rotate(360deg); }
}

.oa-approval-modal-mask {
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 16px;
}

.oa-approval-modal {
    display: flex;
    flex-direction: column;
    width: min(900px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 28px 90px rgba(20, 31, 50, .24);
}

.oa-approval-modal > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex: 0 0 auto;
    padding: 21px 25px 17px;
    border-bottom: 1px solid #e4e9f0;
    background: #fff;
}

.oa-approval-modal > header h2 {
    margin: 4px 0 5px;
    color: #202a3b;
    font-size: 22px;
}

.oa-approval-modal > header p {
    margin: 0;
    color: #758094;
    font-size: 12px;
}

.oa-approval-modal > header .modal-corner-close {
    position: static;
    flex: 0 0 auto;
}

.oa-approval-modal-body,
.oa-approval-detail-body {
    min-height: 0;
    padding: 20px 25px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.oa-detail-loading {
    display: grid;
    min-height: 300px;
    place-items: center;
    align-content: center;
    gap: 12px;
    color: #526078;
}

.oa-governed-form {
    display: grid;
    gap: 18px;
}

.oa-form-grid,
.oa-detail-dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 15px;
}

.oa-field {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.oa-field.wide,
.oa-detail-dl > div.wide {
    grid-column: 1 / -1;
}

.oa-field > span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #455168;
    font-size: 12px;
    font-weight: 700;
}

.oa-field > span em {
    padding: 1px 5px;
    border-radius: 5px;
    background: #fff1f2;
    color: #b4233d;
    font-size: 9px;
    font-style: normal;
}

.oa-field :is(input, select, textarea) {
    box-sizing: border-box;
    width: 100%;
    min-height: 41px;
    padding: 9px 10px;
    border: 1px solid #cfd8e5;
    border-radius: 9px;
    background: #fff;
    color: #222f43;
    font: inherit;
}

.oa-field textarea {
    min-height: 92px;
    line-height: 1.55;
    resize: vertical;
}

.oa-field > small {
    min-height: 13px;
    color: #7b8798;
    font-size: 10px;
    line-height: 1.4;
}

.oa-field.has-error :is(input, select, textarea),
.oa-field :is(input, select, textarea)[aria-invalid="true"] {
    border-color: #d14354;
    background: #fffafb;
    box-shadow: 0 0 0 3px rgba(209, 67, 84, .1);
}

.oa-field.has-error > small {
    color: #c13646;
    font-weight: 650;
}

.oa-field :is(input, select, textarea):focus,
.oa-approval-filters :is(input, select):focus,
.oa-detail-tabs button:focus-visible,
.oa-text-button:focus-visible {
    border-color: #6476e8;
    outline: 3px solid rgba(79, 70, 229, .14);
    outline-offset: 1px;
}

.oa-form-facts {
    padding-top: 16px;
    border-top: 1px solid #e6eaf0;
}

.oa-form-facts h3 {
    margin: 0 0 12px;
    color: #344054;
    font-size: 14px;
}

.oa-form-error {
    padding: 10px 12px;
    border: 1px solid #f1b8bf;
    border-radius: 9px;
    background: #fff4f5;
    color: #a92e3b;
    font-size: 12px;
}

.oa-form-error[hidden] {
    display: none;
}

.oa-governed-form > footer {
    position: sticky;
    bottom: -20px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin: 0 -25px -20px;
    padding: 13px 25px;
    border-top: 1px solid #e0e6ef;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -10px 26px rgba(27, 42, 69, .06);
    backdrop-filter: blur(14px);
}

.oa-detail-tabs {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
    padding: 8px 25px;
    overflow-x: auto;
    border-bottom: 1px solid #e4e9f0;
    background: #fafbfe;
}

.oa-detail-tabs button {
    padding: 8px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #667085;
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.oa-detail-tabs button.active,
.oa-detail-tabs button[aria-selected="true"] {
    background: #eef1ff;
    color: #3449b9;
    font-weight: 750;
}

.oa-detail-dl {
    margin: 0;
}

.oa-detail-dl > div {
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid #e1e7ef;
    border-radius: 10px;
    background: #fafbfe;
}

.oa-detail-dl dt {
    margin-bottom: 5px;
    color: #7b8495;
    font-size: 10px;
}

.oa-detail-dl dd {
    margin: 0;
    color: #2c3749;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.oa-detail-dl.audit {
    margin-top: 14px;
}

.oa-route-timeline,
.oa-recommendation-list {
    display: grid;
    gap: 10px;
}

.oa-route-timeline > article {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e1e7ef;
    border-radius: 11px;
    background: #fff;
}

.oa-route-timeline > article > span {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: #eef1ff;
    color: #4053bc;
    font-size: 11px;
    font-weight: 800;
}

.oa-route-timeline p,
.oa-route-timeline blockquote,
.oa-route-timeline small {
    margin: 3px 0 0;
    color: #677489;
    font-size: 11px;
    line-height: 1.55;
}

.oa-route-timeline blockquote {
    padding: 7px 9px;
    border-left: 2px solid #cbd5e1;
    background: #fafbfc;
}

.oa-recommendation-list article {
    padding: 13px;
    border: 1px solid #dce5f2;
    border-radius: 11px;
    background: #f8fbff;
}

.oa-recommendation-list article header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.oa-recommendation-list article p {
    margin: 7px 0;
    color: #526078;
    line-height: 1.6;
}

.oa-recommendation-list article small {
    color: #738095;
}

.oa-detail-actions {
    margin-top: 20px;
    padding-top: 17px;
    border-top: 1px solid #e4e9f0;
}

.oa-detail-actions > header h3 {
    margin: 0 0 4px;
    color: #344054;
}

.oa-detail-actions > header p {
    margin: 0 0 12px;
    color: #68758a;
    font-size: 11px;
}

.oa-workspace-action-panel {
    margin: 10px 0;
    border: 1px solid #dde4ee;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.oa-workspace-action-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    color: #344054;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
}

.oa-workspace-action-panel > summary::-webkit-details-marker {
    display: none;
}

.oa-workspace-action-panel > summary::after {
    content: "展开";
    color: #5363c9;
    font-size: 10px;
}

.oa-workspace-action-panel[open] > summary {
    border-bottom: 1px solid #e5e9f0;
    background: #fafbfe;
}

.oa-workspace-action-panel[open] > summary::after {
    content: "收起";
}

.oa-workspace-action-panel > div {
    padding: 14px;
}

.oa-submit-gate,
.oa-action-gate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 10px;
    padding: 13px 14px;
    border: 1px solid #cdd9ec;
    border-radius: 11px;
    background: #f7f9fd;
}

.oa-submit-gate p {
    margin: 4px 0 0;
    color: #68758a;
    font-size: 11px;
    line-height: 1.5;
}

.oa-action-gate {
    align-items: flex-start;
    color: #667085;
    font-size: 12px;
    line-height: 1.55;
}

.oa-action-gate strong {
    flex: 0 0 auto;
    color: #344054;
}

.oa-decision-form {
    display: grid;
    grid-template-columns: 190px 1fr auto;
    gap: 12px;
    align-items: end;
}

.oa-decision-form .oa-form-error {
    grid-column: 1 / -1;
}

.oa-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    padding: 12px 25px;
    border-top: 1px solid #e0e6ef;
    background: rgba(255, 255, 255, .98);
}

.oa-detail-footer span {
    color: #758094;
    font-size: 10px;
    line-height: 1.4;
}

@media (max-width: 980px) {
    .oa-approval-filters {
        grid-template-columns: 1fr 160px 160px auto;
    }

    .oa-approval-filters small {
        justify-self: start;
    }

    .oa-decision-form {
        grid-template-columns: 1fr 1fr;
    }

    .oa-decision-form button {
        width: max-content;
    }
}

@media (max-width: 680px) {
    .oa-approval-hero {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .oa-approval-hero .primary-btn {
        width: 100%;
    }

    .oa-capability-boundary {
        flex-direction: column;
        gap: 5px;
    }

    .oa-approval-filters {
        grid-template-columns: 1fr;
    }

    .oa-approval-filters > button {
        width: 100%;
    }

    .oa-approval-filters small {
        justify-self: start;
    }

    .oa-approval-pagination {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .oa-approval-pagination > div {
        justify-content: space-between;
    }

    .oa-approval-modal-mask {
        padding: 8px;
    }

    .oa-approval-modal {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 14px;
    }

    .oa-approval-modal > header,
    .oa-approval-modal-body,
    .oa-approval-detail-body,
    .oa-detail-footer {
        padding-left: 17px;
        padding-right: 17px;
    }

    .oa-detail-tabs {
        padding-inline: 17px;
    }

    .oa-form-grid,
    .oa-detail-dl,
    .oa-decision-form {
        grid-template-columns: 1fr;
    }

    .oa-field.wide,
    .oa-detail-dl > div.wide {
        grid-column: auto;
    }

    .oa-governed-form > footer {
        bottom: -20px;
        margin-inline: -17px;
        padding-inline: 17px;
    }

    .oa-submit-gate,
    .oa-action-gate,
    .oa-detail-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .oa-submit-gate button,
    .oa-detail-footer button,
    .oa-decision-form button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .oa-loading-mark { animation-duration: 1.5s; }
    .oa-field :is(input, select, textarea) { scroll-behavior: auto; }
}
