/* AVstackr certified system modal — the Add certified system window's own rules on Project Details.
   ========================================================================
   Built to docs/superpowers/specs/2026-11-11-certified-wizard-visual-refresh-design.md (D2–D10, D14) from
   the owner's mock of 2026-11-11. The author-facing shell (frame, header, body, notices, panel, field
   register, footer, buttons, links, chips and numbers) is shared with the other author-facing windows in
   author-modal.css, as `am-` classes; that file carries the register, the colour token table and the
   --am-radius-* steps declared on .am-modal, which the rules here use, and it loads before this one.
   This file holds only what the certified system window uses, every class `csw-` prefixed: the modal
   element wears `am-modal csw-modal`. A plain stylesheet rather than the component's old scoped
   .razor.css, so the window and its three step components (Fit, Configure, Review) sit on the same
   shell as its siblings with no ::deep.

   Promotion rule: a class used by a second author-facing window moves to author-modal.css as `am-`;
   a class only this window uses stays here under `csw-`. Rules here may reach shared classes for this
   window alone (.csw-modal .am-head, .csw-row-label .am-label, .csw-row-control .am-field-note,
   .csw-slot-line .am-select, .am-chip.csw-unpriced, .csw-match-row .am-btn, .am-notice .csw-warnings,
   .csw-modal .am-status.is-warn).

   Colours are --app-* tokens only; no literal colours and no important flags. Amber text takes
   --app-warn-text, which is AA on every surface of the window in both modes; --app-status-warn colours
   only borders, icons and washes (it is 3.98:1 as light-mode text). Radii come from the --am-radius-*
   steps: the step cards, the system rows and the platform track take the button step, the platform
   options and the match rows the toolbar step, the table's frame the panel step, the step numbers and
   chips are fully round.

   Type here: step names 14px/600 and their hints 12px/400; system titles and row labels 14px/600, the
   second line of a system's name, the slot hints and the empty texts 13px/400, system codes and part
   numbers 12px in the monospace stack; the platform label 13px/500 and its options 13px/600; figure
   labels 13px/500, figures 22px/600 in the monospace stack, figure sub lines 13px/400; table headings
   12px/500, cells 13px, a line's note 13px under its make and model; reasons and the Slots count 13px.
   Sentence case throughout: nothing here sets a text transform or a tracking.
   ======================================================================== */

/* ── shell ──────────────────────────────────────────────────────────────── */

/* The shared rule's max-width: calc(100vw - 48px) already bounds the width on small screens. */
.csw-modal { width: 960px; }

/* The step cards sit between the header and the body, so the header gives up its hairline and the
   cards carry it (spec amendment 1). */
.csw-modal .am-head {
    padding-bottom: 16px;
    border-bottom: 0;
}

/* ── step cards ─────────────────────────────────────────────────────────── */

/* An ordered list (spec D5), so Bootstrap's list margin and markers go. */
.csw-steps {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0 var(--am-pad) 20px;
    list-style: none;
    border-bottom: 1px solid var(--app-border-hairline);
}

/* A card: the number circle, then the step's name over its hint, Done · change or Locked. */
.csw-step {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--app-border-hairline);
    border-radius: var(--am-radius-btn);
}
.csw-step.is-current {
    background: var(--app-accent-tint);
    border-color: var(--app-accent-border);
}

.csw-step-num {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: var(--app-text-label);
    border: 1px solid var(--app-border-strong);
    border-radius: 999px;
}
.csw-step.is-current .csw-step-num {
    color: var(--app-on-accent);
    background: var(--app-accent-fill);
    border-color: var(--app-accent-fill);
}
/* A finished step: the tick on a green wash. */
.csw-step.is-done .csw-step-num {
    color: var(--app-status-ok);
    background: color-mix(in srgb, var(--app-status-ok) 12%, transparent);
    border-color: color-mix(in srgb, var(--app-status-ok) 35%, transparent);
}

.csw-step-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.csw-step-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text-strong);
}

.csw-step-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--app-text-label);
}

/* change on a finished card: the shared link at the hint's size, underlined as the mock draws it. */
.csw-step-change {
    font-size: 12px;
    text-decoration: underline;
}

/* ── shared within the window ───────────────────────────────────────────── */

