/* Local AI Safety & Privacy Firewall — Security Gateway Design System */
/* Solid architectural hairlines, ../../public/styles.css semantic tokens only. */

[hidden] {
  display: none !important;
}

/* Guarantee >= 44x44px hit targets across every interactive control, slider, and link */
button,
.model-loader button,
select,
input:not([type="hidden"]):not([type="checkbox"]),
summary,
.file-btn,
.fw-check-row,
.studio-actions a,
.studio-back,
.studio-about-head a,
.studio-about a,
.crumbs a,
footer.byline a,
.byline a,
.model-loader a,
details.show-code .sc-meta a,
.model-pack-bar button,
.model-pack-actions button,
.shell-popover-close {
  min-block-size: 44px;
  min-inline-size: 44px;
}

input[type="range"] {
  min-block-size: 44px;
  min-inline-size: 120px;
  cursor: pointer;
}

.studio-about-head a,
.studio-about a,
.crumbs a,
footer.byline a,
.byline a,
.model-loader a,
details.show-code .sc-meta a {
  display: inline-flex;
  align-items: center;
}

.studio-bar .crumbs {
  margin: 0;
}

html[data-host-mode="standalone"] .studio-back,
html[data-host-mode="standalone"] .studio-sep {
  display: none;
}

.studio-workspace {
  container-type: inline-size;
  container-name: studio;
  min-inline-size: 0;
}
.studio-workspace[data-drop-hover="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius);
}

/* Solid-hairline full-hitbox local file control */
.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--color);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.file-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
}
.file-btn:focus-within,
.file-btn:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  min-inline-size: 44px;
  min-block-size: 44px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: 0;
}

/* ── Top Adversarial Payload Strip & Primary Scan Bar ──────────────────────── */
.fw-desk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-end: 0.78rem;
  min-inline-size: 0;
}

.fw-preset-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.34rem;
  flex: 1 1 24rem;
  min-inline-size: 0;
}

.fw-preset-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.05rem;
  padding: 0.34rem 0.62rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  text-align: start;
  box-shadow: none;
  min-inline-size: 44px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.fw-preset-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
  transform: none;
  box-shadow: none;
}
.fw-preset-btn strong {
  font-size: 0.79rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color);
}
.fw-preset-btn span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: var(--muted);
}
.fw-preset-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.fw-preset-btn[aria-pressed="true"] strong {
  color: var(--accent);
}

.fw-desk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-inline-size: 0;
}

.fw-primary-btn {
  font-weight: 600;
  padding: 0.52rem 1rem;
}

/* ── Two-Column Gateway Workspace (@container studio) ──────────────────────── */
.fw-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.92rem;
  align-items: start;
  min-inline-size: 0;
}
@container studio (inline-size >= 920px) {
  .fw-panes {
    grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  }
}

.fw-col {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  min-inline-size: 0;
}

/* ── Left Column: Pre-Inference Gateway Sheet ──────────────────────────────── */
.fw-sheet {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-inline-size: 0;
}

.fw-sheet-masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  padding: 0.66rem 0.95rem;
  background: var(--bg-secondary);
  border-block-end: 2px solid var(--border-strong);
}

.fw-masthead-left {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-inline-size: 0;
}

.fw-vector-slug {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.fw-sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--color);
}

.fw-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  max-inline-size: 100%;
  min-inline-size: 0;
}

.fw-seg-btn {
  padding: 0.34rem 0.68rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 500;
  box-shadow: none;
}
.fw-seg-btn:hover:not(:disabled) {
  color: var(--color);
  background: var(--bg-secondary);
  transform: none;
  box-shadow: none;
}
.fw-seg-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.fw-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.7rem;
  padding: 0.45rem 0.95rem;
  border-block-end: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-secondary) 55%, var(--bg-raised));
  font-size: 0.74rem;
}

.fw-legend-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.fw-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-weight: 500;
  color: var(--color);
}

.fw-legend-swatch {
  display: inline-block;
  inline-size: 0.75rem;
  block-size: 0.75rem;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}
