/* =================================================================
   SAFEGUARDS - the Compliance Center's Safeguards and Safeguard cases
   tabs, the case's own route (/messaging/safeguards/case/{id}) and
   Listrak's tab on /ops/compliance (safeguards-design.md section 16).
   -----------------------------------------------------------------
   Every class here is owned by this file alone
   (Tests/ConversationBuilderCssOwnershipTests): sgd-*. The shared
   pieces come from components.css and root.css (the page header,
   wf-status-pill, wf-chip-toggle, wf-form-section, wf-skel, wf-empty)
   and message-center.css (mcx-table) - used as they are, never
   restyled here.

   TOKENS ONLY, the whole file (Tests/ShellTokensOnlyTests): no hex,
   no rgb() / hsl(), no colour keyword. State is a word with its ink
   (danger for "nobody is alerted" and a refusal, warning for the ops
   switch and a stop-ask case), never colour alone. Never a score,
   never a tick (K10).

   NOTHING SCROLLS SIDEWAYS but a wide table inside its own wrap.
   ================================================================= */

.sgd-page { display: flex; flex-direction: column; gap: var(--wf-space-5); }

.sgd-card {
    display: flex; flex-direction: column; gap: var(--wf-space-3);
    padding: var(--wf-space-5); margin-bottom: var(--wf-space-4);
    background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md);
}
.sgd-card-title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--theme-text-emphasis); }
.sgd-sub-title { margin: var(--wf-space-3) 0 0; font-size: var(--wf-text-sm); font-weight: 600; color: var(--theme-text-emphasis); }
.sgd-skel { display: block; height: 18px; border-radius: var(--wf-radius-sm); }

.sgd-truth {
    margin: 0 0 var(--wf-space-4); padding: var(--wf-space-4);
    background: var(--wf-inset); border-radius: var(--wf-radius-md);
    color: var(--theme-text-emphasis); font-weight: 500;
}
.sgd-plain { margin: 0; color: var(--theme-text-secondary); font-size: var(--wf-text-sm); }
.sgd-strong { color: var(--theme-text-emphasis); font-weight: 600; }

.sgd-warning, .sgd-nobody, .sgd-refusal {
    display: flex; align-items: flex-start; gap: var(--wf-space-2); margin: 0; font-size: var(--wf-text-sm);
}
.sgd-warning { color: var(--wf-warning-ink); }
.sgd-nobody { color: var(--wf-danger-ink); font-weight: 600; padding: var(--wf-space-3); background: var(--wf-danger-soft); border-radius: var(--wf-radius-sm); }
.sgd-refusal { color: var(--wf-danger-ink); }
.sgd-save-failed { display: flex; flex-direction: column; gap: var(--wf-space-1); }
.sgd-saved { display: inline-flex; align-items: center; gap: var(--wf-space-2); color: var(--theme-text-secondary); font-size: var(--wf-text-sm); margin: 0; }

.sgd-fields { display: flex; flex-direction: column; gap: var(--wf-space-2); min-width: 0; }
.sgd-label { font-size: var(--wf-text-sm); font-weight: 600; color: var(--theme-text-emphasis); }
.sgd-narrow { max-width: 220px; }
.sgd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-2); }
.sgd-chips { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); }
.sgd-members { display: flex; flex-direction: column; gap: var(--wf-space-1); max-height: 220px; overflow-y: auto; }
.sgd-member { display: flex; align-items: center; gap: var(--wf-space-2); font-size: var(--wf-text-sm); color: var(--theme-text-secondary); }
.sgd-numbers { display: grid; grid-template-columns: auto minmax(0, 220px); gap: var(--wf-space-2); align-items: center; }

.sgd-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--wf-space-3); font-size: var(--wf-text-sm); color: var(--theme-text-muted); }
.sgd-counts .is-over { color: var(--wf-danger-ink); font-weight: 600; }

.sgd-table-wrap { overflow-x: auto; }
.sgd-table { width: 100%; }
.sgd-queue th { white-space: nowrap; }
.sgd-line { max-width: 520px; color: var(--theme-text-emphasis); }
.sgd-row-acts { white-space: nowrap; }
.sgd-row.is-stopask { box-shadow: inset 3px 0 0 var(--wf-warning-ink); }
.sgd-table .is-failure { color: var(--wf-warning-ink); }
.sgd-open { padding: 0; }

.sgd-badges { display: inline-flex; flex-wrap: wrap; gap: var(--wf-space-1); margin-left: var(--wf-space-2); }
.sgd-badge {
    display: inline-block; padding: 0 8px; border-radius: var(--wf-radius-pill);
    background: var(--wf-neutral-soft); color: var(--theme-text-secondary); font-size: 0.75rem; line-height: 20px;
}

.sgd-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-2); margin: var(--wf-space-3) 0; }
.sgd-pager { display: flex; align-items: center; gap: var(--wf-space-3); margin-top: var(--wf-space-3); font-size: var(--wf-text-sm); }

