/* ============================================================
   Monitor dashboard — analytics view
   Structure:
     .monitor-view
       .monitor-tabs            (top subtab nav)
       .monitor-content
         .monitor-section
           .monitor-section__head
           .monitor-grid (kpis / 2col)
           .monitor-card (sections)
           .monitor-bars, .monitor-bar (bar breakdowns)
           .monitor-provider-grid, .monitor-provider-stat
           .monitor-table (compare table)
           .monitor-spark (sparklines)
           .monitor-events (log table)
   ============================================================ */

.monitor-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: var(--content-max);
}

/* ── Subtab navigation ──────────────────────────────────── */
.monitor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  padding: var(--space-2xs);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(8px);
}

.monitor-tabs__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  height: var(--control-h-md);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.monitor-tabs__item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.monitor-tabs__item.is-active {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.monitor-tabs__icon {
  display: inline-flex;
  width: var(--icon-sm);
  height: var(--icon-sm);
  color: currentColor;
}

.monitor-tabs__icon svg {
  width: 100%;
  height: 100%;
}

.monitor-tabs__label { white-space: nowrap; }

/* ── Content wrapper ────────────────────────────────────── */
.monitor-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ── Section layout ─────────────────────────────────────── */
.monitor-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.monitor-section__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.monitor-section__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.monitor-section__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.monitor-section__actions {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  gap: var(--space-xs);
}

.monitor-section__actions .btn-secondary {
  height: var(--control-h-sm);
  padding: 0 var(--space-md);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.monitor-section__actions .btn-secondary:hover {
  background: var(--bg-hover);
}

.monitor-section__actions .monitor-danger-btn:hover {
  background: var(--bg-danger-soft);
  border-color: var(--border-danger-soft);
}

/* ── Grid system ────────────────────────────────────────── */
.monitor-grid {
  display: grid;
  gap: var(--space-md);
}

.monitor-grid--kpis {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.monitor-grid--2col {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ── KPI card ───────────────────────────────────────────── */
.monitor-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color 120ms ease, transform 120ms ease;
}

.monitor-kpi:hover {
  border-color: var(--bg-accent-soft);
}

.monitor-kpi__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.monitor-kpi__value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.monitor-kpi__sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Content card ───────────────────────────────────────── */
.monitor-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.monitor-card__title {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0;
}

.monitor-card__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.monitor-card--provider {
  gap: var(--space-lg);
}

/* ── Bar breakdown ──────────────────────────────────────── */
.monitor-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.monitor-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.monitor-bar__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}

.monitor-bar__label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: 500;
}

.monitor-bar__value {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.monitor-bar__track {
  height: 6px;
  background: var(--bg-card-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.monitor-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vibrance-hover), var(--vibrance-info));
  border-radius: var(--radius-pill);
  transition: width 240ms ease;
}

/* ── Provider stats grid ────────────────────────────────── */
.monitor-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
}