.fw-swatch-inj {
  background: color-mix(in srgb, var(--bad) 22%, var(--bg-raised));
  border-color: var(--bad);
}
.fw-swatch-mod {
  background: color-mix(in srgb, var(--warn) 26%, var(--bg-raised));
  border-color: var(--warn);
}
.fw-swatch-pii {
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-raised));
  border-color: var(--accent);
}
.fw-swatch-safe {
  background: color-mix(in srgb, var(--good) 20%, var(--bg-raised));
  border-color: var(--good);
}

.fw-legend-meta {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Annotated Payload & Scrubbed Safe Output Body */
.fw-payload-body {
  padding: 0.9rem 1rem;
  min-block-size: 13.5rem;
  max-block-size: 27rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
  font-size: 0.92rem;
  line-height: 1.66;
  color: var(--color);
  overflow-wrap: anywhere;
  min-inline-size: 0;
}

.fw-segment {
  padding: 0.45rem 0.62rem;
  border-inline-start: 3px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--bg-secondary) 40%, var(--bg-raised));
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.fw-segment[data-threat="injection"] {
  border-inline-start-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 7%, var(--bg-raised));
}
.fw-segment[data-threat="moderation"] {
  border-inline-start-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-raised));
}
.fw-segment[data-threat="privacy"] {
  border-inline-start-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-raised));
}
.fw-segment[data-threat="safe"] {
  border-inline-start-color: var(--good);
}
.fw-segment[data-active="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.fw-seg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 0.55rem;
  margin-block-end: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.fw-seg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.fw-inline-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.06rem 0.36rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.35;
}
.fw-tag-bad {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 45%, var(--border));
  background: color-mix(in srgb, var(--bad) 10%, var(--bg-raised));
}
.fw-tag-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  background: color-mix(in srgb, var(--warn) 11%, var(--bg-raised));
}
.fw-tag-accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
}
.fw-tag-good {
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 45%, var(--border));
  background: color-mix(in srgb, var(--good) 10%, var(--bg-raised));
}

.fw-seg-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Semantic <mark> spans with explicit underlines & tags (never color alone) */
mark.fw-mark-pii {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--color);
  border-block-end: 2px solid var(--accent);
  border-radius: 3px;
  padding: 0.02rem 0.2rem;
}
mark.fw-mark-pii[data-redacted="false"] {
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  border-block-end-color: var(--muted);
}

mark.fw-mark-inj {
  background: color-mix(in srgb, var(--bad) 15%, transparent);
  color: var(--color);
  text-decoration: underline wavy var(--bad);
  text-underline-offset: 0.2em;
  border-radius: 3px;
  padding: 0.02rem 0.16rem;
}

.fw-mark-badge {
  display: inline-block;
  margin-inline-start: 0.25rem;
  padding: 0.02rem 0.28rem;
  border-radius: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  vertical-align: baseline;
}

/* CSS Custom Highlight API transient focus highlight */
::highlight(fw-active-focus) {
  background-color: color-mix(in srgb, var(--warn) 36%, transparent);
  color: var(--color);
}

/* Scrubbed Safe Payload Output Block */
.fw-safe-pre {
  margin: 0;
  padding: 0.78rem 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--color);
}

.fw-safe-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.5rem 0.72rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--good) 8%, var(--bg-raised));
  font-size: 0.8rem;
  color: var(--color);
}
.fw-safe-banner[data-verdict="block"] {
  background: color-mix(in srgb, var(--bad) 8%, var(--bg-raised));
  border-color: color-mix(in srgb, var(--bad) 40%, var(--border));
}
.fw-safe-banner[data-verdict="sanitize"] {
  background: color-mix(in srgb, var(--warn) 9%, var(--bg-raised));
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
}

/* Inline Custom Payload Editor Disclosure */
.fw-editor-wrap {
  border-block-start: 1px solid var(--border);
  background: var(--bg-secondary);
}

.fw-editor-details summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color);
  cursor: pointer;
}

.fw-editor-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}