/* Configure's section heads carry a hairline under them, as the mock draws. */
.csw-section-head {
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--app-border-hairline);
}

/* The Slots count at the right of its head: amber until every slot is filled or owner furnished. */
.csw-slots-filled {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}
.csw-slots-filled.is-warn { color: var(--app-warn-text); }

/* One line saying what to do or what is missing: no library, no line, no slot. */
.csw-empty {
    font-size: 13px;
    color: var(--app-text-label);
}

.csw-strong {
    font-weight: 600;
    color: var(--app-text-strong);
}

/* A table line's role, a candidate's reason. */
.csw-role {
    font-size: 13px;
    color: var(--app-text-label);
}

/* A system code, a candidate's part number. */
.csw-system-designation,
.csw-part {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--app-text-label);
    white-space: nowrap;
}

/* ── fit ────────────────────────────────────────────────────────────────── */

/* Systems and its count left, Platform and its strip right. */
.csw-list-head {
    align-items: center;
    margin-bottom: 12px;
}

.csw-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.csw-filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}

/* The platform strip (spec D4): a sunken track with a hairline, the chosen option raised, the others
   plain text. The window's own control; the estimate's separate segments are a different one. */
.csw-platforms {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--app-surface-sunken);
    border: 1px solid var(--app-border-hairline);
    border-radius: var(--am-radius-btn);
}

.csw-platform {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: var(--app-text-label);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--am-radius-tool);
    cursor: pointer;
}
.csw-platform:hover { color: var(--app-text-strong); }
.csw-platform.is-on {
    color: var(--app-text-strong);
    background: var(--app-surface-raised);
    border-color: var(--app-border-hairline);
}

.csw-system-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* A system's name over the bracket of its name, its code at the right: a Fit row, and the Configure
   panel (am-panel csw-system-head). The text wraps; nothing is clipped. */
.csw-system-row,
.csw-system-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: center;
}

.csw-system-row {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: var(--app-surface-sunken);
    border: 1px solid var(--app-border-hairline);
    border-radius: var(--am-radius-btn);
    cursor: pointer;
}
.csw-system-row:hover { border-color: var(--app-border-strong); }
/* The picked row: the accent border and the raised fill. */
.csw-system-row.is-on {
    background: var(--app-surface-raised);
    border-color: var(--app-accent-border);
}

.csw-system-title {
    grid-column: 1;
    grid-row: 1;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--app-text-strong);
    overflow-wrap: anywhere;
}

.csw-system-detail {
    grid-column: 1;
    grid-row: 2;
    margin-top: 2px;
    font-size: 13px;
    color: var(--app-text-label);
    overflow-wrap: anywhere;
}

.csw-system-row .csw-system-designation,
.csw-system-head .csw-system-designation {
    grid-column: 2;
    grid-row: 1 / span 2;
}

/* ── configure ──────────────────────────────────────────────────────────── */

.csw-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Label column left, control column right. */
.csw-row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* The label, the slot's *, then its hint; the padding sets the label on a 40px field's text line. */
.csw-row-label {
    min-width: 0;
    padding-top: 10px;
    line-height: 1.4;
}
.csw-row-label .am-label {
    display: inline;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text-strong);
}

/* Every slot must be filled to continue (spec D7). */
.csw-required {
    margin-left: 4px;
    font-weight: 600;
    color: var(--app-danger-text);
}

.csw-hint {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--app-text-label);
}

.csw-row-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* The column's gap spaces its notes. */
.csw-row-control .am-field-note { margin-top: 0; }

/* The select, the count box, the range and the loading spinner on one line. */
.csw-slot-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.csw-slot-line .am-select {
    flex: 1 1 auto;
    min-width: 0;
}

/* The shared input is full width; a count is a few digits. */
.csw-qty {
    flex: none;
    width: 72px;
}

.csw-range {
    margin-top: 0;
    white-space: nowrap;
}

/* An empty slot that is not owner furnished: an amber border, not the danger one, because it is not an
   error until the PM tries to continue (spec D7). Focus still shows the accent. */
.csw-slot-select.is-empty { border-color: color-mix(in srgb, var(--app-status-warn) 55%, transparent); }
.csw-slot-select.is-empty:focus { border-color: var(--app-accent-border); }

