:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #05080d;
  --panel: #0c131c;
  --panel-2: #111c27;
  --line: #243442;
  --muted: #91a0ad;
  --text: #f5f8fa;
  --blue: #2384ff;
  --cyan: #55d9d1;
  --gold: #ffca58;
  --coral: #ff7467;
  --green: #64df9b;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.studio-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 13, .96);
  backdrop-filter: blur(12px);
}
.studio-brand, .studio-header-actions, .creator-chip, .connection-pill { display: flex; align-items: center; }
.studio-brand { gap: 10px; }
.studio-brand img { width: 42px; height: 42px; object-fit: contain; }
.studio-brand span { display: grid; gap: 1px; }
.studio-brand strong { font-size: 17px; }
.studio-brand small, .studio-sidebar-foot small { color: var(--muted); }
.studio-header-actions { gap: 10px; }
.connection-pill { gap: 7px; padding: 7px 10px; color: #cbd5dc; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.connection-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.connection-pill[data-status="online"] i { background: var(--green); box-shadow: 0 0 10px rgba(100, 223, 155, .55); }
.connection-pill[data-status="preview"] i { background: var(--blue); box-shadow: 0 0 10px rgba(35, 132, 255, .55); }
.connection-pill[data-status="offline"] i { background: var(--coral); }
.creator-chip { min-height: 36px; padding: 5px 10px; border: 1px solid #315069; border-radius: 6px; background: #10283b; font-weight: 700; }
.quiet-link { padding: 8px 10px; color: #c4d0d9; font-size: 13px; }

.studio-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.studio-sidebar { position: sticky; top: 68px; display: flex; flex-direction: column; justify-content: space-between; height: calc(100vh - 68px); padding: 18px 12px; border-right: 1px solid var(--line); background: #070c12; }
.studio-nav { display: grid; gap: 5px; }
.studio-nav button { width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #aab7c0; text-align: left; cursor: pointer; }
.studio-nav button:hover { background: #101a24; color: var(--text); }
.studio-nav button.active { color: white; background: linear-gradient(180deg, #2690ff, #0a3e9d); box-shadow: inset 0 1px 0 rgba(255,255,255,.34); font-weight: 800; }
.studio-sidebar-foot { display: grid; gap: 3px; padding: 12px; border-top: 1px solid var(--line); }
.studio-sidebar-foot span { color: var(--cyan); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.studio-main { min-width: 0; padding: 26px; }
.studio-view { max-width: 1420px; margin: 0 auto; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.view-header.compact { align-items: flex-start; }
.view-header h1 { margin: 3px 0 5px; font-size: clamp(28px, 3vw, 40px); line-height: 1.05; }
.view-header p { max-width: 720px; margin: 0; color: var(--muted); }
.eyebrow { color: var(--cyan); font-size: 11px; font-weight: 900; text-transform: uppercase; }

.primary-button, .secondary-button, .danger-button, .text-button { min-height: 40px; border-radius: 6px; cursor: pointer; font-weight: 800; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid #58a7ff; background: linear-gradient(180deg, #2e98ff, #0e50bd); color: white; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.secondary-button { padding: 0 15px; border: 1px solid #3c4f5e; background: #121d26; }
.danger-button { padding: 0 15px; border: 1px solid #ff8b7f; background: #8e2d2a; color: white; }
.text-button { min-height: 32px; padding: 0 8px; border: 0; background: transparent; color: #7dc6ff; }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { opacity: .45; cursor: wait; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.metric-strip article { min-height: 104px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.metric-strip article:nth-child(1) { border-top-color: var(--blue); }
.metric-strip article:nth-child(2) { border-top-color: var(--green); }
.metric-strip article:nth-child(3) { border-top-color: var(--gold); }
.metric-strip article:nth-child(4) { border-top-color: var(--coral); }
.metric-strip span, .metric-strip small { display: block; color: var(--muted); font-size: 11px; }
.metric-strip strong { display: block; margin: 5px 0 1px; font-size: 27px; }

.shows-layout { display: grid; grid-template-columns: minmax(480px, 1.4fr) minmax(310px, .8fr); gap: 14px; }
.shows-list-pane, .show-inspector, .workflow-shell, .integration-panel, .youtube-schedule-form, .youtube-chat-panel, .moderation-form, .moderation-state { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.shows-list-pane, .show-inspector { min-height: 440px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 15px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: 15px; }
.shows-list { display: grid; }
.show-row, .show-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; width: 100%; padding: 14px 15px; border: 0; border-bottom: 1px solid #192631; background: transparent; color: white; text-align: left; cursor: pointer; }
.show-row:hover, .show-row.active, .show-list-item:hover, .show-list-item.active { background: #12202c; }
.show-row.active, .show-list-item.active { box-shadow: inset 3px 0 var(--blue); }
.show-row strong, .show-row small, .show-list-item strong, .show-list-item small { display: block; }
.show-list-item strong { grid-column: 1; font-size: 15px; }
.show-list-item .show-date { grid-column: 1; color: #c9d3da; font-size: 12px; }
.show-list-item small { grid-column: 1; margin-top: 3px; color: var(--muted); }
.show-status { grid-column: 2; grid-row: 1 / span 2; align-self: start; padding: 5px 8px; border-radius: 999px; color: #cceee2; background: #17362d; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.status-badge { align-self: start; padding: 5px 8px; border-radius: 999px; color: #cceee2; background: #17362d; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.show-inspector { padding: 18px; }
.empty-inspector { display: grid; place-content: center; height: 100%; min-height: 390px; color: var(--muted); text-align: center; }
.inspector-head, .inspector-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.inspector-head h2, .inspector-header h2 { margin: 3px 0; }
.room-code { color: var(--gold); font: 900 24px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.health-grid div { padding: 10px; border: 1px solid #263847; border-radius: 6px; background: #0a1118; }
.health-grid span, .health-grid small { display: block; color: var(--muted); font-size: 10px; }
.health-grid strong { display: block; margin-top: 4px; font-size: 18px; }
.inspector-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inspector-actions a, .inspector-actions button { min-height: 38px; }
.show-facts { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; margin: 14px 0; font-size: 12px; }
.show-facts dt { color: var(--muted); }
.show-facts dd { margin: 0; color: #e7edf1; font-weight: 700; }
.readiness-panel, .operations-panel { margin: 14px 0; padding: 13px; border: 1px solid #263847; border-radius: 6px; background: #091119; }
.readiness-panel h3, .operations-panel h3 { margin: 0 0 10px; font-size: 13px; }
.readiness-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.readiness-list li { display: flex; align-items: center; gap: 8px; color: #d2dbe1; font-size: 12px; }
.readiness-list span { min-width: 38px; padding: 3px 5px; border-radius: 4px; color: #07110c; background: var(--green); text-align: center; font-size: 9px; font-weight: 900; }
.readiness-list .pending span { color: #241a03; background: var(--gold); }
.readiness-list .optional span { color: #08151d; background: #8bc8ea; }
.operation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.operation-grid div { padding: 8px; border: 1px solid #223443; border-radius: 5px; }
.operation-grid span, .operation-grid strong { display: block; }
.operation-grid span { color: var(--muted); font-size: 10px; }
.operation-grid strong { margin-top: 3px; font-size: 14px; text-transform: capitalize; }
.muted-copy { padding: 14px; color: var(--muted); }
.error-panel { padding: 12px; border: 1px solid rgba(255, 116, 103, .45); border-radius: 6px; background: rgba(142, 45, 42, .18); color: #ffb0a8; }

.workflow-shell { padding: 18px; }
.workflow-steps { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 20px; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.workflow-steps li { display: flex; align-items: center; gap: 8px; padding: 0 0 14px; color: var(--muted); font-size: 12px; font-weight: 800; }
.workflow-steps span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #273540; }
.workflow-steps li.active { color: white; }
.workflow-steps li.active span { background: var(--blue); }
.obs-grid { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(420px, 1.25fr); gap: 20px; }
.setup-form, .youtube-schedule-form, .moderation-form { display: grid; align-content: start; gap: 14px; }
.setup-form label, .youtube-schedule-form label, .moderation-form label, .show-dialog label { display: grid; gap: 6px; color: #c8d2d9; font-size: 12px; font-weight: 800; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #334655; border-radius: 6px; outline: 0; background: #071018; color: white; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #56a8ff; box-shadow: 0 0 0 3px rgba(35,132,255,.18); }
fieldset { margin: 0; padding: 10px; border: 1px solid #334655; border-radius: 6px; }
legend { padding: 0 5px; color: #c8d2d9; font-size: 12px; font-weight: 800; }
.option-row { display: flex !important; align-items: flex-start; gap: 9px !important; padding: 7px; font-weight: 500 !important; cursor: pointer; }
.option-row input, .checkbox-row input { width: 18px; min-height: 18px; margin: 1px 0 0; }
.option-row span { display: grid; gap: 2px; }
.option-row small { color: var(--muted); }
.obs-output { min-height: 390px; padding: 20px; border: 1px dashed #3f5a6f; border-radius: 7px; background: #071018; }
.obs-output h2 { margin: 5px 0 8px; }
.source-url { margin: 14px 0; padding: 12px; overflow-wrap: anywhere; border: 1px solid #2f4556; border-radius: 6px; background: #020508; color: #9fd0ff; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.source-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.source-settings div { padding: 10px; border: 1px solid #283c4c; border-radius: 6px; }
.source-settings small, .source-settings strong { display: block; }
.source-settings small { color: var(--muted); }
.output-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.output-actions a { display: inline-flex; align-items: center; justify-content: center; }
.security-note { margin: 16px 0 0; padding: 10px; border-left: 3px solid var(--gold); color: #bbc6ce; background: rgba(255, 202, 88, .06); font-size: 12px; }

.youtube-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.integration-panel { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px; }
.youtube-mark { display: grid; place-items: center; width: 48px; height: 36px; border-radius: 8px; background: #ff3939; color: white; }
.integration-panel h2, .integration-panel p { margin: 3px 0; }
.integration-panel p { color: var(--muted); }
.youtube-schedule-form, .moderation-form, .moderation-state { padding: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-row { display: flex !important; align-items: center; gap: 8px !important; }
.youtube-chat-panel { min-height: 420px; }
.youtube-chat-list { max-height: 500px; overflow: auto; }
.youtube-chat-message { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; padding: 10px 14px; border-bottom: 1px solid #1b2935; }
.youtube-chat-message img { width: 34px; height: 34px; border-radius: 50%; }
.youtube-chat-message strong, .youtube-chat-message span { display: block; }
.youtube-chat-message span { margin-top: 2px; color: #d2dbe1; font-size: 13px; }
.youtube-chat-message button { border: 0; background: transparent; color: var(--coral); cursor: pointer; }
.youtube-chat-actions { display: grid; align-content: start; gap: 3px; text-align: right; }
.youtube-chat-actions button:last-child { color: var(--gold); }
.moderation-layout { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(420px, 1.3fr); gap: 14px; }
.moderation-state h2 { margin-top: 0; }
.moderation-counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moderation-counters div { padding: 12px; border: 1px solid #304351; border-radius: 6px; }
.moderation-counters span, .moderation-counters strong { display: block; }
.moderation-counters span { color: var(--muted); font-size: 11px; }
.form-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.form-status.is-error { color: #ff9f95; }
.youtube-stream-package { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border: 1px solid #2e7554; border-radius: 6px; background: rgba(42, 126, 86, .14); }
.youtube-stream-package strong { flex: 1 0 100%; color: #b9f2d2; }

.studio-auth-state { max-width: 660px; margin: 14vh auto 0; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: center; }
.studio-auth-state h1 { margin: 6px 0; }
.studio-auth-state p { color: var(--muted); }
.show-dialog { width: min(720px, calc(100vw - 30px)); padding: 0; border: 1px solid #3e5364; border-radius: 8px; background: #0b141c; color: white; box-shadow: 0 30px 90px rgba(0,0,0,.7); }
.show-dialog::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(5px); }
.show-dialog form > header, .show-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.show-dialog footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.show-dialog h2 { margin: 3px 0 0; }
.dialog-close { width: 42px; height: 42px; padding: 4px; border: 0; background: white; border-radius: 7px; cursor: pointer; }
.dialog-close img { width: 100%; height: 100%; object-fit: contain; }
.dialog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 18px; }
.dialog-fields .wide { grid-column: 1 / -1; }
.show-dialog .form-status { padding: 0 18px 12px; }
.settings-studio-button { display: flex; align-items: center; justify-content: center; text-decoration: none; }

@media (max-width: 920px) {
  .studio-layout { grid-template-columns: 1fr; }
  .studio-sidebar { position: sticky; top: 68px; z-index: 15; display: block; width: 100%; height: auto; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .studio-nav { grid-template-columns: repeat(4, 1fr); }
  .studio-nav button { min-height: 38px; padding: 0 5px; text-align: center; font-size: 11px; }
  .studio-sidebar-foot { display: none; }
  .studio-main { padding: 18px 12px; }
  .shows-layout, .obs-grid, .moderation-layout { grid-template-columns: 1fr; }
  .youtube-layout { grid-template-columns: 1fr; }
  .youtube-schedule-form, .youtube-chat-panel { grid-column: 1; }
}

@media (max-width: 620px) {
  .studio-header { padding: 8px 10px; }
  .studio-brand small, .connection-pill, .quiet-link { display: none; }
  .studio-brand img { width: 36px; height: 36px; }
  .studio-main { padding: 14px 9px 30px; }
  .view-header { align-items: stretch; flex-direction: column; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip article { min-height: 88px; }
  .shows-layout { display: block; }
  .show-inspector { margin-top: 10px; }
  .workflow-steps { grid-template-columns: 1fr; gap: 7px; }
  .workflow-steps li { padding-bottom: 7px; }
  .integration-panel { grid-template-columns: auto 1fr; }
  .integration-panel .primary-button { grid-column: 1 / -1; }
  .dialog-fields, .form-row { grid-template-columns: 1fr; }
  .dialog-fields .wide { grid-column: 1; }
  .source-settings { grid-template-columns: 1fr 1fr; }
}