.sgd-case { display: flex; flex-direction: column; gap: var(--wf-space-4); }
.sgd-case-head { display: flex; flex-direction: column; gap: var(--wf-space-3); }
.sgd-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--wf-space-1) var(--wf-space-4); margin: 0; font-size: var(--wf-text-sm); }
.sgd-facts dt { color: var(--theme-text-muted); font-weight: 500; }
.sgd-facts dd { margin: 0; color: var(--theme-text-emphasis); }

/* The person's words - data, framed apart from the page's own words. */
.sgd-words { display: flex; flex-direction: column; gap: var(--wf-space-3); padding: var(--wf-space-4); border: 1px dashed var(--wf-line-strong); border-radius: var(--wf-radius-md); background: var(--wf-inset); }
.sgd-words-frame { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--theme-text-muted); }
.sgd-word { display: flex; flex-direction: column; gap: 2px; }
.sgd-word-meta { margin: 0; font-size: 0.75rem; color: var(--theme-text-muted); }
.sgd-word-text { margin: 0; white-space: pre-wrap; color: var(--theme-text-emphasis); }
.sgd-word.is-person .sgd-word-text { font-weight: 500; }

.sgd-act-form { display: flex; flex-direction: column; gap: var(--wf-space-2); padding: var(--wf-space-3); border: 1px solid var(--wf-line); border-radius: var(--wf-radius-sm); }

.sgd-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--wf-space-2); font-size: var(--wf-text-sm); }
.sgd-timeline li { display: flex; flex-wrap: wrap; gap: var(--wf-space-2); }
.sgd-when { color: var(--theme-text-muted); min-width: 140px; }

.sgd-try-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-2); }
.sgd-try-results { margin: 0; padding-left: var(--wf-space-5); display: flex; flex-direction: column; gap: var(--wf-space-3); }
.sgd-try-result.is-tripped { padding-left: var(--wf-space-2); box-shadow: inset 2px 0 0 var(--theme-primary); }
.sgd-try-said { margin: 0; color: var(--theme-text-muted); font-style: italic; }

.sgd-add-line { display: flex; flex-direction: column; gap: var(--wf-space-2); }

/* What Converse is not - always shown, never collapsible. */
.sgd-notis { border-left: 3px solid var(--wf-line-strong); }
.sgd-notis p { margin: 0; color: var(--theme-text-emphasis); }

.sgd-notyours { text-align: center; }
.sgd-failed { padding: var(--wf-space-4); }

@media (max-width: 720px) {
    .sgd-facts, .sgd-numbers { grid-template-columns: minmax(0, 1fr); }
    .sgd-narrow { max-width: none; }
}

/* CHECK MY SETUP on a Safeguards tab (SafeguardSetupStrip - docs/claude/SAFEGUARDS.md section 15): a quiet line and its panel of
   every beat. A state is a word in a neutral shape - never a colour verdict, never a tick. */
.sgd-setup {
    margin: 0 0 var(--wf-space-3); padding: 8px 12px;
    border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md); background: var(--wf-inset);
    font-size: var(--wf-text-sm); color: var(--theme-text-secondary);
}
.sgd-setup.is-failed { color: var(--theme-text-muted); }
.sgd-setup-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sgd-setup-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--theme-text-muted); }
.sgd-setup-text { flex: 1 1 18rem; min-width: 0; }
.sgd-setup-text strong { color: var(--theme-text-emphasis); margin-right: 6px; }
.sgd-setup-finding { overflow-wrap: anywhere; }
.sgd-setup-person { display: block; margin-top: 2px; font-style: italic; color: var(--theme-text-muted); }
.sgd-setup-panel { margin-top: var(--wf-space-3); padding-top: var(--wf-space-3); border-top: 1px solid var(--wf-line); }
.sgd-setup-title { margin: 0 0 var(--wf-space-2); font-size: var(--wf-text-sm); font-weight: 600; color: var(--theme-text-emphasis); }
.sgd-setup-list { margin: 0; padding-left: 1.25rem; display: grid; gap: 6px; }
.sgd-setup-row { display: grid; grid-template-columns: minmax(10rem, 16rem) auto minmax(0, 1fr); align-items: baseline; gap: 4px 12px; }
.sgd-setup-row-title { font-weight: 600; color: var(--theme-text-emphasis); }
.sgd-setup-row-finding { color: var(--theme-text-secondary); overflow-wrap: anywhere; }
.sgd-setup-note { margin: var(--wf-space-2) 0 0; color: var(--theme-text-muted); }
.sgd-setup-pill { display: inline-block; padding: 0 8px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-sm); font-size: 0.75rem; white-space: nowrap; }
.sgd-tone-is-set { background: var(--theme-background-subtle); border-color: transparent; }
.sgd-tone-is-inherits { color: var(--theme-text-secondary); }
.sgd-tone-is-notset { border-width: 1.5px; border-color: var(--theme-text-emphasis); font-weight: 700; }

@media (max-width: 720px) {
    .sgd-setup-row { grid-template-columns: minmax(0, 1fr) auto; }
    .sgd-setup-row-finding { grid-column: 1 / -1; }
}
.sgd-tone-is-read { color: var(--theme-text-muted); }
