/* campaign.css — the campaign surfaces' own styles (sprint-003: design, library,
 * audience builder, campaign record, monitor).
 *
 * It loads AFTER app.css and adds only what the campaign surfaces need. Nothing here
 * redefines a shared class: `.card`, `.chip`, `.btn`, `.tabs`, `.defs`, the four
 * states, and the empty-artifact block are app.css's, and two stylesheets arguing over
 * one class is how a suite app drifts out of the suite.
 *
 * TOKENS ONLY. Every colour below is a token or a token-derived rgba. Two rules carry
 * MEANING rather than decoration and are called out where they appear:
 *   · `.chip-stub` — the one stub treatment. It is the WARNING amber, never the mint
 *     the suite reads as "real": stub content must never look measured.
 *   · the tile/swatch statuses — categorical colours for a categorical vocabulary. No
 *     gradient, no fill level, nothing that implies a quantity (REQ-SENTIA-019).
 */

/* ── the stub label: ONE treatment, everywhere ────────────────────────────── */

/* Amber, and never green. `--measured` is the suite's "this was collected" colour and
   stub content is the opposite of that claim (audience-integrity.md). */
.chip-stub {
    color: var(--warning);
    border-color: rgba(255, 170, 48, 0.34);
    background: rgba(255, 170, 48, 0.08);
    cursor: help;
}
.stub-note {
    margin-top: 12px;
    padding: 10px 14px;
    border-left: 2px solid var(--warning);
    background: rgba(255, 170, 48, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.86rem;
    color: var(--text-muted);
}
.stub-note-key {
    color: var(--warning);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    margin-right: 6px;
}

/* ── panels, rows, detail heads ───────────────────────────────────────────── */

.panel > h3 { margin-top: 0; }
.panel.is-blocked { border-color: rgba(255, 170, 48, 0.4); }
.panel.is-valid { border-color: rgba(0, 255, 180, 0.28); }
.panel.depth-empty { border-style: dashed; }

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.detail-head h2 { margin-bottom: 0; }

.rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.row-main { flex: 1; min-width: 260px; }
.row-main h3, .row-main h4 { margin-bottom: 2px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.row-side .actions { margin-top: 0; }
.row-sub { font-size: 0.82rem; color: var(--text-muted); }
.row-warn { font-size: 0.84rem; color: var(--warning); margin-top: 6px; }
.row-tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
}
a.tag:hover { color: var(--cyan); text-decoration: none; border-color: var(--border-focus); }

/* The variant sub-view's RESULTS SLOT, in the state where a measurement exists
   (2026-09-22). The slot has two states and they are the same slot: the heading here
   is `.empty-artifact .artifact-name`'s treatment verbatim, so the reader meets one
   label in both, and the rows below it are the results surface's own `.result-index` /
   `.result-row` — one treatment for "a held result", never a second invented here. */
.result-slot { margin-top: 16px; }
.result-slot h4 {
    color: var(--text);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.result-slot .result-index { margin-top: 10px; }

/* ── forms ────────────────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: block; margin-top: 14px; }
.field-label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 5px;
}
.field input[type="text"], .field input[type="search"], .field input[type="number"],
.field input[type="datetime-local"], .field select, .field textarea {
    width: 100%;
    max-width: 640px;
}
.field-hint { display: block; margin-top: 5px; font-size: 0.8rem; color: var(--text-dim); }
.check {
    display: block;
    margin-top: 6px;
    font-size: 0.86rem;
    color: var(--text-muted);
}
.check input { margin-right: 8px; }
.btn-small { padding: 4px 10px; font-size: 0.76rem; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters input[type="search"] { min-width: 320px; flex: 1; }
.filter-chip {
    font-size: 0.78rem;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 4px 10px;
}
.filter-chip button { color: var(--text-dim); margin-left: 6px; }
.filter-chip button:hover { color: var(--error); }

.banner { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.banner p { color: var(--text); }
.banner-ok { border-color: rgba(0, 255, 180, 0.28); background: rgba(0, 255, 180, 0.05); }
.banner-warn { border-color: rgba(255, 170, 48, 0.34); background: rgba(255, 170, 48, 0.05); }
.banner-error { border-color: rgba(255, 68, 102, 0.34); background: rgba(255, 68, 102, 0.05); }

/* ── refusals ─────────────────────────────────────────────────────────────── */

.refusal { margin-top: 10px; }
.refusal-code {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--error);
    margin-bottom: 4px;
}
.refusal-text { color: var(--text); }
.refusal-detail { font-size: 0.84rem; margin-top: 6px; }
.refusal-list { margin: 8px 0 0 18px; font-size: 0.86rem; color: var(--text-muted); }

/* A secondary read that failed. Dashed, because the section is present and its
   CONTENT is unknown — visibly different from a section that is legitimately empty. */
.unreadable {
    margin-top: 10px;
    padding: 10px 14px;
    border: 1px dashed rgba(255, 170, 48, 0.34);
    border-radius: var(--radius-sm);
    background: rgba(255, 170, 48, 0.04);
}

/* ── confirmation (REQ-SENTIA-053) ────────────────────────────────────────── */

.confirm-veil {
    position: fixed;
    inset: 0;
    background: rgba(6, 7, 13, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 50;
}
.confirm-card {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 24px 26px;
    max-width: 560px;
}
.confirm-object { color: var(--text); font-weight: 500; margin-top: 8px; }
.confirm-consequence { margin-top: 8px; font-size: 0.9rem; }

/* ── the audience builder ─────────────────────────────────────────────────── */

.chips { display: flex; flex-direction: column; gap: 10px; }
.filter-clause {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: var(--surface-2);
}
.clause-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clause-dim { color: var(--text); font-weight: 500; }
.clause-values { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.value-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 3px 8px 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 200, 255, 0.28);
    background: rgba(0, 200, 255, 0.06);
    color: var(--text);
}
.value-chip button { color: var(--text-dim); font-size: 0.9rem; line-height: 1; }
.value-chip button:hover { color: var(--error); }

/* The evidence is not decoration: it is why a suggestion is on screen. */
.evidence { margin: 10px 0 0 16px; font-size: 0.8rem; color: var(--text-muted); }
.evidence-none { margin-top: 10px; font-size: 0.8rem; color: var(--text-dim); }

.dimensions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 12px; }
.dimension h4 { color: var(--text); font-size: 0.9rem; }
.values { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.value-btn {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-muted);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.value-btn:hover { color: var(--text); border-color: var(--border-focus); }
.value-btn.is-on {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.4);
    background: rgba(0, 200, 255, 0.08);
}