.monitor-provider-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.monitor-provider-stat__label {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.monitor-provider-stat__value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.monitor-provider-stat__sub {
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Compare table ──────────────────────────────────────── */
.monitor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.monitor-table thead th {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.monitor-table thead th:first-child {
  text-align: left;
}

.monitor-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
}

.monitor-table tbody tr:last-child {
  border-bottom: none;
}

.monitor-table td {
  padding: var(--space-sm);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.monitor-table__label {
  text-align: left !important;
  color: var(--text-secondary) !important;
  font-weight: 500;
}

.monitor-table__value {
  font-weight: 600;
}

/* ── Sparkline ──────────────────────────────────────────── */
.monitor-spark {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.monitor-spark__svg {
  width: 100%;
  height: 140px;
  display: block;
}

.monitor-spark__line {
  stroke: var(--vibrance-hover);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.monitor-spark__area {
  fill: var(--bg-accent-soft);
  opacity: 0.28;
  stroke: none;
}

.monitor-spark__dot {
  fill: var(--vibrance-hover);
  stroke: var(--bg-card);
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity 120ms ease;
}

.monitor-spark__svg:hover .monitor-spark__dot {
  opacity: 1;
}

.monitor-spark__axis {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-2xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Events log table ───────────────────────────────────── */
.monitor-events-wrap {
  max-height: 560px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.monitor-events {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.monitor-events thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.monitor-events tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 80ms ease;
}

.monitor-events tbody tr:last-child { border-bottom: none; }

.monitor-events tbody tr:hover {
  background: var(--bg-hover);
}

.monitor-events td {
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
  vertical-align: middle;
}

.monitor-events__when { color: var(--text-secondary); white-space: nowrap; }
.monitor-events__provider { white-space: nowrap; }
.monitor-events__model { color: var(--text-secondary); font-size: var(--text-2xs); letter-spacing: 0.02em; }
.monitor-events__tokens { color: var(--text-secondary); white-space: nowrap; }
.monitor-events__cost { font-weight: 600; white-space: nowrap; }
.monitor-events__latency { color: var(--text-secondary); white-space: nowrap; }
.monitor-events__status { white-space: nowrap; }
.monitor-events__story { color: var(--text-muted); font-size: var(--text-2xs); letter-spacing: 0.02em; }

.monitor-tokens {
  display: inline-flex;
  gap: 2px;
  align-items: baseline;
}

.monitor-tokens > span:first-child {
  color: var(--text-secondary);
}

.monitor-tokens > span:last-child {
  color: var(--text-primary);
}

/* ── Tags (chips) ───────────────────────────────────────── */
.monitor-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-xs);
  height: var(--control-h-xs);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-card-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-family: var(--font-sans);
}

.monitor-tag--muted {
  color: var(--text-muted);
}

.monitor-tag--ok {
  background: var(--bg-success-soft);
  color: var(--vibrance-success);
  border-color: var(--border-success-soft);
}

.monitor-tag--fail {
  background: var(--bg-danger-soft);
  color: var(--vibrance-danger);
  border-color: var(--border-danger-soft);
}

.monitor-tag--claude {
  background: color-mix(in srgb, #d97706 25%, transparent);
  color: #fbbf24;
  border-color: color-mix(in srgb, #d97706 35%, transparent);
}

.monitor-tag--gemini {
  background: color-mix(in srgb, #2563eb 25%, transparent);
  color: #60a5fa;
  border-color: color-mix(in srgb, #2563eb 35%, transparent);
}

.monitor-tag--creatomate {
  background: color-mix(in srgb, #a855f7 25%, transparent);
  color: #c084fc;
  border-color: color-mix(in srgb, #a855f7 35%, transparent);
}

.monitor-tag--jina {
  background: color-mix(in srgb, #10b981 25%, transparent);
  color: #34d399;
  border-color: color-mix(in srgb, #10b981 35%, transparent);
}

/* ── Empty state ────────────────────────────────────────── */
.monitor-empty {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
  background: var(--bg-card-soft);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
}

/* ── Database tab ──────────────────────────────────────── */
.monitor-db-tables {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.monitor-db-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.monitor-db-table__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.monitor-db-table__name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.monitor-db-table__desc {
  color: var(--text-muted);
  font-size: var(--text-2xs);
}

.monitor-db-table__stats {
  display: flex;
  gap: var(--space-md);
}

.monitor-db-table__stat {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.monitor-db-backup {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.monitor-db-backup__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.monitor-db-backup__label {
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.monitor-db-backup__value {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.monitor-db-backup__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ── Danger zone (full DB wipe) ─────────────────────────── */
.monitor-card--danger {
  border-color: color-mix(in srgb, var(--vibrance-danger) 35%, var(--border-subtle));
}

.monitor-db-danger {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .monitor-db-danger {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }
}

.monitor-db-danger__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  min-width: 0;
}

.monitor-db-danger__label {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.monitor-db-danger__desc {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* ── Backup schedule ──────────────────────────────────── */
.monitor-db-schedule {
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
}

.monitor-db-schedule__title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0;
}

.monitor-db-schedule__desc {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: 0;
}

.monitor-db-schedule__slots {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.monitor-schedule-row {
  align-items: center;
  display: flex;
  gap: var(--space-xs);
}

.monitor-schedule-row__label {
  color: var(--text-secondary);
  flex: 0 0 auto;
  font-size: var(--text-xs);
  min-width: 3rem;
}

.monitor-schedule-row__picker {
  flex: 0 0 auto;
  width: 4.5rem;
}

.monitor-schedule-row__picker .ui-dropdown__trigger {
  min-height: var(--control-h-sm);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  justify-content: center;
  gap: var(--space-2xs);
}

.monitor-schedule-row__picker .ui-dropdown__menu {
  max-height: 14rem;
}

.monitor-schedule-row__sep {
  color: var(--text-muted);
  font-weight: 600;
}

.monitor-db-schedule__actions {
  display: flex;
  gap: var(--space-sm);
}

/* ── Branding tab ──────────────────────────────────────── */

/* Group body: controls + inline preview side by side */
.monitor-branding-group-body {
  display: grid;
  grid-template-columns: 1fr 16rem;
  gap: var(--space-md);
  align-items: start;
}

.monitor-branding-group-preview {
  min-width: 0;
}

.branding-preview-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 6px; /* fixed — not affected by branding */
}

@media (max-width: 800px) {
  .monitor-branding-group-body {
    grid-template-columns: 1fr;
  }
}

/* ── Shared preview primitives ─────────────────────────── */

/* Color swatches */
.branding-preview-swatches {
  display: flex;
  gap: var(--space-xs);
}

.branding-preview-dot {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.12), 0 0 0 1px rgba(0,0,0,.15);
}

.branding-preview-neutral-strip {
  display: flex;
  border-radius: 3px;
  overflow: hidden;
  height: 0.625rem;
}

.branding-preview-neutral-strip > span { flex: 1; }

/* Badges */
.branding-preview-badges-row {
  display: flex;
  gap: var(--space-2xs);
  flex-wrap: wrap;
}

.branding-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-xs);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: 600;
  white-space: nowrap;
}

/* Buttons */
.branding-preview-btn-row {
  display: flex;
  gap: var(--space-2xs);
  flex-wrap: wrap;
}

.branding-preview-btn-row button {
  pointer-events: none;
}

/* Focus ring demo */
.branding-preview-focus-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--control-h-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
  font-size: var(--text-2xs);
  color: var(--text-muted);
  background: var(--bg-card);
}

/* ── Neutrals: surface stack + text ────────────────────── */
.branding-preview-surface-stack {
  border-radius: 4px;
  overflow: hidden;
}

.branding-preview-surface {
  padding: var(--space-xs);
  border-radius: 3px;
}

.branding-preview-surface span {
  font-size: var(--text-2xs);
  display: block;
  margin-bottom: var(--space-3xs);
}

.branding-preview-text-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.branding-preview-text-stack span {
  font-size: var(--text-2xs);
}

/* ── Typography: type sample ───────────────────────────── */
.branding-preview-type-sample {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.branding-preview-type {
  margin: 0;
  line-height: 1;
  color: var(--vibrance-hover);
  flex-shrink: 0;
}

.branding-preview-type-scale {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.branding-preview-type-scale span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branding-preview-type-paragraph {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-xs);
}

/* ── Spacing: bars + gap demo ──────────────────────────── */
.branding-preview-spacing-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.branding-preview-spacing-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  height: 0.5rem;
}

.branding-preview-spacing-fill {
  height: 100%;
  background: var(--vibrance-hover);
  border-radius: 2px;
  min-width: 2px;
  opacity: .7;
}

.branding-preview-spacing-lbl {
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.branding-preview-spacing-boxes {
  display: flex;
  gap: var(--space-md);
  padding-top: var(--space-2xs);
  border-top: 1px solid var(--border-subtle);
}

.branding-preview-spacing-demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.branding-preview-spacing-demo span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--vibrance-hover);
  opacity: .5;
}

.branding-preview-spacing-demo em {
  font-style: normal;
  font-size: 9px;
  color: var(--text-muted);
  width: 100%;
  margin-top: 2px;
}

/* ── Radius: boxes + samples ───────────────────────────── */
.branding-preview-radius-row {
  display: flex;
  gap: var(--space-2xs);
  flex-wrap: wrap;
}

.branding-preview-radius-box {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.branding-preview-radius-box > span {
  font-size: 9px;
  color: var(--text-muted);
}

.branding-preview-radius-pill { width: 3rem; }

.branding-preview-radius-samples {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.branding-preview-radius-sample {
  height: var(--control-h-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  padding: 0 var(--space-xs);
}

.branding-preview-radius-sample-label {
  font-size: var(--text-2xs);
  color: var(--text-muted);
}

/* ── Layout: diagram ───────────────────────────────────── */
.branding-preview-layout-diagram {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.branding-preview-layout-outer {
  border: 1px dashed var(--border-subtle);
  border-radius: 4px;
  padding: var(--space-xs);
  position: relative;
}

.branding-preview-layout-label {
  position: absolute;
  top: -0.5em;
  left: var(--space-xs);
  background: var(--bg-card-soft);
  padding: 0 4px;
  font-size: 9px;
  color: var(--text-muted);
}

.branding-preview-layout-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2xs);
}

.branding-preview-layout-cell {
  height: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
}

.branding-preview-layout-modals {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.branding-preview-layout-modal {
  height: 1rem;
  border: 1px dashed var(--vibrance-hover);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .5;
}

.branding-preview-layout-modal span {
  font-size: 9px;
  color: var(--vibrance-hover);
}

/* ── Controls: rows with label ─────────────────────────── */
.branding-preview-controls-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.branding-preview-control-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.branding-preview-control-label {
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 1.2rem;
}

.branding-preview-mock-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-xs);
  border: 1px solid var(--vibrance-hover);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--vibrance-hover);
  font-size: var(--text-xs);
  font-weight: 500;
}

.branding-preview-mock-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.branding-preview-mock-input {
  display: flex;
  align-items: center;
  padding: 0 var(--space-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: var(--text-xs);
  height: var(--control-h-md);
  border-radius: var(--radius-sm);
}

/* ── Icons: grid ───────────────────────────────────────── */
.branding-preview-icons-grid {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  justify-content: space-between;
}

.branding-preview-icon-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-secondary);
}

.branding-preview-icon-cell svg {
  flex-shrink: 0;
}

.branding-preview-icon-cell > span {
  font-size: 9px;
  color: var(--text-muted);
}

/* ── Transitions: bars + hover boxes ───────────────────── */
.branding-preview-transitions-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.branding-preview-transition-demo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.branding-preview-transition-demo > span {
  font-size: 9px;
  color: var(--text-muted);
  min-width: 1.8rem;
}

.branding-preview-transition-bar {
  flex: 1;
  height: 6px;
  background: var(--neutral-700);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

.branding-preview-transition-bar > span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--vibrance-hover);
  border-radius: 3px;
}

.branding-preview-transition-demo:hover .branding-preview-transition-bar > span {
  width: 100%;
}

.branding-preview-transition-hover {
  display: flex;
  gap: var(--space-2xs);
  padding-top: var(--space-2xs);
  border-top: 1px solid var(--border-subtle);
}

.branding-preview-transition-box {
  flex: 1;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 9px;
  color: var(--text-muted);
  cursor: default;
}

.branding-preview-transition-box:hover {
  background: var(--vibrance-hover);
  color: var(--text-inverse);
  transform: scale(1.05);
}

.monitor-branding-group {
  gap: var(--space-md);
}

.monitor-branding-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.monitor-branding-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-2xs) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.monitor-branding-row:last-child {
  border-bottom: none;
}

.monitor-branding-label {
  flex: 0 0 auto;
  min-width: 7rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.monitor-branding-var {
  flex: 0 0 auto;
  min-width: 10rem;
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.monitor-branding-swatch {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  padding: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.monitor-branding-swatch:hover {
  border-color: var(--text-secondary);
  box-shadow: 0 0 0 2px var(--bg-hover);
}

.monitor-branding-input {
  flex: 0 0 auto;
  width: 8rem;
  height: var(--control-h-sm);
  padding: 0 var(--space-xs);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card-soft);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  transition: border-color 120ms ease;
}

.monitor-branding-input:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
  border-color: var(--vibrance-hover);
}

.monitor-branding-input--hex {
  width: 6.5rem;
  font-family: var(--font-sans);
  letter-spacing: 0.03em;
}

.monitor-branding-reset-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h-xs);
  height: var(--control-h-xs);
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}

.monitor-branding-reset-btn:hover {
  color: var(--vibrance-danger);
  background: var(--bg-danger-soft);
}

.monitor-branding-reset-btn.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.monitor-branding-reset-btn svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.monitor-branding-actions .is-hidden {
  display: none;
}

/* ── Range sliders ─────────────────────────────────────── */
.monitor-branding-range-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1 1 auto;
  min-width: 0;
}

.monitor-branding-range {
  flex: 1 1 auto;
  min-width: 0;
  height: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  cursor: pointer;
}

/* ── Track (the bar) ── */
.monitor-branding-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--vibrance-hover) var(--range-fill, 0%),
    var(--neutral-600) var(--range-fill, 0%)
  );
}

.monitor-branding-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--neutral-600);
  border: none;
}

/* Firefox: filled portion uses a separate pseudo */
.monitor-branding-range::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--vibrance-hover);
}

/* ── Thumb ── */
.monitor-branding-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--vibrance-hover);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  margin-top: -5px;
  cursor: grab;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.monitor-branding-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 1px 6px rgba(0,0,0,.3);
}

