/* Brand Pulse — Design System Tokens Only (../../public/styles.css) */
/* Strictly uses --good / --warn / --bad / --accent / --bg-* tokens with zero raw hex literals. */

/* Enforce >= 44x44px hit targets on ALL interactive controls */
button,
.model-loader button,
select,
input:not([type="hidden"]),
textarea,
summary,
.file-btn,
.studio-actions a,
.studio-back,
.studio-about-head a,
.crumbs a,
.byline a,
.model-loader a,
details.show-code .sc-meta a,
.bp-check-label {
  min-block-size: 44px;
  min-inline-size: 44px;
}

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

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

/* Accessible >= 44x44px checkbox control */
.bp-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.72rem 0.2rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
}
.bp-check-label:hover {
  border-color: var(--accent);
}
.bp-check-label:focus-within,
.bp-check-label:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.bp-check-input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 44px;
  inline-size: 44px;
  block-size: 44px;
  min-inline-size: 44px;
  min-block-size: 44px;
  margin: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.bp-check-input::before {
  content: "";
  inline-size: 20px;
  block-size: 20px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  background: var(--bg-raised);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.bp-check-input:checked::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg-raised);
}

/* Full-hitbox file upload control */
.file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.file-btn:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-raised));
}
.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;
}

/* Top Control & Pack Deck */
.bp-top-deck {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
  min-inline-size: 0;
}

.bp-dataset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.45rem;
}

.bp-preset-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
  gap: 0.45rem;
  flex: 1 1 560px;
  min-inline-size: 0;
}

.bp-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.14rem;
  text-align: start;
  padding: 0.45rem 0.72rem;
  background: var(--bg-raised);
  color: var(--color);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.bp-preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  inline-size: 100%;
}
.bp-preset-head strong {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color);
}
.bp-preset-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg-secondary);
  white-space: nowrap;
}
.bp-preset-sub {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  line-height: 1.3;
  color: var(--muted);
}
.bp-preset-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-sm);
}
.bp-preset-btn[aria-pressed="true"] .bp-preset-head strong,
.bp-preset-btn[aria-pressed="true"] .bp-preset-badge {
  color: var(--accent);
}

.bp-loaders-strip {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 275px), 1fr));
  gap: 0.55rem;
  margin: 0;
}
.bp-loaders-strip .loader-slot {
  padding: 0.55rem 0.7rem;
}
.bp-loaders-strip .loader-slot-title {
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
}
.bp-stage-sub {
  margin: 0.3rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--muted);
}

.bp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.bp-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-inline-size: 0;
}
.bp-inline-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.bp-inline-field[hidden] {
  display: none;
}

.bp-topic-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  padding: 0.52rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.bp-section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}
.bp-topic-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.bp-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding-inline-start: 0.65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
  color: var(--color);
  font-size: 0.8rem;
  font-weight: 600;
}
.bp-topic-remove {
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 0 0.55rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}
.bp-topic-remove:hover:not(:disabled) {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
  box-shadow: none;
  transform: none;
}
.bp-topic-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: auto;
}
.bp-topic-input {
  inline-size: min(100%, 13rem);
  font-size: 0.84rem;
}

.bp-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.9rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}
.bp-status-bar .status {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  flex: 1 1 260px;
}
.bp-status-bar .status.ok {
  color: var(--good);
  font-weight: 600;
}
.bp-status-bar .status.err {
  color: var(--bad);
  font-weight: 600;
}
.bp-progress {
  inline-size: 100%;
}

.bp-meta-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
}

/* Diagnostics Strip */
.bp-diag-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr));
  gap: 0.45rem;
}
.bp-diag-tile {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  min-inline-size: 0;
}
.bp-diag-tile span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.bp-diag-tile strong {
  display: block;
  margin-top: 0.12rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--color);
  overflow-wrap: anywhere;
}
.bp-diag-tile strong.good {
  color: var(--good);
}
.bp-diag-tile strong.warn {
  color: var(--warn);
}
.bp-diag-tile strong.bad {
  color: var(--bad);
}

/* Main Responsive Two-Column Workbench */
.studio-workspace {
  container: studio / inline-size;
  min-inline-size: 0;
  scroll-margin-top: 4.5rem;
  border-radius: var(--radius);
}
.studio-workspace[data-drop-hover="true"] {
  outline: 3px dashed var(--accent);
  outline-offset: 4px;
}

.bp-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}
@container studio (inline-size >= 980px) {
  .bp-panes {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  }
}

.bp-pane {
  margin: 0;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 0.68rem;
}

.bp-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
}
.bp-pane-head h2,
.bp-pane-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
}
.bp-pane-head h2 {
  font-size: 1.08rem;
  line-height: 1.25;
}

