:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #17202e;
  --panel: #fff;
  --ink: #17202e;
  --muted: #637083;
  --line: #d9e0ea;
  --line-soft: #edf1f5;
  --accent: #9a123f;
  --blue: #1f6feb;
  --green: #0d8a58;
  --amber: #b76e00;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
}

html,
body,
.workbench,
.sidebar,
.workspace,
.tab-panel {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.workbench {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 24px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 28px 18px;
  min-width: 0;
}

.workspace {
  min-width: 0;
  overflow-x: hidden;
  padding: 28px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
span,
strong,
small,
button,
a {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 28px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

h3 {
  font-size: 18px;
}

.lead {
  margin-top: 8px;
  color: var(--muted);
  max-width: 68ch;
  overflow-wrap: anywhere;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab,
.segment {
  min-width: 0;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.nav-tab.active,
.segment.active {
  border-color: #d7e3ff;
  background: #eef5ff;
  color: var(--blue);
  font-weight: 800;
}

.system-card,
.panel,
.table-panel,
.detail-panel,
.hero-status,
.kpi-grid > div,
.report-card,
.wizard,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.system-card {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.system-card strong,
.system-card small {
  overflow-wrap: anywhere;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.button-row,
.form-actions,
.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.compact {
  justify-self: start;
  min-height: 34px;
  margin-top: 10px;
  padding-inline: 12px;
}

.button.danger {
  border-color: #ffd7d3;
  background: #fff4f2;
  color: var(--red);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.hero-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.hero-status strong {
  display: block;
  font-size: 24px;
}

.hero-status.ok {
  border-color: #b7ead4;
  background: #effcf6;
}

.hero-status.warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-grid > div {
  min-height: 86px;
  padding: 16px;
}

.kpi-grid span,
.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-grid strong,
.metric-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.shift-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.shift-brief article {
  display: grid;
  gap: 8px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.shift-brief article.ok {
  border-color: #b7ead4;
  background: #f4fff9;
}

.shift-brief article.warning {
  border-color: #fed7aa;
  background: #fff8ec;
}

.shift-brief span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.shift-brief strong {
  font-size: 22px;
}

.shift-brief small {
  color: var(--muted);
  line-height: 1.35;
}

.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.table-panel,
.detail-panel {
  min-width: 0;
  overflow-x: auto;
  padding: 14px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  min-width: 0;
  margin-bottom: 12px;
}

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

.stream-table {
  display: grid;
  min-width: 0;
}

.stream-header,
.stream-row {
  display: grid;
  grid-template-columns: 110px minmax(170px, 1.15fr) minmax(170px, 1.2fr) minmax(120px, 0.8fr) minmax(150px, 1fr);
  gap: 12px;
  align-items: center;
}

.stream-header {
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px 10px;
  text-transform: uppercase;
}

.stream-row {
  width: 100%;
  border: 1px solid transparent;
  border-bottom-color: var(--line-soft);
  background: transparent;
  color: inherit;
  padding: 12px 10px;
  text-align: left;
  cursor: pointer;
}

.stream-row:hover,
.stream-row.selected {
  border-color: #d7e3ff;
  border-radius: 8px;
  background: #f8fbff;
}

@media (max-width: 1500px) {
  .ops-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-panel,
  .detail-panel {
    overflow-x: visible;
  }
}

.stream-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stream-row strong,
.stream-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stream-row small {
  color: var(--muted);
}

.verdict {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.verdict.no_action,
.verdict.ready {
  background: #e6f8ef;
  color: var(--green);
}

.verdict.draft_needs_publish,
.verdict.reporting_needed,
.verdict.asset_missing,
.verdict.asset_unapproved,
.verdict.blackout,
.verdict.api_error,
.verdict.target_offline,
.verdict.conflict {
  background: #fff0dc;
  color: var(--amber);
}

.verdict.conflict,
.verdict.api_error,
.verdict.blackout,
.verdict.target_offline {
  background: #fff1f0;
  color: var(--red);
}

.detail-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 14px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mini-preview,
.preview-card {
  --accent: #9a123f;
  display: grid;
  gap: 8px;
  min-height: 160px;
  border-left: 8px solid var(--accent);
  border-radius: 8px;
  background: #1f2430;
  color: #fff;
  padding: 18px;
  align-content: end;
}

.mini-preview img {
  width: 80px;
  max-height: 52px;
  object-fit: contain;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
}

.source-url {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.source-url input {
  width: 100%;
  border-color: #c9d3df;
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.wizard,
.preview-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

fieldset {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
}

legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  padding: 0 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.placement-list {
  display: grid;
  gap: 10px;
}

.placement-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.placement-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.placement-row-header strong {
  color: var(--ink);
  font-size: 13px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
}

input[type="color"] {
  padding: 3px;
}

.upload-control input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-drop {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border: 1px dashed #b9c6d8;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--ink);
  padding: 10px 12px;
  cursor: pointer;
}

.upload-drop small {
  color: var(--muted);
  font-weight: 700;
}

.upload-control:focus-within .upload-drop,
.upload-drop:hover {
  border-color: var(--blue);
  background: #eef5ff;
}

.checklist {
  display: grid;
  gap: 10px;
}

.checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.readiness-list {
  display: grid;
  gap: 8px;
}

.readiness-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
}

.readiness-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.readiness-list .ready span {
  color: var(--green);
}

.readiness-list .not-ready span {
  color: var(--amber);
}

.report-list {
  display: grid;
  gap: 14px;
}

.report-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.report-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-grid > div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
}

.notice {
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff8ec;
  color: #5f3b00;
  padding: 12px;
}

.video-id-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto minmax(70px, auto);
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-grid > .panel {
  padding: 16px;
}

.settings-grid h3 {
  margin: 0 0 12px;
}

.settings-grid code {
  display: block;
  overflow-wrap: anywhere;
}

.support-panel {
  grid-column: 1 / -1;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.support-grid h4 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.ops-list {
  display: grid;
  gap: 10px;
}

.ops-row {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: grid;
  gap: 6px 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.ops-row strong,
.ops-row span,
.ops-row small {
  display: block;
}

.ops-row span,
.ops-row small {
  color: var(--muted);
  font-size: 12px;
}

.ops-row small {
  grid-column: 1 / -1;
}

.incident-row .button {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 32px;
  width: auto;
}

code {
  display: block;
  overflow-x: auto;
  border-radius: 8px;
  background: #17202e;
  color: #fff;
  padding: 12px;
}

.risk-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.empty-state {
  color: var(--muted);
}

.obs-body {
  overflow: hidden;
  background: transparent;
}

.overlay {
  --accent: #8b1538;
  position: fixed;
  left: 4vw;
  right: 4vw;
  bottom: 4vh;
  display: grid;
  gap: 6px;
  max-height: 34vh;
  overflow: hidden;
  padding: 18px 24px;
  border-left: 10px solid var(--accent);
  background: rgba(10, 12, 18, 0.88);
  color: #fff;
  font-size: 30px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
}

.overlay.has-media {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.overlay-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.overlay strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.08;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.overlay-media {
  align-items: center;
  display: flex;
  justify-content: center;
  width: clamp(96px, 12vw, 190px);
}

.overlay-media img,
.overlay-media video {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: block;
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.overlay span {
  font-size: 18px;
  line-height: 1.25;
  opacity: 0.86;
  overflow-wrap: anywhere;
}

.overlay.pre_stream,
.overlay.post_stream {
  top: 12vh;
  bottom: auto;
  max-height: 76vh;
  text-align: center;
  border-left: 0;
  border-top: 10px solid var(--accent);
}

.overlay.pre_stream strong,
.overlay.post_stream strong {
  -webkit-line-clamp: 3;
}

.overlay.pre_stream.has-media,
.overlay.post_stream.has-media {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.overlay.pre_stream .overlay-media,
.overlay.post_stream .overlay-media {
  width: min(36vw, 420px);
}

.overlay.pre_stream .overlay-media img,
.overlay.pre_stream .overlay-media video,
.overlay.post_stream .overlay-media img,
.overlay.post_stream .overlay-media video {
  max-height: 220px;
}

.hidden {
  display: none;
}

.target-list {
  display: grid;
  gap: 10px;
}

.target-row {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.target-row strong {
  display: block;
  font-size: 14px;
}

.target-row span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.target-actions {
  align-items: center;
  display: grid;
  justify-items: end;
}

.target-actions summary {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  padding: 8px 10px;
}

.target-actions summary::-webkit-details-marker {
  display: none;
}

.target-actions div {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.target-actions:not([open]) div {
  display: none;
}

.reveal-url {
  grid-column: 1 / -1;
}

@media (max-width: 1120px) {
  .workbench {
    display: block;
    width: 100%;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-tab {
    text-align: center;
  }

  .ops-layout,
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
  }

  .workbench,
  .workspace,
  .sidebar,
  .tab-panel,
  .page-heading,
  .hero-status,
  .ops-layout,
  .studio-layout {
    width: 100%;
  }

  .workspace,
  .sidebar {
    padding: 18px;
  }

  .page-heading,
  .hero-status,
  .toolbar,
  .button-row,
  .report-card header,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading > div,
  .hero-status > div {
    min-width: 0;
    max-width: 100%;
  }

  .kpi-grid,
  .shift-brief,
  .form-grid,
  .metric-grid,
  .settings-grid,
  .video-id-form {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .stream-header {
    display: none;
  }

  .stream-row {
    grid-template-columns: 1fr;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    margin-bottom: 10px;
  }

  .button {
    width: 100%;
  }

  .table-panel,
  .detail-panel {
    overflow-x: visible;
  }
}