.monitor-branding-range::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.monitor-branding-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--vibrance-hover);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: grab;
}

.monitor-branding-range:focus {
  outline: none;
}

.monitor-branding-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--vibrance-hover), 0 1px 4px rgba(0,0,0,.25);
}

.monitor-branding-range-value {
  flex: 0 0 auto;
  min-width: 4.5rem;
  text-align: right;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Presets ────────────────────────────────────────────── */
.monitor-branding-presets {
  gap: var(--space-md);
}

.monitor-branding-preset-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.monitor-branding-preset-bar .btn-secondary,
.monitor-branding-preset-bar .btn-success {
  gap: var(--space-2xs);
}

.monitor-branding-preset-bar .btn-secondary svg,
.monitor-branding-preset-bar .btn-success svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.monitor-branding-preset-input {
  flex: 0 1 auto;
  width: 10rem;
  height: var(--control-h-sm);
  padding: 0 var(--space-xs);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card-soft);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  transition: border-color 120ms ease;
}

.monitor-branding-preset-input:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
  border-color: var(--vibrance-hover);
}

.monitor-branding-preset-input::placeholder {
  color: var(--text-muted);
}

.monitor-branding-preset-sep {
  flex: 0 0 1px;
  height: 1.2rem;
  background: var(--border-subtle);
  margin: 0 var(--space-2xs);
}