.fw-editor-body {
  padding: 0.35rem 0.95rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.fw-textarea {
  inline-size: 100%;
  min-block-size: 7.5rem;
  padding: 0.62rem 0.74rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
}

.fw-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Status & Hardware Diagnostics Strip */
.fw-status-strip {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 0.62rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-inline-size: 0;
}

.fw-status-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fw-status-strip .status {
  margin: 0;
  font-size: 0.84rem;
  flex: 1 1 16rem;
}

.fw-progress {
  inline-size: 100%;
  max-inline-size: 14rem;
  block-size: 8px;
}

.fw-hw-banner {
  margin: 0;
  padding: 0.36rem 0.56rem;
  border-radius: calc(var(--radius-sm) - 2px);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}
.fw-hw-banner[data-mode="webgpu"] {
  border-color: color-mix(in srgb, var(--good) 40%, var(--border));
  color: var(--color);
}
.fw-hw-banner[data-mode="cpu-fallback"] {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  color: var(--color);
}

/* Gateway Export Dock */
.fw-export-dock {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 0.72rem 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-inline-size: 0;
}

.fw-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.4rem, 1fr));
  gap: 0.42rem;
}

/* ── Right Column: Verdict Gate, Policy Rules & Findings Ledger ────────────── */
.fw-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  padding: 0.78rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.64rem;
  min-inline-size: 0;
}

.fw-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 0.6rem;
}

.fw-card-title {
  margin: 0;
  border: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--color);
}

.fw-card-meta {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Verdict Gate Header */
.fw-verdict-box {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.68rem 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}
.fw-verdict-box[data-verdict="allow"] {
  border-color: color-mix(in srgb, var(--good) 55%, var(--border));
  background: color-mix(in srgb, var(--good) 9%, var(--bg-raised));
}
.fw-verdict-box[data-verdict="sanitize"] {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
  background: color-mix(in srgb, var(--warn) 10%, var(--bg-raised));
}
.fw-verdict-box[data-verdict="block"] {
  border-color: color-mix(in srgb, var(--bad) 55%, var(--border));
  background: color-mix(in srgb, var(--bad) 10%, var(--bg-raised));
}

.fw-verdict-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.fw-verdict-label {
  font-family: var(--font-mono);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color);
}
.fw-verdict-box[data-verdict="allow"] .fw-verdict-label {
  color: var(--good);
}
.fw-verdict-box[data-verdict="sanitize"] .fw-verdict-label {
  color: var(--warn);
}
.fw-verdict-box[data-verdict="block"] .fw-verdict-label {
  color: var(--bad);
}

.fw-verdict-reason {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color);
}

/* 3-Layer Defense Meter Rows */
.fw-layer-list {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.fw-layer-row {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  padding: 0.46rem 0.58rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.fw-layer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.fw-layer-name {
  font-weight: 600;
  color: var(--color);
}

.fw-layer-score {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.fw-meter-track {
  inline-size: 100%;
  block-size: 7px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.fw-meter-fill {
  block-size: 100%;
  inline-size: 0%;
  background: var(--accent);
  transition: inline-size 0.2s ease, background-color 0.2s ease;
}
.fw-meter-fill[data-level="good"] {
  background: var(--good);
}
.fw-meter-fill[data-level="warn"] {
  background: var(--warn);
}
.fw-meter-fill[data-level="bad"] {
  background: var(--bad);
}

.fw-layer-detail {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Policy Threshold Sliders & Profiles */
.fw-control-block {
  display: flex;
  flex-direction: column;
  gap: 0.44rem;
  padding-block-start: 0.45rem;
  border-block-start: 1px solid var(--border);
}

.fw-profile-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.34rem;
}

.fw-profile-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.04rem;
  padding: 0.32rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: none;
}
.fw-profile-btn small {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 400;
  color: var(--muted);
}
.fw-profile-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
  color: var(--accent);
}

.fw-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 8.6rem) minmax(0, 1fr) 2.9rem;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.79rem;
}
.fw-slider-row label {
  font-weight: 500;
  color: var(--color);
}
.fw-slider-row output {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: end;
  font-variant-numeric: tabular-nums;
  color: var(--color);
}

