:root {
  color-scheme: light dark;
  --bg: #f4f3ee;
  --surf: #ffffff;
  --surf-alt: #eae8e0;
  --fg: #181816;
  --muted: #57534e;
  --border: #d6d3c9;
  --accent: #ea580c;
  --ok: #059669;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121210;
    --surf: #1c1c19;
    --surf-alt: #262622;
    --fg: #f4f3ee;
    --muted: #a8a29e;
    --border: #32322d;
    --accent: #f97316;
    --ok: #10b981;
  }
}

@supports (color: light-dark(white, black)) {
  :root {
    --bg: light-dark(#f4f3ee, #121210);
    --surf: light-dark(#ffffff, #1c1c19);
    --surf-alt: light-dark(#eae8e0, #262622);
    --fg: light-dark(#181816, #f4f3ee);
    --muted: light-dark(#57534e, #a8a29e);
    --border: light-dark(#d6d3c9, #32322d);
    --accent: light-dark(#ea580c, #f97316);
    --ok: light-dark(#059669, #10b981);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  line-height: 1.45;
  font-size: 13.5px;
  accent-color: var(--accent);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surf);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #ea580c;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.mono-ver,
.mono-count,
.mono-dim {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.mono-ver {
  font-size: 12px;
  color: var(--accent);
}

.subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tier-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surf-alt);
}

.tier-badge[data-pro="true"] {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.studio-grid {
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px 20px 36px;
  display: grid;
  grid-template-columns: 1fr 370px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1020px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

.left-col,
.right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.track-bays {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 720px) {
  .track-bays {
    grid-template-columns: 1fr;
  }
}

.bay,
.controls-panel,
.monitor-shell,
.pro-box {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.bay-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.bay-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}

.bay-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  flex: 1;
}

.mono-count {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surf-alt);
}

.drop-btn {
  display: block;
  text-align: center;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surf-alt);
}

.clip-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
}

.clip-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  background: var(--bg);
}

.clip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-del {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 10px;
}

@media (max-width: 720px) {
  .controls-row {
    grid-template-columns: 1fr;
  }
}

.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.field input,
.field select,
.license-row input {
  width: 100%;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 12.5px;
}

.render-bar {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.render-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-inline-size: 24px;
  min-block-size: 34px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-sm {
  min-block-size: 28px;
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

.btn-secondary {
  background: var(--surf-alt);
  color: var(--fg);
}

.status-line {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(440px, 70vh);
  container-type: inline-size;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  --label-2: "Hook";
  --label-3: "Body";
  --label-4: "CTA";
  --label-5: "Aspect";
  --label-6: "Status";
  --label-7: "Action";
}

caption {
  text-align: left;
  font-weight: 800;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--surf);
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surf);
}

tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--surf);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@container (width < 600px) {
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    white-space: normal;
  }
  thead {
    display: none;
  }
  tr {
    margin-block-end: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 6px;
  }
  tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--surf-alt);
  }
  td:nth-child(2)::before { content: var(--label-2) ": "; font-weight: 700; color: var(--muted); }
  td:nth-child(3)::before { content: var(--label-3) ": "; font-weight: 700; color: var(--muted); }
  td:nth-child(4)::before { content: var(--label-4) ": "; font-weight: 700; color: var(--muted); }
  td:nth-child(5)::before { content: var(--label-5) ": "; font-weight: 700; color: var(--muted); }
  td:nth-child(6)::before { content: var(--label-6) ": "; font-weight: 700; color: var(--muted); }
  td:nth-child(7)::before { content: var(--label-7) ": "; font-weight: 700; color: var(--muted); }
}

.monitor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rec-led {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--ok);
}

.canvas-stage {
  background: #09090b;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  padding: 6px;
}

#nleCanvas {
  width: 240px;
  height: auto;
  max-height: 430px;
  border-radius: 4px;
  background: #000;
}

.monitor-transport {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.monitor-transport .mono-dim {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.pro-box h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.pro-desc {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.copy-block {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.copy-block pre {
  margin: 0;
  flex: 1;
  overflow-x: auto;
  font-size: 11.5px;
}

.copy {
  position: relative;
  display: inline-flex;
}

.tip {
  position: absolute;
  inset-block-end: calc(100% + 4px);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 4px;
  background: #18181b;
  color: #f4f3ee;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.copy-button[data-copied] + .tip,
.copy-button[data-failed] + .tip {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tip {
    transition: opacity 0.01s linear;
  }
}

.license-row {
  display: flex;
  gap: 6px;
}

.sr-only {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
