/*
 * Items For Approval portal list (views/for-approval): type pills, Parent / Account / Expires cells,
 * the row square and tab counts, in light and dark mode.
 *
 * The page reuses the Case SLA triage page's tab strip, chip toolbar and list panel from
 * case-queues.css (BR-16); this file only adds what that page doesn't have. Rule IDs (BR-xx) and
 * section numbers refer to the design handoff's BUSINESS-RULES.md and DESIGN-SPEC.md. Every rule
 * is scoped to .ifa- classes so nothing leaks into other lists.
 */

/* Colour tokens the design adds on top of the theme (handoff theme-additions.css). The pill and
   label inks were picked to pass 4.5:1 on their tints; the theme's own --state-*-text don't. */
:root {
    --ifa-we-ink: #005fa3;          /* Work Estimate pill text, on --state-primary-bg */
    --ifa-cwi-ink: #725696;         /* Case Work Item pill text, on --state-info-bg */
    --ifa-quote-ink: #1f7a3a;       /* Quote pill text, on --state-success-bg */
    --ifa-crit: #ce2b5b;            /* Expires: critical label and bar (2 days or fewer) */
    --ifa-warn-ink: #9c6915;        /* Expires: warning label (7 days or fewer) */
    --ifa-warn: #e4a133;            /* Expires: warning bar; row and chip square */
    --ifa-normal-bar: #618cda;      /* Expires: normal bar (more than 7 days) */
    --ifa-square-off: #cfd4df;      /* Row square: not expiring this week */
}

html.dark {
    --ifa-we-ink: #6aa6e3;
    --ifa-cwi-ink: #a895c8;
    --ifa-quote-ink: #66c482;
    --ifa-crit: #e0828f;
    --ifa-warn-ink: #d4aa60;
    --ifa-square-off: #5a6070;
}

/* Tab strip (§3): the count after each tab's label. */
.ifa-tab-count { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--text-muted-color); }

/* Focus: the theme's focus ring on tabs and chips (§6). */
.ifa-tabs-container .cq-tab:focus-visible,
.ifa-list-panel .cq-count:focus-visible {
    outline: 1px solid #66afe9;
    box-shadow: 0 0 8px rgba(102, 175, 233, .6);
}

/* Row square (§4.3) and the Expiring This Week chip's square. */
.ifa-square { display: inline-block; width: 8px; height: 8px; border-radius: 1px; background: var(--ifa-square-off); vertical-align: middle; }
.ifa-square.is-expiring { background: var(--ifa-warn); }

/* The table scrolls sideways inside its panel on narrow screens, never the page (§4). */
.ifa-list-panel .list { overflow-x: auto; }
body[data-navbar="side"] #main .ifa-list-panel .list > table { min-width: 1140px; }

/* Rows open nothing on click; only the Name and Parent links do (the triage page's rows do). */
.ifa-list-panel .list-row { cursor: default; }

/* Square column: vertically centred like the triage page's SLA square column. */
.ifa-list-panel .cell[data-name="expiryState"] { vertical-align: middle; }

/* Expires column has extra room on its left (§4.2). */
.ifa-list-panel th[data-name="expiresAt"],
.ifa-list-panel td[data-name="expiresAt"] { padding-left: 20px; }

/* Truncation with an ellipsis; the cell's title shows the full text (§7). */
.ifa-trunc { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.for-approval-name-link { font-weight: 500; }

/* Parent cell (§4.4): "C-805540 · name"; the number never shrinks, the name truncates. Colour and
   hover come from core's .text-default list-link style, like other link columns. */
.ifa-parent { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ifa-parent-number { flex: 0 0 auto; font-weight: 500; white-space: nowrap; }
.ifa-parent-sep { flex: 0 0 auto; color: var(--text-muted-color); }

/* Account cell (BR-12). */
.ifa-account { color: var(--text-gray-color); }

/* Type pill (§4.5, BR-17): soft tint, never a solid fill. */
.ifa-type { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.ifa-type[data-type="WorkEstimate"] { background: var(--state-primary-bg); color: var(--ifa-we-ink); }
.ifa-type[data-type="CaseItem"] { background: var(--state-info-bg); color: var(--ifa-cwi-ink); }
.ifa-type[data-type="Quote"] { background: var(--state-success-bg); color: var(--ifa-quote-ink); }

/* Hours and Amount line up digit for digit. */
.ifa-num { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Expires cell (§4.6): label · date over a 3px bar; the tone sets both colours. */
.ifa-expires { display: flex; flex-direction: column; gap: 3px; width: 128px; }
.ifa-expires[data-tone="critical"] { --ifa-tone-ink: var(--ifa-crit); --ifa-tone-bar: var(--ifa-crit); }
.ifa-expires[data-tone="warning"] { --ifa-tone-ink: var(--ifa-warn-ink); --ifa-tone-bar: var(--ifa-warn); }
.ifa-expires[data-tone="normal"] { --ifa-tone-ink: var(--text-color); --ifa-tone-bar: var(--ifa-normal-bar); }
.ifa-expires-text { font-size: 12px; line-height: 16px; white-space: nowrap; }
.ifa-expires-label { font-weight: 600; color: var(--ifa-tone-ink); }
.ifa-expires-date { color: var(--text-gray-color); }
.ifa-expires-bar { height: 3px; border-radius: 2px; background: var(--default-border-color); overflow: hidden; }
.ifa-expires-bar > span { display: block; height: 100%; background: var(--ifa-tone-bar); }

/* "About This Page" dialog: the triage ranking dialog's layout, narrower for its short text, with
   room in the left column for the Expiring This Week label. */
.modal.ifa-help-dialog .modal-dialog { width: 620px; }
.ifa-help-dialog .cq-ranking-row:not(.is-numbered) { grid-template-columns: 160px 1fr; }

/* Empty result (§6). */
.ifa-list-panel .no-data { padding: 14px; color: var(--text-muted-color); }