.fw-toggle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fw-check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color);
  cursor: pointer;
}
.fw-check-row input[type="checkbox"] {
  inline-size: 18px;
  block-size: 18px;
  margin: 0;
  cursor: pointer;
}

/* Findings Ledger */
.fw-ledger-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.fw-bulk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.fw-bulk-row button {
  padding: 0.34rem 0.64rem;
  font-size: 0.76rem;
}

.fw-ledger-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.44rem;
  max-block-size: 22rem;
  overflow-y: auto;
}

.fw-ledger-empty {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 0.82rem;
  color: var(--muted);
}

.fw-finding-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 0.52rem 0.62rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.fw-finding-item[data-layer="injection"] {
  border-inline-start: 3px solid var(--bad);
}
.fw-finding-item[data-layer="moderation"] {
  border-inline-start: 3px solid var(--warn);
}
.fw-finding-item[data-layer="privacy"] {
  border-inline-start: 3px solid var(--accent);
}

.fw-finding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.fw-finding-excerpt {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.42;
  color: var(--color);
  overflow-wrap: anywhere;
}

.fw-finding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.34rem;
}
.fw-finding-actions button {
  padding: 0.3rem 0.62rem;
  font-size: 0.75rem;
}

/* ── Below-the-Fold Engine Models & About/Code ─────────────────────────────── */
#engine-models,
#about-code {
  content-visibility: auto;
  contain-intrinsic-size: 1px 420px;
}

.fw-engine-head {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-block-end: 0.75rem;
}
.fw-engine-head h2 {
  margin: 0;
}
.fw-engine-sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  max-inline-size: 72ch;
}

.fw-stage-sub {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.fw-diag-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.52rem;
  margin-block-start: 0.75rem;
}

.fw-diag-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.55rem 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
}
.fw-diag-cell span {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--muted);
}
.fw-diag-cell strong {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--color);
  font-variant-numeric: tabular-nums;
}

.fw-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.78rem;
  margin-block: 0.95rem 1.25rem;
}

.fw-model-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 0.9rem 1rem;
}
.fw-model-card h3 {
  margin-block-start: 0;
}
.fw-model-card p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.56;
  color: var(--muted);
}

/* ── Declarative Audit Export Dialog (<dialog closedby="any">) ─────────────── */
.fw-export-dialog {
  inline-size: min(46rem, calc(100vw - 1.5rem));
  max-block-size: min(86vh, 48rem);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--color);
  box-shadow: var(--shadow-md);
}
.fw-export-dialog::backdrop {
  background: color-mix(in srgb, var(--color) 45%, transparent);
  backdrop-filter: blur(2px);
}
.fw-export-dialog[open] {
  display: flex;
  flex-direction: column;
}

.fw-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.05rem;
  border-block-end: 1px solid var(--border);
  background: var(--bg-secondary);
}
.fw-dialog-head h2 {
  margin: 0;
  border: 0;
  padding: 0;
  font-size: 1.15rem;
}
.fw-dialog-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.fw-dialog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem;
  border-block-end: 1px solid var(--border);
}

.fw-dialog-body {
  padding: 0.85rem 1.05rem;
  overflow: auto;
  flex: 1 1 auto;
}

.fw-dialog-pre {
  margin: 0;
  padding: 0.78rem 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  line-height: 1.52;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--color);
}

.fw-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.75rem 1.05rem;
  border-block-start: 1px solid var(--border);
  background: var(--bg-secondary);
}

/* Narrow mobile refinements (390x844 and 360x740 — 0px horizontal overflow) */
@media (max-width: 600px) {
  .fw-slider-row {
    grid-template-columns: minmax(0, 1fr) 3rem;
  }
  .fw-slider-row label {
    grid-column: 1 / -1;
  }
  .fw-profile-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .fw-desk-actions {
    inline-size: 100%;
  }
  .fw-desk-actions > * {
    flex: 1 1 auto;
  }
  .fw-preset-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}