.bp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-inline-size: 0;
}

.bp-canvas-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  overflow: hidden;
  min-inline-size: 0;
}
.bp-canvas {
  display: block;
  inline-size: 100%;
  block-size: 210px;
}

/* Interactive Topic x Sentiment Heatmap Table */
.bp-table-wrap {
  overflow-x: auto;
  max-inline-size: 100%;
}
.bp-heatmap-table th,
.bp-heatmap-table td {
  padding: 0.35rem 0.4rem;
  vertical-align: middle;
  text-align: center;
}
.bp-heatmap-table tbody th {
  text-align: start;
}
.bp-heat-topic-btn {
  inline-size: 100%;
  justify-content: flex-start;
  text-align: start;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.bp-heat-topic-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.bp-heatmap-cell {
  inline-size: 100%;
  min-inline-size: 44px;
  min-block-size: 44px;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bp-heatmap-cell.tone-bad {
  border-color: color-mix(in srgb, var(--bad) 36%, var(--border));
  color: var(--bad);
}
.bp-heatmap-cell.tone-warn {
  border-color: color-mix(in srgb, var(--warn) 36%, var(--border));
  color: var(--warn);
}
.bp-heatmap-cell.tone-good {
  border-color: color-mix(in srgb, var(--good) 36%, var(--border));
  color: var(--good);
}
.bp-heatmap-cell.tone-accent {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent);
}
.bp-heatmap-cell[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.bp-heat-total {
  font-weight: 700;
  color: var(--muted);
}

/* Signal Ledger Cards */
.bp-ledger-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.bp-ledger-controls button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.bp-ledger-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-block-size: 32rem;
  overflow-y: auto;
  padding-inline-end: 0.15rem;
}

.bp-signal-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.65rem 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}
.bp-signal-card.is-divergent {
  border-inline-start: 4px solid var(--bad);
  background: color-mix(in srgb, var(--bad) 4%, var(--bg-raised));
}
.bp-signal-card[data-selected="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.bp-signal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}
.bp-signal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
}
.bp-row-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}
.bp-row-inspect-btn {
  padding: 0.35rem 0.68rem;
  font-size: 0.78rem;
}
.bp-signal-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color);
  overflow-wrap: anywhere;
}
.bp-signal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.bp-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 600;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--muted);
}
.bp-pill.tone-good {
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 40%, var(--border));
  background: color-mix(in srgb, var(--good) 8%, var(--bg-raised));
}
.bp-pill.tone-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 42%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-raised));
}
.bp-pill.tone-bad {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 42%, var(--border));
  background: color-mix(in srgb, var(--bad) 8%, var(--bg-raised));
}
.bp-pill.tone-accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
}

.bp-empty-msg {
  margin: 0;
  padding: 0.65rem;
  font-size: 0.86rem;
}
.bp-empty-msg.bad {
  color: var(--bad);
  font-weight: 600;
}

/* Raw Feed Drawer */
.bp-source-drawer {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.4rem 0.7rem;
}
.bp-source-drawer summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}
.bp-source-editor {
  inline-size: 100%;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-top: 0.45rem;
}
.bp-source-actions {
  margin-top: 0.45rem;
  display: flex;
  justify-content: flex-end;
}

/* Right Pane: What-If Simulator & Exports */
.bp-sim-input {
  inline-size: 100%;
  font-size: 0.9rem;
}
.bp-sim-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 0.5rem;
}
.bp-sim-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 0.55rem 0.7rem;
}
.bp-sim-box span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  text-transform: uppercase;
  color: var(--muted);
}
.bp-sim-box strong {
  display: block;
  margin-top: 0.18rem;
  font-family: var(--font-mono);
  font-size: 0.81rem;
  color: var(--color);
  overflow-wrap: anywhere;
}

.bp-verdict-card {
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 0.65rem 0.8rem;
}
.bp-verdict-card[data-tier="divergent"] {
  border-inline-start-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 7%, var(--bg-raised));
}
.bp-verdict-card[data-tier="shift"] {
  border-inline-start-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 7%, var(--bg-raised));
}
.bp-verdict-card[data-tier="aligned"] {
  border-inline-start-color: var(--good);
  background: color-mix(in srgb, var(--good) 7%, var(--bg-raised));
}
.bp-verdict-card strong {
  display: block;
  font-size: 0.92rem;
  color: var(--color);
}
.bp-verdict-card p {
  margin: 0.22rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.bp-mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.bp-mono.good {
  color: var(--good);
}
.bp-mono.bad {
  color: var(--bad);
}

.bp-export-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.bp-disclaimer {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
}
