/*
 * Change approvals (Step 06): what People Settings › Change approvals adds to the settings pattern (settings_section.css) --
 * the matrix, the group and rule lists, the rule form and Test a change. Colours come from the settings tokens.
 */
.worker-hr-change-settings .people-settings-index a[aria-current="page"] {
    color: var(--people-settings-purple, #7c3aed);
    font-weight: 600;
}

.worker-hr-change-label,
.worker-hr-change-settings .people-settings-chip {
    display: inline-block;
    margin: 0 4px 4px 0;
}

.worker-hr-change-order,
.worker-hr-change-row-actions {
    white-space: nowrap;
}

.worker-hr-change-matrix th[scope="row"] {
    font-weight: normal;
    min-width: 220px;
}

.worker-hr-change-matrix td,
.worker-hr-change-notices td {
    vertical-align: middle;
}

.worker-hr-change-rule-form {
    margin-bottom: 16px;
}

.worker-hr-change-rule-form > summary {
    display: inline-block;
    list-style: none;
    margin-bottom: 12px;
}

.worker-hr-change-rule-form > summary::-webkit-details-marker {
    display: none;
}

.worker-hr-change-rule-form[open] > form {
    padding: 16px;
    border: 1px solid var(--people-settings-line, #e5e7eb);
    border-radius: 12px;
}

.worker-hr-change-toggle {
    border: 0;
    cursor: pointer;
}

.worker-hr-change-tester {
    margin-top: 16px;
}

.worker-hr-change-test-answer:not(:empty) {
    margin-top: 12px;
}

.worker-hr-change-test-steps,
.worker-hr-change-test-why {
    margin: 6px 0 0;
    padding-left: 18px;
}

.worker-hr-change-nobody {
    margin: 0 0 12px;
}

.worker-hr-change-nobody .people-term-choice {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.worker-hr-change-categories {
    margin-top: 8px;
}

.worker-hr-change-categories[disabled] {
    opacity: .5;
}

.worker-hr-change-nobody .people-term-choice {
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--people-settings-line, #e5e7eb);
    border-radius: 10px;
    cursor: pointer;
}

.worker-hr-change-nobody .people-term-choice.is-selected {
    border-color: var(--people-settings-purple, #7c3aed);
}

.worker-hr-change-nobody .people-term-choice small {
    display: block;
    color: var(--people-settings-muted, #6b7280);
}

/*
 * Change requests on screen (Step 06, plan "Shared UI"): a field's hint, what the confirm dialog says per field, the step chips, the
 * progress track and the pending chip. The pills themselves are the directory's (people-dir-status-*).
 */
.wp-change-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #4b5563;
}

.wp-change-hint.is-approval,
.wp-change-outcome.is-approval {
    color: #92400e;
}

.wp-change-hint.is-not_allowed,
.wp-change-hint.is-blocked,
.wp-change-outcome.is-not_allowed {
    color: #b91c1c;
}

.wp-change-hint.is-direct,
.wp-change-outcome.is-direct {
    color: #047857;
}

.wp-change-outcome {
    margin: 6px 0 0;
    font-size: 12px;
}

.wp-change-summary {
    font-weight: 600;
    margin-bottom: 8px;
}

.wp-change-lines > li {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.wp-change-lines > li > strong {
    display: block;
    margin-bottom: 4px;
    color: #1f2937;
}

.wp-change-lines .people-term-diff-before {
    color: #64748b;
}

.wp-change-impact-item {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}

.wp-change-impact-item.is-warning .fa {
    color: #b45309;
}

.wp-change-impact-item.is-info .fa {
    color: #2563eb;
}

.wp-change-steps {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.wp-change-step {
    font-size: 11px;
    cursor: default;
}

.wp-change-track {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.wp-change-track-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 10px 6px 0;
    font-size: 12px;
}

.wp-change-track-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 700;
    font-size: 11px;
}

.wp-change-track-item.is-done .wp-change-track-mark {
    background: #d1fae5;
    color: #047857;
}

.wp-change-track-item.is-now .wp-change-track-mark {
    background: #fef3c7;
    color: #92400e;
}

.wp-change-track-item.is-rejected .wp-change-track-mark {
    background: #fee2e2;
    color: #b91c1c;
}

.wp-change-track-item.is-now .wp-change-track-label {
    font-weight: 600;
}

.wp-change-track-text {
    display: flex;
    flex-direction: column;
}

.wp-change-track-arrow {
    color: #d1d5db;
    margin-left: 4px;
}

.wp-change-pending {
    margin-left: 6px;
    font-size: 11px;
}

.wp-change-value-hidden {
    color: #6b7280;
    font-style: italic;
}

/*
 * Change requests: lists, the request page and the profile tab (second UI pass). People's spacing scale (field.css: 4, 8, 12, 16,
 * 24px) and its text colours: values dark and 600 where they are what a row is about, notes 12px and muted.
 */
.worker-hr-change-table td {
    vertical-align: top;
}

.wp-change-cell {
    display: flex;
    flex-direction: column;
    gap: var(--ido-space-1, 4px);
    min-width: 0;
}
.wp-change-cell--description { white-space: normal; overflow-wrap: anywhere; }

.wp-change-cell-title {
    font-weight: 600;
    white-space: nowrap;
}

.wp-change-cell-strong {
    font-weight: 600;
    color: var(--ido-field-value-color, #0f172a);
}

.wp-change-cell-note {
    font-size: 12px;
    color: var(--ido-field-muted-color, #64748b);
}

.wp-change-cell-note.is-danger {
    color: #b91c1c;
    font-weight: 600;
}

.wp-change-cell-actions,
.worker-hr-change-table .wp-change-col-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.wp-change-diff {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--ido-space-1, 4px) var(--ido-space-2, 8px);
}

.wp-change-diff .people-term-diff-before {
    color: var(--ido-field-muted-color, #64748b);
    text-decoration: line-through;
    text-decoration-color: #cbd5e1;
}

.wp-change-diff .people-term-diff-after {
    font-weight: 600;
    color: var(--ido-field-value-color, #0f172a);
}

.wp-change-diff .wp-change-value-hidden {
    font-weight: 500;
    color: var(--ido-field-muted-color, #64748b);
}

.wp-change-steps {
    gap: var(--ido-space-1, 4px);
    max-width: 180px;
}

/* The request page: the facts, why the route, and the approval record. */
.worker-hr-change-detail .panel_s {
    margin-bottom: var(--ido-space-4, 16px);
}

.worker-hr-change-detail .panel_s h4 {
    margin: 0 0 var(--ido-space-3, 12px);
    font-size: 15px;
    font-weight: 700;
    color: var(--ido-field-value-color, #0f172a);
}

.worker-hr-change-detail .people-settings-callout {
    margin-bottom: var(--ido-space-4, 16px);
}

.wp-change-facts {
    margin: 0;
}

.wp-change-facts .ido-field:first-child {
    padding-top: 0;
}

.wp-change-why,
.wp-change-record {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wp-change-why li {
    display: flex;
    gap: var(--ido-space-2, 8px);
    align-items: baseline;
    padding: var(--ido-space-2, 8px) 0;
    border-bottom: 1px solid var(--ido-field-line, #e2e8f0);
}

.wp-change-why li:last-child {
    border-bottom: 0;
}

.wp-change-why .fa {
    color: #7c3aed;
    font-size: 12px;
}

.wp-change-record {
    margin-top: var(--ido-space-3, 12px);
    border-top: 1px solid var(--ido-field-line, #e2e8f0);
}

.wp-change-record li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--ido-space-3, 12px) 0 var(--ido-space-3, 12px) var(--ido-space-3, 12px);
    border-bottom: 1px solid var(--ido-field-line, #e2e8f0);
    border-left: 3px solid #e2e8f0;
}

.wp-change-record li.is-approved {
    border-left-color: #10b981;
}

.wp-change-record li.is-rejected {
    border-left-color: #ef4444;
}

.wp-change-record-title {
    font-weight: 600;
    color: var(--ido-field-value-color, #0f172a);
}

.wp-change-record-who {
    font-size: 13px;
    color: var(--ido-field-label-color, #475569);
}

.wp-change-record-comment {
    font-size: 12px;
    font-style: italic;
    color: var(--ido-field-label-color, #475569);
}

.worker-hr-change-actions form + form,
.worker-hr-change-actions form + .btn,
.worker-hr-change-actions .btn + .btn {
    margin-top: var(--ido-space-2, 8px);
}

.worker-hr-change-actions .form-group {
    margin-bottom: var(--ido-space-3, 12px);
}

.wp-change-track {
    gap: var(--ido-space-1, 4px) 0;
}

/* Profile › Requests and the portal's cards. */
.worker-hr-change-profile-row {
    display: flex;
    flex-direction: column;
    gap: var(--ido-space-2, 8px);
    padding: var(--ido-space-3, 12px) 0;
    border-bottom: 1px solid var(--ido-field-line, #e2e8f0);
}

.worker-hr-change-profile-row:last-child {
    border-bottom: 0;
}

.worker-hr-change-profile-row-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--ido-space-2, 8px);
}

.worker-hr-change-profile-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ido-space-2, 8px);
}

/* ---- Settings: one chip style, the switch, legends, controls (second UI pass) ---------------------------------------------- */
.wp-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--ido-space-1, 4px);
    margin: 0 var(--ido-space-1, 4px) var(--ido-space-1, 4px) 0;
    padding: 2px 10px;
    border: 1px solid var(--ido-field-line, #e2e8f0);
    border-radius: 999px;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--ido-field-label-color, #475569);
    white-space: nowrap;
}

.wp-chip.is-strong {
    border-color: #ddd6fe;
    background: #f5f3ff;
    color: #5b21b6;
    font-weight: 600;
}

.wp-chip.is-muted {
    font-style: italic;
    color: var(--ido-field-muted-color, #64748b);
    background: #fff;
}

.wp-chip.is-locked {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 600;
}

.wp-chip.is-locked .fa {
    font-size: 10px;
}

/* P19: approvals switched off. Neutral, never a danger colour (canvas "Approvals flow · 9"). */
.wp-chip.is-off {
    border-color: var(--ido-line-strong);
    background: var(--ido-surface-2);
    color: var(--ido-text);
    font-weight: 600;
    margin-inline-start: 8px;
    vertical-align: middle;
}

.wp-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border: 1px solid var(--ido-field-line, #e2e8f0);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: var(--ido-field-muted-color, #64748b);
}

.wp-toggle::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
}

.wp-toggle.is-on {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #047857;
}

.wp-toggle.is-on::before {
    background: #10b981;
}

.wp-btn-remove .fa,
.wp-btn-remove {
    color: #b91c1c;
}

.wp-btn-remove:hover {
    border-color: #fecaca;
    background: #fef2f2;
}

.wp-legend {
    width: auto;
    margin: 0 0 var(--ido-space-2, 8px);
    padding: 0;
    border: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--people-settings-text, #0f172a);
}

/* The settings rows: a control column wide enough for a sentence-long choice, every control as wide as its column. */
.worker-hr-change-settings .people-settings-row {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
}

.worker-hr-change-settings .people-settings-row-control > select,
.worker-hr-change-settings .people-settings-row-control > .form-control,
.worker-hr-change-settings .people-settings-row-control > .bootstrap-select,
.worker-hr-change-settings .people-settings-row-control > .input-group {
    width: 100% !important;
}

/* A number with its unit reads from the left with room on the right, not against the addon. */
.worker-hr-change-settings .people-settings-row .input-group .form-control {
    text-align: left;
    padding-right: var(--ido-space-3, 12px);
}

/* Yes / No on one line, aligned with the label, as a pair. */
.worker-hr-change-settings .people-settings-row-control[role="radiogroup"] {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--ido-space-4, 16px);
    padding-top: var(--ido-space-2, 8px);
}

.worker-hr-change-settings .people-settings-row-control[role="radiogroup"] .radio-inline {
    margin: 0;
}

/* The switch's own card: no line above its only row, and its Save inside it. */
.worker-hr-change-settings-form > .people-settings-section:first-of-type > .people-settings-row:first-child {
    padding-top: 0;
    border-top: 0;
}

.wp-change-switch-actions {
    margin-top: var(--ido-space-3, 12px);
    text-align: right;
}

/* The matrix: chips side by side, the approved-by column wide enough for two of them. */
.worker-hr-change-matrix td:last-child {
    min-width: 200px;
}

.worker-hr-change-matrix .people-settings-chip {
    white-space: nowrap;
}

/* Categories in the group dialog: two columns, not one long list. */
.worker-hr-change-categories .checkbox-grid,
.worker-hr-change-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--ido-space-5, 24px);
}

.worker-hr-change-categories > legend {
    grid-column: 1 / -1;
}

.worker-hr-change-categories .checkbox {
    margin: var(--ido-space-1, 4px) 0;
}

/* Cutoff runs: a period on one line. */
.worker-hr-change-runs td:nth-child(2) {
    white-space: nowrap;
}

.worker-hr-change-settings .people-settings-chip {
    white-space: nowrap;
}

.worker-hr-change-settings .table > tbody > tr > td {
    vertical-align: top;
    padding-top: var(--ido-space-3, 12px);
    padding-bottom: var(--ido-space-3, 12px);
}

.people-settings-row-control > .wp-chip {
    align-self: flex-start;
}

span.wp-change-diff > .people-term-diff-before {
    color: var(--ido-field-muted-color, #64748b);
    text-decoration: line-through;
    text-decoration-color: #cbd5e1;
}

span.wp-change-diff > .people-term-diff-after {
    color: var(--ido-field-value-color, #0f172a);
}

/* The portal's request card: what it is and its status on one line, the track, what happens next, and Withdraw. */
.worker-hr-portal-request .panel-body {
    display: flex;
    flex-direction: column;
    gap: var(--ido-space-3, 12px);
}

.worker-hr-portal-request-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ido-space-3, 12px);
}

.worker-hr-portal-request-head > .wp-change-cell {
    min-width: 0;
    flex: 1 1 auto;
}

@media (max-width: 640px) {
    .worker-hr-portal-request-head {
        flex-direction: column;
    }

    .worker-hr-portal-request-head > div {
        width: 100%;
    }

    .worker-hr-portal-request .worker-hr-portal-request-head .people-dir-status {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .worker-hr-portal-request .worker-hr-portal-withdraw {
        flex-direction: column;
        align-items: stretch;
    }
}

.worker-hr-portal-request .wp-change-track {
    margin: 0;
    padding: var(--ido-space-3, 12px) 0;
    border-top: 1px solid var(--ido-field-line, #e2e8f0);
    border-bottom: 1px solid var(--ido-field-line, #e2e8f0);
}

.worker-hr-portal-request-next {
    margin: 0;
}

.worker-hr-portal-request p {
    margin: 0;
}

.worker-hr-portal-withdraw {
    display: flex;
    gap: var(--ido-space-2, 8px);
    align-items: center;
}

.worker-hr-portal-withdraw .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.worker-hr-portal-withdraw .btn {
    flex: 0 0 auto;
}

/* The client portal loads this file without People's directory styles: the status pills a request card shows, the same colours. */
.worker-hr-portal-request .people-dir-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.worker-hr-portal-request .people-dir-status-active { background: #dcfce7; color: #15803d; }
.worker-hr-portal-request .people-dir-status-recruitment { background: #ffedd5; color: #c2410c; }
.worker-hr-portal-request .people-dir-status-draft { background: #fef3c7; color: #b45309; }
.worker-hr-portal-request .people-dir-status-inactive { background: #f3f4f6; color: #4b5563; }
.worker-hr-portal-request .people-dir-status-onboarding { background: #dbeafe; color: #1d4ed8; }
.worker-hr-portal-request .people-dir-status-maternity { background: #fce7f3; color: #be185d; }

/* Ready for change requests? (activation): a card above every section of Change approvals, open while something required is missing. */
.worker-hr-change-readiness {
    margin-bottom: 16px;
    padding: 12px 16px;
}

.worker-hr-change-readiness.is-missing {
    border-left: 3px solid #d97706;
}

.worker-hr-change-readiness summary {
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
}

.worker-hr-change-readiness-list {
    margin: 8px 0 0;
}

.worker-hr-change-readiness-list li {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 4px 0;
}

.worker-hr-change-readiness-list .fa {
    width: 14px;
    flex: 0 0 14px;
}

/* A client step waiting for the client: Confirm, or Decline with a reason, one above the other. */
.worker-hr-portal-confirm {
    display: grid;
    gap: var(--ido-space-2, 8px);
    padding: var(--ido-space-3, 12px);
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
}

/* P19: rows that expand in place in Pending approvals and My requests (canvas "Approvals flow · 8"). */
.wp-change-cell-first {
    display: flex;
    align-items: flex-start;
    gap: var(--ido-space-2, 8px);
}

.wp-change-cell-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wp-change-expand {
    flex: none;
    width: 28px;
    height: 28px;
    margin-inline-start: -4px;
    border: 0;
    border-radius: var(--ido-radius-sm, 8px);
    background: transparent;
    color: var(--ido-text);
    cursor: pointer;
}

.wp-change-expand:hover { background: var(--ido-surface-2); }

.wp-change-expand .fa { transition: transform 150ms ease; }

.wp-change-expand[aria-expanded="true"] .fa { transform: rotate(90deg); }

[dir="rtl"] .wp-change-expand .fa-chevron-right { transform: scaleX(-1); }

[dir="rtl"] .wp-change-expand[aria-expanded="true"] .fa { transform: scaleX(-1) rotate(90deg); }

tr.wp-change-child > td {
    padding: 0;
    background: var(--ido-surface-2);
    border-bottom: 1px solid var(--ido-line);
}

.wp-change-expand-body {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--ido-space-6, 24px);
    padding: var(--ido-space-4, 16px) var(--ido-space-4, 16px) var(--ido-space-4, 16px) var(--ido-space-12, 48px);
}
.wp-change-expand-skeleton .wp-change-expand-col { display: flex; flex-direction: column; gap: var(--ido-space-2, 8px); }
.wp-change-expand-skeleton .wp-change-expand-title { margin-bottom: 0; }
.wp-change-expand-skeleton .ido-skeletons { max-width: 100%; }
.wp-change-expand-feedback { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 991px) {
    .wp-change-expand-body { grid-template-columns: minmax(0, 1fr); padding-inline-start: var(--ido-space-4, 16px); }
}

.wp-change-expand-title {
    margin: 0 0 var(--ido-space-2, 8px);
    font-size: 13px;
    font-weight: 600;
    color: var(--ido-text);
}

.wp-change-expand-facts {
    display: grid;
    grid-template-columns: minmax(96px, max-content) minmax(0, 1fr);
    gap: var(--ido-space-2, 8px) var(--ido-space-4, 16px);
    margin: 0;
    font-size: 14px;
}

.wp-change-expand-facts dt { font-weight: 400; color: var(--ido-text-muted); }

.wp-change-expand-facts dd { min-width: 0; margin: 0; color: var(--ido-text); overflow-wrap: anywhere; }

.wp-change-expand-help { font-size: 13px; color: var(--ido-text-muted); }

.wp-change-expand-help.is-danger { color: var(--ido-danger-text, var(--ido-text)); }

/* P24: the request page's kit cards and lists (canvas "07 · Approvals flow" › Screens 2). */
.wp-change-actions { display: flex; flex-direction: column; gap: var(--ido-space-2, 8px); }

.wp-change-impact,
.wp-change-why { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--ido-space-2, 8px); font-size: 14px; }

.wp-change-impact li,
.wp-change-why li { display: flex; gap: var(--ido-space-2, 8px); align-items: flex-start; }

.wp-change-impact-item.is-warning { color: var(--ido-status-warning-text, #92400e); }

.wp-change-failure { color: var(--ido-status-danger-text, #991b1b); }

.wp-change-status { display: inline-flex; gap: var(--ido-space-2, 8px); align-items: center; flex-wrap: wrap; }

.wp-change-steps { display: inline-flex; gap: var(--ido-space-1, 4px); flex-wrap: wrap; }

.wp-change-step-wrap { display: inline-flex; border-radius: var(--ido-radius-sm, 8px); }

.wp-change-pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ido-space-3, 12px); margin-block: var(--ido-space-4, 16px); }

/* Approval checkboxes are form controls, not highlighted option rows. Keep the kit's input focus ring. */
[data-change-settings-kit] .ido-choice:not(.ido-choice--card):hover,
#change-group-dialog .ido-choice:not(.ido-choice--card):hover {
    background: transparent;
}

/* The readiness callout is tinted; its setup action needs a solid, bounded surface. */
[data-change-settings-kit] .ido-alert .worker-hr-change-readiness__setup {
    border: 1px solid var(--ido-line-strong);
    background: var(--ido-surface);
    color: var(--ido-ink);
}
[data-change-settings-kit] .ido-alert .worker-hr-change-readiness__setup:hover,
[data-change-settings-kit] .ido-alert .worker-hr-change-readiness__setup:focus-visible {
    border-color: var(--ido-accent);
    background: var(--ido-surface);
    color: var(--ido-accent-text);
}

.worker-hr-change-list .worker-hr-onboarding-approval-queue {
    margin-bottom: var(--ido-space-4, 16px);
}