/* Owner furnished, an option's toggle, a group's radios. */
.csw-check {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--app-text-data);
    cursor: pointer;
}
.csw-check input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    accent-color: var(--app-accent-fill);
    cursor: inherit;
}
.csw-check:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.csw-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-top: 9px;
}

/* ── review ─────────────────────────────────────────────────────────────── */

/* Priced total, Equipment lines, Schematic (spec D8). */
.csw-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.csw-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.csw-stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-label);
}

.csw-stat-figure {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--app-text-strong);
    overflow-wrap: anywhere;
}

.csw-stat-sub {
    font-size: 13px;
    color: var(--app-text-label);
}

/* n lines unpriced: the shared amber chip, its words in the amber text token. */
.am-chip.csw-unpriced { color: var(--app-warn-text); }

/* The table's rounded frame; a narrow window scrolls the table rather than clipping a column. */
.csw-table-frame {
    overflow-x: auto;
    border: 1px solid var(--app-border-hairline);
    border-radius: var(--am-radius-panel);
}

/* Sunken header row, hairline rows (spec D9). */
.csw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.csw-table th {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    color: var(--app-text-label);
    background: var(--app-surface-sunken);
    white-space: nowrap;
}

.csw-table td {
    padding: 10px 12px;
    color: var(--app-text-data);
    border-top: 1px solid var(--app-border-hairline);
    vertical-align: top;
}

/* Qty, Cost, Markup, Hours, Sell. */
.csw-table .csw-num {
    text-align: right;
    white-space: nowrap;
}

/* Make / model, then the line's note as its second line. */
.csw-line-name {
    display: block;
    color: var(--app-text-strong);
}

.csw-note {
    display: block;
    margin-top: 2px;
    color: var(--app-text-label);
    white-space: pre-line;
}

/* Catalog matches: one panel per device, its head naming it, then a row per product it may use with
   its button (or the Unlink pointer) at the right end (spec D10). */
.csw-match-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.csw-match {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
}

.csw-match-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 8px 12px;
    font-size: 14px;
    border-radius: var(--am-radius-tool);
}

.csw-match-head {
    border-bottom: 1px solid var(--app-border-hairline);
    border-radius: 0;
}

/* The product the review is priced on: the raised fill. */
.csw-match-row.is-on { background: var(--app-surface-raised); }

.csw-match-row .am-btn { margin-left: auto; }

/* Linked to … To use it here: Products → Unlink, where the button would be. */
.csw-match-note { margin: 0 0 0 auto; }

/* Several linked products, or no part number to tell them apart: the ask on its own line under the
   device's name. --app-warn-text, not --app-status-warn, which is 3.98:1 in light mode (theme-base.css). */
.csw-match-ask {
    flex-basis: 100%;
    font-size: 13px;
    color: var(--app-warn-text);
}

/* The chosen product's button reads as selected, not unavailable: it is never disabled, a click on it
   does nothing, and it keeps the raised fill under the pointer. */
.csw-match-row .am-btn[aria-pressed="true"] {
    background: var(--app-surface-raised);
    border-color: var(--app-accent-border);
    cursor: default;
}

/* Added to your catalog, unpriced; the warnings inside their notice, whose words take the amber text token
   (the shared notice paints its own text in --app-status-warn; the icon keeps it). */
.csw-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--app-text-data);
}
.csw-list li + li { margin-top: 4px; }

.am-notice .csw-warnings {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    color: var(--app-warn-text);
}

/* ── footer ─────────────────────────────────────────────────────────────── */

.csw-foot-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Fill every slot to continue. / Set each count within its range.: the amber warning icon and amber
   words; the ready sentence keeps the shared status colour. */
.csw-modal .am-status.is-warn { color: var(--app-warn-text); }
.csw-modal .am-status.is-warn .am-status-icon { color: var(--app-status-warn); }

/* ── focus ──────────────────────────────────────────────────────────────── */

.csw-platform:focus-visible,
.csw-system-row:focus-visible {
    outline: 2px solid var(--app-accent-border);
    outline-offset: 2px;
}

/* ── narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 720px) {
    .csw-steps,
    .csw-stats { grid-template-columns: 1fr; }
    .csw-list-head { flex-wrap: wrap; }
    .csw-row { grid-template-columns: 1fr; gap: 8px; }
    .csw-row-label { padding-top: 0; }
}