.kind-readout {
    margin-top: 8px;
    padding: 8px 12px;
    border-left: 2px solid var(--accent-2);
    background: rgba(120, 80, 255, 0.06);
    font-size: 0.88rem;
    color: var(--text);
}
.kind-choice { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.strata-editor, .quota-editor, .deps-editor, .questions-editor { margin-top: 16px; }
.quota-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.set-aside { opacity: 0.55; text-decoration: line-through; }
.strategy-text { color: var(--text); }

/* ── the design surface ───────────────────────────────────────────────────── */

.save-state:empty { display: none; }
.readout-line { color: var(--text); font-size: 0.95rem; }
.halves { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.halves li, .readiness-list li { font-size: 0.88rem; color: var(--text-muted); }
.readiness-list { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.fix { display: block; margin-top: 4px; font-size: 0.82rem; color: var(--warning); }
.readout { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.readout li { font-size: 0.88rem; color: var(--text-muted); }
.adder { margin-top: 12px; }
.adder select { min-width: 340px; }
.variant-row .variant-label { width: 90px; margin-right: 10px; }
.variant-stimulus { font-size: 0.88rem; color: var(--text-muted); }
.wave-row, .wave-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.card.freeze { border-color: rgba(0, 200, 255, 0.32); }
.section-body { white-space: pre-wrap; }

/* ── the library's typed question cards ───────────────────────────────────── */

.questions { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.question-card, .question-edit {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    background: var(--surface-2);
}
.question-edit { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.question-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.question-number {
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    font-size: 0.72rem;
    color: var(--text-muted);
}
.question-kind {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.question-prompt { color: var(--text); margin-top: 8px; }
.question-hint { font-size: 0.82rem; color: var(--text-dim); margin-top: 6px; }
.options { margin: 8px 0 0 18px; font-size: 0.88rem; color: var(--text-muted); }
.scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.scale-end { font-size: 0.8rem; color: var(--text-dim); }
.scale-tick {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-muted);
}
.scale-edit { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-edit input[type="number"] { width: 90px; }

.grid { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.86rem; }
.grid th {
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}
.grid td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.grid tr.is-current td { color: var(--text); }

/* ── the monitor ──────────────────────────────────────────────────────────── */

.monitor-phase { color: var(--text); font-size: 1.02rem; }
.counts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.count-cell {
    flex: 1;
    min-width: 120px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.count-value { display: block; font-size: 1.6rem; font-family: var(--font-display); font-weight: 300; color: var(--text); }
.count-label { display: block; font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.reconcile { margin-top: 12px; font-size: 0.86rem; color: var(--text-muted); }

/* The three density treatments. Cards → chips → mosaic: the ink per respondent
   shrinks, the vocabulary does not (REQ-SENTIA-019). */
.tiles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tiles-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.tiles-chips { gap: 4px; }
.tiles-mosaic { gap: 2px; }

.tile {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    text-align: left;
    transition: border-color 0.15s;
}
.tile:hover { border-color: var(--border-focus); }
.tiles-cards .tile { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.tiles-chips .tile { padding: 3px 8px; font-size: 0.72rem; border-radius: 999px; }
.tiles-mosaic .tile { width: 12px; height: 12px; padding: 0; border-radius: 2px; }
.tile-handle { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); }
.tile-status { font-size: 0.8rem; color: var(--text); }

/* Categorical, never quantitative: four flat colours and one for the bucket that is
   reported separately. Nothing here is a gradient or a fill level. */
.tile-waiting  { border-color: var(--border-strong); }
.tile-active   { border-color: rgba(0, 200, 255, 0.45); background: rgba(0, 200, 255, 0.10); }
.tile-finished { border-color: rgba(0, 255, 180, 0.40); background: rgba(0, 255, 180, 0.10); }
.tile-failed   { border-color: rgba(255, 68, 102, 0.45); background: rgba(255, 68, 102, 0.10); }
.tile-excluded { border-color: var(--border); background: transparent; opacity: 0.45; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 0.78rem; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--border-strong); display: inline-block; }
.swatch-active   { border-color: rgba(0, 200, 255, 0.45); background: rgba(0, 200, 255, 0.10); }
.swatch-finished { border-color: rgba(0, 255, 180, 0.40); background: rgba(0, 255, 180, 0.10); }
.swatch-failed   { border-color: rgba(255, 68, 102, 0.45); background: rgba(255, 68, 102, 0.10); }
.swatch-excluded { opacity: 0.45; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── small screens ────────────────────────────────────────────────────────── */

/* The desktop-class surface is this rung's parity statement; full small-screen parity
   is REQ-SENTIA-009 (Phase 3) and is NOT claimed here. This keeps the campaign
   surfaces legible below the breakpoint rather than making them responsive. */
@media (max-width: 720px) {
    .row { flex-direction: column; }
    .row-side { align-items: flex-start; }
    .filters input[type="search"] { min-width: 100%; }
    .adder select { min-width: 100%; }
    .dimensions { grid-template-columns: 1fr; }
}