.btn-danger-ghost {
  color: var(--text-muted);
  transition: color 120ms ease, background 120ms ease;
}

.btn-danger-ghost:hover:not(:disabled) {
  color: var(--vibrance-danger);
  background: var(--bg-danger-soft);
}

.btn-danger-ghost:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-danger-ghost svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.monitor-branding-preset-dropdown {
  flex: 0 1 auto;
  min-width: 14rem;
}

.monitor-branding-preset-dropdown .ui-dropdown__trigger {
  min-height: var(--control-h-sm);
  font-size: var(--text-xs);
}

.branding-preset-option-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.branding-preset-option-row .ui-dropdown__option {
  flex: 1 1 auto;
  min-width: 0;
}

.branding-preset-option-delete {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.branding-preset-option-delete:hover {
  color: var(--vibrance-danger);
  background: var(--bg-danger-soft);
}

.branding-preset-option-delete svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

/* ── Font selector ─────────────────────────────────────── */
.monitor-branding-font-dropdown {
  flex: 0 0 auto;
  min-width: 14rem;
}

.monitor-branding-font-dropdown .ui-dropdown__trigger {
  min-height: var(--control-h-sm);
  font-size: var(--text-sm);
}

.monitor-branding-row--font {
  padding: var(--space-xs) 0;
}

.branding-preview-font-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .monitor-section__actions {
    position: static;
    margin-top: var(--space-sm);
  }
  .monitor-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .monitor-tabs__item {
    flex-shrink: 0;
  }
  .monitor-branding-row {
    flex-wrap: wrap;
    gap: var(--space-2xs);
  }
  .monitor-branding-label {
    min-width: 5rem;
  }
  .monitor-branding-var {
    min-width: auto;
    flex-basis: 100%;
    order: -1;
  }
}
