:root {
  --bg: #000;
  --surface: linear-gradient(180deg, #121212 0%, #0c0c0c 100%);
  --surface-solid: #121212;
  --surface-2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --text: #fff;
  --text-muted: #8e8e93;
  --accent: #2ecc71;
  --accent-ios: #3498db;
  --spend: #e74c3c;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* Block Mac trackpad swipe back/forward while scrolling horizontally. */
  overscroll-behavior-x: none;
}

.app {
  display: flex;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
  gap: 14px;
}

.app[hidden] {
  display: none !important;
}

/* ---- Login ---- */
body.login-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-gate[hidden] {
  display: none !important;
}

.login-card {
  width: min(360px, 100%);
  padding: 28px 24px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: #161616;
}

.login-title {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.login-sub {
  margin-top: -6px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-field input {
  appearance: none;
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.login-field input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.login-error {
  font-size: 0.8rem;
  color: #ff6b63;
}

.login-error[hidden] {
  display: none !important;
}

.login-submit {
  margin-top: 4px;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
}

.login-submit:hover {
  background: #f0f0f0;
}

.login-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

.auth-user {
  padding: 0 12px 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Sidebar ---- */
.sidebar {
  flex: 0 0 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #161616;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--surface-2);
  color: #fff;
}

.nav-item.active {
  background: rgba(46, 204, 113, 0.12);
  color: var(--accent);
}

.sidebar-foot {
  padding-top: 12px;
  border-top: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---- Main ---- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

/* Class display:flex beats the UA [hidden] rule — force tab panes off. */
.main[hidden] {
  display: none !important;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ---- Scroll tracks ---- */
.scroll-track {
  overflow-x: auto;
  scroll-behavior: smooth;
  display: flex;
  gap: 8px;
  padding-bottom: 2px;
  overscroll-behavior-x: none;
}

.creatives-scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  overscroll-behavior-x: none;
}

.creatives-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: max-content;
  min-width: 100%;
  padding-top: 4px;
}

.scroll-track,
.creatives-scroll,
.creatives-list,
.creative-preview-assets .feat-asset-list,
.creative-preview-notes .feat-note-editor,
.feat-note-editor,
.tb-canvas,
.tb-pop-params-scroll,
.tb-pop-outs-scroll,
.tb-add-menu,
.take-board-field-wrap textarea.take-board-field {
  scrollbar-width: none;
}

.scroll-track::-webkit-scrollbar,
.creatives-scroll::-webkit-scrollbar,
.creatives-list::-webkit-scrollbar,
.creative-preview-assets .feat-asset-list::-webkit-scrollbar,
.creative-preview-notes .feat-note-editor::-webkit-scrollbar,
.feat-note-editor::-webkit-scrollbar,
.tb-canvas::-webkit-scrollbar,
.tb-pop-params-scroll::-webkit-scrollbar,
.tb-pop-outs-scroll::-webkit-scrollbar,
.tb-add-menu::-webkit-scrollbar,
.take-board-field-wrap textarea.take-board-field::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.panel-day,
.creatives-panel {
  position: relative;
}

.fade-sb {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.fade-sb.is-on {
  opacity: 1;
  transition-duration: 0.15s;
}

.fade-sb-x {
  left: 16px;
  right: 16px;
  bottom: 6px;
  height: 4px;
}

.fade-sb-y {
  top: 14px;
  bottom: 14px;
  right: 6px;
  width: 4px;
}

.creatives-panel.has-compare-bar .fade-sb-x {
  bottom: 58px;
}

.creatives-panel.has-compare-bar .fade-sb-y {
  bottom: 66px;
}

.fade-sb-thumb {
  position: absolute;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}

.fade-sb-x .fade-sb-thumb {
  top: 0;
  height: 100%;
  min-width: 24px;
}

.fade-sb-y .fade-sb-thumb {
  left: 0;
  width: 100%;
  min-height: 24px;
}

/* Day chart — continuous profit-widget chart */
.day-stack {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.day-chart {
  position: relative;
  flex: 0 0 auto;
  height: 148px;
  background: transparent;
  border-radius: 0;
  border: none;
  overflow: hidden;
}

.day-chart svg {
  display: block;
  height: 148px;
}

.creative-rail {
  position: relative;
  flex: 0 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  overflow: hidden;
}

.creative-rail svg {
  display: block;
}

.day-hits {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  pointer-events: none;
}

.creative-rail-hits {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
}

.creative-rail-hit {
  position: absolute;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.creative-rail-hit:hover {
  background: rgba(255, 255, 255, 0.06);
}

.day-hit {
  flex: 0 0 auto;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  font: inherit;
}

.day-hit:hover {
  background: rgba(255, 255, 255, 0.04);
}

.day-hit.active {
  background: transparent;
}

.day-hit.empty {
  opacity: 0.45;
}

body.day-dragging {
  cursor: ew-resize;
  user-select: none;
}

body.day-dragging .day-hit {
  cursor: ew-resize;
}

/* Day panel: chart sits flush in the dark card */
.panel-day {
  padding-bottom: 10px;
}

#dayTrack {
  gap: 0;
  position: relative;
}

.day-axis {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: 0 0 auto;
  min-height: 148px;
  background: var(--surface);
  pointer-events: none;
}

.day-axis svg {
  display: block;
}

.ads-filter-trigger {
  pointer-events: auto;
  position: absolute;
  left: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font: 600 9px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.ads-filter-trigger:hover,
.ads-filter-trigger.is-filtered {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.ads-filter-trigger svg,
.ads-filter-icon {
  display: block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  stroke: currentColor;
}

.ads-filter-label {
  line-height: 1;
}

/* Ad-group filter dialog */
body.ag-filter-open {
  overflow: hidden;
}

.ag-filter-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ag-filter-dialog[hidden] {
  display: none !important;
}

.ag-filter-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.ag-filter-sheet {
  position: relative;
  z-index: 1;
  width: min(340px, 100%);
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.ag-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 8px;
}

.ag-filter-title {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.ag-filter-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.ag-filter-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ag-filter-close svg {
  width: 14px;
  height: 14px;
}

.ag-filter-actions {
  display: flex;
  gap: 12px;
  padding: 0 14px 10px;
}

.ag-filter-link {
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.45);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.ag-filter-link:hover {
  color: #fff;
}

.ag-filter-list {
  overflow: auto;
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.ag-filter-list::-webkit-scrollbar {
  width: 4px;
}

.ag-filter-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.ag-filter-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ag-filter-campaign {
  padding: 6px 8px 4px;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-filter-empty {
  padding: 20px 8px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

.ag-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.8rem;
}

.ag-filter-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ag-filter-row input {
  margin: 0;
  accent-color: #2ecc71;
}

.ag-filter-swatch {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.ag-filter-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hour cells */
.hour-divider {
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  align-self: center;
  margin: 0 6px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}

.hour-cell {
  flex: 0 0 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.hour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
}

.hour-dot.on {
  background: #fff;
}

.hour-dot.start {
  background: #2ecc71;
}

.hour-dot.stop {
  background: #e74c3c;
}

.hour-dot.both {
  background: #fff;
}

/* Start/stop activity tooltip */
.launch-tip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1a1a1a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.72rem;
  line-height: 1.35;
  color: #fff;
  pointer-events: none;
}

.launch-tip[hidden] {
  display: none;
}

.launch-tip.is-rail {
  max-height: none;
  overflow: visible;
}

.launch-tip-section + .launch-tip-section {
  margin-top: 6px;
}

.launch-tip-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.launch-tip-section.start .launch-tip-label {
  color: #2ecc71;
}

.launch-tip-section.stop .launch-tip-label {
  color: #e74c3c;
}

.launch-tip-section.budget .launch-tip-label {
  color: rgba(255, 255, 255, 0.55);
}

.launch-tip-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  max-width: 260px;
}

.creative-rail-tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  max-width: 280px;
}

.creative-rail-tip-row + .creative-rail-tip-row {
  margin-top: 6px;
}

.creative-rail-tip-thumb {
  flex: 0 0 auto;
  width: 2.6em;
  height: 2.6em;
  object-fit: cover;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.creative-rail-tip-thumb-empty {
  display: block;
}

.creative-rail-tip-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.creative-rail-tip-copy .launch-tip-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.creative-rail-tip-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-rail-tip-live {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecc71;
}

.creative-rail-tip-new,
.creative-rail-tip-stop {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.435rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.creative-rail-tip-new {
  background: #2ecc71;
  color: #000;
}

.creative-rail-tip-stop {
  background: #e74c3c;
  color: #fff;
}

.creative-rail-tip-sub {
  opacity: 0.7;
  font-size: 0.66rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-rail-tip-range {
  opacity: 0.7;
  margin-top: 6px;
  font-size: 0.66rem;
}

.launch-tip-kind {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  opacity: 0.55;
  stroke-width: 2;
}

.launch-tip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Metric hover chart tooltip */
.metric-tip {
  position: fixed;
  z-index: 55;
  width: max-content;
  min-width: 230px;
  max-width: 420px;
  padding: 10px 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1a1a1a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  color: #fff;
  pointer-events: none;
}

.metric-tip-section + .metric-tip-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-tip-section-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 4px;
}

.metric-tip[hidden] {
  display: none;
}

.metric-tip-loading {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.metric-tip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.metric-tip-metric {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.metric-tip-value {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.metric-tip-name {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

.metric-tip-chart {
  display: block;
  width: 100%;
  height: auto;
}

.hour-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: #fff;
  overflow: hidden;
  transition: border-color 0.15s, color 0.15s;
}

.hour-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.hour-val {
  position: relative;
  z-index: 1;
}

.hour-cell:hover .hour-card {
  border-color: rgba(255, 255, 255, 0.14);
}

.hour-cell:hover .hour-fill {
  background: rgba(255, 255, 255, 0.16);
}

.hour-cell.has-conv .hour-card {
  color: var(--accent);
}

.hour-cell.active .hour-card {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(46, 204, 113, 0.35);
}

.hour-cell.active .hour-fill {
  background: rgba(46, 204, 113, 0.28);
}

.hour-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hour-cell.active .hour-label {
  color: var(--accent);
}

.hour-cell.disabled {
  opacity: 0.35;
  cursor: default;
}

/* Focused creative chip between day chart and creatives list */
.creative-focus-panel {
  flex: 0 0 auto;
  padding: 10px 14px;
}

.creative-focus-panel[hidden] {
  display: none !important;
}

.creative-focus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.creative-focus-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.creative-focus-main .thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.creative-focus-main .thumb-btn {
  border-radius: 8px;
}

.creative-focus-text {
  min-width: 0;
}

.creative-focus-name {
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-focus-ad,
.creative-focus-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-focus-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.creative-focus-clear:hover {
  color: #fff;
  border-color: var(--border-strong);
}

.creative-focus-clear svg {
  width: 16px;
  height: 16px;
}

/* Creatives list — matches ad_creatives widget density */
.creatives-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compare-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-strong);
  min-height: 44px;
}

.compare-bar[hidden] {
  display: none !important;
}

.compare-bar-count,
.compare-bar-go,
.compare-bar-link {
  font: inherit;
  cursor: pointer;
}

.compare-bar-count {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: transparent;
}

.compare-bar-count.is-a {
  color: #6aa8ff;
  border-color: rgba(106, 168, 255, 0.35);
}

.compare-bar-count.is-b {
  color: #ff7b72;
  border-color: rgba(231, 76, 60, 0.4);
}

.compare-bar-count:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

.compare-bar-count:disabled {
  opacity: 0.4;
  cursor: default;
}

.compare-bar-go {
  border: none;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0a0a0a;
  background: var(--accent);
}

.compare-bar-go:hover:not(:disabled) {
  filter: brightness(1.08);
}

.compare-bar-go:disabled {
  opacity: 0.4;
  cursor: default;
  filter: none;
}

.compare-bar-spacer {
  flex: 1;
}

.compare-bar-link {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: 8px;
}

.compare-bar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.creatives-head {
  display: grid;
  grid-template-columns: 252px var(--metric-template, repeat(6, 96px));
  gap: 12px;
  width: max-content;
  min-width: 100%;
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  align-items: center;
  flex: 0 0 auto;
}

.creatives-head > span:first-child,
.creatives-head-name {
  text-align: left;
}

.creatives-head-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.compare-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.compare-mode-btn svg {
  width: 15px;
  height: 15px;
}

.compare-mode-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.compare-mode-btn.is-on {
  color: #5b9cff;
  background: rgba(91, 156, 255, 0.14);
  border-color: rgba(91, 156, 255, 0.35);
}

.sort-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 4px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.sort-head .sort-arrow {
  display: inline-flex;
  align-items: center;
  opacity: 0.35;
}

.sort-head .sort-arrow svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.25;
}

.sort-head:hover {
  color: #fff;
}

.sort-head:hover .sort-arrow {
  opacity: 0.7;
}

.sort-head.active {
  color: var(--accent);
}

.sort-head.active .sort-arrow {
  opacity: 1;
}

.metric-cell.sorted {
  color: #fff;
}

.metric-sep {
  justify-self: center;
  width: 1px;
  height: 70%;
  min-height: 18px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.creatives-head .metric-sep {
  height: 14px;
  min-height: 0;
}

.ag-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  margin-top: 10px;
  padding: 8px 8px 6px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.ag-group-header:first-child {
  margin-top: 0;
}

.ag-group-header:hover .ag-group-name {
  color: #fff;
}

.ag-group-chevron {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease;
}

.ag-group-header.collapsed .ag-group-chevron {
  transform: rotate(-90deg);
}

.ag-group-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.72);
}

.ag-group-count {
  flex: 0 0 auto;
  margin-left: 2px;
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
}

.creative-row {
  position: relative;
  display: grid;
  grid-template-columns: 252px var(--metric-template, repeat(6, 96px));
  gap: 12px;
  align-items: center;
  padding: 12px 8px;
  border-radius: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  width: 100%;
  box-sizing: border-box;
}

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

.creative-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.creative-row.is-compare-a::before,
.creative-row.is-compare-b::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 2px;
  pointer-events: none;
}

.creative-row.is-compare-a::before {
  background: #5b9cff;
}

.creative-row.is-compare-b::before {
  background: #e74c3c;
}

.creative-row.is-compare-flash {
  background: rgba(255, 255, 255, 0.08);
}

.compare-chips {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.compare-chip-a {
  color: #6aa8ff;
  border-color: rgba(106, 168, 255, 0.35);
}

.compare-chip-b {
  color: #ff7b72;
  border-color: rgba(231, 76, 60, 0.4);
}

.compare-chip:hover {
  background: rgba(255, 255, 255, 0.06);
}

.compare-chip-a.is-on {
  color: #0a0a0a;
  background: #5b9cff;
  border-color: #5b9cff;
}

.compare-chip-b.is-on {
  color: #fff;
  background: #e74c3c;
  border-color: #e74c3c;
}

.creative-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-left: 8px;
}

.thumb {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.thumb-btn {
  position: relative;
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 11px;
  overflow: hidden;
  line-height: 0;
}

.thumb-btn .thumb {
  display: block;
}

.thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.thumb-play::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
  margin-left: 1px;
}

.thumb-btn:hover .thumb-play,
.thumb-btn:focus-visible .thumb-play {
  opacity: 1;
}

.creative-meta {
  min-width: 0;
  flex: 1;
}

.creative-name {
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 75%;
  letter-spacing: -0.01em;
  cursor: default;
}

.state {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.state.error {
  color: #ff453a;
}

.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ---- Creative video preview popup ---- */
body.creative-preview-open {
  overflow: hidden;
}

.creative-preview {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.creative-preview[hidden] {
  display: none !important;
}

.creative-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.creative-preview-sheet {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: min(100%, calc(100vw - 48px));
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.creative-preview-cols {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.creative-preview-media {
  flex: 0 0 auto;
  width: calc(min(70vh, 560px) * 9 / 16 + 32px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.creative-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-preview-head .creative-preview-close {
  position: static;
}

.creative-preview-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.creative-preview-close svg {
  width: 16px;
  height: 16px;
}

.creative-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 16px 10px;
}

.creative-preview-sheet.is-draft .creative-preview-head {
  align-items: center;
}

.creative-preview-head-text {
  min-width: 0;
  flex: 1;
}

.creative-preview-head-text .creative-preview-draft-name {
  margin-top: 0;
}

.creative-preview-draft-action {
  position: relative;
  flex-shrink: 0;
}

.creative-preview-draft-action[hidden] {
  display: none !important;
}

.creative-preview-assets .creative-preview-draft-action {
  width: 100%;
}

.creative-preview-draft-btn {
  width: auto;
  height: 32px;
  padding: 0 10px 0 8px;
  gap: 6px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.creative-preview-assets .creative-preview-draft-btn {
  width: 100%;
}

.creative-preview-draft-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.creative-preview-draft-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.creative-preview-draft-btn[hidden] {
  display: none !important;
}

.creative-preview-draft-btn svg {
  width: 15px;
  height: 15px;
}

.creative-preview-draft-action .feat-import-menu {
  left: 0;
  right: 0;
  top: auto;
  bottom: calc(100% + 6px);
  width: 100%;
  max-width: none;
}

.creative-preview-sheet.is-draft {
  width: calc((min(70vh, 560px) * 9 / 16 + 32px) * 2);
  min-width: 560px;
  height: min(86vh, 720px);
}

.creative-preview-sheet.is-draft .creative-preview-media {
  display: none;
}

.creative-preview-sheet.is-draft .creative-preview-features {
  max-width: none;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border-left: none;
}

.creative-preview-sheet.is-draft .creative-preview-assets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px 0;
  padding: 4px 0 16px;
}

.creative-preview-sheet.is-draft .creative-preview-notes {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 0;
  padding: 0 16px;
}

.creative-preview-sheet.is-draft .creative-preview-boards {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  border-top: none;
  border-left: 1px solid var(--border);
  margin: 0;
  padding: 0 16px;
}

.creative-preview-sheet.is-draft .creative-preview-assets-foot {
  grid-column: 2;
  grid-row: 2;
  border-left: 1px solid var(--border);
  padding-left: 16px;
  padding-right: 16px;
}

.creative-preview-title[hidden],
.creative-preview-sub[hidden],
.creative-preview-draft-name[hidden] {
  display: none !important;
}

.creative-preview-draft-name {
  appearance: none;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color-scheme: dark;
}

.creative-preview-draft-name:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.creative-preview-title {
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-preview-sub {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-preview-body {
  padding: 0 16px 16px;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-preview-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  max-height: min(70vh, 560px);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.creative-preview-video,
.creative-preview-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.creative-preview-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.creative-preview-spinner::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: feat-spin 0.7s linear infinite;
}

@keyframes feat-spin {
  to { transform: rotate(360deg); }
}

.creative-preview-status {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 12px;
}

.creative-preview-status.error {
  color: #ff453a;
}

/* ---- Side-by-side compare inspector ---- */
body.creative-compare-open {
  overflow: hidden;
}

.creative-compare {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.creative-compare[hidden] {
  display: none !important;
}

.creative-compare-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.creative-compare-sheet {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: min(100%, calc(100vw - 48px));
  max-height: min(94vh, 900px);
  display: flex;
  flex-direction: column;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.compare-cols {
  display: flex;
  flex-direction: row;
  min-height: 0;
  overflow: auto;
  align-items: stretch;
  min-height: 0;
}

.compare-divider {
  width: 1px;
  background: var(--border);
  flex: 0 0 auto;
}

.compare-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 14px;
  outline: none;
}

.compare-col.is-focused {
  background: rgba(255, 255, 255, 0.025);
}

.compare-col[data-col="a"].is-focused {
  box-shadow: inset 0 0 0 1px rgba(91, 156, 255, 0.28);
}

.compare-col[data-col="b"].is-focused {
  box-shadow: inset 0 0 0 1px rgba(231, 76, 60, 0.28);
}

.compare-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.compare-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.compare-badge-a {
  color: #0a0a0a;
  background: #5b9cff;
}

.compare-badge-b {
  color: #fff;
  background: #e74c3c;
}

.compare-step {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.compare-step svg {
  width: 16px;
  height: 16px;
}

.compare-step:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.compare-step:disabled {
  opacity: 0.35;
  cursor: default;
}

.compare-index {
  min-width: 52px;
  text-align: center;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.compare-media {
  width: calc(min(62vh, 480px) * 9 / 16);
  max-width: 100%;
}

.compare-media .creative-preview-stage {
  max-height: min(62vh, 480px);
}

.compare-body {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-meta {
  margin-top: 10px;
  min-width: 0;
}

.compare-name {
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-metric {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-preview-features {
  position: relative;
  flex: 0 0 auto;
  width: calc(min(70vh, 560px) * 9 / 16 + 32px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.creative-preview-assets {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 16px 16px;
}

.creative-preview-notes,
.creative-preview-boards {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.creative-preview-boards {
  border-top: 1px solid var(--border);
  margin: 0 -16px;
  padding: 10px 16px 0;
}

.creative-preview-notes-wrap,
.creative-preview-assets-list-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.creative-preview-notes-wrap .fade-sb-y {
  top: 8px;
  bottom: 8px;
  right: 4px;
}

.creative-preview-assets .feat-note-editor {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.creative-preview-assets-list-wrap .fade-sb-y {
  top: 4px;
  bottom: 4px;
  right: 2px;
}

.creative-preview-assets .feat-asset-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.creative-preview-assets .feat-pane-label {
  flex-shrink: 0;
}

.creative-preview-assets-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  background: #121212;
}

.feat-pane-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feat-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 8px 0;
}

.feat-status.error {
  color: #ff6b63;
  font-size: 0.82rem;
}

.feat-asset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.feat-asset-list[hidden] {
  display: none !important;
}

.feat-asset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.feat-asset-row.is-sorting {
  opacity: 0.45;
}

.feat-asset-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 28px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.2);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.feat-asset-grip svg {
  width: 14px;
  height: 14px;
}

.feat-asset-row.is-sorting .feat-asset-grip {
  cursor: grabbing;
}

.feat-asset-row.is-uploading {
  pointer-events: none;
  opacity: 0.72;
}

.feat-asset-row.is-uploading .feat-asset-kind {
  color: rgba(255, 255, 255, 0.55);
}

.feat-asset-row.is-uploading .feat-asset-kind svg {
  animation: feat-spin 0.8s linear infinite;
}

.feat-asset-row.is-note,
.feat-asset-row.is-board {
  cursor: pointer;
}

.feat-asset-row.is-note:hover,
.feat-asset-row.is-board:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.feat-asset-row.is-note .feat-asset-name,
.feat-asset-row.is-board .feat-asset-name {
  padding: 4px 0;
}

.feat-asset-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.feat-asset-kind svg {
  width: 15px;
  height: 15px;
}

.feat-asset-meta {
  min-width: 0;
  flex: 1;
}

.feat-asset-name {
  appearance: none;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
}

.feat-asset-name:focus {
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.feat-asset-size {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.feat-asset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.feat-asset-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.feat-asset-btn.is-off {
  opacity: 0.4;
}

.feat-asset-btn svg {
  width: 14px;
  height: 14px;
}

.feat-asset-dl-menu {
  position: fixed;
  z-index: 1100;
  min-width: 180px;
  max-width: 280px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.feat-asset-dl-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.feat-asset-dl-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.feat-asset-dl-sub {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feat-asset-drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.feat-asset-drop.is-over {
  border-color: var(--accent);
  background: rgba(46, 204, 113, 0.08);
}

.feat-asset-drop.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.feat-asset-drop-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  pointer-events: none;
}

.feat-asset-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.feat-note-status {
  font-size: 0.72rem;
  color: #ff6b63;
}

.feat-note-status[hidden] {
  display: none !important;
}

.feat-note-pop {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.feat-note-pop[hidden] {
  display: none !important;
}

.feat-note-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.feat-note-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
}

.feat-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.feat-note-title {
  font-size: 0.95rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feat-note-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.feat-note-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.feat-note-close svg {
  width: 14px;
  height: 14px;
}

.feat-note-editor-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.feat-note-editor-wrap .fade-sb-y {
  top: 8px;
  bottom: 8px;
  right: 4px;
}

.feat-note-editor {
  display: block;
  width: 100%;
  height: min(42vh, 320px);
  resize: none;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  outline: none;
  box-sizing: border-box;
}

.feat-note-editor:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.feat-note-editor::placeholder {
  color: var(--text-muted);
}

.feat-import-menu {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
}

.feat-import-menu[hidden] {
  display: none !important;
}

.feat-import-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.feat-import-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.feat-import-meta {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ---- Explore ---- */
.explore-main {
  flex-direction: column;
}

.explore-query {
  flex: 0 0 auto;
}

.explore-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 14px;
}

.explore-conditions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.explore-cond {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
}

.explore-cond select,
.explore-cond input {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

.explore-cond select {
  cursor: pointer;
  max-width: 7.5rem;
}

.explore-cond select.explore-scope {
  max-width: 6.2rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
}

.explore-cond select.explore-scope:disabled {
  opacity: 0.45;
  cursor: default;
}

.explore-cond select.explore-op {
  max-width: 3.2rem;
  font-weight: 600;
  color: var(--accent);
}

.explore-cond input.explore-value {
  width: 4.5rem;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.explore-cond input.explore-value::-webkit-outer-spin-button,
.explore-cond input.explore-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.explore-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.explore-remove:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.explore-remove svg {
  width: 14px;
  height: 14px;
}

.explore-and {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.explore-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.explore-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.explore-btn:hover {
  color: #fff;
  border-color: var(--border-strong);
}

.explore-btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.explore-btn svg {
  width: 15px;
  height: 15px;
}

.explore-btn-primary {
  color: #0a0a0a;
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
}

.explore-btn-primary:hover {
  color: #0a0a0a;
  filter: brightness(1.08);
}

.explore-results-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.explore-results-head {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 160px minmax(160px, 1fr);
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.explore-results {
  flex: 1;
  overflow: auto;
  padding: 4px 0 12px;
}

.explore-result {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 160px minmax(160px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.explore-result:hover {
  background: rgba(255, 255, 255, 0.03);
}

.explore-result-creative {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.explore-result-creative .thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.explore-result-creative .thumb-btn {
  border-radius: 8px;
}

.explore-result-text {
  min-width: 0;
}

.explore-result-name {
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explore-result-ad {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.explore-jump {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ios);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
}

.explore-jump:hover {
  border-color: var(--border-strong);
  background: rgba(52, 152, 219, 0.1);
}

.explore-result-snaps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.explore-snap {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

/* ---- Watchers ---- */
.watch-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.watch-bell:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.watch-bell.is-armed {
  color: var(--accent);
}

.watch-bell:not(.is-armed) svg {
  stroke-dasharray: 3.5 2.5;
}

.watch-bell svg {
  width: 16px;
  height: 16px;
}

body.watch-open {
  overflow: hidden;
}

.watch-dialog {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.watch-dialog[hidden] {
  display: none !important;
}

.watch-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.watch-sheet {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
}

.watch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  flex-shrink: 0;
}

.watch-title {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.watch-sub {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.watch-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  flex-shrink: 0;
}

.watch-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.watch-close svg {
  width: 14px;
  height: 14px;
}

.watch-list {
  overflow: auto;
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1;
}

.watch-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 10px 6px;
}

.watch-other-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 6px 2px;
}

.watch-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.watch-item.is-complete {
  opacity: 0.72;
}

.watch-item-main {
  min-width: 0;
  flex: 1;
}

.watch-item-filter {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.watch-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.watch-item-status {
  color: var(--accent);
  font-weight: 600;
}

.watch-item-action {
  color: var(--text-muted);
}

.watch-item.is-complete .watch-item-status {
  color: var(--text-muted);
  font-weight: 500;
}

.watch-item-creative {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.watch-item-snaps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.watch-item-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.watch-item-del:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.watch-item-del svg {
  width: 14px;
  height: 14px;
}

.watch-builder {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-builder-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.watch-conditions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.watch-builder .explore-cond {
  flex: 1 1 100%;
}

.watch-action {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watch-action-row {
  display: flex;
  gap: 8px;
}

.watch-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.watch-action-btn:hover {
  color: #fff;
  border-color: var(--border-strong);
}

.watch-action-btn.is-on {
  color: #0a0a0a;
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
}

.watch-action-btn svg {
  width: 15px;
  height: 15px;
}

.watch-action-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.watch-builder-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.watch-status {
  font-size: 0.75rem;
  color: var(--accent);
}

.watch-status.error {
  color: #e74c3c;
}

/* ---- Drafts tab ---- */
.drafts-main {
  flex-direction: column;
}

.drafts-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.drafts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.drafts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.draft-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.draft-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.draft-item:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.draft-item-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.draft-item-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.feat-status {
  margin-bottom: 10px;
}

.feat-status[hidden] {
  display: none !important;
}

.feat-strip-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feat-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.feat-chip-x:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.feat-add-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.feat-add-chip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

.feat-add-chip svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 860px) {
  .app {
    flex-direction: column;
    padding: 10px;
  }

  .sidebar {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    gap: 12px;
  }

  .brand {
    padding: 0 4px 0 0;
  }

  .nav {
    flex-direction: row;
    flex: 1;
  }

  .sidebar-foot {
    border: none;
    padding: 0;
  }

  .creatives-head,
  .creative-row {
    grid-template-columns: 188px var(--metric-template-sm, repeat(6, 88px));
    gap: 10px;
    font-size: 0.75rem;
  }

  .explore-results-head,
  .explore-result {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .explore-results-head span:nth-child(2),
  .explore-results-head span:nth-child(3) {
    display: none;
  }

  .creative-preview-sheet {
    width: min(420px, 100%);
    max-height: min(94vh, 900px);
  }

  .creative-preview-cols {
    flex-direction: column;
  }

  .creative-preview-media,
  .creative-preview-features {
    width: 100%;
  }

  .creative-preview-media {
    flex: 0 1 auto;
    min-width: 0;
  }

  .creative-preview-features {
    flex: 1 1 auto;
    max-height: 48vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .creative-preview-sheet.is-draft {
    width: min(420px, 100%);
    min-width: 0;
    height: min(86vh, 720px);
  }

  .creative-preview-sheet.is-draft .creative-preview-features {
    max-height: none;
  }

  .creative-preview-sheet.is-draft .creative-preview-assets {
    display: flex;
    flex-direction: column;
    padding: 4px 16px 16px;
  }

  .creative-preview-sheet.is-draft .creative-preview-notes,
  .creative-preview-sheet.is-draft .creative-preview-boards,
  .creative-preview-sheet.is-draft .creative-preview-assets-foot {
    grid-column: auto;
    grid-row: auto;
    border-left: none;
    padding-left: 0;
    padding-right: 0;
  }

  .creative-preview-sheet.is-draft .creative-preview-boards {
    border-top: 1px solid var(--border);
    margin: 0 -16px;
    padding: 10px 16px 0;
  }

  .creative-compare-sheet {
    width: min(420px, 100%);
    max-height: min(94vh, 900px);
    overflow: auto;
  }

  .compare-cols {
    flex-direction: column;
  }

  .compare-divider {
    width: auto;
    height: 1px;
  }

  .compare-media {
    width: 100%;
  }
}

/* ---- Recipe picker for new boards ---- */
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #161616;
}

.feat-board-menu[hidden] {
  display: none !important;
}

.feat-board-menu-item {
  appearance: none;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.feat-board-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ---- Take board overlay ---- */
body.take-board-open {
  overflow: hidden;
}

.take-board {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
}

.take-board[hidden] {
  display: none !important;
}

.take-board-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.take-board-sheet {
  position: relative;
  z-index: 1;
  width: calc(100vw - 20px);
  height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.take-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.take-board-head-text {
  min-width: 0;
  flex: 1;
}

.take-board-name {
  appearance: none;
  width: 100%;
  max-width: 420px;
  padding: 2px 0;
  border: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
}

.take-board-name:focus {
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.take-board-recipe {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.take-board-head-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tb-add-menu-wrap {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 8;
  width: 280px;
}

.tb-add-menu-wrap[hidden] {
  display: none !important;
}

.tb-add-menu {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #161616;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.tb-add-menu-wrap .fade-sb-y {
  top: 8px;
  bottom: 8px;
  right: 4px;
}

.tb-add-kicker {
  padding: 8px 8px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tb-add-item {
  appearance: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tb-add-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tb-add-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  word-break: break-all;
}

.take-board-close {
  appearance: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.take-board-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.take-board-close[hidden] {
  display: none;
}

.take-board-close svg {
  width: 18px;
  height: 18px;
}

.take-board-status {
  margin: 0 18px;
  padding: 8px 0 0;
  color: #ff6b63;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.take-board-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.tb-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0) 0 0 / 22px 22px;
}

.tb-graph {
  position: relative;
  display: inline-block;
  min-width: 100%;
  min-height: 100%;
  padding: 28px 40px 72px;
}

.tb-wires {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.tb-wires path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.6;
}

.tb-nodes {
  position: relative;
  z-index: 1;
  min-width: 100%;
  min-height: 100%;
}

.tb-node {
  appearance: none;
  position: absolute;
  width: 216px;
  display: flex;
  flex-direction: column;
  padding: 0 0 8px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #161616;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: grab;
  overflow: visible;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.tb-node.is-dragging {
  z-index: 6;
  cursor: grabbing;
}

.tb-node.is-drop {
  border-color: var(--accent);
}

.tb-node:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.tb-node.is-open {
  border-color: transparent;
}

.tb-node.is-open::after,
.tb-take.is-selected::after,
.tb-take.is-live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 3px solid var(--accent);
  box-shadow: inset 0 0 0 1px #000;
  z-index: 4;
}

.tb-node.is-locked {
  opacity: 0.72;
}

.tb-node.is-output .tb-node-head {
  color: var(--accent);
}

.tb-node-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 10px 6px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--text-muted);
}

.tb-node-head svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.tb-node-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-node-count {
  margin-left: auto;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
}

.tb-node-body {
  flex: 1 1 auto;
  min-height: 118px;
  height: 118px;
  margin: 0 8px;
  border-radius: 10px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-node-ins {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 6px;
}

.tb-port-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 12px 2px 16px;
}

.tb-port-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tb-node-out {
  position: relative;
}

.tb-socket {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #0c0c0c;
  background: #8e8e93;
  z-index: 5;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.tb-socket.is-in {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
}

.tb-socket.is-out {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
}

.tb-socket.is-in:hover,
.tb-socket.is-out:hover {
  transform: translateY(-50%) scale(1.2);
}

.tb-socket.is-image { background: #3498db; }
.tb-socket.is-video { background: #9b59b6; }
.tb-socket.is-audio { background: #f1c40f; }
.tb-socket.is-media { background: #2ecc71; }

.tb-wires .tb-wire.is-temp {
  stroke: var(--accent);
  stroke-dasharray: 6 4;
}

.tb-pop-params.tb-media-pane {
  padding: 12px;
}

.tb-pop-params.tb-media-pane .tb-media-drop {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.tb-media-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  cursor: pointer;
}

.tb-media-drop.is-drop {
  border-color: var(--accent);
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.tb-media-drop input {
  display: none;
}

.tb-media-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.tb-pop-params .tb-media-items {
  margin-top: 12px;
}

.tb-media-item {
  appearance: none;
  position: relative;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #0a0a0a;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tb-media-item.is-dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.tb-media-item.is-drop-target {
  box-shadow: inset 0 0 0 1px #000, 0 0 0 2px var(--accent);
}

.tb-media-ghost {
  position: fixed;
  z-index: 1400;
  margin: 0;
  pointer-events: none;
  opacity: 0.92;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.tb-media-ghost .tb-media-item-del {
  display: none;
}

.tb-media-item-frame {
  display: block;
  aspect-ratio: 9 / 16;
  overflow: hidden;
}

.tb-media-item-frame img,
.tb-media-item-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.tb-media-item-del {
  appearance: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tb-media-item-del svg {
  width: 12px;
  height: 12px;
}

.tb-media-preview {
  width: min(220px, 100%);
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0a0a;
}

.tb-node-media,
.tb-node-text,
.tb-miss {
  width: 100%;
  height: 100%;
  position: relative;
}

.tb-media-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tb-node-media img,
.tb-node-media video,
.tb-take-media img,
.tb-take-media video,
.tb-media-frame img,
.tb-media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
}

.tb-node-text {
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #fff;
  white-space: pre-wrap;
  overflow: hidden;
}

.tb-miss {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.tb-node.is-busy .tb-miss svg,
.tb-take.is-busy .tb-miss svg,
.tb-media-item.is-busy .tb-miss svg {
  animation: feat-spin 0.8s linear infinite;
  width: 18px;
  height: 18px;
}

.tb-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.tb-audio audio {
  display: none;
}

.tb-audio-btn {
  position: relative;
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.tb-audio-btn::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.tb-audio-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.tb-audio-track,
.tb-audio-prog {
  fill: none;
  stroke-width: 2.4;
}

.tb-audio-track {
  stroke: rgba(255, 255, 255, 0.18);
}

.tb-audio-prog {
  stroke: var(--accent);
  stroke-linecap: round;
}

.tb-audio-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.tb-audio-icon svg {
  width: 18px;
  height: 18px;
}

.tb-audio.is-playing .tb-audio-btn::before {
  background: rgba(46, 204, 113, 0.16);
}

.tb-pop {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tb-pop[hidden] {
  display: none !important;
}

.tb-pop-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.tb-pop-card {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 48px));
  height: min(82vh, 740px);
  display: flex;
  flex-direction: column;
  background: #121212;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.tb-pop-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  align-items: start;
  padding: 14px 14px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tb-pop-kicker {
  grid-column: 1;
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.tb-pop-title {
  grid-column: 1;
  font-size: 1.05rem;
  font-weight: 700;
}

.tb-pop-head-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 2px;
  align-self: center;
}

.tb-pop-head .take-board-close {
  grid-column: auto;
  grid-row: auto;
  align-self: center;
}

.tb-pop-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tb-pop-cols {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.tb-pop-params {
  flex: 0 0 340px;
  width: 340px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.tb-pop-params-wrap,
.tb-pop-outs-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.tb-pop-params-scroll,
.tb-pop-outs-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.tb-pop-params-scroll {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tb-pop-params-wrap .fade-sb-y,
.tb-pop-outs-wrap .fade-sb-y {
  top: 8px;
  bottom: 8px;
  right: 4px;
}

.take-board-body .fade-sb-y {
  top: 10px;
  bottom: 10px;
  right: 6px;
}

.take-board-body .fade-sb-x {
  left: 16px;
  right: 16px;
  bottom: 6px;
}

.tb-pop-params .take-board-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tb-pop-params .take-board-field {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  resize: vertical;
  color-scheme: dark;
}

.tb-pop-params .take-board-field-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.tb-pop-params .take-board-field-wrap .fade-sb-y {
  top: 8px;
  bottom: 14px;
  right: 6px;
}

.tb-pop-params textarea.take-board-field {
  min-height: 120px;
  line-height: 1.4;
  overflow-y: auto;
}

.tb-pop-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tb-pop-params.tb-crop-pane > .take-board-locked {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.tb-crop-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 0;
  display: flex;
}

.tb-crop-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
  border-radius: 12px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-crop-frame img,
.tb-crop-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0a0a0a;
}

.tb-crop-box {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  cursor: move;
  touch-action: none;
}

.tb-crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1px solid #000;
  border-radius: 1px;
  z-index: 3;
}

.tb-crop-handle.is-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.tb-crop-handle.is-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.tb-crop-handle.is-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.tb-crop-handle.is-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.tb-crop-handle.is-n { left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.tb-crop-handle.is-s { left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.tb-crop-handle.is-w { left: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.tb-crop-handle.is-e { right: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }

.tb-crop-bar {
  flex-wrap: wrap;
}

.tb-crop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  align-items: center;
}

.tb-crop-chip {
  appearance: none;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.tb-crop-chip.is-on {
  border-color: var(--accent);
  background: rgba(52, 199, 89, 0.12);
}

.tb-pop-gen .take-board-run:disabled {
  opacity: 0.55;
  cursor: default;
}

.tb-pop-gen.tb-crop-bar .take-board-run {
  flex: 0 0 auto;
  min-width: 140px;
}

.tb-pop-gen {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.tb-pop-gen .take-board-count {
  flex: 0 0 72px;
  width: 72px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
}

.tb-pop-gen .take-board-run {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #04150c;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.tb-pop-gen .take-board-run:disabled {
  opacity: 0.45;
  cursor: default;
}

.tb-pop-gen.tb-crop-bar .take-board-run {
  flex: 0 0 auto;
  min-width: 140px;
}

.tb-pop-params.tb-trim-pane > .take-board-locked {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.tb-trim-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tb-trim-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  border-radius: 12px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-trim-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0a0a0a;
  cursor: pointer;
}

.tb-trim-play {
  appearance: none;
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tb-trim-play svg {
  width: 16px;
  height: 16px;
}

.tb-trim-rail {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.tb-trim-track {
  position: relative;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  touch-action: none;
  cursor: ew-resize;
}

.tb-trim-range {
  position: absolute;
  top: 0;
  bottom: 0;
  box-sizing: border-box;
  background: rgba(52, 199, 89, 0.28);
  border: 1px solid var(--accent);
  border-radius: 10px;
  cursor: grab;
}

.tb-trim-handle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 10px;
  background: #fff;
  border: 1px solid #000;
  border-radius: 3px;
  z-index: 3;
  cursor: ew-resize;
  touch-action: none;
}

.tb-trim-handle.is-start { left: -5px; }
.tb-trim-handle.is-end { right: -5px; }

.tb-trim-playhead {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  border-radius: 1px;
  pointer-events: none;
  z-index: 2;
}

.tb-trim-times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.tb-trim-times .tb-trim-span {
  color: #fff;
}

.tb-pop-gen.tb-trim-bar .take-board-run {
  flex: 1 1 auto;
}

.tb-pop-params.tb-mute-pane > .take-board-locked {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.tb-mute-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-mute-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  border-radius: 12px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-mute-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0a0a0a;
}

.tb-mute-note {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tb-pop-gen.tb-mute-bar .take-board-run {
  flex: 1 1 auto;
}

.tb-pop-params.tb-match-pane > .take-board-locked {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.tb-match-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-match-ref {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.tb-match-ref.is-video {
  flex: 1.4 1 auto;
}

.tb-match-ref.is-image {
  flex: 0.8 1 auto;
}

.tb-match-ref-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tb-match-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 88px;
  border-radius: 12px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-match-frame video,
.tb-match-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0a0a0a;
}

.tb-match-frame .take-board-locked {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 0.78rem;
}

.tb-match-note {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tb-pop-gen.tb-match-bar .take-board-run {
  flex: 1 1 auto;
}

.tb-pop-outs {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tb-pop-outs-label {
  flex-shrink: 0;
  padding: 12px 16px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tb-pop-outs-scroll {
  padding: 0 16px 16px;
}

.tb-take-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}

.tb-take {
  appearance: none;
  position: relative;
  padding: 0;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #0a0a0a;
  overflow: hidden;
  cursor: pointer;
}

.tb-take.is-selected,
.tb-take.is-live {
  border-color: transparent;
}

.tb-take.is-failed {
  border-color: rgba(255, 69, 58, 0.45);
}

.tb-take-media {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #0a0a0a;
  overflow: hidden;
}

.take-board-gen {
  display: flex;
  align-items: center;
  gap: 8px;
}

.take-board-count {
  width: 56px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
}

.take-board-run {
  appearance: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #04150c;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.take-board-run:disabled {
  opacity: 0.45;
  cursor: default;
}

.take-board-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.take-board-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.take-board-field {
  appearance: none;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  resize: vertical;
}

.take-board-locked {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.take-board-strip-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 12px 0;
}

.take-board-empty {
  color: var(--text-muted);
  padding: 24px 0;
}

