:root {
  --bg: #000;
  --surface: #101010;
  --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;
  /* Actions (primary buttons, selected/active states, focus, drop targets)
     are white; --accent green is reserved for data and good outcomes. */
  --action: #fff;
  --action-hover: #e6e6e8;
  --action-text: #0a0a0a;
  --accent-ios: #3498db;
  --spend: #e74c3c;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  --font-id: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  --workspace-chrome-top: 0px;
  /* Flat backgrounds as an 8px tile of the same color: Arc draws 256px
     tiles that are one plain color through a shortcut that comes out a shade
     darker than tiles with anything in them, which shows as bands. With an
     image in every tile, every tile is drawn alike. Use on large flat
     areas: background: <color> var(--tile-...) repeat. */
  --tile-surface: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23101010'/%3E%3C/svg%3E");
  --tile-panel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23121212'/%3E%3C/svg%3E");
  --tile-board: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%230d0d0d'/%3E%3C/svg%3E");
  --tile-sheet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23111111'/%3E%3C/svg%3E");
  --tile-well: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%230b0b0c'/%3E%3C/svg%3E");
  --tile-node: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%230a0a0a'/%3E%3C/svg%3E");
  --tile-card: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23141414'/%3E%3C/svg%3E");
  --tile-modal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23151515'/%3E%3C/svg%3E");
  --tile-queue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23141416'/%3E%3C/svg%3E");
  --tile-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%231a1a1a'/%3E%3C/svg%3E");
  /* Fills are solid too: a see-through fill (rgba white, or color-mix with
     transparent) is drawn by Arc as a separate blend that shifts when focus
     or hover changes elsewhere. Write the color it comes to over the surface
     beneath (4% white over #121212 = #1b1b1b; color-mix(..., <surface>)).
     Keep rgba only for scrims and badges over images or video. */
  --workspace-nav-height: 42px;
  --gen-line-1: #5B8DEF;
  --gen-line-2: #E07A5F;
  --gen-line-3: #7BC67E;
  --gen-line-4: #C792EA;
  --gen-line-5: #E6B84F;
  --gen-line-6: #5EC8C5;
  --gen-line-7: #F07178;
  --gen-line-8: #82AAFF;
}

.mono-id,
.lineage-id,
.ag-group-gen,
.pg-gen-id,
.draft-item-cid,
.creative-preview-draft-cid,
.creative-preview-draft-head .draft-ready,
.lin-node-id,
.lin-ledger-ids,
.lin-creative-id,
.day-note-creative-name,
.day-note-editor.is-generation .creative-preview-draft-name[readonly],
.creative-focus-name,
.workspace-tab-draft.is-cid,
input[data-transform="lineage"],
input[data-transform="format"] {
  font-family: var(--font-id);
}

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

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

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 chrome is not selectable: stray drags and double-clicks on labels,
   buttons, chips and table cells used to paint selection highlights.
   Inputs, textareas and contenteditable editors (notes, docs, chat compose)
   stay selectable on their own; read-only text people copy opts back in. */
body {
  -webkit-user-select: none;
  user-select: none;
}

pre,
code,
.ask-chat-msg,
.note-agent-content,
.note-agent-error,
.tb-confirm-msg,
.delivery-confirm-msg {
  -webkit-user-select: text;
  user-select: text;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
  /* Tiled, so Arc draws it evenly (see --tile-surface). */
  background: var(--surface) var(--tile-surface) repeat;
  border: none;
  border-radius: 0;
}

.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: #1a1a1a;
  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: #1e1e1e;
}

.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;
}

/* ---- Workspace tabs ---- */
/* Tab text and icons are solid greys (what the old white-at-38/70/22/42%
   came to on the bar's #121212). */
.workspace-tabs {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 8px 0 0;
  border-bottom: 1px solid #000;
  background: var(--surface-solid);
  position: relative;
  z-index: 50;
}

.workspace-tabs[hidden] {
  display: none !important;
}

.workspace-tab {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: 300px;
  min-width: 72px;
  flex: 0 0 auto;
  padding: 0 4px 0 8px;
  border-bottom: 2px solid transparent;
  color: #6c6c6c;
  cursor: grab;
  user-select: none;
}

.workspace-tab.is-sorting {
  opacity: 0.55;
  cursor: grabbing;
}

/* The open tab is white with a white underline; hovering lifts the others
   part way. */
.workspace-tab:hover {
  color: #b8b8b8;
}

.workspace-tab.is-on {
  color: #fff;
  border-bottom-color: #fff;
}

.workspace-tab-open {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  padding: 8px 4px 7px 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: left;
}

.workspace-tab-open svg,
.workspace-tab-close svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: inherit;
  stroke: currentColor;
}

.workspace-tab-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.workspace-tab-draft {
  appearance: none;
  flex: 0 0 auto;
  max-width: 7.5em;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 500;
  color: #464646;
  text-align: left;
  cursor: pointer;
}

.workspace-tab-group.is-on > .workspace-tab-draft,
.workspace-tab-group:hover > .workspace-tab-draft {
  color: #767676;
}

.workspace-tab-group > .workspace-tab-draft:hover {
  color: #fff;
}

/* Tabs of one draft: a colored edge, a faint tint, and the draft name once
   up front. Edge colors come from planning's format line palette. */
.workspace-tab-group {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 2px;
  padding-left: 10px;
  border-left: 2px solid var(--ws-group-color, rgba(255, 255, 255, 0.2));
  background: #181818;
  cursor: grab;
  user-select: none;
}

/* A draft's tab on planning-board-next: one tab for the draft (it opens
   the draft's screen), edged in the draft's colour. */
.workspace-tab.workspace-tab-screen {
  border-left: 2px solid var(--ws-group-color, rgba(255, 255, 255, 0.2));
}

/* An angle's drafts: the angle's colour on the edge with its full name,
   then the draft tabs (no edge of their own). Dragging moves the group. */
.workspace-angle-group {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  border-left: 2px solid var(--ws-group-color, rgba(255, 255, 255, 0.2));
  cursor: grab;
  user-select: none;
}

.workspace-angle-group.is-sorting {
  opacity: 0.55;
  cursor: grabbing;
}

.workspace-angle-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  appearance: none;
  flex: 0 0 auto;
  align-self: stretch;
  margin: 0;
  /* A tab's padding and underline, so a folded angle (just its name) is as
     tall as an open one. */
  padding: 8px 10px 7px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: inherit;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ws-group-color, #767676);
  cursor: pointer;
}

/* Folded: the name and how many tabs it holds. */
.workspace-angle-group.is-collapsed > .workspace-tab {
  display: none;
}

.workspace-angle-count {
  align-self: center;
  min-width: 18px;
  height: 18px;
  margin-right: 8px;
  padding: 0 5px;
  border-radius: 4px;
  background: #222;
  color: #8e8e93;
  font-size: 0.68rem;
  line-height: 18px;
  text-align: center;
}

.workspace-angle-group.is-collapsed.is-on > .workspace-angle-count {
  color: #fff;
}

.workspace-angle-group > .workspace-tab.workspace-tab-screen {
  border-left-color: transparent;
}

.workspace-tab-group > .workspace-group-close {
  align-self: center;
  margin-right: 2px;
  color: #464646;
}

.workspace-tab-group:hover > .workspace-group-close,
.workspace-tab-group.is-on > .workspace-group-close {
  color: #767676;
}

.workspace-tab-group.is-on {
  background: #1d1d1d;
}

.workspace-tab-group.is-sorting {
  opacity: 0.55;
  cursor: grabbing;
}

.workspace-tab-group > .workspace-tab-draft {
  align-self: stretch;
  max-width: 9em;
  padding: 0 4px 0 0;
  font-size: 0.72rem;
}

.workspace-tab-draft.is-cid {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.workspace-draft-menu {
  position: fixed;
  z-index: 1900;
  right: auto;
  min-width: 196px;
  max-width: min(280px, calc(100vw - 16px));
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.workspace-draft-menu[hidden] {
  display: none !important;
}

.workspace-draft-menu .workspace-draft-item.feat-import-item {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.workspace-draft-menu .workspace-draft-item i,
.workspace-draft-menu .workspace-draft-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  stroke: currentColor;
}

.workspace-draft-menu .workspace-draft-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-draft-sep {
  height: 1px;
  margin: 4px 6px;
  background: #313131;
}

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

.workspace-tab-close {
  appearance: none;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.workspace-tab-close:hover {
  background: #252525;
  color: #fff;
}

.workspace-tab-icon {
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.workspace-tab-icon.is-check,
.workspace-tab-icon.is-check svg {
  color: var(--accent);
  stroke: currentColor;
}

.workspace-tab-spin {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--action);
  border-radius: 50%;
  animation: feat-spin 0.7s linear infinite;
}

/* ---- Sidebar ---- */
.sidebar {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  border-bottom: 1px solid #000;
  border-radius: 0;
  padding: 0 11px 0 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  color: #fff;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  flex: 0 0 auto;
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 0;
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--surface-solid);
}

.brand-ask {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
}

.brand-ask:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -1px;
}

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

.nav-scroll-inner {
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  flex: 0 0 auto;
}

.nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  flex: 0 0 auto;
}

.nav-item[hidden] {
  display: none !important;
}

.nav-item[data-tab="performance"] { --nav-tab-color: var(--gen-line-1); }
.nav-item[data-tab="drafts"] { --nav-tab-color: var(--gen-line-6); }
.nav-item[data-tab="planning"] { --nav-tab-color: var(--gen-line-2); }
.nav-item[data-tab="workflows"] { --nav-tab-color: var(--gen-line-3); }
.nav-item[data-tab="compositions"] { --nav-tab-color: var(--gen-line-4); }
.nav-item[data-tab="notes"] { --nav-tab-color: var(--gen-line-5); }
.nav-item[data-tab="reports"] { --nav-tab-color: var(--gen-line-7); }
.nav-item[data-tab="settings"] { --nav-tab-color: #fff; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 0;
  color: rgb(120, 120, 129);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.6;
  border: none;
  background: transparent;
  cursor: pointer;
  width: auto;
  flex: 0 0 auto;
  align-self: stretch;
  white-space: nowrap;
  text-align: left;
  font-family: inherit;
  transition: color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.5;
  color: rgb(91, 91, 100);
  transition: color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
  background: transparent;
  color: rgb(166, 166, 174);
}

.nav-item:hover svg {
  color: rgb(120, 120, 129);
}

.nav-item.active,
.nav-item.active:hover {
  background: transparent;
  color: rgb(244, 244, 245);
}

.nav-item.active svg,
.nav-item.active:hover svg {
  color: var(--nav-tab-color, #fff);
}

.nav-item:focus {
  outline: none;
}

.nav-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.2);
  outline-offset: -2px;
}

.nav-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 1px;
  background: var(--nav-indicator-color, #fff);
  transform: translateX(0) scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
  pointer-events: none;
  z-index: 2;
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-indicator.is-instant {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .nav-item,
  .nav-item svg,
  .nav-indicator {
    transition: none;
  }
}

.sidebar-foot {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 0;
}

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

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

.main.is-entering {
  animation:
    main-enter-slide 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    main-enter-fade 0.25s ease-out;
}

@keyframes main-enter-slide {
  from { transform: translateY(14px); }
  to { transform: none; }
}

@keyframes main-enter-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .main.is-entering {
    animation: none;
  }
}

.panel {
  padding: 14px 16px;
}

.main > .panel + .panel {
  border-top: 1px solid #000;
}

/* ---- 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-cols {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 100%;
  width: max-content;
}

.metric-group-stripes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.metric-group-stripe {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #1c1c1c;
}

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

.panel-day,
.creatives-panel,
.fade-sb-host {
  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 .fade-sb-x {
  left: 8px;
  right: 8px;
}

.creatives-panel .fade-sb-y {
  top: 8px;
  bottom: 8px;
}

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

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

.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: 162px;
  background: transparent;
  border-radius: 0;
  border: none;
  overflow: hidden;
}

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

.panel-day.is-loading #dayTrack {
  min-height: 184px;
}

.day-chart-skeleton {
  display: flex;
  flex: 1 1 auto;
  min-width: 100%;
  width: 100%;
}

.day-chart-skeleton .day-stack {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.day-chart-skeleton .day-chart {
  width: 100%;
}

/* Same geometry as renderDays(): padTop 34, padBottom 36, usable 92, slotW 36, padSide 8. */
.day-chart-skeleton .day-chart::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* The two dotted guides, faint; no per-day lines. */
  background-image:
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.12) 0 1px,
      transparent 1px 6px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.12) 0 1px,
      transparent 1px 6px
    );
  background-size: auto 1px, auto 1px;
  background-position: 0 34px, 0 80px;
  background-repeat: repeat-x;
}

.day-chart-skeleton-axis {
  width: 44px;
  height: 184px;
  min-height: 184px;
}

.day-chart-skeleton-axis::before,
.day-chart-skeleton-axis::after {
  content: "";
  position: absolute;
  left: 8px;
  width: 22px;
  height: 8px;
  border-radius: 4px;
  background: #1e1e1e;
}

.day-chart-skeleton-axis::before {
  top: 30px;
}

.day-chart-skeleton-axis::after {
  top: 76px;
}

.day-chart-skeleton-bars {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  width: 100%;
  min-width: 100%;
  height: 100%;
  padding: 34px 8px 36px;
  box-sizing: border-box;
  overflow: hidden;
}

.day-chart-skeleton-bars span {
  flex: 0 0 20px;
  width: 20px;
  height: 40%;
  border-radius: 4px 4px 1px 1px;
  /* Flat; a soft pulse runs across the bars, left to right (each bar
     starts a little after the one before it: --i, set by
     fillSkeletonBars). */
  background: #212121;
  animation: day-chart-skeleton-sweep 1.8s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes day-chart-skeleton-sweep {
  0%, 60%, 100% { opacity: 0.6; }
  30% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .day-chart-skeleton-bars span {
    animation: none;
  }
}

.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-notes {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  height: 22px;
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
  pointer-events: none;
}

.day-note-cell {
  flex: 0 0 auto;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
}

.day-note-cell:hover,
.day-note-cell.is-open {
  background: #1e1e1e;
  color: rgba(255, 255, 255, 0.92);
}

.day-note-cell.has-emoji,
.day-note-cell.has-emoji:hover,
.day-note-cell.has-emoji.is-open {
  color: #fff;
  opacity: 1;
}

.day-note-cell.is-empty {
  color: rgba(255, 255, 255, 0.45);
}

.day-note-cell.is-empty svg {
  opacity: 0;
}

.day-note-cell.is-empty:hover svg,
.day-note-cell.is-empty:focus-visible svg {
  opacity: 1;
}

.day-note-cell svg {
  display: block;
  width: 12px;
  height: 12px;
  stroke: currentColor;
}

.day-note-cell .day-note-emoji,
.day-note-menu .feat-import-item .day-note-emoji,
.launch-tip-item .day-note-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 1;
}

.day-note-cycle {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  overflow: hidden;
}

.day-note-reel {
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform;
}

.day-note-reel-item {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .day-note-reel {
    animation: none !important;
  }
}

.day-note-menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  max-width: 280px;
  max-height: 220px;
  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);
}

.day-note-menu[hidden] {
  display: none !important;
}

.day-note-menu .feat-import-item {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.day-note-menu .feat-import-item svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.55;
  stroke: currentColor;
}

.day-note-editor-head .day-note-emoji-btn {
  position: static;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #202020;
  color: #fff;
  cursor: pointer;
  touch-action: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-note-editor-head .day-note-emoji-btn:hover,
.day-note-editor-head .day-note-emoji-btn[aria-expanded="true"] {
  background: #2e2e2e;
}

.day-note-editor-head .day-note-emoji-btn[hidden] {
  display: none !important;
}

.day-note-editor.is-ad .day-note-emoji-btn,
.day-note-editor.is-generation .day-note-emoji-btn {
  display: none !important;
}

.day-note-editor-head .day-note-emoji-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.day-note-editor-head .day-note-emoji-btn .day-note-emoji {
  font-size: 18px;
  line-height: 1;
}

.day-note-emoji-pop {
  position: fixed;
  z-index: 3200;
  width: 304px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #1a1a1a;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

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

.day-note-emoji-pop-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  padding: 8px 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.day-note-emoji-clear {
  margin: 0;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: #2c2c2c;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.day-note-emoji-clear:hover {
  background: #3a3a3a;
}

.day-note-emoji-pop-body {
  min-height: 120px;
}

.day-note-emoji-pop-loading {
  padding: 28px 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
}

.day-note-emoji-pop emoji-picker {
  width: 100%;
  height: 340px;
  --background: #1a1a1a;
  --border-color: transparent;
  --button-hover-background: rgba(255, 255, 255, 0.08);
  --button-active-background: rgba(255, 255, 255, 0.14);
  --input-border-color: rgba(255, 255, 255, 0.12);
  --input-font-color: #fff;
  --input-placeholder-color: rgba(255, 255, 255, 0.4);
  --outline-color: #fff;
  --category-font-color: rgba(255, 255, 255, 0.72);
  --indicator-color: #fff;
}

.day-note-menu .feat-import-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-note-editor {
  position: fixed;
  z-index: 3000;
  width: 380px;
  height: 340px;
  display: flex;
  flex-direction: column;
  background: #121212 var(--tile-panel) repeat;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.day-note-editor[hidden] {
  display: none !important;
}

.day-note-editor.is-minimized {
  display: none !important;
}

/* A minimized float: a small bar in the lower-right corner. */
.day-note-minibar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: min(280px, calc(100vw - 32px));
  padding: 4px;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.day-note-minibar[hidden] {
  display: none;
}

.day-note-minibar button {
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s ease, color 0.12s ease;
}

.day-note-minibar button:hover {
  background: #252525;
}

.day-note-minibar-open {
  gap: 8px;
  min-width: 0;
  padding: 6px 10px 6px 8px;
  font: inherit;
  font-size: 13px;
}

.day-note-minibar-glyph {
  display: flex;
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}

.day-note-minibar-glyph svg,
.day-note-minibar-close svg {
  width: 14px;
  height: 14px;
}

.day-note-minibar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-note-minibar-close {
  flex: 0 0 auto;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: rgba(255, 255, 255, 0.5) !important;
}

.day-note-minibar-close:hover {
  color: rgba(255, 255, 255, 0.86) !important;
}

.day-note-editor.is-dragging {
  cursor: grabbing;
}

.day-note-editor.is-resizing {
  cursor: nwse-resize;
}

.day-note-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 12px 10px;
  cursor: grab;
  user-select: none;
}

.day-note-editor.is-dragging .day-note-editor-head {
  cursor: grabbing;
}

.day-note-editor-head .creative-preview-draft-name {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  cursor: text;
  user-select: text;
  touch-action: auto;
}

.day-note-editor-head .creative-preview-close {
  position: static;
  cursor: pointer;
  touch-action: auto;
}

.day-note-backlinks {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 12px 10px;
  overflow: hidden;
}

.day-note-backlinks[hidden] {
  display: none !important;
}

.day-note-backlinks-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.day-note-backlink {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  flex-shrink: 0;
  max-width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  color: #2ecc71;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.day-note-backlink:hover {
  color: #58d68d;
}

.day-note-backlink-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.day-note-backlink-icon svg {
  width: 1em;
  height: 1em;
  display: block;
}

.day-note-backlink-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-note-backlinks .fade-sb-x {
  left: 12px;
  right: 12px;
  bottom: 0;
}

.day-note-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 12px;
  cursor: default;
  touch-action: auto;
}

.day-note-editor-split {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
}

.day-note-editor-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-note-editor-body .feat-note-editor {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  touch-action: auto;
  user-select: text;
}

/* The floating note shares the Notes tab's block layer (.note-doc) without
   its drag / add gutter; heading toggles shrink into the editor's padding. */
.day-note-editor-body .note-doc > h1::before,
.day-note-editor-body .note-doc > h2::before,
.day-note-editor-body .note-doc > h3::before {
  left: -12px;
  width: 12px;
  -webkit-mask-size: 11px;
  mask-size: 11px;
}

.day-note-editor-main > .note-block-handle,
.day-note-editor-main > .note-block-drop {
  display: none;
}

.day-note-editor-main.has-note-blocks {
  overflow: hidden;
}

.day-note-takeaways {
  flex: 1 1 50%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.day-note-editor.is-draft-ad .day-note-editor-main,
.day-note-editor.is-draft-ad .day-note-takeaways {
  flex: 1 1 0;
  width: 50%;
}

.day-note-takeaways[hidden] {
  display: none !important;
}

.day-note-editor:not(.is-draft-ad) .day-note-takeaways {
  display: none !important;
}

.day-note-takeaways-scroller {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #191919;
  cursor: default;
  user-select: text;
}

.day-note-takeaways-empty {
  color: var(--text-muted);
  font-size: 0.86rem;
  padding: 10px 4px;
}

/* Generation review: creatives pane */
.day-note-editor.is-generation .day-note-takeaways-scroller {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-note-editor.is-generation .creative-preview-draft-name[readonly] {
  background: transparent;
  border-color: transparent;
  padding-left: 4px;
  cursor: default;
  letter-spacing: 0.04em;
}

.day-note-creatives-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 6px;
}

.day-note-creatives-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}

.day-note-creatives-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.day-note-creative {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.day-note-creative:hover {
  background: #272727;
  border-color: var(--border);
}

.day-note-creative.is-idle {
  opacity: 0.55;
}

.day-note-creative-rank {
  flex: 0 0 18px;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.day-note-creative .thumb,
.day-note-creative .thumb-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background: #272727;
}

.day-note-creative .thumb-btn {
  pointer-events: none;
  padding: 0;
  border: 0;
  overflow: hidden;
}

.day-note-creative .thumb-btn .thumb {
  width: 100%;
  height: 100%;
}

.day-note-creative-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-note-creative-name {
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-note-creative-blurb {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-note-creative-stats {
  display: flex;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.day-note-creative-fit {
  color: #fff;
  font-weight: 600;
}

.day-note-takeaways-scroller > .note-callout:first-child {
  margin-top: 0;
}

.day-note-takeaways-scroller > .note-callout:last-child {
  margin-bottom: 0;
}

.day-note-takeaways .note-callout-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 3px;
}

.day-note-takeaways .note-callout-title-row .note-callout-title {
  margin: 0;
  flex: 0 0 auto;
}

.note-callout-ad {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  min-width: 0;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.69em;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.note-callout-ad:hover {
  color: #fff;
}

.day-note-rich {
  position: relative;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: text;
}

.day-note-rich b,
.day-note-rich strong {
  font-weight: 700;
  color: var(--text);
}

.day-note-rich mark {
  background: #5c4a0f;
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}

.day-note-rich b [style*="font-weight: normal"],
.day-note-rich b [style*="font-weight:normal"],
.day-note-rich b [style*="font-weight: 400"],
.day-note-rich b [style*="font-weight:400"],
.day-note-rich strong [style*="font-weight: normal"],
.day-note-rich strong [style*="font-weight:normal"],
.day-note-rich strong [style*="font-weight: 400"],
.day-note-rich strong [style*="font-weight:400"] {
  color: var(--text);
}

.day-note-rich i,
.day-note-rich em {
  font-style: italic;
}

.note-math {
  color: var(--text);
}

.note-math.is-display {
  display: block;
  width: 100%;
  margin: 10px 0;
  overflow-x: auto;
  text-align: center;
}

.note-math .katex {
  color: inherit;
}

.ask-chat-rich .note-math.is-display {
  font-size: 0.92em;
}

.day-note-rich u {
  text-decoration: underline;
}

.day-note-rich s,
.day-note-rich strike,
.day-note-rich del {
  text-decoration: line-through;
}

.day-note-rich h1,
.day-note-rich h2,
.day-note-rich h3 {
  display: block;
  margin: 0.4em 0 0.15em;
  padding: 0;
  font-family: inherit;
  font-weight: 750;
  line-height: 1.25;
  min-height: 1.15em;
}

.day-note-rich h1:first-child,
.day-note-rich h2:first-child,
.day-note-rich h3:first-child {
  margin-top: 0;
}

.day-note-rich h1 {
  font-size: 1.38em;
}

.day-note-rich h2 {
  font-size: 1.18em;
}

.day-note-rich h3 {
  font-size: 1.05em;
}

.day-note-rich .note-table {
  border-collapse: collapse;
  width: 100%;
  margin: 4px 0 8px;
  table-layout: fixed;
  font-size: inherit;
  font-weight: 500;
  white-space: normal;
}

.day-note-rich .note-table td,
.day-note-rich .note-table th {
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 8px;
  min-width: 2.4em;
  vertical-align: top;
  word-break: break-word;
}

.day-note-rich .note-table tr:first-child td,
.day-note-rich .note-table tr:first-child th {
  font-weight: 700;
  background: #1e1e1e;
}

.day-note-rich .note-code {
  display: block;
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0c0c0c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82em;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  color: #d6e4f0;
}

.day-note-rich .note-code code {
  font: inherit;
  background: none;
  padding: 0;
  border: 0;
  color: inherit;
}

.day-note-rich .note-callout {
  --callout: #3498db;
  display: flex;
  gap: 9px;
  margin: 8px 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--callout) 45%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--callout) 13%, #121212);
  color: #e8f0f5;
}

.day-note-rich .note-callout.is-important { --callout: #e74c3c; }
.day-note-rich .note-callout.is-takeaway { --callout: #2ecc71; }

.day-note-rich .note-callout-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--callout);
  color: #17212b;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.day-note-rich .note-callout-icon svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.5;
}

.day-note-rich .note-callout-content {
  min-width: 0;
  flex: 1;
}

.day-note-rich .note-callout-title {
  margin: 0 0 3px;
  color: var(--callout);
  font-size: 0.69em;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
}

.day-note-rich[contenteditable="true"] [data-callout-rename] {
  cursor: text;
}

.note-callout-title-input {
  width: 100%;
  max-width: 24em;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

.day-note-rich .note-callout-body {
  min-width: 0;
}

/* Agent blocks (/ask, /data) and the finished /ask callout. */
.day-note-rich .note-callout.is-ask { --callout: #a78bfa; }


.day-note-rich .note-agent {
  --callout: #a78bfa;
  display: flex;
  gap: 9px;
  margin: 8px 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--callout) 45%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--callout) 10%, #121212);
  color: #e8f0f5;
  white-space: normal;
  cursor: default;
  user-select: none;
}

.day-note-rich .note-agent.is-data { --callout: #f0c674; }

/* Answered AI blocks drop their tint. */
.day-note-rich .note-callout.is-ask,
.day-note-rich .note-agent[data-state="done"],
.day-note-rich .note-remind[data-state="sent"] {
  background: transparent;
}

/* /remind: email reminder with subject, body, and a send time. */
.day-note-rich .note-agent.note-remind { --callout: #4fd1c5; }

/* /page: a sub-doc; the whole block opens it. */
.day-note-rich .note-agent.note-page {
  --callout: #7aa2f7;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.day-note-rich .note-agent.note-page:hover {
  background: color-mix(in srgb, var(--callout) 16%, #121212);
  border-color: color-mix(in srgb, var(--callout) 70%, transparent);
}

.day-note-rich .note-agent.note-page.is-missing {
  cursor: default;
}

.note-page-open {
  display: inline-flex;
  color: rgba(255, 255, 255, 0.45);
}

.note-page-open svg {
  width: 15px;
  height: 15px;
}

.note-page:hover .note-page-open {
  color: #fff;
}

.note-remind-title {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  outline: none;
  user-select: text;
}

.note-remind-title::placeholder {
  color: rgba(255, 255, 255, 0.38);
  font-weight: 500;
}

.note-remind-body {
  width: 100%;
  font-size: 0.92em;
  color: rgba(255, 255, 255, 0.85);
}

.note-remind-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.note-remind-date,
.note-remind-time {
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: #212e2d;
  color: #fff;
  font: inherit;
  font-size: 0.86em;
  color-scheme: dark;
  user-select: text;
}

.note-remind-date:focus,
.note-remind-time:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--callout) 70%, transparent);
}

.note-remind-hint,
.note-remind-meta {
  flex: 1;
  min-width: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.86em;
}

.note-remind-meta strong {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.note-remind-hint.is-past {
  color: #ff8a84;
}

.note-remind-subject {
  font-weight: 600;
  overflow-wrap: anywhere;
  user-select: text;
}

.note-remind-text {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* AI block content spans the icon column (18px icon + 9px gap); only the
   title row sits beside the icon. */
.day-note-rich .note-agent-body,
.day-note-rich .note-callout.is-ask .note-callout-body {
  margin-left: -27px;
}

.note-agent-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.note-agent-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}

.note-agent-titlebar .note-callout-title {
  flex: 0 0 auto;
  margin: 0;
}

.note-agent-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.note-agent-chevron,
.day-note-rich .note-callout-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  color: color-mix(in srgb, var(--callout) 70%, transparent);
  opacity: 0;
  transition: transform 0.15s ease, opacity 0.12s ease;
}

.note-agent-chevron svg,
.day-note-rich .note-callout-chevron svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.6;
}

.day-note-rich .note-agent:hover .note-agent-chevron,
.day-note-rich .note-agent.is-collapsed .note-agent-chevron,
.day-note-rich .note-callout.is-ask:hover .note-callout-chevron,
.day-note-rich .note-callout.is-ask.is-collapsed .note-callout-chevron {
  opacity: 1;
}

.day-note-rich .note-agent.is-collapsed .note-agent-chevron,
.day-note-rich .note-callout.is-ask.is-collapsed .note-callout-chevron {
  transform: rotate(-90deg);
}

.note-agent-peek {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.86em;
}

.day-note-rich .note-agent.is-collapsed .note-agent-body {
  display: none;
}

.day-note-rich .note-agent.is-collapsed .note-agent-content {
  gap: 0;
}

.day-note-rich .note-callout.is-ask [data-callout-toggle] {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.day-note-rich .note-callout.is-ask.is-collapsed .note-callout-body {
  max-height: 1.45em;
  overflow: hidden;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, #000 75%, transparent);
  mask-image: linear-gradient(90deg, #000 75%, transparent);
}

.note-agent-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -4px -4px -4px auto;
}

.note-agent-stop svg {
  width: 11px;
  height: 11px;
}

.day-note-rich .note-agent-remove,
.day-note-rich .note-callout-remove {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
}

.day-note-rich .note-agent-remove svg,
.day-note-rich .note-callout-remove svg {
  width: 13px;
  height: 13px;
}

.day-note-rich .note-agent-edit,
.day-note-rich .note-agent-duplicate,
.day-note-rich .note-callout-duplicate {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
}

.day-note-rich .note-agent-edit svg,
.day-note-rich .note-agent-duplicate svg,
.day-note-rich .note-callout-duplicate svg {
  width: 12px;
  height: 12px;
}

.day-note-rich .note-agent-edit.is-on {
  background: #252525;
  color: var(--callout);
}

.note-agent-edit-pop {
  --callout: #f0c674;
  position: fixed;
  z-index: 3100;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 11px;
  border: 1px solid color-mix(in srgb, var(--callout) 45%, rgba(255, 255, 255, 0.13));
  border-radius: 9px;
  background: #202934;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  font-size: 0.9rem;
}

.day-note-rich .note-callout.is-ask {
  position: relative;
  padding-right: 60px;
}

.day-note-rich .note-callout-remove,
.day-note-rich .note-callout-duplicate {
  position: absolute;
  top: 5px;
  right: 6px;
  cursor: pointer;
  user-select: none;
}

.day-note-rich .note-callout-duplicate {
  right: 30px;
}

.note-agent-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.note-agent-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.note-agent-input {
  flex: 1;
  min-width: 0;
  min-height: 22px;
  max-height: 220px;
  padding: 1px 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  line-height: 1.45;
  resize: none;
  outline: none;
  user-select: text;
}

.note-agent-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.note-agent-send {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--callout);
  color: #17212b;
  cursor: pointer;
}

.note-agent-context {
  flex: 0 0 auto;
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font: inherit;
  font-size: 0.78em;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.note-agent-context svg {
  width: 12px;
  height: 12px;
}

.note-agent-context:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.24);
}

.note-agent-context.is-on {
  border-color: color-mix(in srgb, var(--callout) 60%, transparent);
  background: color-mix(in srgb, var(--callout) 18%, color-mix(in srgb, var(--callout) 10%, #121212));
  color: var(--callout);
}

.note-agent-send:hover {
  filter: brightness(1.1);
}

.note-agent-send svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}


.note-agent-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.note-agent-spinner {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border: 2px solid color-mix(in srgb, var(--callout) 30%, transparent);
  border-top-color: var(--callout);
  border-radius: 50%;
  animation: feat-spin 0.7s linear infinite;
}

.note-agent-thinking {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 1.45em;
  overflow: hidden;
  font-size: 0.9em;
}

.note-agent-think-line {
  position: absolute;
  inset: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Symmetric gradient on a 200% tile, moved exactly one tile per loop, so
     the wrap from 100% back to 0% lands on an identical frame. */
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.42) 30%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 255, 255, 0.42) 70%, rgba(255, 255, 255, 0.42) 100%);
  background-size: 200% 100%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: note-agent-shimmer 2.2s linear infinite;
  transition: transform 0.38s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.38s ease;
  will-change: transform, opacity;
}

.note-agent-think-line.is-entering {
  transform: translateY(100%);
  opacity: 0;
  transition: none;
}

.note-agent-think-line.is-leaving {
  transform: translateY(-100%);
  opacity: 0;
}

@keyframes note-agent-shimmer {
  from { background-position: 200% 0; }
  to { background-position: 0% 0; }
}

.note-agent-error {
  color: #ff8a84;
  font-size: 0.9em;
  user-select: text;
}

.note-agent-btns {
  display: flex;
  gap: 6px;
}

.note-agent-frame-wrap {
  margin: 2px -3px -3px;
  border-radius: 6px;
  overflow: hidden;
}

.note-agent-frame {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color-scheme: dark;
}

.day-note-rich .note-code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  font-weight: 550;
  background: #252525;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  color: #d6e4f0;
}

.day-note-rich.is-empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  position: absolute;
  left: 12px;
  right: 12px;
  top: 10px;
}

.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 4px);
  margin: 0 1px;
  padding: 1px 7px 1px 2px;
  border-radius: 11px;
  border: 1px solid rgba(41, 128, 185, 0.55);
  background: #2980b9;
  color: #fff;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.2;
}

.note-chip:hover {
  background: #3498db;
  border-color: rgba(255, 255, 255, 0.28);
}

.note-chip.is-note-ref {
  padding: 1px 7px 1px 5px;
  border-color: rgba(22, 160, 133, 0.55);
  background: #16a085;
}

.note-chip.is-note-ref:hover {
  background: #1abc9c;
  border-color: rgba(255, 255, 255, 0.28);
}

.note-chip.is-time-ref {
  padding: 1px 7px 1px 5px;
  border-color: rgba(214, 137, 16, 0.55);
  background: #d68910;
}

.note-chip.is-time-ref:hover {
  background: #e09b24;
  border-color: rgba(255, 255, 255, 0.28);
}

/* A /now timestamp reads like inline code (.note-code-inline). Inline, not
   inline-flex: an atomic inline always allows a wrap after it, which would
   push a long first word below the chip. */
.note-chip.is-time-ref.is-now,
.note-chip.is-time-ref.is-now:hover {
  display: inline;
  white-space: nowrap;
  margin: 0 0.4em 0 0;
  padding: 0.05em 0.35em;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: #252525;
  color: #d6e4f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  font-weight: 550;
  line-height: inherit;
  vertical-align: baseline;
  cursor: default;
}

.note-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.note-chip-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.note-chip-thumb,
.note-chip-thumb-empty {
  width: 16px;
  height: 16px;
  border-radius: 16px;
  flex-shrink: 0;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.1);
}

.note-chip-thumb-draft {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
}

.note-chip-thumb-draft svg {
  width: 10px;
  height: 10px;
  display: block;
  stroke-width: 2.25;
}

.note-chip-thumb-draft.is-ready {
  background: var(--action);
  color: #0c0c0c;
}

.note-chip-thumb-draft.is-ready::after {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border: solid #0c0c0c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.note-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-chip-video-tip {
  position: fixed;
  z-index: 3200;
  width: 168px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #111;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  pointer-events: none;
}

.note-chip-video-tip[hidden] {
  display: none !important;
}

.note-chip-video-tip-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  background: #000;
}

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

.note-chip-video-tip.is-note-preview {
  width: 300px;
  max-width: min(300px, calc(100vw - 16px));
  min-height: 180px;
  max-height: min(340px, calc(100vh - 16px));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: #16181c;
}

.note-chip-note-head {
  flex: 0 0 auto;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #e8eef4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-chip-note-body {
  flex: 1 1 auto;
  min-height: 132px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 12px 12px;
  max-height: 280px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
  cursor: default;
  overscroll-behavior: contain;
}

.note-chip-note-body.day-note-rich {
  cursor: default;
}

.note-chip-note-body.day-note-rich.is-empty::before {
  left: 12px;
  right: 12px;
  top: 10px;
}

.note-chip-note-body .note-chip {
  pointer-events: none;
  max-width: 100%;
}

.note-chip-video-tip.is-note-preview .day-note-rich h1 {
  font-size: 1.05rem;
}

.note-chip-video-tip.is-note-preview .day-note-rich h2 {
  font-size: 0.95rem;
}

.note-chip-video-tip.is-note-preview .day-note-rich h3 {
  font-size: 0.85rem;
}

.note-hr {
  display: block;
  width: 100%;
  height: 14px;
  margin: 2px 0;
  position: relative;
  cursor: default;
  user-select: none;
}

.note-hr::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #464646;
}

.note-hr.is-thick::after {
  height: 3px;
  margin-top: -1px;
  background: #5e5e5e;
}

/* List markers lead their line: a bullet, a number or a to-do checkbox. */
.note-list {
  --note-list-step: 1.5em;
  display: inline-block;
  box-sizing: border-box;
  min-width: 1.1em;
  margin-right: 0.4em;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
  user-select: none;
  cursor: default;
}

.note-list[data-level="1"] { margin-left: var(--note-list-step); }
.note-list[data-level="2"] { margin-left: calc(var(--note-list-step) * 2); }
.note-list[data-level="3"] { margin-left: calc(var(--note-list-step) * 3); }

.note-list.is-bullet::before { content: "\2022"; }
.note-list.is-bullet[data-level="1"]::before { content: "\25E6"; }
.note-list.is-bullet[data-level="2"]::before,
.note-list.is-bullet[data-level="3"]::before { content: "\25AA"; }

.note-list.is-number {
  min-width: 1.4em;
  text-align: right;
}

.note-list.is-todo {
  position: relative;
  width: 0.95em;
  min-width: 0;
  height: 0.95em;
  margin-right: 0.5em;
  vertical-align: -0.12em;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.note-list.is-todo:hover {
  border-color: rgba(255, 255, 255, 0.75);
}

.note-list.is-todo.is-checked {
  background: var(--accent-ios);
  border-color: var(--accent-ios);
}

.note-list.is-todo.is-checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.24em;
  height: 0.48em;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.day-note-rich:not([contenteditable="true"]) .note-list.is-todo {
  cursor: default;
}

/* Items in a run sit closer together than paragraphs. */
.note-doc > .note-gap.is-list {
  height: 0.3em;
  overflow: hidden;
}

.day-note-mention {
  position: fixed;
  z-index: 3100;
  min-width: 220px;
  max-width: 320px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.day-note-mention-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.day-note-mention .fade-sb-y {
  top: 8px;
  bottom: 8px;
  right: 4px;
}

.day-note-mention[hidden] {
  display: none !important;
}

.day-note-command {
  position: fixed;
  z-index: 3100;
  max-width: min(360px, calc(100vw - 16px));
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  background: #202934;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.day-note-command .feat-import-item {
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.day-note-command .feat-import-item.is-active,
.day-note-command .feat-import-item:hover {
  background: #323a44;
}

.note-command-icon {
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  color: #17212b;
  font-size: 12px;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.note-command-icon svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.5;
}

.note-command-icon.is-info { background: #3498db; }
.note-command-icon.is-important { background: #e74c3c; }
.note-command-icon.is-takeaway { background: #2ecc71; }
.note-command-icon.is-ask { background: #a78bfa; }
.note-command-icon.is-data { background: #f0c674; }
.note-command-icon.is-asknote { background: #a78bfa; }
.note-command-icon.is-remind { background: #4fd1c5; }
.note-command-icon.is-page { background: #7aa2f7; }
.note-command-icon.is-todo { background: #f472b6; }
.note-command-icon.is-bullet { background: #fb923c; }
.note-command-icon.is-numbered { background: #818cf8; }
.note-command-icon.is-now { background: #a3e635; }

.day-note-mention .feat-import-item {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.day-note-mention .feat-import-item.is-active,
.day-note-mention .feat-import-item:hover {
  background: #2c2c2c;
}

.day-note-mention-thumb,
.day-note-mention-thumb-empty {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
  object-fit: cover;
  background: #2c2c2c;
}

.day-note-mention-thumb-empty.is-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #16a085;
}

.day-note-mention-thumb-empty.is-note svg {
  width: 14px;
  height: 14px;
}

.day-note-mention-thumb-empty.is-note.is-emoji {
  font-size: 16px;
  line-height: 1;
  background: #2c2c2c;
}

.day-note-mention-thumb-empty.is-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #313131;
}

.day-note-mention-thumb-empty.is-create svg {
  width: 14px;
  height: 14px;
}

.day-note-mention .feat-import-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-note-mention .feat-import-meta {
  margin-left: auto;
  flex-shrink: 0;
  max-width: 42%;
}

.day-note-editor-status {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: #ff6b63;
}

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

.day-note-editor .creative-float-handle {
  z-index: 6;
}

.ask-chat {
  z-index: 3010;
}

.ask-chat .day-note-editor-head {
  padding-bottom: 8px;
}

.ask-chat-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: #f1c40f;
}

.ask-chat-mark svg {
  width: 16px;
  height: 16px;
  display: block;
}

.ask-chat-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-weight: 700;
  line-height: 1.15;
}

.ask-chat-range {
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ask-chat-range:empty,
.ask-chat-range[hidden] {
  display: none;
}

.ask-chat-msgs {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ask-chat-msg {
  max-width: 100%;
}

.ask-chat-msg.is-user {
  align-self: flex-end;
  max-width: 92%;
}

.ask-chat-msg.is-user .ask-chat-rich {
  padding: 8px 10px;
  border-radius: 12px 12px 4px 12px;
  background: #252525;
}

.ask-chat-rich {
  font-size: 0.86rem;
  line-height: 1.45;
  cursor: default;
}

.ask-chat-pending {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 550;
}

.ask-chat-msg.is-interim .ask-chat-rich {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.ask-chat-msg.is-continue {
  align-self: stretch;
}

.ask-chat-continue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #202020;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 550;
}

.ask-chat-continue-btns {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.ask-chat-continue .explore-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.ask-chat .day-note-editor-status {
  padding: 0 12px 8px;
}

.ask-chat-compose {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 0 12px 12px;
}

.ask-chat-compose-rich {
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  min-height: 42px;
  max-height: 120px;
  padding: 8px 10px;
  cursor: text;
}

.ask-chat-compose-rich.is-empty::before {
  left: 10px;
  right: 10px;
  top: 8px;
}

.ask-chat-send {
  flex: 0 0 auto;
  align-self: stretch;
  width: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: var(--accent, #3498db);
  color: #111;
  cursor: pointer;
}

.ask-chat-send:hover {
  filter: brightness(1.08);
}

.ask-chat-send:disabled {
  opacity: 0.4;
  cursor: default;
  filter: none;
}

.ask-chat-send svg {
  width: 14px;
  height: 14px;
  display: block;
  stroke: #111;
}

.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: leftover band under the plot holds the day labels */
.panel-day {
  padding-bottom: 16px;
}

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

.day-axis {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: 0 0 auto;
  min-height: 162px;
  /* Solid (scrolled bars pass under it), in the page's own color so it
     doesn't read as a band. */
  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: #1e1e1e;
}

.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 var(--tile-panel) repeat;
  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: #202020;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.ag-filter-close:hover {
  background: #2e2e2e;
  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;
}

.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: #1e1e1e;
}

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

.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: #646464;
  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.is-rail .creative-rail-tip-new,
.launch-tip.is-rail .creative-rail-tip-stop {
  pointer-events: auto;
}

.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: #3498db;
}

.launch-tip-stats {
  display: grid;
  gap: 3px 14px;
  min-width: 148px;
}

.launch-tip-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: baseline;
}

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

.launch-tip-stat-value {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.launch-tip-stats + .launch-tip-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.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: #2c2c2c;
}

.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-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;
  cursor: help;
}

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

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

.creative-rail-tip-ad {
  margin-top: 8px;
  font-size: 0.66rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.launch-tip-label + .creative-rail-tip-ad {
  margin-top: 6px;
}

.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.is-lifetime .metric-tip-section-label {
  color: rgba(255, 255, 255, 0.55);
}

.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-share {
  font-weight: 500;
  color: #6e6e73;
}

.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: #171717;
  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: #333333;
  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: #3c3c3c;
}

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

.hour-cell.active .hour-card {
  border-color: var(--action);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.hour-cell.active .hour-fill {
  background: #3c3c3c;
}

.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(--action);
}

.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: #1a1a1a;
  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: #1a1a1a;
  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;
  padding: 0;
}

.creatives-panel.is-loading .creatives-loading {
  display: flex;
}

.creatives-panel.is-loading .creatives-scroll,
.creatives-panel.is-loading .compare-bar {
  visibility: hidden;
  pointer-events: none;
}

.compare-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 10px 16px;
  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: #1e1e1e;
}

.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: var(--action-text);
  background: var(--action);
}

.compare-bar-go:hover:not(:disabled) {
  background: var(--action-hover);
}

.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: #1e1e1e;
}

.creatives-head {
  --metric-col: 96px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: max-content;
  min-width: 100%;
  padding: 14px 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);
  flex: 0 0 auto;
}

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

.creatives-head-name {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 var(--creative-col, 252px);
  width: var(--creative-col, 252px);
  min-width: 0;
  padding-right: 8px;
}

.creatives-head-name .sort-head {
  justify-content: flex-start;
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
}

.creatives-head-toggles {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.creatives-col-resize {
  appearance: none;
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 14px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.22);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  touch-action: none;
}

.creatives-col-resize:hover,
body.is-col-resizing .creatives-col-resize {
  color: rgba(255, 255, 255, 0.75);
}

.creatives-col-resize svg {
  width: 12px;
  height: 12px;
  pointer-events: none;
}

body.is-col-resizing,
body.is-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.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: #232323;
}

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

.group-by-menu {
  min-width: 148px;
  width: max-content;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 550;
}

.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(--action);
}

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

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

.metric-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--metric-col, 96px);
  gap: inherit;
  align-items: center;
  align-self: stretch;
  flex: 0 0 auto;
  padding: 0 8px;
}

.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;
}

.creatives-list .ag-group-header {
  --metric-col: 96px;
  align-items: stretch;
  gap: 12px;
  width: max-content;
  min-width: 100%;
  margin-top: 10px;
  padding: 12px 8px;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  cursor: default;
}

.creatives-list .ag-group-header:hover .ag-group-name {
  color: rgba(255, 255, 255, 0.72);
}

.creatives-list .ag-group-toggle:hover .ag-group-name {
  color: #fff;
}

.ag-group-id {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 3px;
  flex: 0 0 var(--creative-col, 252px);
  width: var(--creative-col, 252px);
  min-width: 0;
  min-height: 42px;
  position: relative;
  z-index: 1;
}

.ag-group-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.ag-group-note-line {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  padding-left: 16px;
}

.ag-group-note-line .creative-note {
  flex: 1 1 auto;
  width: auto;
  max-width: 100%;
}

.ag-group-toggle,
.ag-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 28px);
  margin: 0 0 0 8px;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: inherit;
  text-align: left;
}

.ag-group-toggle {
  cursor: pointer;
}

.ag-group-note {
  appearance: none;
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  pointer-events: auto;
}

.ag-group-note:hover {
  background: #252525;
  color: rgba(255, 255, 255, 0.85);
}

.ag-group-note.has-notes {
  color: var(--text);
}

.ag-group-note.has-notes:hover {
  color: var(--text);
}

.ag-group-note svg {
  width: 14px;
  height: 14px;
}

.creatives-list .ag-group-gen {
  margin-right: 2px;
}

.ag-group-note-line.is-fitness {
  padding-left: 16px;
  margin-top: 2px;
}

.ag-group-fitness {
  appearance: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  padding: 1px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: #1c1c1c;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  pointer-events: auto;
}

.ag-group-fitness:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.ag-group-fitness.is-pending {
  background: transparent;
  border-style: dashed;
  color: rgba(255, 255, 255, 0.5);
}

.ag-group-fitness-label {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.ag-group-fitness.is-better {
  border-color: rgba(46, 204, 113, 0.5);
  color: #5fe39a;
}

.ag-group-fitness.is-worse {
  border-color: rgba(255, 107, 99, 0.5);
  color: #ff8a84;
}

.ag-group-fitness.is-same {
  border-color: rgba(240, 198, 116, 0.5);
  color: #f0c674;
}

.ag-group-fitness-delta {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

.creatives-list .ag-group-header .metric-cell {
  color: rgba(255, 255, 255, 0.72);
}

.creatives-list .ag-group-header .metric-cell.sorted {
  color: #fff;
}

.day-note-editor.is-ad [data-note-del],
.day-note-editor-head [data-note-del][hidden],
.day-note-editor-head [data-note-up][hidden],
.day-note-editor-head .day-note-mode-pill[hidden],
.day-note-editor:not(.is-creative-ad) .day-note-mode-pill {
  display: none !important;
}

.day-note-editor.is-creative-ad .day-note-mode-pill {
  display: inline-flex;
}

.day-note-mode-pill {
  flex: 0 0 auto;
  align-items: center;
  height: 32px;
  padding: 2px;
  gap: 0;
  border-radius: 10px;
  background: #202020;
}

.day-note-mode {
  appearance: none;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.day-note-mode:hover {
  color: #fff;
}

.day-note-mode.is-on,
.day-note-mode.is-on:hover {
  color: var(--action);
  background: #363636;
}

.day-note-mode svg {
  width: 14px;
  height: 14px;
}

.day-note-rich.is-readonly {
  caret-color: transparent;
  cursor: default;
}

.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;
  max-width: 100%;
  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 {
  --metric-col: 96px;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  width: max-content;
  min-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: #1e1e1e;
}

.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;
  flex: 0 0 var(--creative-col, 252px);
  width: var(--creative-col, 252px);
  min-width: 0;
  padding-left: 8px;
}

.thumb {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  object-fit: cover;
  background: #232323;
  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;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.creative-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
}

.creative-row-context {
  flex: 0 0 auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.02em;
}

.creative-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: #fff;
}

.creative-name-text.is-undrafted {
  opacity: 0.5;
}

.creative-row .creative-meta:not(:has(.creative-note)) .creative-name {
  font-size: 0.92rem;
}

.creative-note {
  max-width: 100%;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-muted);
}

.creative-row .creative-note {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: #fff;
}

.creative-review-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: #f0c14b;
  background: #342c19;
}

.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.is-over-workspace {
  z-index: 1800;
}

.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(96vh, 980px);
  --preview-video-h: min(70vh, 560px, calc(96vh - 160px));
  display: flex;
  flex-direction: column;
  background: #121212 var(--tile-panel) repeat;
  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(var(--preview-video-h) * 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: #202020;
  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: #2e2e2e;
}

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

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

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

.creative-preview-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

button.note-chip {
  appearance: none;
  font-family: inherit;
}

.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 {
  position: relative;
  width: auto;
  height: 32px;
  padding: 0 10px 0 8px;
  gap: 6px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: #202020;
  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: #2e2e2e;
}

.creative-preview-draft-btn.is-danger {
  background: #341b19;
  color: #ff6b63;
}

.creative-preview-draft-btn.is-danger:hover {
  background: #4e221e;
  color: #ff8a84;
}

.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-copies {
  position: fixed;
  inset: 0;
  z-index: 1850;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

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

.creative-preview-copies-card {
  width: min(320px, 100%);
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #141414 var(--tile-card) repeat;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.creative-preview-copies-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.creative-preview-copies-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.creative-preview-copies-ad {
  position: relative;
}

.creative-preview-copies-ads {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

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

.creative-preview-copies-ads .feat-import-item.is-active {
  background: #2c2c2c;
}

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

.creative-preview-copies-input {
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1d1d1d;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color-scheme: dark;
}

.creative-preview-copies-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: #222222;
}

.creative-preview-copies-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.creative-preview-copies-cancel,
.creative-preview-copies-go {
  appearance: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1d1d1d;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.creative-preview-copies-go {
  border: none;
  background: var(--action);
  color: var(--action-text);
}

.creative-preview-add-workflow {
  position: relative;
}

.creative-preview-assets .creative-preview-add-workflow {
  width: 100%;
}

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

.feat-import-item.is-static {
  cursor: default;
  opacity: 0.6;
}

.creative-preview-sheet.is-draft {
  width: min(420px, calc(100vw - 48px));
  min-width: 0;
  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-title[hidden],
.creative-preview-sub[hidden],
.creative-preview-draft-name[hidden],
.creative-preview-title-row[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: #1b1b1b;
  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: #202020;
}

.creative-preview-draft-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.creative-preview-draft-head .creative-preview-draft-name {
  flex: 1 1 auto;
  min-width: 0;
}

.creative-preview-draft-cid {
  flex: 0 0 auto;
  padding: 0 8px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background: #202020;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

.creative-preview-draft-head .draft-ready {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: #282828;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.creative-preview-sheet:not(.is-draft) [data-draft-ready],
.creative-preview-draft-head .draft-ready[hidden] {
  display: none !important;
}

.creative-preview-draft-head .draft-ready:hover {
  background: #313131;
  color: rgba(255, 255, 255, 0.72);
}

.creative-preview-draft-head .draft-ready[data-state="ready"] {
  background: #20382a;
  border-color: transparent;
  color: var(--draft-ready, #3ed67c);
}

.creative-preview-draft-head .draft-ready[data-state="ready"]:hover {
  background: #234732;
  border-color: transparent;
  color: #66e096;
}

.creative-preview-draft-head .draft-ready[data-state="wip"] {
  background: #242c3c;
  border-color: transparent;
  color: var(--draft-wip, #5b8def);
}

.creative-preview-draft-head .draft-ready[data-state="wip"]:hover {
  background: #2a364d;
  border-color: transparent;
  color: #7aa4f2;
}

.creative-preview-draft-head .draft-ready svg,
.creative-preview-draft-head .draft-ready[data-state="ready"]::after,
.creative-preview-draft-head .draft-ready[data-state="wip"]::after {
  display: none;
  content: none;
}

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

.creative-preview-copies-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 12px;
  text-align: left;
  cursor: pointer;
}

.creative-preview-copies-select [data-copies-gen-label] {
  display: flex;
  align-items: baseline;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
}

.creative-preview-copies-select .feat-import-meta {
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-preview-copies-select::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.45);
  flex: 0 0 auto;
}

.creative-preview-copies-select[aria-expanded="true"]::after {
  border-top: none;
  border-bottom: 5px solid rgba(255, 255, 255, 0.45);
}

.creative-preview-title {
  flex: 0 1 auto;
  min-width: 0;
  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;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.creative-preview-media-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  gap: 8px;
}

.creative-preview-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  height: auto;
  max-height: var(--preview-video-h);
  flex: 0 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.creative-preview-media-stack .creative-preview-stage {
  max-height: var(--preview-video-h);
}

.creative-preview-video,
.creative-preview-poster,
.creative-preview-image {
  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;
}

.creative-preview-pip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-preview-pip:hover {
  background: rgba(0, 0, 0, 0.75);
}

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

/* ---- Second-by-second video metric chart ---- */
.video-metric-chart {
  --video-metric-chart-bg: #1b1b1b;
  position: relative;
  z-index: 5;
  height: auto;
  flex: 0 0 auto;
  margin-bottom: 0;
  overflow: visible;
}

.video-metric-chart-plot {
  position: relative;
  height: 88px;
  border-radius: 12px;
  background: var(--video-metric-chart-bg);
  overflow: hidden;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
}

.video-metric-chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.video-metric-chart-axis {
  position: relative;
  height: 8px;
  overflow: visible;
  pointer-events: none;
}

.video-metric-chart-axis-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.video-metric-chart-area {
  fill: rgba(46, 204, 113, 0.18);
}

.video-metric-chart-line {
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.video-metric-chart-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.video-metric-chart-playhead[hidden] {
  display: none !important;
}

.video-metric-chart-menu {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 6;
}

.video-metric-chart.is-loading .video-metric-chart-area,
.video-metric-chart.is-loading .video-metric-chart-line {
  opacity: 0;
}

/* Asset lanes under the chart: what played when (exposure snapshot). */
.video-metric-chart-lanes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.video-metric-chart-lanes[hidden] {
  display: none !important;
}

.video-metric-chart-lane {
  position: relative;
  height: 22px;
}

.video-metric-chart-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #232323;
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 10.5px;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.28);
}

.video-metric-chart-seg span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-metric-chart-seg em {
  margin-left: auto;
  padding-left: 2px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-id);
  font-size: 9.5px;
  font-style: normal;
}

.video-metric-chart-seg.is-narrow {
  justify-content: center;
  padding: 0 2px;
}

.video-metric-chart-seg.is-narrow span {
  display: none;
}

.video-metric-chart-seg.is-narrow em {
  margin-left: 0;
  padding-left: 0;
}

/* Too thin for a number: colour only; hover still shows everything. */
.video-metric-chart-seg.is-tiny {
  padding: 0;
}

.video-metric-chart-seg.is-tiny em {
  display: none;
}

/* Segment tooltip (styled like .metric-tip). */
.video-metric-chart-tip {
  position: fixed;
  /* Above the creative preview / compare overlays (z-index 1000). */
  z-index: 3000;
  width: max-content;
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #1a1a1a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}

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

.video-metric-chart-tip .is-muted {
  color: rgba(255, 255, 255, 0.45);
}

.video-metric-chart-tip-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.video-metric-chart-tip-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.video-metric-chart-tip-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-metric-chart-tip-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: #2c2c2c;
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--font-id);
  font-size: 10px;
}

.video-metric-chart-tip-when {
  margin: 2px 0 0 15px;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-id);
  font-size: 10.5px;
}

.video-metric-chart-tip-verdict {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

.video-metric-chart-tip-spot {
  margin-top: 3px;
  font-size: 11px;
}

.video-metric-chart-tip-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.video-metric-chart-tip-k {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.video-metric-chart-tip-v {
  font-variant-numeric: tabular-nums;
}

.video-metric-chart-lanes-note {
  padding: 6px 2px 0;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.video-metric-chart-seg:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.video-metric-chart-seg.is-active {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.feat-dropdown.is-icon {
  width: auto;
}

.feat-dropdown.is-icon .feat-dropdown-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.feat-dropdown.is-icon .feat-dropdown-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

.feat-dropdown.is-icon .feat-dropdown-btn svg {
  width: 15px;
  height: 15px;
}

.feat-dropdown.is-icon .feat-dropdown-btn [data-feat-drop-label].is-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.feat-dropdown.is-icon .feat-dropdown-btn::after {
  display: none;
}

.feat-dropdown.is-icon .feat-import-menu {
  left: auto;
  right: 0;
  top: auto;
  bottom: calc(100% + 6px);
  width: max-content;
  min-width: 148px;
}

/* ---- Picture-in-picture floating player ---- */
.creative-float {
  position: fixed;
  z-index: 3000;
  width: 200px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.creative-float.is-dragging {
  cursor: grabbing;
}

.creative-float.is-resizing {
  cursor: nwse-resize;
}

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

.creative-float-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  background: #000;
}

.creative-float-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  background: #000;
}

.creative-float-handle {
  position: absolute;
  z-index: 5;
  touch-action: none;
}

.creative-float-handle.is-n,
.creative-float-handle.is-s {
  left: 14px;
  right: 14px;
  height: 10px;
  cursor: ns-resize;
}

.creative-float-handle.is-n { top: 0; }
.creative-float-handle.is-s { bottom: 0; }

.creative-float-handle.is-e,
.creative-float-handle.is-w {
  top: 14px;
  bottom: 14px;
  width: 10px;
  cursor: ew-resize;
}

.creative-float-handle.is-e { right: 0; }
.creative-float-handle.is-w { left: 0; }

.creative-float-handle.is-ne,
.creative-float-handle.is-nw,
.creative-float-handle.is-se,
.creative-float-handle.is-sw {
  width: 16px;
  height: 16px;
}

.creative-float-handle.is-ne { top: 0; right: 0; cursor: nesw-resize; }
.creative-float-handle.is-nw { top: 0; left: 0; cursor: nwse-resize; }
.creative-float-handle.is-se { bottom: 0; right: 0; cursor: nwse-resize; }
.creative-float-handle.is-sw { bottom: 0; left: 0; cursor: nesw-resize; }

.creative-float-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 7;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-float-close:hover {
  background: rgba(0, 0, 0, 0.78);
}

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

.creative-float-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 18px 8px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  cursor: default;
  touch-action: auto;
}

.creative-float-play {
  position: relative;
  z-index: 7;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-float-play:hover {
  background: rgba(255, 255, 255, 0.2);
}

.creative-float-play svg {
  width: 14px;
  height: 14px;
}

.creative-float-seek {
  position: relative;
  z-index: 7;
  flex: 1;
  min-width: 0;
  height: 4px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 99px;
  cursor: pointer;
}

.creative-float-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

.creative-float-seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

.creative-float-seek::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 99px;
}

.creative-float-time {
  flex-shrink: 0;
  min-width: 2.2em;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.82);
  text-align: right;
}

/* ---- 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(96vh, 980px);
  --compare-video-h: min(62vh, 480px, calc(96vh - 200px));
  display: flex;
  flex-direction: column;
  background: #121212 var(--tile-panel) repeat;
  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: #202020;
  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: #181818;
}

.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: #202020;
  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: #2e2e2e;
}

.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 {
  display: flex;
  flex-direction: column;
  width: calc(var(--compare-video-h) * 9 / 16);
  max-width: 100%;
  min-height: 0;
  gap: 8px;
}

.compare-media .creative-preview-stage {
  max-height: var(--compare-video-h);
  flex: 0 0 auto;
}

.compare-media .video-metric-chart {
  width: 100%;
  margin-bottom: 0;
}

.compare-media.is-media-only {
  --compare-video-h: min(68vh, 560px, calc(96vh - 140px));
}

.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-workflows {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.creative-preview-workflows[hidden],
.creative-preview-add-workflow[hidden] {
  display: none !important;
}

.creative-preview-sheet.is-fresh-creative .creative-preview-assets {
  justify-content: flex-end;
}

.creative-preview-sheet.is-fresh-creative .creative-preview-assets-foot {
  position: static;
  padding-top: 0;
  background: transparent;
}

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

.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;
}

/* Performance: per-second chart + asset lanes in a full-width row under
   the video and assets columns. */
.creative-preview-perf {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

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

/* Give the row its height back from the video so the sheet still fits. */
.creative-preview-sheet:has(.creative-preview-perf:not([hidden])) {
  --preview-video-h: min(calc(70vh - 206px), 464px, calc(96vh - 366px));
}

/* Space above the row: the video pane gets the assets pane's 16px. */
.creative-preview-sheet:has(.creative-preview-perf:not([hidden])) .creative-preview-media {
  padding-bottom: 16px;
}

.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: #191919;
}

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

.feat-asset-row.is-workflow:not(.is-locked) {
  user-select: none;
  -webkit-user-select: none;
}

.feat-asset-row.is-workflow:not(.is-locked) img,
.feat-asset-row.is-workflow:not(.is-locked) svg {
  -webkit-user-drag: none;
}

.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-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-grip.is-off {
  cursor: default;
  color: var(--text-muted);
}

.feat-asset-row.is-composition {
  cursor: pointer;
  background: #16222a;
  border-color: rgba(52, 152, 219, 0.28);
}

.feat-asset-row.is-composition .feat-asset-grip,
.feat-asset-row.is-workflow.is-locked .feat-asset-grip {
  margin-left: 8px;
}

.feat-asset-row.is-composition .feat-asset-grip {
  color: #3498db;
}

.feat-asset-row.is-composition .feat-asset-grip svg,
.feat-asset-row.is-workflow.is-locked .feat-asset-grip svg {
  width: 15px;
  height: 15px;
}

.feat-asset-row.is-composition:hover {
  border-color: rgba(52, 152, 219, 0.45);
  background: #182a36;
}

/* A draft without a composition yet (creative-preview.js noCompositionHtml):
   a dashed slot, nothing to open. */
.feat-asset-row.is-composition.is-missing,
.feat-asset-row.is-composition.is-missing:hover {
  cursor: default;
  background: transparent;
  border: 1px dashed rgba(52, 152, 219, 0.45);
}

/* Its icon and text in the composition blue, a little see-through (it's
   a slot, not a composition yet). */
.feat-asset-row.is-composition.is-missing .feat-asset-grip,
:is(.creative-preview.is-drawer, .feat-ghost.is-drawer-ghost) .feat-asset-row.is-composition.is-missing .feat-asset-name.is-empty {
  color: rgba(52, 152, 219, 0.7);
}

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

.feat-asset-row.is-note:hover,
.feat-asset-row.is-workflow:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #1e1e1e;
}

.feat-asset-row.is-composition .feat-asset-name,
.feat-asset-row.is-note .feat-asset-name,
.feat-asset-row.is-workflow .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 {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}

.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: #2b2b2b;
}

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

.feat-asset-btn.is-error,
.feat-asset-btn.is-error:hover {
  opacity: 1;
  color: rgb(255, 69, 58);
}

.feat-asset-btn.is-busy,
.feat-asset-btn.is-busy:hover {
  background: transparent;
  cursor: default;
}

/* A workflow's {{placeholder}} output IDs, set per draft (planning-board-
   next's draft screen): under the row, an arrow, the placeholder, its ID. */
.feat-asset-row.has-slots {
  flex-wrap: wrap;
  row-gap: 4px;
}

.feat-asset-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 0 100%;
  /* The arrow's stem sits under the middle of the workflow's icon. */
  padding: 2px 0 2px 30.5px;
}

.feat-asset-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: text;
}

.feat-slot-branch {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-muted);
}

.feat-slot-branch svg {
  width: 14px;
  height: 14px;
}

.feat-slot-id {
  flex: 0 0 auto;
  max-width: 45%;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font-id);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feat-slot-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  outline: none;
  background: #0b0b0c;
  color: #fff;
  font-family: var(--font-id);
  font-size: 0.74rem;
}

.feat-slot-input:focus {
  border-color: rgba(255, 255, 255, 0.3);
}

.feat-slot-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.feat-asset-slot.is-unset .feat-slot-input {
  border-color: rgba(230, 184, 79, 0.4);
}

.feat-slot-input.is-invalid {
  border-color: #f07178;
}

/* Draft screen rows end without a chevron: a warning that ends the row
   lines up with the outputs badge other rows end on. */
.creative-preview.is-split .feat-asset-row > .pg-comp-status:is(:last-child, :has(+ .feat-asset-slots)) {
  margin-right: 4px;
}

/* New outputs not opened yet (planning-board-next's draft screen). */
.feat-asset-btn.feat-asset-new {
  /* A square like the outputs count beside it. */
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: #1c3627;
  color: var(--accent);
  cursor: pointer;
}

.feat-asset-btn.feat-asset-new svg {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}

.feat-asset-btn.feat-asset-new:hover {
  background: #1f4b32;
}

.feat-asset-spin {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--action);
  border-radius: 50%;
  animation: feat-spin 0.7s linear infinite;
}

.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: #282828;
}

.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: #191919;
  cursor: pointer;
}

.feat-asset-drop.is-over {
  border-color: var(--action);
  background: #202020;
}

.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: #282828;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.feat-note-close:hover {
  background: #353535;
}

.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: #1b1b1b;
  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: #202020;
}

.ask-chat .ask-chat-compose-rich.feat-note-editor {
  height: auto;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
}

.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-menu.is-floating {
  position: fixed;
  z-index: 2100;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.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,
.feat-import-item.is-active {
  background: #282828;
}

.feat-import-item.is-active {
  background: #2c2c2c;
}

/* Default dropdown (replaces native <select>) */
.feat-dropdown {
  position: relative;
  width: 100%;
}

.feat-dropdown-btn {
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color-scheme: dark;
}

.feat-dropdown-btn:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
}

/* 4% white over the #1e1e1e explore condition. */
.explore-cond .feat-dropdown-btn {
  background: #272727;
}

.feat-dropdown-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.feat-dropdown-btn [data-feat-drop-label] {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feat-dropdown-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.45);
  flex: 0 0 auto;
}

.feat-dropdown-btn[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.feat-dropdown .feat-import-menu {
  z-index: 20;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.feat-dropdown.is-inline {
  width: auto;
  max-width: 7.5rem;
  flex: 0 1 auto;
}

.feat-dropdown.is-inline .feat-dropdown-btn {
  height: auto;
  min-height: 0;
  padding: 2px 16px 2px 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 500;
}

.feat-dropdown.is-inline .feat-import-menu {
  left: 0;
  right: auto;
  min-width: 160px;
  width: max-content;
  max-width: 240px;
}

/* A versioned workflow in a draft's + menu: icon, class, version on one row. */
.feat-import-item.is-version {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.feat-import-item.is-version svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.feat-import-item.is-version > span:not(.feat-import-meta) {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.feat-import-item.is-version .feat-import-meta {
  flex: 0 0 auto;
}

.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: #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
  overflow: visible;
}

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

.explore-cond .feat-dropdown.explore-scope {
  max-width: 7.4rem;
}

.explore-cond .feat-dropdown.explore-scope .feat-dropdown-btn {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
}

.explore-cond .feat-dropdown.explore-op {
  max-width: 3.2rem;
}

.explore-cond .feat-dropdown.explore-op .feat-dropdown-btn {
  font-weight: 600;
  color: var(--action);
}

.explore-cond input.explore-value {
  width: 4.5rem;
  padding: 2px 4px;
  border-radius: 6px;
  background: #141414;
  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: #303030;
}

.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: #171717;
}

.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: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

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

/* Same 4% white lift, solid over the lighter rows it also sits in. */
.settings-account .explore-btn:not(.explore-btn-primary),
.watch-builder .explore-btn:not(.explore-btn-primary) {
  background: #1e1e1e;
}

.api-key-row .explore-btn:not(.explore-btn-primary) {
  background: #232323;
}

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

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

.explore-btn-primary {
  color: var(--action-text);
  background: var(--action);
  border-color: transparent;
  font-weight: 600;
}

.explore-btn-primary:hover {
  color: var(--action-text);
  background: var(--action-hover);
}

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

.explore-results-panel > .fade-sb-y {
  top: 44px;
}

.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: #171717;
}

.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: #1a1a1a;
  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: #141e24;
}

.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: #1a1a1a;
  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: #232323;
}

.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;
}

.creative-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.delivery-status-btn {
  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;
}

.delivery-status-btn:hover {
  background: #232323;
}

.delivery-status-btn.is-on {
  color: var(--accent);
}

.delivery-status-btn:not(.is-on) {
  color: var(--text-muted);
}

.delivery-status-btn svg {
  width: 16px;
  height: 16px;
}

/* Run / pause on its way to TikTok. */
.delivery-status-btn.is-busy {
  cursor: default;
}

.delivery-status-btn.is-busy:hover {
  background: transparent;
}

.delivery-status-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: feat-spin 0.7s linear infinite;
}

body.delivery-confirm-open {
  overflow: hidden;
}

.delivery-confirm {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.delivery-confirm[hidden] {
  display: none !important;
}

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

.delivery-confirm-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 20px 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: #141414;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.delivery-confirm-msg {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
}

.delivery-confirm-error {
  margin-top: 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #ff6b6b;
}

.delivery-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.delivery-confirm-cancel,
.delivery-confirm-yes {
  appearance: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1d1d1d;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.delivery-confirm-cancel:hover,
.delivery-confirm-yes:hover {
  background: #272727;
}

.delivery-confirm-yes {
  border: none;
  background: var(--action);
  color: var(--action-text);
}

.delivery-confirm-yes:hover {
  background: var(--action-hover);
}

.delivery-confirm-yes.is-pause {
  background: var(--spend);
  color: #fff;
}

.delivery-confirm-cancel:disabled,
.delivery-confirm-yes:disabled {
  opacity: 0.55;
  cursor: default;
}

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(520px, 100%);
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  background: #121212 var(--tile-panel) repeat;
  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: #202020;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  flex-shrink: 0;
}

.watch-close:hover {
  background: #2e2e2e;
  color: #fff;
}

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

.watch-list-wrap,
.watch-builder-wrap {
  position: relative;
  min-height: 0;
}

.watch-list-wrap {
  flex: 1 1 auto;
  overflow: hidden;
}

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

.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: #171717;
}

.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);
  overflow-wrap: anywhere;
}

.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-btns {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  gap: 0;
}

.watch-item-edit,
.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-edit:hover,
.watch-item-del:hover {
  color: #fff;
  background: #2a2a2a;
}

.watch-item-edit svg,
.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: #1b1b1b;
  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: var(--action-text);
  background: var(--action);
  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-streak {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.watch-streak-hours {
  width: 4.2em;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.watch-streak-hours::-webkit-outer-spin-button,
.watch-streak-hours::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.watch-streak-unit {
  color: var(--text-muted);
}

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

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

.watch-act {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #1c1c1c;
}

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

.watch-act-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

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

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

.watch-act-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.watch-act-field input {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background-color: #121212;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
}

.watch-act-field .feat-dropdown-btn {
  height: 36px;
  font-size: 0.85rem;
  font-weight: 500;
  background: #121212;
  border-color: var(--border);
  border-radius: 8px;
}

.watch-act-field input:focus,
.watch-act-field .feat-dropdown-btn:focus {
  outline: none;
  border-color: var(--border-strong);
}

.watch-act-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.watch-add-wrap {
  align-self: flex-start;
}

.watch-add-menu {
  position: fixed;
  z-index: 1200;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #1a1a1a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.watch-add-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}

.watch-add-menu-item:hover {
  background: #2c2c2c;
}

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

.watch-add-cond {
  align-self: flex-start;
}

.watch-dialog .watch-builder-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.watch-dialog .watch-builder {
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
  border-top: none;
}

.watch-list-wrap .fade-sb-y,
.watch-builder-wrap .fade-sb-y {
  top: 8px;
  bottom: 8px;
  right: 4px;
}

.watch-dialog[data-mode="list"] .watch-builder-wrap,
.watch-dialog[data-mode="list"] .watch-create-actions {
  display: none;
}

.watch-dialog[data-mode="create"] .watch-list-wrap,
.watch-dialog[data-mode="create"] .watch-add-bar {
  display: none;
}

.watch-add-bar,
.watch-create-actions,
.watch-dialog .watch-status {
  flex-shrink: 0;
  padding: 10px 14px 14px;
}

.watch-add-open,
.watch-dialog .watch-save {
  width: 100%;
  justify-content: center;
}

.settings-watch-builder.watch-builder {
  border-top: none;
}

.settings-section .watch-builder-actions {
  margin-top: 10px;
}

.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;
}

/* ---- Genealogies tab ---- */
.main.genealogies-main {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
}

.genealogies-main .genealogies-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.genealogies-main .drafts-head {
  flex: 0 0 auto;
}

.genealogies-main .lin-graph {
  flex: 0 0 auto;
  overflow: visible;
}

.genealogies-main .lin-panel {
  margin: 14px 16px 14px 0;
}

.lin-seg {
  padding: 2px;
  border-radius: 10px;
}

.lin-seg .settings-seg-btn {
  flex: 0 0 auto;
  padding: 5px 10px;
  font-size: 0.76rem;
  border-radius: 8px;
}

.lin-select {
  appearance: none;
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color-scheme: dark;
  cursor: pointer;
}

.lin-graph {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lin-lane {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #151515;
  overflow: hidden;
}

.lin-lane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}

.lin-lane.is-collapsed .lin-lane-head {
  border-bottom: none;
}

.lin-lane-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lin-lane-toggle:hover .lineage-id,
.lin-lane-toggle:focus-visible .lineage-id {
  color: #fff;
}

.lin-lane.is-collapsed .lin-lane-toggle .ag-group-chevron {
  transform: rotate(-90deg);
}

.lin-lane.is-collapsed .lin-track-wrap {
  display: none;
}

.lin-lane-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin-left: auto;
}

.lin-lane-settings {
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
}

.lin-lane-settings:hover,
.lin-lane-settings:focus-visible {
  color: #fff;
  background: #282828;
}

.lin-lane-settings svg {
  width: 14px;
  height: 14px;
}

.lin-track-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}

.lin-track-wrap.is-vertical {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.lin-track.is-vertical {
  min-width: 0;
  width: 100%;
}

.lin-track.is-vertical .lin-node {
  cursor: default;
}

.lin-track {
  position: relative;
  min-width: 100%;
}

.lin-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}

.lin-edge {
  fill: none;
  stroke: #4a4a4a;
  stroke-width: 2;
}

.lin-edge.is-pending,
.lin-edge.is-planning {
  stroke-dasharray: 0 6;
  stroke-linecap: round;
}

.lin-edge.is-pending {
  stroke: #6e6e6e;
  stroke-width: 1.5;
  stroke-dasharray: 9 8;
}

.lin-edge.is-planning {
  stroke: #4a4a4a;
}

.lin-edge.is-winner { stroke: #2ecc71; }

.lin-node {
  position: absolute;
  z-index: 2;
  appearance: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  width: max-content;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  --lin-node-bg: #161616;
  background: var(--lin-node-bg);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.lin-node:hover {
  border-color: rgba(255, 255, 255, 0.3);
  --lin-node-bg: #1c1c1c;
}

.lin-node.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.lin-node.is-planning {
  border-style: dashed;
  --lin-node-bg: #101010;
}

.lin-node.is-winner { border-color: rgba(46, 204, 113, 0.55); }

.lin-node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 0;
  min-width: 100%;
}

.lin-node-title.draft-item-name {
  display: flex;
  align-items: baseline;
  flex: 0 0 auto;
  gap: 8px;
  width: max-content;
  min-width: max-content;
  font-size: 0.92rem;
}

.lin-node-title .draft-item-cid {
  flex: 0 0 auto;
  font-size: 0.88rem;
}

.lin-node-title .draft-item-label {
  flex: 0 0 auto;
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
}

.lin-track.is-vertical .lin-node-title.draft-item-name {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.lin-track.is-vertical .lin-node-title .draft-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lin-node-creatives {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 100%;
}

.lin-node-creative {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.lin-node-creative .note-chip.lin-node-chip {
  --lin-chip-icon: 18px;
  display: flex;
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  border-color: rgba(52, 152, 219, 0.4);
  background-color: #1a5276;
  background-origin: border-box;
  background-clip: border-box;
  background-repeat: no-repeat;
  background-position: right center;
  background-size: calc(100% - var(--lin-chip-icon)) 100%;
  background-image: linear-gradient(
    90deg,
    #3498db 0,
    #3498db var(--lin-chip-pct, 0%),
    #1a5276 var(--lin-chip-pct, 0%),
    #1a5276 100%
  );
}

.lin-node-creative .note-chip.lin-node-chip.is-delivering,
.pg-board .lin-node-creative .note-chip.lin-node-chip.is-delivering {
  border-color: rgba(129, 236, 236, 0.75);
  background-image: linear-gradient(
    90deg,
    #81ecec 0,
    #81ecec var(--lin-chip-pct, 0%),
    #1a5276 var(--lin-chip-pct, 0%),
    #1a5276 100%
  );
}

.lin-node-creative .note-chip .note-chip-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-text-stroke: 2.5px var(--lin-node-bg, #161616);
  paint-order: stroke fill;
}

.lin-creative .note-chip .note-chip-label {
  -webkit-text-stroke: 2.5px var(--lin-node-bg, #161616);
  paint-order: stroke fill;
}

.lin-creative .note-chip {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  pointer-events: none;
}

.lin-node-foot {
  margin-top: 2px;
}

.lin-node-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.lin-node-id {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}

.lin-node-change {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 0;
  min-width: 100%;
  min-height: 2.4em;
  font-size: 0.72rem;
  line-height: 1.25;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.lin-node-change.is-empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

.lin-node-change.is-better { color: #5fe39a; }
.lin-node-change.is-worse { color: #ff8a84; }
.lin-node-change.is-same { color: #f0c674; }
.lin-node-change.is-pending { color: var(--text-muted); }

.lin-node-sub {
  width: 0;
  min-width: 100%;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.lin-node-fit {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lin-node-fit.is-pending {
  color: var(--text-muted);
  font-weight: 500;
  font-style: italic;
}

.lin-node-fit:empty,
.lin-node-fit.is-empty {
  display: none;
}

.lin-node-pie {
  --lin-pie: 0;
  display: inline-block;
  width: 0.7lh;
  height: 0.7lh;
  margin-left: 0;
  flex: 0 0 auto;
  align-self: center;
  border-radius: 50%;
  background: conic-gradient(
    #fff 0 calc(var(--lin-pie) * 30deg),
    rgba(255, 255, 255, 0.12) 0
  );
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.08);
}

.lin-node-count {
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.lin-node-takeaways {
  margin-left: 0;
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  border: 1px solid rgba(46, 204, 113, 0.45);
  color: #5fe39a;
}

.lin-node-delta {
  padding: 0 5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lin-node-delta.is-better { color: #5fe39a; }
.lin-node-delta.is-worse { color: #ff8a84; }
.lin-node-delta.is-same { color: #f0c674; }

.lin-verdict {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.lin-verdict.is-better { color: #5fe39a; border-color: rgba(46, 204, 113, 0.5); }
.lin-verdict.is-worse { color: #ff8a84; border-color: rgba(255, 107, 99, 0.5); }
.lin-verdict.is-same { color: #f0c674; border-color: rgba(240, 198, 116, 0.5); }

.lin-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}

.lin-ledger {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lin-ledger-row {
  appearance: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 70px 90px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
}

.lin-ledger-row:hover {
  border-color: var(--border-strong);
  background: #1e1e1e;
}

.lin-ledger-change {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.lin-ledger-ids {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lin-ledger-arrow {
  opacity: 0.6;
}

.lin-ledger-delta {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lin-ledger-row.is-better .lin-ledger-delta { color: #5fe39a; }
.lin-ledger-row.is-worse .lin-ledger-delta { color: #ff8a84; }
.lin-ledger-row.is-same .lin-ledger-delta { color: #f0c674; }

.lin-ledger-row .lin-verdict {
  justify-self: end;
}

/* Node side panel */
.lin-panel {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #1a1a1a;
  overflow: hidden;
}

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

.lin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
}

.lin-panel-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.lin-panel-title .draft-item-name {
  min-width: 0;
}

.lin-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lin-panel-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.lin-panel-text {
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.lin-panel-text.is-empty,
.lin-panel-review.is-empty {
  color: var(--text-muted);
  font-style: italic;
}

.lin-panel-review {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: left;
  color: inherit;
  cursor: default;
}

.lin-panel-review.day-note-rich.is-empty::before {
  left: 0;
  right: 0;
  top: 0;
}

.lin-panel-review > .note-callout {
  margin: 0;
}

.lin-panel-fitness {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.lin-panel-fit-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lin-panel-fit-value.is-pending {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

.lin-panel-fit-note,
.lin-panel-fit-vs {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.lin-panel-creatives,
.lin-panel-children {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lin-parent-picker {
  position: relative;
}

.lin-parent-picker .feat-import-menu {
  z-index: 20;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.lin-parent-picker .lin-link[aria-expanded="true"] {
  background: #282828;
  border-color: var(--border);
}

.lin-parent-picker .feat-import-item.is-active {
  background: #2c2c2c;
}

.lin-creative,
.lin-link {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.lin-creative:hover,
.lin-link:hover {
  background: #282828;
  border-color: var(--border);
}

.lin-creative-id {
  flex: 0 0 auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.55);
}

.lin-creative-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lin-creative-draft {
  margin-left: auto;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lin-link {
  font-weight: 600;
}

.lin-link-sub {
  font-weight: 500;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lin-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.lin-panel-actions .creative-preview-draft-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  justify-content: center;
}

.lin-panel-actions .creative-preview-draft-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Shared dialogs (new genealogy / edit / fork) */
.lin-dialog-card {
  width: min(440px, 100%);
}

.lin-dialog.is-format-settings .creative-preview-copies-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;
}

.lin-dialog.is-format-settings .pg-gen-title[data-pg-rename-format] {
  cursor: text;
}

.lin-dialog.is-format-settings .creative-preview-copies-title .pg-gen-title-input {
  font: inherit;
  font-weight: 700;
  color: #fff;
}

.lin-dialog.is-format-settings .lin-def-wf-name[data-pg-rename-wf] {
  cursor: text;
}

/* Renameable names are also .pg-gen-title, whose `font: inherit` would
   otherwise undo the list's size and weight. */
.lin-dialog.is-format-settings .lin-def-wf-name.pg-gen-title {
  font-size: 0.86rem;
  font-weight: 600;
}

.lin-dialog.is-format-settings .lin-def-wf-name.is-editing {
  overflow: visible;
}

.lin-dialog.is-format-settings .lin-def-wf-name .draft-item-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lin-dialog.is-format-settings .lin-def-wf-name .pg-gen-title-input {
  display: block;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
}

.lin-dialog.is-lineage-settings .lin-dialog-card {
  width: min(480px, 100%);
}

.lin-dialog.is-lineage-settings .lin-dialog-fields {
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.lin-dialog.is-group-settings .lin-dialog-card {
  width: min(480px, 100%);
}

.lin-dialog.is-group-settings .creative-preview-copies-title {
  display: none;
}

.lin-dialog.is-group-settings .lin-dialog-fields {
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.lin-dialog.is-group-settings .creative-preview-draft-name {
  flex: 0 0 auto;
}

.lin-def-wfs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.lin-def-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 2px;
}

.lin-def-wf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1b1b1b;
  user-select: none;
}

.lin-def-wf.is-sorting {
  opacity: 0.55;
}

.lin-def-grip {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: grab;
}

.lin-def-grip:hover {
  color: #fff;
}

.lin-def-grip svg {
  width: 14px;
  height: 14px;
}

.lin-def-wf-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.lin-def-wf-name {
  appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.lin-def-wf-name:hover:not(.is-missing) {
  color: #fff;
}

button.lin-def-wf-name.is-missing {
  cursor: default;
}

.lin-def-wf-name.is-missing {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}

.lin-def-wf-del {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.lin-def-wf-del:hover {
  color: #fff;
  background: #2d2d2d;
}

.lin-def-wf-del svg {
  width: 14px;
  height: 14px;
}

.lin-def-add-wrap {
  position: relative;
  margin-top: 6px;
}

.lin-def-add-wrap .feat-import-menu {
  z-index: 20;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.lin-dialog-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

.lin-dialog-textarea {
  height: auto;
  min-height: 72px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.4;
  font-weight: 500;
}

.lin-dialog-static {
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.8);
}

.lin-dialog-status {
  color: #ff6b63;
  font-size: 0.8rem;
}

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

.lin-dialog-spacer {
  flex: 1 1 auto;
}

.lin-dialog-danger {
  color: #ff8a84;
}

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

/* ---- 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-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.drafts-review-callout {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #26221a;
  border: 1px solid rgba(240, 198, 116, 0.22);
}

.drafts-review-callout[hidden] {
  display: none !important;
}

.drafts-review-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #f0c674;
  margin-bottom: 8px;
}

.drafts-review-ads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.drafts-review-ad {
  border: none;
  background: transparent;
  padding: 0;
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.drafts-review-ad:hover {
  color: #f0c674;
}

/* ---- Notes tab: gutter of notes + the selected note filling the right ---- */
.main.notes-main {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
}

.notes-main .notes-panel {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.notes-panel.is-loading .notes-loading {
  display: flex;
}

.notes-panel.is-loading .notes-workspace {
  visibility: hidden;
  pointer-events: none;
}

.notes-workspace {
  --notes-rail: 257px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.notes-rail {
  flex: 0 0 var(--notes-rail, 257px);
  width: var(--notes-rail, 257px);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface) var(--tile-surface) repeat;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.notes-rail-list {
  gap: 4px;
}

.notes-rail-empty {
  padding: 6px 8px;
}

.notes-rail .pg-rail-title-label {
  font-size: 1.025rem;
}

/* Folders: quiet section headers between docs. */
.notes-folder-add {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.notes-folder-add svg {
  width: 15px;
  height: 15px;
}

.notes-folder-add:hover,
.notes-folder-add:focus-visible {
  color: #fff;
  background: #232323;
  outline: none;
}

/* Hides the gutter down to a strip holding just this toggle. */
.notes-rail-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: -4px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.notes-rail-toggle svg {
  width: 16px;
  height: 16px;
}

.notes-rail-toggle:hover,
.notes-rail-toggle:focus-visible {
  color: #fff;
  background: #232323;
  outline: none;
}

.notes-rail-toggle-open,
.notes-workspace.is-rail-collapsed .notes-rail-toggle-close {
  display: none;
}

.notes-workspace.is-rail-collapsed .notes-rail-toggle-open {
  display: block;
}

.notes-workspace.is-rail-collapsed .notes-rail {
  flex-basis: 40px;
  width: 40px;
}

.notes-workspace.is-rail-collapsed .pg-rail-title > :not(.notes-rail-toggle),
.notes-workspace.is-rail-collapsed .notes-rail-list,
.notes-workspace.is-rail-collapsed .pg-rail-resize {
  display: none;
}

.notes-rail-list {
  position: relative;
}

.notes-folder {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 28px;
  margin-top: 10px;
  padding: 0 4px 0 2px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  user-select: none;
}

.notes-folder:first-child {
  margin-top: 0;
}

.notes-folder:hover {
  color: rgba(255, 255, 255, 0.85);
  background: #171717;
}

.notes-folder-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.notes-folder-toggle svg {
  width: 13px;
  height: 13px;
  transition: transform 0.14s ease;
}

.notes-folder.is-folded .notes-folder-toggle svg {
  transform: rotate(-90deg);
}

.notes-folder .notes-folder-name {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: text;
}

.notes-folder .notes-folder-name.is-editing {
  flex: 1 1 auto;
}

.notes-folder-count {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.4);
}

.notes-folder-remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  opacity: 0;
}

.notes-folder-remove svg {
  width: 12px;
  height: 12px;
}

.notes-folder:hover .notes-folder-remove {
  opacity: 1;
}

.notes-folder-remove:hover {
  color: #fff;
  background: #232323;
}

.notes-folder .notes-folder-new {
  width: 20px;
  height: 20px;
  margin-top: 0;
}

.notes-folder .notes-folder-new svg {
  width: 12px;
  height: 12px;
}

.notes-drop-line {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--action);
  pointer-events: none;
}

.notes-drop-line[hidden] {
  display: none;
}

.notes-item.is-drag-source,
.notes-folder.is-drag-source {
  opacity: 0.35;
}

body.is-notes-rail-dragging,
body.is-notes-rail-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.notes-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  color: #fff;
  cursor: pointer;
  user-select: none;
  outline: none;
}

.notes-item:hover {
  background: #1a1a1a;
}

.notes-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
}

.notes-item.is-on {
  border-color: var(--border-strong);
  background: #1e1e1e;
}

.notes-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.notes-item-bell {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 16px;
  margin: 0 -4px 0 auto;
  color: var(--action);
}

.notes-item-count {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.4);
}

.notes-item-count + .notes-item-bell {
  margin-left: 0;
}

.notes-item-bell svg {
  width: 13px;
  height: 13px;
}

.notes-item .notes-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.notes-item.is-on .notes-item-name {
  cursor: text;
}

/* /pages sit under their doc: one line, indented per level, with a
   corner-down-right marker. */
/* Docs under a folder header sit one step in. */
.notes-item.in-folder {
  --folder-indent: 14px;
  margin-left: var(--folder-indent);
}

.notes-item.is-page {
  margin-top: -12px;
  margin-left: calc(var(--folder-indent, 0px) + var(--page-depth, 1) * 14px);
  padding-top: 5px;
  padding-bottom: 5px;
}

.notes-item.is-page .notes-item-sub {
  display: none;
}

.notes-item.is-page .notes-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 550;
}

.notes-item-page-icon {
  flex: 0 0 auto;
  display: inline-flex;
  margin-left: -2px;
  color: rgba(255, 255, 255, 0.4);
}

.notes-item-page-icon svg {
  width: 14px;
  height: 14px;
}

.notes-item-sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.notes-item-date {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
}

.notes-item-date:empty {
  display: none;
}

.notes-item-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-item-preview.is-empty {
  color: rgba(255, 255, 255, 0.32);
}

.notes-doc {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid) var(--tile-panel) repeat;
}

.notes-outline {
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  max-width: 260px;
  max-height: calc(100% - 96px);
  padding: 6px 4px;
  overflow-y: auto;
  scrollbar-width: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transform: translateY(-50%);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.notes-outline::-webkit-scrollbar {
  display: none;
}

.notes-outline[hidden],
.notes-doc.is-empty .notes-outline {
  display: none;
}

.notes-outline:hover {
  background: #1b1d21;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.notes-outline-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 10px;
  padding: 3px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.notes-outline-pill {
  flex: 0 0 auto;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: #414141;
  transition: background 0.12s ease;
}

.notes-outline-item.is-h2 .notes-outline-pill {
  width: 12px;
}

.notes-outline-item.is-h3 .notes-outline-pill {
  width: 8px;
}

.notes-outline-item.is-active .notes-outline-pill {
  background: #dbdbdb;
}

.notes-outline-label {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-outline-item.is-h2 .notes-outline-label {
  padding-left: 10px;
}

.notes-outline-item.is-h3 .notes-outline-label {
  padding-left: 20px;
}

.notes-outline:hover .notes-outline-item {
  padding-top: 4px;
  padding-bottom: 4px;
}

.notes-outline:hover .notes-outline-label {
  display: block;
}

.notes-outline-item:hover {
  background: #292b2e;
  color: var(--text);
}

.notes-outline-item.is-active .notes-outline-label {
  color: var(--text);
}

@media (max-width: 699px) {
  .notes-outline {
    display: none;
  }
}

.notes-doc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  cursor: text;
}

.notes-doc-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
  /* Full pane width; the right padding keeps text clear of the heading outline. */
  padding: 28px 64px 80px 40px;
  box-sizing: border-box;
}

.notes-doc-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: default;
}

.notes-doc-heading {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Pin and delete, centred on the title's first line (1.5rem x 1.2 + padding). */
.notes-doc-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  height: calc(1.5rem * 1.2 + 2px);
  margin-right: -4px;
}

.notes-doc.is-empty .notes-doc-actions {
  display: none;
}

.notes-doc-action {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.4);
}

.notes-doc-action svg {
  width: 15px;
  height: 15px;
}

.notes-doc-action.is-on,
.notes-doc-action.is-on:hover {
  color: var(--action);
}

.notes-doc-delete:hover {
  color: #ff8a84;
}

.notes-doc-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  overflow-wrap: anywhere;
  margin: 0 -6px;
  padding: 1px 6px;
  border-radius: 6px;
  outline: none;
  cursor: text;
  transition: background 0.12s ease;
}

.notes-doc-title:hover {
  background: #1b1b1b;
}

.notes-doc-title:focus {
  background: #202020;
}

.notes-doc-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* A /page links back to the doc it belongs to, above its title. */
.notes-doc-parent {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  height: 20px;
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  cursor: pointer;
}

.notes-doc-parent[hidden] {
  display: none;
}

.notes-doc-parent:hover {
  color: #fff;
  background: #202020;
}

.notes-doc-parent svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.notes-doc-parent-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-doc-head:has(.notes-doc-parent:not([hidden])) .notes-doc-actions {
  margin-top: 24px;
}

.notes-doc-meta:empty {
  display: none;
}

.notes-doc-body {
  flex: 1 1 auto;
  min-height: 240px;
  padding: 0;
  color: #fff;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.55;
  outline: none;
}

.has-note-blocks {
  position: relative;
}

@media (hover: hover) and (min-width: 700px) {
  .notes-doc-inner.has-note-blocks {
    padding-left: 64px;
  }
}

.note-block-handle {
  position: absolute;
  z-index: 3;
  width: 18px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.28);
  cursor: grab;
  touch-action: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.note-block-handle[hidden] {
  display: none;
}

.note-block-handle svg {
  fill: currentColor;
}

.note-block-handle:hover,
.note-block-handle.is-dragging {
  background: #252525;
  color: rgba(255, 255, 255, 0.7);
}

.note-block-add {
  cursor: pointer;
}

/* Zoom into a heading's section; shown beside the hovered heading, in the
   Notes tab and the float alike. */
.note-block-zoom {
  position: absolute;
  z-index: 3;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.32);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.note-block-zoom[hidden] {
  display: none;
}

.note-block-zoom:hover {
  background: #252525;
  color: rgba(255, 255, 255, 0.8);
}

/* Same look as the AI block x (.note-agent-remove). */
.note-block-removes {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

.note-block-remove {
  position: absolute;
  z-index: 3;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
}

.note-block-remove svg {
  width: 13px;
  height: 13px;
}

.note-block-remove[hidden] {
  display: none;
}

/* Room for that x. */
.note-doc > .note-callout:not(.is-ask),
.note-doc > .note-code {
  padding-right: 36px;
}

.note-doc > .note-table tr:first-child > :last-child {
  padding-right: 32px;
}

.note-block-handle.is-dragging,
body.is-note-block-dragging,
body.is-note-block-dragging * {
  cursor: grabbing !important;
}

body.is-note-block-dragging {
  user-select: none;
}

.note-block-drop {
  position: absolute;
  z-index: 3;
  height: 3px;
  border-radius: 2px;
  background: #5b9cf6;
  pointer-events: none;
}

.note-block-drop[hidden] {
  display: none;
}

.note-block-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  max-height: 140px;
  overflow: hidden;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(40, 40, 44, 0.9);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.55;
  opacity: 0.7;
  pointer-events: none;
  box-sizing: border-box;
}

.is-block-dragging {
  opacity: 0.35;
}

::highlight(note-block-drag) {
  color: rgba(255, 255, 255, 0.3);
}

/* Blocks picked with Ctrl/Cmd-click on the drag handle. */
::highlight(note-block-picked) {
  background-color: rgba(91, 156, 246, 0.28);
}

.day-note-rich .is-block-picked {
  border-radius: 6px;
  background-color: rgba(91, 156, 246, 0.16);
  box-shadow: 0 0 0 2px rgba(91, 156, 246, 0.55);
}

.day-note-rich .note-agent.is-block-drop-target {
  border-color: #5b9cf6;
  background: rgba(91, 156, 246, 0.2);
  box-shadow: inset 0 0 0 2px rgba(91, 156, 246, 0.45);
}

.note-doc h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.note-doc > h1:not(:first-child) {
  margin-top: 2.0em;
}

.note-doc > h1,
.note-doc > h2,
.note-doc > h3 {
  position: relative;
}

.note-doc > h1::before,
.note-doc > h2::before,
.note-doc > h3::before {
  content: "";
  position: absolute;
  left: -20px;
  top: calc(0.6em - 9px);
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background-color: #7d7d7d;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 14px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 14px no-repeat;
  cursor: pointer;
  transition: background-color 0.12s ease, transform 0.12s ease;
}

.note-doc > h1:hover::before,
.note-doc > h2:hover::before,
.note-doc > h3:hover::before {
  background-color: #c4c4c4;
}

.note-doc > .is-collapsed::before {
  transform: rotate(-90deg);
}

.note-fold {
  display: none;
}

/* Sections nest one small step per open heading (set by note-blocks.js);
   it was 24px (14px on narrow screens). */
.note-doc {
  --note-indent: 10px;
}

@media (max-width: 699px) {
  .note-doc {
    --note-indent: 6px;
  }
}

.note-doc > .note-indent {
  display: block;
}

/* A list item's wrapped lines hang past its marker; --list-hang is the
   marker's width plus its margins (see .note-list). */
.note-doc > .note-indent.is-list-line {
  --list-hang: 1.5em;
  --list-level: 0em;
  padding-left: calc(var(--list-level) + var(--list-hang));
  text-indent: calc(-1 * (var(--list-level) + var(--list-hang)));
}

.note-doc > .note-indent.is-list-line * {
  text-indent: 0;
}

/* Same-day /now lines (note-blocks.js syncNowRuns): a quote line down the
   run, its day above it once rather than in every chip. */
.note-doc > .note-indent.is-list-line.is-now-run {
  border-left: 2px solid rgba(255, 255, 255, 0.14);
  padding-left: calc(var(--list-level) + var(--list-hang) + 0.75em);
}

.note-doc > .note-gap.is-now-run {
  height: 0.3em;
  overflow: hidden;
  border-left: 2px solid rgba(255, 255, 255, 0.14);
}

.note-doc > .is-now-run .note-chip-day {
  display: none;
}

.note-doc > .note-indent.is-now-run-first {
  position: relative;
  margin-top: 1.5em;
}

.note-doc > .note-indent.is-now-run-first::before {
  content: attr(data-now-day);
  position: absolute;
  left: -2px;
  bottom: 100%;
  margin-bottom: 0.25em;
  text-indent: 0;
  /* Type of the /now chips (.note-chip.is-now). */
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  font-weight: 550;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.note-doc > .note-indent.is-list-line:has(.note-list.is-number) { --list-hang: 1.8em; }
.note-doc > .note-indent.is-list-line:has(.note-list.is-todo) { --list-hang: 1.45em; }
.note-doc > .note-indent.is-list-line:has(.note-list[data-level="1"]) { --list-level: 1.5em; }
.note-doc > .note-indent.is-list-line:has(.note-list[data-level="2"]) { --list-level: 3em; }
.note-doc > .note-indent.is-list-line:has(.note-list[data-level="3"]) { --list-level: 4.5em; }

/* A collapsed heading's break is folded away with its section; add its gap back
   (one body line: 0.94rem * 1.55). */
.note-doc > .is-collapsed {
  margin-bottom: calc(0.15em + 0.94rem * 1.55);
}

.note-doc > [data-depth="1"] {
  margin-left: var(--note-indent);
  max-width: calc(100% - var(--note-indent));
}

.note-doc > [data-depth="2"] {
  margin-left: calc(var(--note-indent) * 2);
  max-width: calc(100% - var(--note-indent) * 2);
}

.note-doc > [data-depth="3"] {
  margin-left: calc(var(--note-indent) * 3);
  max-width: calc(100% - var(--note-indent) * 3);
}

/* Viewport culling on big docs: lines off screen skip style, layout and
   paint (sized from their last render, else one line). The first line of a
   /now run is left out: its day label sits above the box and would be
   clipped. */
.note-doc.is-big > .note-indent:not(.is-now-run-first) {
  content-visibility: auto;
  contain-intrinsic-block-size: auto 1.55em;
}

/* Holds the <br> ending a text line; its own line box is the gap between blocks. */
.note-doc > .note-gap {
  display: block;
  user-select: none;
}

.notes-doc-body.is-empty::before {
  left: 0;
  right: 0;
  top: 0;
}

.notes-doc-empty {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.notes-doc-empty svg {
  width: 22px;
  height: 22px;
  opacity: 0.6;
}

.notes-doc.is-empty .notes-doc-scroll {
  display: none;
}

.notes-doc.is-empty .notes-doc-empty {
  display: flex;
}

/* ---- Reports tab: gutter of reports + the selected report on the right ---- */
.reports-doc {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid) var(--tile-panel) repeat;
}

.reports-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px 12px;
}

.reports-controls {
  flex: 0 0 auto;
}

.reports-seg .settings-seg-btn {
  flex: 0 0 auto;
  font-size: 0.78rem;
  padding: 6px 12px;
}

.reports-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reports-body > .state {
  padding: 24px;
}

.reports-legend {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-height: 22px;
  padding: 0 24px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.reports-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  transition: color 0.12s ease;
}

.reports-legend-item.is-hot {
  color: #fff;
}

.reports-legend-swatch {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.reports-track {
  gap: 0;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: hidden;
}

.reports-stack {
  position: relative;
  flex: 0 0 auto;
}

.reports-svg {
  display: block;
}

.reports-stack .reports-notes {
  position: absolute;
  left: 0;
}

.reports-stack .reports-hits {
  bottom: auto;
}

.reports-band {
  transition: opacity 0.12s ease;
}

.reports-area.is-hovering .reports-band:not(.is-hot) {
  opacity: 0.35;
}

.reports-tip-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-weight: 700;
}

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

.reports-tip-members {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.drafts-list .ag-group-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: auto;
  margin-top: 8px;
}

.drafts-list .ag-group-head {
  width: auto;
}

.drafts-list .ag-group-note-line {
  width: auto;
  max-width: 100%;
  padding-left: 28px;
}

.drafts-list .draft-row {
  padding-left: 20px;
}

.drafts-list .ag-group-row:first-child {
  margin-top: 0;
}

.drafts-list .ag-group-header {
  width: auto;
  margin-top: 0;
  padding: 6px 4px 2px;
  flex: 0 1 auto;
  min-width: 0;
}

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

.ag-group-download,
.ag-group-edit {
  appearance: none;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.drafts-list .ag-group-note {
  width: 26px;
  height: 26px;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.45);
}

.drafts-list .ag-group-note:not(.has-notes) {
  opacity: 0.75;
}

.drafts-list .ag-group-note:not(.has-notes):hover {
  opacity: 1;
}

.drafts-list .ag-group-note.has-notes {
  color: var(--text);
  opacity: 1;
}

.drafts-list .ag-group-note.has-notes:hover {
  color: var(--text);
}

/* Genealogies / generations in the drafts list */
.lineage-block {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 18px;
}

.lineage-block:first-child {
  margin-top: 0;
}

.lineage-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px 4px 6px;
  border-bottom: 1px solid var(--border);
}

.lineage-head .ag-group-download {
  margin-top: 0;
}

.lineage-head.is-legacy {
  margin-top: 22px;
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.lineage-head.is-legacy .lineage-legacy-toggle {
  padding: 6px 4px;
}

.lineage-head.is-legacy .lineage-id {
  color: var(--text-muted);
}

.lineage-id {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.lineage-bucket-label {
  font-size: 0.864rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ios);
}

.lineage-desc {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lineage-meta {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.lin-lane-tools .lineage-meta {
  margin-left: 0;
}

.lineage-empty,
.ag-group-empty {
  padding: 8px 4px 4px 20px;
}

.drafts-list .ag-group-row.is-generation {
  margin-top: 6px;
}

.ag-group-add {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 4px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.ag-group-add:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: #1e1e1e;
}

.ag-group-add.pg-draft-expand,
.ag-group-add.pg-draft-expand:hover {
  border: 0;
}

.pg-draft .ag-group-note[data-pg-gen-notes],
.pg-draft .ag-group-note.pg-hydrate-check,
.pg-draft .ag-group-add[data-pg-add-creative] {
  color: rgba(255, 255, 255, 0.55);
}

.pg-draft .ag-group-note[data-pg-gen-notes]:hover,
.pg-draft .ag-group-note.pg-hydrate-check:hover,
.pg-draft .ag-group-add[data-pg-add-creative]:hover {
  color: #fff;
  background: #202020;
}

.ag-group-add svg {
  width: 13px;
  height: 13px;
}

.ag-group-gen,
.pg-gen-id,
.draft-item-cid {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.02em;
}

.ag-group-header .ag-group-name.is-empty {
  font-weight: 500;
  font-style: italic;
  color: rgba(255, 255, 255, 0.38);
}

.ag-group-flask svg {
  width: 14px;
  height: 14px;
}

.ag-group-parent.is-blocked {
  color: #f0c674;
}

.draft-item-name {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.draft-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-item-label.is-empty {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.38);
}

.draft-item-cid.is-empty {
  color: rgba(255, 255, 255, 0.38);
}

.drafts-list .ag-group-row.is-flash > .ag-group-head {
  animation: lineage-flash 1.6s ease-out;
  border-radius: 8px;
}

@keyframes lineage-flash {
  0% { background: rgba(255, 255, 255, 0.14); }
  100% { background: transparent; }
}

.ag-group-download:hover:not(:disabled),
.ag-group-edit:hover {
  background: #232323;
  color: #fff;
}

.ag-group-download:disabled {
  opacity: 0.35;
  cursor: default;
}

.ag-group-download svg,
.ag-group-edit svg {
  width: 14px;
  height: 14px;
}

.ag-group-download.is-busy svg {
  animation: feat-spin 0.8s linear infinite;
}

.composition-export-host {
  position: fixed;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.composition-export-frame {
  width: 640px;
  height: 360px;
  border: 0;
}

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

.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: #1a1a1a;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.draft-item.has-ready {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: default;
}

.draft-item.has-grip {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
  cursor: default;
}

.draft-item.has-grip .feat-asset-grip {
  height: 32px;
}

.draft-row.is-sorting .draft-item {
  opacity: 0.45;
}

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

.draft-item:hover {
  border-color: var(--border-strong);
  background: #1e1e1e;
}

.draft-ready[hidden] {
  display: none !important;
}

.draft-ready {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: #232323;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.draft-ready:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: #2c2c2c;
}

/* Ready to publish: green with a tick. */
.draft-ready[data-state="ready"] {
  background: var(--draft-ready, #3ed67c);
  border-color: var(--draft-ready, #3ed67c);
}

.draft-ready[data-state="ready"]::after {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border: solid #0c0c0c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.draft-ready[data-state="ready"]:hover {
  background: #66e096;
  border-color: #66e096;
}

/* Work in progress: blue with a dash (counts as unmarked). */
.draft-ready[data-state="wip"] {
  background: var(--draft-wip, #5b8def);
  border-color: var(--draft-wip, #5b8def);
}

.draft-ready[data-state="wip"]::after {
  content: "";
  width: 7px;
  height: 2px;
  border-radius: 1px;
  background: #0c0c0c;
}

.draft-ready[data-state="wip"]:hover {
  background: #7aa4f2;
  border-color: #7aa4f2;
}

.draft-ready:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.draft-ready[data-state="ready"]:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.draft-item-open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.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;
}

.draft-export {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -14px -16px 8px;
}

.draft-export[hidden] {
  display: none !important;
}

.draft-export-track {
  height: 6px;
  border-radius: 0;
  overflow: hidden;
  background: #232323;
}

.draft-export-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: inherit;
  background: var(--action);
  transition: transform 0.28s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .draft-export-fill {
    transition: none;
  }
}

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

.feat-head-tabs {
  min-width: 0;
}

/* Tab toggle (tab-toggle.js) — mirrors the sidebar nav's sliding underline. */
.tab-toggle {
  position: relative;
  display: flex;
  align-items: stretch;
  margin-left: -10px;
  min-width: 0;
}

.tab-toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 10px 6px;
  border: none;
  background: transparent;
  color: rgb(120, 120, 129);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.6;
  white-space: nowrap;
  cursor: pointer;
  transition: color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-toggle-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.5;
  color: rgb(91, 91, 100);
  transition: color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-toggle-item:hover {
  color: rgb(166, 166, 174);
}

.tab-toggle-item:hover svg {
  color: rgb(120, 120, 129);
}

.tab-toggle-item.is-on,
.tab-toggle-item.is-on:hover {
  color: rgb(244, 244, 245);
}

.tab-toggle-item.is-on svg {
  color: var(--tab-color, #fff);
}

.tab-toggle-item:focus {
  outline: none;
}

.tab-toggle-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.2);
  outline-offset: -2px;
}

.tab-toggle-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 1px;
  background: var(--tab-indicator-color, #fff);
  transform: translateX(0) scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
  pointer-events: none;
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-toggle-indicator.is-instant {
  transition: none;
}

/* Segmented toggle (seg-toggle.js): options on a track, the chosen one on a
   pill that slides between them. */
.seg-toggle {
  position: relative;
  display: flex;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
}

.seg-toggle-pill {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 0;
  border-radius: 7px;
  background: #313131;
  pointer-events: none;
  will-change: transform, width;
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), width 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.seg-toggle-pill.is-instant {
  transition: none;
}

.seg-toggle-item {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 200ms ease;
}

.seg-toggle-item:hover,
.seg-toggle-item.is-on {
  color: #fff;
}

.seg-toggle-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-toggle-item svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .seg-toggle-pill,
  .seg-toggle-item {
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab-toggle-item,
  .tab-toggle-item svg,
  .tab-toggle-indicator {
    transition: none;
  }
}

.drafts-panel.has-sticky-head {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drafts-panel.has-sticky-head .feat-status,
.drafts-panel.has-sticky-head .drafts-head {
  flex-shrink: 0;
}

.drafts-panel.has-sticky-head .drafts-list,
.drafts-panel.has-sticky-head .comp-lib-host {
  flex: 1 1 auto;
  min-height: 0;
}

.drafts-panel.has-sticky-head .drafts-list {
  overflow: auto;
}

.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: #232323;
}

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

.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[hidden] {
  display: none !important;
}

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

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

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

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

.feat-lib-chip.is-on {
  background: #232323;
}

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

.drafts-panel.is-lib {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drafts-panel.is-lib .drafts-head,
.drafts-panel.is-lib .feat-status {
  flex-shrink: 0;
}

.comp-lib-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #111 var(--tile-sheet) repeat;
}

/* The library fills the panel edge to edge, below the header. */
.drafts-panel.is-lib {
  padding-bottom: 0;
}

.drafts-panel.is-lib .drafts-head {
  margin-bottom: 0;
  padding-bottom: 0;
}

.drafts-panel.is-lib .comp-lib-host {
  margin: 0 -16px;
  border-top: 1px solid var(--border);
}

.comp-lib-host .tb-pop-cols {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.comp-lib-host[hidden] {
  display: none !important;
}

/* ---- Composition library (composition-library.js) ---- */
.clib {
  --clib-sel: #5b8def;
  --clib-warn: #f0c674;
  --clib-danger: #f07178;
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  color: #fff;
  font-size: 13px;
}
.clib [hidden] { display: none !important; }
.clib svg.lucide { width: 15px; height: 15px; stroke-width: 1.8; flex: none; }
.clib kbd {
  font: 10px var(--font-id);
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  color: rgba(255, 255, 255, 0.72);
}

/* Sidebar */
.clib-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  background: #0c0c0c;
}
.clib-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 8px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.clib-side-head .clib-icon-btn { margin-right: -6px; }
.clib-buckets { flex: 1; min-height: 0; overflow-y: auto; }
.clib-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}
.clib-row:hover { background: #161616; color: #fff; }
.clib-row.is-on { background: #1f1f1f; color: #fff; }
.clib-row.is-drop { border-color: var(--clib-sel); background: rgba(91, 141, 239, 0.14); color: #fff; }
.clib-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clib-row-count { color: var(--text-muted); font: 11px var(--font-id); }
.clib-row-hint {
  position: absolute;
  right: 8px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--clib-sel);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.clib-row .clib-row-x {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: none;
  padding: 2px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.clib-row:hover .clib-row-x { display: inline-flex; }
.clib-row:hover .clib-row-x + .clib-row-count { visibility: hidden; }
.clib-row-x:hover { color: #fff; background: #292929; }
.clib-row input {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
  border: 1px solid var(--clib-sel);
  border-radius: 6px;
  background: #000;
  color: #fff;
  font: inherit;
  outline: none;
}
.clib-dot { width: 9px; height: 9px; flex: none; border-radius: 3px; background: var(--c, #888); }
.clib-dot.is-btn { padding: 0; border: 0; cursor: pointer; }
.clib-dot.is-btn:hover { outline: 2px solid #3a3a3a; outline-offset: 2px; }
.clib-swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; padding: 6px 8px 8px; }
.clib-swatch { aspect-ratio: 1; padding: 0; border: 0; border-radius: 5px; background: var(--c); cursor: pointer; }
.clib-swatch.is-on { outline: 2px solid #fff; outline-offset: 2px; }
.clib-icon-btn {
  display: inline-flex;
  padding: 4px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.clib-icon-btn:hover { color: #fff; background: #1f1f1f; }

/* Grid */
.clib-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.clib-scroll {
  position: relative;
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 16px 18px 110px;
  user-select: none;
}
.clib-section + .clib-section { margin-top: 22px; }
.clib-section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  font: 12px var(--font-id);
}
.clib-section-head span { color: var(--text-muted); font-family: var(--font); font-size: 11px; }
.clib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.clib-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 70px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--text-muted);
  text-align: center;
}
.clib-empty svg.lucide { width: 26px; height: 26px; }
.clib-tile { position: relative; border-radius: 12px; cursor: default; }
.clib-tile-media { position: relative; }
.clib-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  isolation: isolate;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0c0c0c;
  transition: box-shadow 0.12s;
}
.clib-thumb.is-audio { background: #1d1829; }
.clib-thumb > svg.lucide { width: 28px; height: 28px; color: #fff; }
.clib-thumb img, .clib-thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.clib-tile:hover .clib-thumb { border-color: var(--border-strong); }
.clib-tile.is-sel .clib-thumb { box-shadow: 0 0 0 2px var(--clib-sel); border-color: transparent; }
.clib-tile.is-dragging { opacity: 0.4; }
.clib-tile.is-flash .clib-thumb { animation: clib-flash 1.2s ease-out; }
@keyframes clib-flash {
  0%, 40% { box-shadow: 0 0 0 3px var(--clib-warn); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.clib-tile.is-busy .clib-thumb { background: #141414; }
.clib-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: clib-spin 0.8s linear infinite;
}
@keyframes clib-spin { to { transform: rotate(360deg); } }
.clib-dur {
  position: absolute;
  right: 7px;
  top: 7px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.55);
  font: 10px var(--font-id);
}
.clib-check {
  position: absolute;
  top: 7px;
  left: 7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.1s;
}
.clib-check svg.lucide { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.clib-tile:hover .clib-check { opacity: 1; }
.clib-tile.is-sel .clib-check { opacity: 1; background: var(--clib-sel); border-color: var(--clib-sel); }
.clib-tile.is-sel .clib-check svg.lucide { opacity: 1; }
.clib-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.72);
  font: 10px var(--font-id);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clib-tile-group {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 64px);
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}
.clib-tile-group svg.lucide { width: 10px; height: 10px; }
.clib-perf {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.62rem;
  font-weight: 700;
}
.clib-perf svg.lucide { width: 10px; height: 10px; }
.clib-perf.is-up { background: rgba(22, 92, 52, 0.9); color: #7ee2a8; }
.clib-perf.is-down { background: rgba(110, 32, 38, 0.9); color: #ffa3a8; }
.clib-perf.is-early { opacity: 0.55; }
.clib-cap {
  padding: 7px 2px 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clib-tag {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border: 0;
  border-radius: 6px;
  background: #222;
  color: #bdbdbd;
  font: inherit;
  font-size: 10.5px;
  line-height: 16px;
  white-space: nowrap;
}
.clib-tag svg.lucide { width: 10px; height: 10px; }
button.clib-tag { cursor: pointer; }
button.clib-tag:hover { background: #2c2c2c; color: #fff; }
.clib-tag.is-on { background: #26324a; color: #fff; }
.clib-tag.is-on button {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  color: #9fb4dd;
  cursor: pointer;
}
.clib-tag.is-on button:hover { color: #fff; }
.clib-tag .clib-row-count { font-size: 10px; }
.clib-menu-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; }
.clib-switch { display: grid; gap: 8px; margin-top: auto; padding: 10px 8px 4px; }
.clib-switch .clib-btn { justify-content: center; }
.clib-marquee {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--clib-sel);
  border-radius: 4px;
  background: rgba(91, 141, 239, 0.12);
  pointer-events: none;
}
.clib-ghost {
  position: fixed;
  top: -200px;
  left: -200px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #5b8def;
  color: #fff;
  font-weight: 600;
}
.clib-ghost svg.lucide { width: 15px; height: 15px; }

/* Audio ring (matches .tb-audio) */
.clib-audio { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.clib-audio audio { display: none; }
.clib-audio-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
}
.clib-audio-btn::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #2f2a3a; }
.clib-audio.is-playing .clib-audio-btn::before { background: #383443; }
.clib-audio-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.clib-audio-track, .clib-audio-prog { fill: none; stroke-width: 2.4; }
.clib-audio-track { stroke: rgba(255, 255, 255, 0.18); }
.clib-audio-prog { stroke: #fff; stroke-linecap: round; }
.clib-audio-icon { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; }
.clib-audio-icon svg.lucide { width: 18px; height: 18px; }

/* Selection bar */
.clib-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 24px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px;
  transform: translateX(-50%);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: #181818;
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.clib-bar-count { padding: 0 10px 0 8px; font-weight: 600; }
.clib-bar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  cursor: pointer;
}
.clib-bar button:hover { background: #2a2a2a; color: #fff; }
.clib-bar button.is-danger:hover { color: var(--clib-danger); }
.clib-bar-sep { width: 1px; height: 18px; margin: 0 4px; background: #2f2f2f; }
.clib-filedrop {
  position: absolute;
  inset: 8px;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 2px dashed var(--clib-sel);
  border-radius: 14px;
  background: rgba(91, 141, 239, 0.1);
  pointer-events: none;
}
.clib-filedrop div { display: grid; justify-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.clib-filedrop svg.lucide { width: 28px; height: 28px; }

/* Inspector */
.clib-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #000;
  color: #fff;
  font: inherit;
  outline: none;
}
.clib-input:focus { border-color: var(--clib-sel); }
.clib-input.is-mono, .clib-mono { font-family: var(--font-id); font-size: 12px; }
.clib-hint { color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
.clib-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: none;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  cursor: pointer;
}
.clib-btn:hover { color: #fff; background: #1d1d1d; }
.clib-btn.is-danger:hover { color: var(--clib-danger); border-color: rgba(240, 113, 120, 0.4); }
.clib-btn.is-red { border-color: transparent; background: var(--clib-danger); color: #0a0a0a; font-weight: 600; }

/* Menu / modal / toast */
.clib-menu {
  position: fixed;
  z-index: 1200;
  width: 240px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #181818;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
}
.clib-menu-title { padding: 6px 8px 4px; color: var(--text-muted); font-size: 11px; }
.clib-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.clib-menu-item:hover { background: #2a2a2a; }
.clib-menu-item .clib-row-count { margin-left: auto; }
.clib-menu-sep { height: 1px; margin: 5px 4px; background: #262626; }
.clib-menu .clib-input { margin: 4px 0 2px; }
.clib-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
}
.clib-modal-card {
  display: grid;
  gap: 12px;
  width: min(400px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #151515 var(--tile-modal) repeat;
}
.clib-modal-card h3 { margin: 0; font-size: 15px; }
.clib-modal-card p { margin: 0; color: rgba(255, 255, 255, 0.72); line-height: 1.5; }
.clib-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.clib-toast {
  position: absolute;
  left: 50%;
  bottom: 74px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  transform: translateX(-50%);
  border-radius: 11px;
  background: #fff;
  color: #0a0a0a;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.clib-toast button {
  padding: 3px 9px;
  border: 0;
  border-radius: 7px;
  background: #ebebeb;
  color: #0a0a0a;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .clib { grid-template-columns: 200px minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .clib { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .clib-side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .clib-side-head { display: none; }
  .clib-buckets { display: flex; flex: none; overflow: visible; }
  .clib-row { white-space: nowrap; }
}

@media (max-width: 860px) {
  /* Lock the document so iOS cannot pan the visual viewport into
     empty space. Inner regions (.sidebar, .scroll-track, lists)
     keep their own overflow and remain the only scroll surfaces. */
  html, body {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .app {
    position: fixed;
    inset: 0;
    flex-direction: column;
    margin: 0;
    width: auto;
    max-width: none;
    min-width: 0;
    height: auto;
    overflow: hidden;
  }

  .workspace-tabs {
    overflow-x: auto;
    min-width: 0;
    touch-action: pan-x;
  }

  .sidebar {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    padding: 0 11px 0 0;
    gap: 0;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid #000;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    touch-action: pan-x;
  }

  .brand {
    padding: 0;
    flex: 0 0 auto;
    position: sticky;
    left: 0;
    z-index: 5;
  }

  .nav-scroll-inner {
    flex-direction: row;
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .nav {
    flex-direction: row;
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .sidebar-foot {
    border: none;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    flex-direction: row;
  }

  .pg-workspace .pg-rail,
  .pg-workspace .pg-rail-resize {
    display: none;
  }

  .notes-workspace .pg-rail-resize {
    display: none;
  }

  .notes-workspace {
    flex-direction: column;
  }

  .notes-rail {
    flex: 0 0 auto;
    width: auto;
    max-height: 38vh;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  }

  .notes-workspace.is-rail-collapsed .notes-rail {
    flex-basis: auto;
    width: auto;
  }

  .notes-doc-inner {
    padding: 18px 16px 60px;
  }

  .main,
  .panel-day,
  .creatives-panel {
    min-width: 0;
    max-width: 100%;
  }

  .panel-day {
    overflow: hidden;
  }

  .scroll-track {
    touch-action: pan-x;
  }

  .creatives-list,
  .drafts-panel {
    touch-action: pan-y;
  }

  .lin-track-wrap {
    touch-action: pan-x pan-y;
  }

  .creatives-head,
  .creative-row,
  .creatives-list .ag-group-header {
    --metric-col: 88px;
    gap: 10px;
    font-size: 0.75rem;
  }

  .creatives-head-name,
  .creative-id,
  .ag-group-id {
    flex-basis: var(--creative-col, 188px);
    width: var(--creative-col, 188px);
  }

  .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(96vh, 980px);
  }

  .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-compare-sheet {
    width: min(420px, 100%);
    max-height: min(96vh, 980px);
    overflow: auto;
  }

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

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

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

@media (max-width: 860px), (pointer: coarse) {
  .planning-panel .pg-canvas,
  .planning-panel .pg-rail-list,
  .planning-panel .pg-draft,
  .planning-panel .pg-rail-head,
  .planning-panel .pg-draft-creative,
  .planning-panel .draft-item,
  .planning-panel .draft-row,
  .planning-panel .lin-node,
  .planning-panel .lin-node-creative,
  .planning-panel [data-pg-creative] {
    touch-action: pan-x pan-y;
  }

  .planning-panel .pg-canvas {
    cursor: default;
  }

  .planning-panel .pg-draft,
  .planning-panel .pg-rail-head {
    cursor: pointer;
  }
}

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

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

.feat-workflow-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-workflow-menu-item:hover {
  background: #242424;
}

/* ---- Composition overlay ---- */
body.composition-editor-open {
  overflow: hidden;
}

body.composition-editor-open .sidebar,
body.composition-editor-open .workspace-tabs {
  display: none !important;
}

.composition-editor {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.composition-editor[hidden] {
  display: none !important;
}

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

.composition-editor-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #111 var(--tile-sheet) repeat;
  border: none;
  border-radius: 0;
  overflow: hidden;
}

.composition-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.composition-editor-head-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
}

.composition-editor-head-text svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

.composition-editor-import-wrap {
  position: relative;
}

.composition-editor.is-readonly .composition-editor-import-wrap {
  display: none;
}

.composition-editor-import,
.composition-editor-export,
.composition-editor-save {
  appearance: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.composition-editor-import {
  background: #242424;
  color: #fff;
}

.composition-editor-import:hover {
  background: #323232;
}

.composition-editor-export {
  background: #fff;
  color: #111;
}

.composition-editor-export:hover {
  background: #f2f2f2;
}

.composition-editor-save {
  background: #fff;
  color: #111;
}

.composition-editor-save:hover:not(:disabled) {
  background: #f2f2f2;
}

.composition-editor-save:disabled {
  opacity: 0.55;
  cursor: default;
}

.composition-editor.is-asset .composition-editor-import-wrap,
.composition-editor.is-asset .composition-editor-export {
  display: none;
}

.composition-editor-import-wrap .feat-import-menu {
  left: auto;
  right: 0;
  top: calc(100% + 6px);
  width: 260px;
  max-width: min(260px, 70vw);
}

.composition-editor-title,
.composition-editor-name {
  font-size: 0.92rem;
  font-weight: 650;
  color: #fff;
}

.composition-editor-name {
  appearance: none;
  width: min(420px, 100%);
  padding: 2px 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  outline: none;
}

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

.composition-editor-name:disabled {
  opacity: 1;
  color: #fff;
}

/* The read-only format (and its icon) is blue, like a draft's composition
   row. */
.composition-editor-head-text:has(.composition-editor-name:disabled),
.composition-editor-head-text .composition-editor-name:disabled {
  color: #3498db;
}
.composition-editor-head-text .composition-editor-name:disabled {
  -webkit-text-fill-color: #3498db;
}

/* An ad's composition: "Class: name", the class in grey like the workflow
   editor's title. */
.composition-editor-class {
  appearance: none;
  flex: 0 0 auto;
  min-width: 3ch;
  max-width: 40%;
  padding: 2px 1px 2px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  outline: none;
  field-sizing: content;
}

.composition-editor-class::placeholder,
.composition-editor-name::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.composition-editor-class:focus {
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.composition-editor-class:disabled {
  opacity: 1;
}

.composition-editor-colon {
  flex: 0 0 auto;
  margin-left: -8px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.composition-editor-name.is-paired {
  flex: 1 1 auto;
  min-width: 0;
}

.composition-editor-status {
  margin: 0 16px;
  padding: 8px 0 0;
  color: #ff6b63;
  font-size: 0.82rem;
  flex-shrink: 0;
}

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

.composition-editor-body {
  position: relative;
  flex: 1;
  min-height: 0;
}

.composition-editor-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  background: var(--surface-solid) var(--tile-panel) repeat;
}

.composition-editor.is-loading .composition-editor-loading {
  display: flex;
}

.composition-editor-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b0b0b;
}

/* ---- Library asset prep overlay ---- */
body.asset-editor-open {
  overflow: hidden;
}

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

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

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

.asset-editor-sheet {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #111 var(--tile-sheet) repeat;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  outline: none;
}

.asset-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.asset-editor-head-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
}

.asset-editor-head-text svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.asset-editor-title {
  color: #fff;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.asset-editor-apply {
  appearance: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: #111;
}

.asset-editor-apply:hover:not(:disabled) {
  background: #f2f2f2;
}

.asset-editor-apply:disabled {
  opacity: 0.45;
  cursor: default;
}

.asset-editor-status {
  margin: 0 16px;
  padding: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.asset-editor-status.error {
  color: #ff6b63;
}

.asset-editor-status[hidden] {
  display: none;
}

.asset-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.asset-editor-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
}

.asset-editor-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 16px;
  gap: 12px;
  border-right: 1px solid var(--border);
}

.asset-editor-stage .tb-trim-frame {
  flex: 1 1 auto;
}

.asset-editor-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.asset-editor-track {
  position: relative;
  height: 36px;
  border-radius: 8px;
  background: #1f1f1f;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.asset-editor-keeps {
  position: absolute;
  inset: 0;
  display: flex;
}

.asset-editor-seg {
  appearance: none;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.45);
  background: #505050;
  cursor: pointer;
}

.asset-editor-seg:last-child {
  border-right: 0;
}

.asset-editor-seg.is-on {
  background: var(--action);
}

.asset-editor-track .tb-trim-playhead {
  z-index: 3;
}

.asset-editor-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.asset-editor-tool {
  appearance: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1f1f1f;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.asset-editor-tool:hover:not(:disabled) {
  background: #2e2e2e;
}

.asset-editor-tool:disabled {
  opacity: 0.4;
  cursor: default;
}

.asset-editor-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.asset-editor-side {
  min-width: 0;
  overflow: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 820px) {
  .asset-editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .asset-editor-stage {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .asset-editor-side {
    max-height: 42%;
  }

  .asset-editor-hint {
    display: none;
  }
}

body.take-workflow-open {
  overflow: hidden;
}

body.take-workflow-open .sidebar {
  visibility: hidden;
  pointer-events: none;
}

.take-workflow:not(.is-popup) .take-workflow-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1650;
  box-sizing: border-box;
  height: var(--workspace-nav-height);
  min-height: var(--workspace-nav-height);
  padding: 9px 11px;
  align-items: center;
  border-bottom: 1px solid #000;
}

.take-workflow:not(.is-popup) .take-workflow-name {
  font-size: 0.79rem;
  max-width: none;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.take-workflow:not(.is-popup) .take-workflow-close {
  width: 30px;
  height: 30px;
}

.take-workflow:not(.is-popup) .take-workflow-close svg {
  width: 16px;
  height: 16px;
}

.take-workflow {
  position: fixed;
  top: var(--workspace-chrome-top, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1600;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background: var(--surface-solid);
}

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

.take-workflow-backdrop {
  display: none;
}

.take-workflow.is-popup {
  top: var(--workspace-chrome-top, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1200;
  padding: 32px;
  align-items: stretch;
  justify-content: stretch;
}

.creative-preview,
.creative-preview-copies,
.creative-compare,
.asset-editor,
.ag-filter-dialog,
.watch-dialog {
  top: var(--workspace-chrome-top, 0px);
}

.creative-preview-sheet,
.creative-compare-sheet {
  max-height: min(96vh, 980px, 100%);
}

.take-workflow.is-popup .take-workflow-backdrop {
  display: block;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.take-workflow.is-popup .take-workflow-sheet {
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.tb-confirm {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

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

.tb-confirm-card {
  width: min(420px, 100%);
  padding: 20px 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: #141414;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.tb-confirm-msg {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
}

.tb-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.tb-confirm-cancel,
.tb-confirm-yes {
  appearance: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1d1d1d;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.tb-confirm-yes {
  border: none;
  background: var(--action);
  color: var(--action-text);
}

.tb-take-info {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

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

.tb-take-info-card {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: #141414;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

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

.tb-take-info-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
}

.tb-take-info-body {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tb-take-info-empty {
  color: var(--text-muted);
  font-size: 0.86rem;
  padding: 12px 0;
}

.tb-take-info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tb-take-info-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tb-take-info-val {
  font-size: 0.88rem;
  color: #eee;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.tb-take-info-copy {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.tb-take-info-copy:hover {
  color: #fff;
  border-color: var(--border-strong);
}

.tb-take-info-copy svg {
  width: 13px;
  height: 13px;
}

.tb-take-info-val.is-long {
  white-space: pre-wrap;
  line-height: 1.45;
  max-height: 240px;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 10px;
  background: #1d1d1d;
}

.tb-take-info-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tb-take-info-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid var(--border);
}

.tb-take-info-thumb img,
.tb-take-info-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tb-take-info-thumb.is-audio {
  width: auto;
  min-width: 72px;
  height: auto;
}

.tb-or-out-wrap {
  position: relative;
  min-height: 32px;
  padding-bottom: 28px;
}

.take-workflow-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid) var(--tile-panel) repeat;
  overflow: hidden;
}

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

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

.take-workflow-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-workflow-name[readonly] {
  cursor: default;
}

.take-workflow-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.take-workflow-title-row .take-workflow-name {
  flex: 1 1 auto;
  min-width: 0;
}

.take-workflow-icon {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.take-workflow-icon.is-custom {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.14);
  background: #1e1e1e;
  color: #fff;
}

.tb-wf-settings-pop .take-workflow-icon.is-custom {
  background: #252525;
}

.take-workflow-icon:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
}

.take-workflow-icon:disabled {
  cursor: default;
  border-color: transparent;
}

.take-workflow-icon svg {
  width: 15px;
  height: 15px;
}

.take-workflow:not(.is-popup) .take-workflow-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.take-workflow:not(.is-popup) .take-workflow-icon svg {
  width: 13px;
  height: 13px;
}

/* The workflow's class name in the editor's head (take-workflow.js
   placeClassControls): read-only, before the workflow's own label. */
.take-workflow-head-class {
  flex: 0 0 auto;
  max-width: 40%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.take-workflow-head-class:empty {
  display: none;
}

.take-workflow-head-class::after {
  content: ":";
}

/* A component (take-workflow.js isComponent) has no class in its head: just
   its own name. */
.take-workflow.is-component .take-workflow-head .take-workflow-icon,
.take-workflow.is-component .take-workflow-head .take-workflow-class,
.take-workflow.is-component .take-workflow-head .take-workflow-colon,
.take-workflow.is-component .take-workflow-head .take-workflow-head-class {
  display: none;
}

/* A class's own copy (opened from the Workflows tab): the class name only,
   not editable; no workflow name after it. */
.take-workflow.is-class-edit .take-workflow-head .take-workflow-name,
.take-workflow.is-class-edit .take-workflow-head .take-workflow-colon {
  display: none;
}

.take-workflow.is-class-edit .take-workflow-head .take-workflow-head-class {
  max-width: none;
  color: var(--text);
}

.take-workflow.is-class-edit .take-workflow-head .take-workflow-head-class::after {
  content: none;
}

.take-workflow-icon-pop {
  position: fixed;
  z-index: 3300;
  width: 292px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #151515 var(--tile-modal) repeat;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.take-workflow-icon-pop[hidden] {
  display: none;
}

.take-workflow-icon-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #1e1e1e;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  outline: none;
}

.take-workflow-icon-search:focus {
  border-color: rgba(255, 255, 255, 0.28);
}

.take-workflow-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 248px;
  overflow-y: auto;
}

.take-workflow-icon-opt {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.take-workflow-icon-opt:hover {
  background: #282828;
  color: #fff;
}

.take-workflow-icon-opt.is-current {
  border-color: rgba(52, 152, 219, 0.6);
  background: #1a2a35;
  color: #fff;
}

.take-workflow-icon-opt svg {
  width: 16px;
  height: 16px;
}

.take-workflow-icon-more {
  grid-column: 1 / -1;
  padding: 6px 4px 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: center;
}

.take-workflow-name[readonly]:focus {
  border-bottom: none;
}

.take-workflow.is-readonly .tb-pop-gen,
.take-workflow.is-readonly .take-workflow-run,
.take-workflow.is-readonly [data-tb-clear-outputs],
.take-workflow.is-readonly [data-tb-delete-node],
.take-workflow.is-readonly [data-tb-delete-template],
.take-workflow.is-readonly [data-tb-duplicate-template],
.take-workflow.is-readonly .tb-media-pin,
.take-workflow.is-readonly .tb-output-id-add,
.take-workflow.is-readonly .tb-output-id-del,
.take-workflow.is-readonly .tb-media-item-del {
  display: none;
}

.take-workflow.is-readonly .tb-pop-body input,
.take-workflow.is-readonly .tb-pop-body textarea,
.take-workflow.is-readonly .tb-pop-body select,
.take-workflow.is-readonly .tb-pop-title {
  pointer-events: none;
  opacity: 0.72;
}

.take-workflow.is-readonly .tb-socket {
  pointer-events: none;
  opacity: 0.4;
}

.take-workflow.is-readonly .tb-take {
  cursor: default;
}

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

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

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

.tb-add-menu-wrap {
  position: fixed;
  z-index: 20;
  width: 280px;
}

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

.tb-add-menu {
  max-height: 420px;
  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-search {
  position: sticky;
  top: -8px;
  z-index: 1;
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: -8px 0 4px;
  padding: 10px 10px;
  border: none;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background: #161616;
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  outline: none;
}

.tb-add-search::placeholder {
  color: var(--text-muted);
}

.tb-add-item[hidden],
.tb-add-kicker[hidden],
.tb-add-empty[hidden] {
  display: none;
}

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

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

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

.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: #242424;
}

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

.take-workflow-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-workflow-close:hover {
  background: #252525;
}

.take-workflow-close[data-tb-delete-template]:hover {
  background: #381c1a;
  color: #ff8a84;
}

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

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

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

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

.tb-zoom-space {
  position: relative;
  box-sizing: border-box;
  min-width: 100%;
  min-height: 100%;
  min-width: 100cqw;
  min-height: 100cqh;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0) 0 0 / 22px 22px,
    var(--surface-solid);
}

.tb-canvas {
  container-type: size;
  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,
    var(--surface-solid);
}

/* Same overlay as the planning board while a workflow loads. */
.tb-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 8;
  align-items: center;
  justify-content: center;
  background: var(--surface-solid) var(--tile-panel) repeat;
}

.take-workflow-body.is-loading .tb-loading {
  display: flex;
}

.take-workflow-body.is-loading .tb-canvas {
  visibility: hidden;
  pointer-events: none;
}

.tb-canvas.is-marquee {
  cursor: crosshair;
  user-select: none;
}

.tb-marquee {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  border: 1px solid var(--action);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

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

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

.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;
  vector-effect: non-scaling-stroke;
}

.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-group-hidden {
  display: none;
}

/* Canvas groups: an open group is a frame behind its members; a collapsed
   group is one card with proxy sockets for the wires that cross it. */
.tb-group {
  position: absolute;
  border-radius: 18px;
  user-select: none;
  touch-action: none;
}

/* The frame paints first (behind its members); its title row sits inside
   the frame above them. Grouping makes room for that row. */
.tb-group.is-open {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  /* See-through on purpose: wires are drawn beneath the nodes layer and
     must show through the frame (a solid fill hides them). */
  background: rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.tb-group.is-open .tb-group-head {
  position: relative;
  z-index: 5;
  height: 32px;
  padding: 0 6px 0 12px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 18px 18px 0 0;
  background: rgba(255, 255, 255, 0.03);
  pointer-events: auto;
  cursor: grab;
}

.tb-group.is-collapsed {
  display: flex;
  flex-direction: column;
  padding: 0 0 8px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: #121212;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

.tb-group.is-dragging,
.tb-group.is-dragging .tb-group-head {
  cursor: grabbing;
}

.tb-group.is-collapsed.is-dragging {
  z-index: 6;
}

.tb-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 6px 0 10px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--text-muted);
}

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

.tb-group-name {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  padding: 3px 4px;
  margin-left: -4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: inherit;
  text-overflow: ellipsis;
}

.tb-group-name:hover:not([readonly]) {
  border-color: rgba(255, 255, 255, 0.08);
}

.tb-group-name:focus {
  outline: none;
  cursor: text;
  border-color: var(--action);
  background: #0b0b0b;
}

.tb-group-count {
  flex-shrink: 0;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #232323;
  font-weight: 600;
  text-align: center;
}

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

.tb-group-btn:hover {
  background: #252525;
  color: var(--text);
}

.tb-group-btn svg {
  width: 14px;
  height: 14px;
}

.tb-group .tb-socket {
  cursor: default;
  pointer-events: none;
}

/* Collapsed: one in and one out socket on a single row, then a status strip. */
.tb-group-ports {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 2px 16px;
}

.tb-group-ports .tb-port-label {
  white-space: nowrap;
}

.tb-group-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 10px 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: #1b1b1b;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tb-group-status > svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}

.tb-group-status-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tb-group-status-verb {
  font-weight: 500;
  opacity: 0.7;
}

.tb-group-status.is-running {
  background: #202020;
  color: var(--text);
}

.tb-group-status.is-done {
  color: #2ecc71;
  background: #15251c;
}

.tb-group-status.is-failed {
  color: #ff6b6b;
  background: #2a1b1b;
}

.tb-group-spinner {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: feat-spin 0.8s linear infinite;
}

.tb-group-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #1c1c1c;
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.tb-group-hint[hidden] {
  display: none;
}

.tb-group-hint:hover {
  background: #242424;
}

.tb-group-hint svg {
  width: 14px;
  height: 14px;
}

.tb-group-hint kbd {
  padding: 1px 5px;
  border-radius: 4px;
  background: #2e2e2e;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.68rem;
}

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

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

.tb-node.is-open {
  border-color: var(--border-strong);
}

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

.tb-node.is-picked::after {
  border-radius: 17px;
}

.tb-take.is-selected::after,
.tb-media-item.is-picked::after {
  border-radius: 13px;
}

.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: 0 0 auto;
  min-height: 0;
  height: auto;
  aspect-ratio: var(--tb-ar, 16 / 9);
  margin: 0 8px;
  border-radius: 10px;
  background: #0a0a0a var(--tile-node) repeat;
  overflow: hidden;
}

.tb-node-text {
  height: 100%;
  padding: 8px 10px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #c8c8c8;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

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

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

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

.tb-port-row.is-out {
  justify-content: flex-end;
  padding: 2px 16px 2px 12px;
}

.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: 6;
  pointer-events: auto;
  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-socket.is-any { background: #2ecc71; }
.tb-socket.is-text { background: #8e8e93; }
.tb-socket.is-node { background: #e67e22; }

.tb-node.is-compare .tb-socket.is-in[data-input="a"] {
  background: #5b9cff;
}

.tb-node.is-compare .tb-socket.is-in[data-input="b"] {
  background: #e74c3c;
}

.tb-node.is-compare {
  width: 432px;
}

/* Workflow nodes read like a collapsed group (status strip for the inner
   run) but keep their own input and output sockets and a solid border. */
.tb-node.is-workflow {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #121212;
}

.tb-node.is-workflow .tb-node-body {
  aspect-ratio: auto;
  margin: 2px 10px 0;
  background: transparent;
  overflow: visible;
}

.tb-node.is-workflow .tb-node-body > .tb-group-status {
  margin: 0;
}

/* Stop control at the end of a running status strip. */
.tb-run-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: -4px -4px -4px auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #323232;
  color: var(--text);
  cursor: pointer;
}

.tb-run-stop:hover {
  background: #4d2f2f;
  color: #ff6b6b;
}

.tb-run-stop:disabled {
  opacity: 0.5;
  cursor: default;
}

.tb-run-stop svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.take-workflow-run.tb-run-stop-wide[hidden] {
  display: none;
}

.tb-node.is-compare .tb-node-body {
  aspect-ratio: 9 / 8;
}

.tb-socket.is-card-node {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  z-index: 7;
}

.take-workflow.is-wiring-node .tb-node.is-node-target .tb-socket.is-card-node,
.tb-node.has-node-in .tb-socket.is-card-node {
  opacity: 1;
  pointer-events: auto;
}

.take-workflow.is-wiring-node .tb-node.is-node-target .tb-socket.is-card-node {
  transform: translateY(-50%) scale(1.35);
}

.tb-wires .tb-wire.is-node,
.tb-wires .tb-wire.is-temp.is-node {
  stroke: #e67e22;
}

.tb-node.is-generate .tb-node-body {
  aspect-ratio: auto;
  height: auto;
  min-height: 0;
  margin: 0 8px 4px;
  background: transparent;
  overflow: visible;
}

.tb-node.is-querycreatives .tb-node-body {
  aspect-ratio: auto;
  height: auto;
  min-height: 0;
  margin: 0 8px 4px;
  background: transparent;
  overflow: visible;
}

.tb-node.is-picker .tb-node-body {
  aspect-ratio: auto;
  height: auto;
  max-height: 220px;
  min-height: 0;
  overflow: auto;
}

.tb-node.is-picker .tb-pick-card {
  height: auto;
}

.tb-node.is-picker .tb-pick-options {
  padding: 6px;
  gap: 4px;
}

.tb-node.is-picker .tb-pick-opt {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 0.75rem;
}

.tb-node.is-picker .take-workflow-strip-empty,
.tb-node.is-picker .tb-miss {
  min-height: 48px;
}

.tb-node.is-switch .tb-node-body {
  aspect-ratio: auto;
  height: auto;
  max-height: 220px;
  min-height: 0;
  overflow: auto;
}

.tb-node.is-switch .tb-pick-card {
  height: auto;
}

.tb-node.is-switch .tb-pick-options {
  padding: 6px;
  gap: 4px;
}

.tb-node.is-switch .tb-pick-opt {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 0.75rem;
}

.tb-node.is-switch .take-workflow-strip-empty {
  min-height: 48px;
}

.tb-sw-pane [data-sw-pick] {
  margin-top: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.tb-sw-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tb-sw-rows:empty {
  display: none;
}

.tb-sw-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tb-sw-row:has(.tb-sw-grip) {
  padding-left: 4px;
}

.tb-sw-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 28px;
  color: var(--text-muted);
  cursor: grab;
  touch-action: none;
}

.tb-sw-grip svg {
  width: 14px;
  height: 14px;
}

.tb-sw-item.is-dragging {
  opacity: 0.45;
}

.tb-sw-item.is-dragging .tb-sw-grip {
  cursor: grabbing;
}

.tb-sw-item.is-drop-before::before,
.tb-sw-item.is-drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--action);
}

.tb-sw-item.is-drop-before::before {
  top: -5px;
}

.tb-sw-item.is-drop-after::after {
  bottom: -5px;
}

/* A choice's typed value, or the wired text when a wire feeds it. */
.tb-sw-val,
.tb-pop-params textarea.take-workflow-field.tb-sw-val {
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  font-size: 0.82rem;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
}

.tb-sw-val.is-wired {
  padding: 7px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow: auto;
}

.tb-sw-val-hint {
  font-style: italic;
}

/* Concat: switch-style rows, each showing the wired clip. */
.tb-cc-row {
  padding-left: 4px;
}

.tb-cc-thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 30px;
  border-radius: 6px;
  background: #0a0a0a;
  object-fit: cover;
  display: block;
}

.tb-cc-thumb.is-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
}

.tb-cc-thumb.is-empty svg {
  width: 14px;
  height: 14px;
}

.tb-cc-sub {
  font-weight: 400;
  color: var(--text-muted);
}

.tb-cc-error {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 8px;
  background: #241a1a;
  color: #fca5a5;
  font-size: 0.8rem;
  line-height: 1.4;
}

.tb-cc-note {
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.tb-cc-add {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.tb-cc-add:hover:not(:disabled) {
  color: #fff;
  background: #1b1b1b;
}

.tb-cc-add:disabled {
  opacity: 0.5;
  cursor: default;
}

.tb-cc-add svg {
  width: 14px;
  height: 14px;
}

.tb-sw-text {
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Same footprint as the comparison card; the grid scrolls inside it. */
.tb-node.is-gallery {
  width: 432px;
}

.tb-node.is-gallery .tb-node-body {
  aspect-ratio: 9 / 8;
  overflow-y: auto;
}

.tb-node.is-gallery .tb-gal-card {
  padding: 8px;
}

.tb-node.is-gallery .tb-gal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* The body's 9:8 --tb-ar must not squash the portrait tiles. */
.tb-node.is-gallery .tb-gal-tile {
  --tb-ar: 9 / 16;
}

.tb-node.is-gallery .take-workflow-strip-empty {
  min-height: 48px;
}

.tb-gal-tile {
  cursor: pointer;
  touch-action: auto;
}

.tb-gal-tile:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.tb-gal-pane .tb-gal-grid {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  padding: 4px 0 8px;
}

.tb-gal-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-gal-pick-media {
  border-radius: 10px;
  overflow: hidden;
}

.tb-gal-pick-media img,
.tb-gal-pick-media video {
  width: 100%;
  display: block;
}

/* Same look as the Query Creatives JSON pane. */
.tb-gal-take {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0a0a;
  color: #d4d4d4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.tb-gen-fire {
  padding: 4px 0 2px;
}

.tb-gen-fire-btn {
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: none;
  border-radius: 10px;
  background: var(--action);
  color: var(--action-text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-gen-fire-btn:hover {
  background: var(--action-hover);
}

.tb-pop-params.tb-gen-pane {
  padding: 16px;
}

.tb-qc-preview {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  height: 100%;
  padding: 10px 8px 8px;
}

.tb-qc-count {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-muted);
}

.tb-qc-pane .explore-conditions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex: none;
}

.tb-qc-pane .explore-cond {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.tb-qc-pane .explore-cond.is-meta .feat-dropdown.explore-op {
  max-width: 7.8rem;
}

.tb-qc-pane .explore-cond input.explore-value.is-text,
.tb-qc-pane .explore-cond .feat-dropdown.explore-value {
  flex: 1 1 8rem;
  min-width: 8rem;
  width: auto;
}

.tb-qc-pane .explore-cond .feat-dropdown.explore-value .feat-dropdown-btn {
  width: 100%;
}

.tb-qc-pane .tb-qc-query {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tb-qc-pane .tb-pop-params-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.tb-qc-run-row {
  flex-shrink: 0;
}

.tb-qc-run-row .take-workflow-run {
  min-height: 39px;
}

.tb-pop-cols:has(.tb-qc-pane) .tb-pop-params,
.tb-pop-cols:has(.tb-qc-pane) .tb-pop-outs {
  flex: 1 1 0;
  width: auto;
}

.tb-qc-json {
  margin: 0;
  min-height: calc(100% - 8px);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0a0a;
  color: #d4d4d4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.tb-gen-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* Wires to a collapsed group recede until the group is hovered. */
.tb-wires .tb-wire.is-grouped {
  opacity: 0.28;
  stroke-width: 1.1;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}

.tb-wires .tb-wire.is-grouped.is-lit {
  opacity: 1;
  stroke-width: 2;
}

.tb-wires .tb-wire.is-grouped.is-lit:not(.is-node) {
  stroke: rgba(255, 255, 255, 0.6);
}

.tb-wires .tb-wire.is-temp {
  stroke: var(--action);
  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-pop-params.tb-lib-pane {
  gap: 10px;
}

.tb-pop-params.tb-lib-pane .tb-media-drop {
  height: auto;
}

.tb-lib-folder {
  position: relative;
  flex: 0 0 auto;
  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-lib-folder-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.tb-lib-folder-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-lib-folder-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.tb-lib-folder-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 9;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #161616;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.tb-lib-folder-menu[hidden] {
  display: none !important;
}

.tb-lib-folder-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tb-lib-folder-pick {
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  cursor: pointer;
}

.tb-lib-folder-pick:hover,
.tb-lib-folder-pick.is-on {
  background: #242424;
}

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

.tb-lib-folder-del:hover {
  color: #fff;
  background: #2d2d2d;
}

.tb-lib-folder-del svg {
  width: 14px;
  height: 14px;
}

.tb-lib-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.tb-lib-modal[hidden] {
  display: none;
}

.tb-lib-modal-card {
  width: min(320px, 100%);
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #141414 var(--tile-card) repeat;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.tb-lib-modal-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.tb-lib-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tb-lib-modal-cancel,
.tb-lib-modal-create {
  appearance: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1d1d1d;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.tb-lib-modal-create {
  border: none;
  background: var(--action);
  color: var(--action-text);
}

.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-lib-folder-btn .is-placeholder {
  color: var(--text-muted);
}

.tb-media-drop.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tb-media-drop.is-drop {
  border-color: rgba(255, 255, 255, 0.4);
  background: #1b1b1b;
}

.tb-media-drop.is-disabled.is-drop {
  border-color: var(--border-strong);
  color: var(--text-muted);
  background: transparent;
}

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

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

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

.tb-url-outs .tb-media-item {
  cursor: default;
  touch-action: auto;
}

.tb-media-item {
  appearance: none;
  position: relative;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #0a0a0a;
  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 2px var(--action);
}

.tb-pop-outs-scroll .tb-media-items,
.tb-pop-outs-scroll .tb-take-grid {
  padding: 4px;
}

.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,
.tb-media-ghost .tb-media-expand {
  display: none;
}

.tb-media-expand {
  appearance: none;
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 6;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  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;
  text-decoration: none;
}

.tb-media-expand:hover {
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
}

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

.tb-media-pin {
  appearance: none;
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 6;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  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-pin:hover,
.tb-media-pin.is-on {
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
}

.tb-media-pin.is-on {
  color: var(--accent);
}

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

.tb-media-ghost .tb-media-pin {
  display: none;
}

.tb-media-info {
  appearance: none;
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 6;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  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-info:hover {
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
}

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

.tb-media-ghost .tb-media-info {
  display: none;
}

.tb-media-item-frame {
  display: block;
  aspect-ratio: var(--tb-ar, 9 / 16);
  overflow: hidden;
  border-radius: inherit;
}

.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-frame .tb-node-text {
  height: 100%;
  padding: 8px 10px;
  font-size: 0.68rem;
  line-height: 1.35;
  -webkit-line-clamp: 10;
}

.tb-media-item-del {
  appearance: none;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 6;
  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-item-edit-wrap {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 7;
}

.tb-media-item-edit {
  appearance: none;
  position: relative;
  top: auto;
  left: auto;
  z-index: auto;
  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-edit:hover {
  background: rgba(0, 0, 0, 0.88);
}

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

.tb-media-item-edit-menu {
  width: 148px;
  max-height: none;
  overflow: visible;
  right: auto;
}

.tb-media-ghost .tb-media-item-edit,
.tb-media-ghost .tb-media-item-edit-wrap,
.tb-media-ghost .tb-media-item-tags {
  display: none;
}

.tb-media-item-tags {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.tb-media-item-tags svg {
  width: 10px;
  height: 10px;
}

/* Position-adjusted hold vs typical, from live creatives (asset-performance.js). */
.tb-media-item-perf {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tb-media-item-perf svg {
  width: 10px;
  height: 10px;
}

.tb-media-item-perf.is-up {
  background: rgba(22, 92, 52, 0.9);
  color: #7ee2a8;
}

.tb-media-item-perf.is-down {
  background: rgba(110, 32, 38, 0.9);
  color: #ffa3a8;
}

.tb-media-item-perf.is-early {
  opacity: 0.55;
}

.tb-lib-tags-card {
  width: min(380px, 100%);
}

.tb-lib-tags-card .tb-output-ids {
  max-height: 180px;
  overflow-y: auto;
}

.tb-lib-tags-add {
  position: relative;
}

.tb-lib-tags-add .feat-import-menu {
  left: 0;
  right: 0;
  top: calc(100% + 4px);
}

.tb-media-preview {
  position: relative;
  width: min(220px, 100%);
  aspect-ratio: var(--tb-ar, 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-preview img,
.tb-media-preview video,
.tb-media-frame img,
.tb-media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
}

.tb-compare-preview {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
}

.tb-compare-preview-side {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: #000;
}

.tb-compare-preview-side.is-a {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.tb-compare-preview-side.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141414;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tb-compare-preview-side img,
.tb-compare-preview-side video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tb-compare-nav {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.tb-compare-step {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.tb-compare-step.is-prev {
  left: 0;
}

.tb-compare-step.is-next {
  right: 0;
}

.tb-compare-step svg {
  width: 14px;
  height: 14px;
  display: block;
}

.tb-compare-step:hover {
  background: rgba(0, 0, 0, 0.78);
}

.tb-compare-nav-index {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  min-width: 28px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: 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: #1e1e1e;
}

.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(--action);
  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: #272727;
}

.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;
  /* Tiled, so Arc draws it evenly (see --tile-surface). */
  background: #121212 var(--tile-panel) repeat;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.tb-pop-card:has(.tb-compare-pane) {
  width: fit-content;
  max-width: min(100%, calc(100vw - 48px));
  height: auto;
  max-height: min(90vh, 860px);
}

.tb-pop-body:has(.tb-compare-pane) {
  flex: 0 1 auto;
  overflow: auto;
}

.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;
  /* Its popups (auto-run, …) open over the takes below, whose outlines and
     pin buttons are positioned. */
  position: relative;
  z-index: 10;
}

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

.tb-pop-title {
  grid-column: 1;
  appearance: none;
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  border: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
  cursor: text;
}

.tb-pop-title:focus {
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.tb-pop-title[readonly] {
  cursor: default;
}

.tb-pop-title[readonly]:focus {
  border-bottom: none;
}

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

/* Workflow icon toggles are white when idle, so "on" stays green. */
.tb-autorun-btn.is-on,
.tb-autorun-btn.is-on:hover {
  color: var(--accent);
}

.tb-autorun-btn.is-error,
.tb-autorun-btn.is-error:hover,
.tb-node.has-autorun-error .tb-node-count {
  color: rgb(255, 69, 58);
}

.tb-node.hide-preview .tb-node-body {
  display: none;
}

.tb-node.hide-preview .tb-node-out {
  min-height: 8px;
}

/* Workflow versions (take-workflow.js syncVersionChip): a chip in the
   editor's header and its popup. */
.tb-wf-version {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tb-wf-version[hidden] {
  display: none;
}

.tb-version-chip {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: #b8b8b8;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tb-version-chip:hover {
  color: #fff;
}

.tb-version-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* The icon draws only its middle third: pulled in so the chip's contents
   look centered. */
.tb-version-chip-icon {
  width: 13px;
  height: 13px;
  margin: 0 -3px 0 -4px;
  flex-shrink: 0;
}

/* The version itself reads in Space Mono, like ids. */
.tb-version-chip > span,
.tb-version-n {
  font-family: var(--font-id);
  font-weight: 400;
}

.tb-version-chip.is-none {
  color: var(--text-muted);
  border-style: dashed;
}

.tb-version-chip.is-edited {
  color: #f5c451;
  border-color: rgba(245, 196, 81, 0.5);
}

.tb-version-chip.is-behind {
  color: #0a0a0a;
  border-color: #5b8def;
  background: #5b8def;
}

.tb-version-pop {
  width: 320px;
}

.tb-version-changes,
.tb-version-history {
  margin: 4px 0 8px;
  padding: 0;
  list-style: none;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #ddd;
}

.tb-version-changes li {
  padding: 2px 0;
  word-break: break-word;
}

/* The exact changes, folded under the summary. */
.tb-version-details {
  margin: -4px 0 8px;
}

.tb-version-details > summary {
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  list-style: none;
}

.tb-version-details > summary::-webkit-details-marker {
  display: none;
}

.tb-version-details > summary:hover {
  color: #fff;
}

.tb-version-details[open] > summary {
  margin-bottom: 2px;
}

.tb-version-details .tb-version-changes {
  max-height: 180px;
  overflow-y: auto;
  color: var(--text-muted);
}

.tb-version-history li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
  color: var(--text-muted);
}

.tb-version-history li.is-on {
  color: #fff;
}

.tb-version-n {
  flex: 0 0 auto;
  font-weight: 700;
}

.tb-version-note-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tb-version-when {
  flex: 0 0 auto;
  font-size: 0.68rem;
}

.tb-version-warn {
  margin: 0 0 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #f5c451;
}

.tb-version-note {
  width: 100%;
  box-sizing: border-box;
  margin: 2px 0 8px;
}

.tb-version-btn {
  width: 100%;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #0a0a0a;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.tb-version-btn.is-danger {
  background: rgb(255, 69, 58);
  color: #fff;
}

.tb-version-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.tb-autorun-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 4;
  width: 280px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a var(--tile-menu) repeat;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

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

.tb-autorun-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.tb-autorun-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0;
  font-size: 0.8rem;
  color: #fff;
  cursor: pointer;
}

.tb-autorun-check input {
  margin-top: 2px;
  accent-color: #fff;
}

.tb-autorun-hint {
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.tb-autorun-inputs .tb-autorun-hint {
  margin: 10px 0 4px;
}

.tb-autorun-every-fields {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
}

.tb-autorun-every-fields input,
.tb-autorun-every-fields select {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #141414;
  color: #fff;
  font-size: 0.8rem;
  padding: 0 8px;
}

.tb-autorun-every-fields input {
  width: 72px;
}

.tb-autorun-every-fields select {
  flex: 1;
  min-width: 0;
}

.tb-pop-head .take-workflow-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 {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.tb-compare-pane {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  border-right: none;
}

.creative-compare-embed {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  display: block;
}

.creative-compare-embed .compare-cols {
  flex: 0 1 auto;
  width: auto;
}

.creative-compare-embed .compare-media {
  --compare-video-h: min(64vh, 520px, calc(90vh - 168px));
}

.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.is-solo {
  flex: 1 1 auto;
  width: auto;
  border-right: none;
}

.tb-text-pane .take-workflow-label {
  flex: 1 1 auto;
  min-height: 0;
}

.tb-text-pane .take-workflow-field-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.tb-text-pane textarea.take-workflow-field {
  flex: 1 1 auto;
  min-height: 220px;
  height: 100%;
  resize: none;
}

.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-workflow-body .fade-sb-y {
  top: 10px;
  bottom: 10px;
  right: 6px;
}

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

.tb-pop-params .take-workflow-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-workflow-field {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1b1b1b;
  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-workflow-field:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  /* Solid (2% white over the card): see Arc note on .tb-pop fields. */
  background: #171717;
  border-color: var(--border);
}

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

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

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

.tb-pop-params.tb-text-pane .take-workflow-label {
  flex: 1 1 auto;
  min-height: 0;
}

.tb-pop-params.tb-text-pane .take-workflow-field-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.tb-pop-params.tb-text-pane textarea.take-workflow-field {
  flex: 1 1 auto;
  min-height: 220px;
  height: 100%;
  resize: none;
}

.tb-prompt-pane .take-workflow-label,
.tb-pop-params.tb-prompt-pane .take-workflow-label {
  flex: 1 1 auto;
  min-height: 0;
}

.tb-prompt-pane .take-workflow-field-wrap,
.tb-pop-params.tb-prompt-pane .take-workflow-field-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.tb-prompt-pane textarea.take-workflow-field,
.tb-pop-params.tb-prompt-pane textarea.take-workflow-field {
  flex: 1 1 auto;
  min-height: 220px;
  height: 100%;
  resize: none;
}

.tb-prompt-hint {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.tb-prompt-out {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #e8e8e8;
  padding: 4px 0 12px;
  user-select: text;
  -webkit-user-select: text;
}

.tb-prompt-fill {
  color: #fff;
  background: #193620;
  border-radius: 3px;
  padding: 0 2px;
}

.tb-prompt-gap {
  color: var(--text-muted);
  font-style: italic;
}

.tb-fmt-pane .take-workflow-label,
.tb-pop-params.tb-fmt-pane .take-workflow-label {
  flex: 1 1 auto;
  min-height: 0;
}

.tb-fmt-pane .take-workflow-field-wrap,
.tb-pop-params.tb-fmt-pane .take-workflow-field-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.tb-fmt-pane textarea.take-workflow-field,
.tb-pop-params.tb-fmt-pane textarea.take-workflow-field {
  flex: 1 1 auto;
  min-height: 220px;
  height: 100%;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  tab-size: 2;
}

.tb-fmt-pane .tb-pop-gen .take-workflow-run {
  flex: 1 1 auto;
}

.tb-pick-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 8px;
}

.tb-pick-opt {
  appearance: none;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  word-break: break-word;
}

.tb-pick-opt:hover {
  background: #202020;
}

.tb-pick-opt.is-on {
  border-color: var(--action);
  background: #16281b;
}

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

.tb-output-ids {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.tb-output-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #1b1b1b;
}

.tb-output-id-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tb-output-id-del:hover {
  color: #fff;
  background: #2d2d2d;
}

.tb-output-id-del svg {
  width: 14px;
  height: 14px;
}

.tb-output-id-add {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.tb-output-id-add .take-workflow-field {
  flex: 1 1 auto;
  min-width: 0;
}

.tb-output-id-add .take-workflow-run {
  flex: 0 0 auto;
}

/* Workflow output ids read in Space Mono: the Output node's IDs, its
   sockets, id badges and the id fields. */
.tb-output-id-row.is-id .tb-output-id-name,
.tb-port-label.is-id,
.tb-output-id-badge,
[data-output-id-input],
[data-qc-id-input] {
  font-family: var(--font-id);
}

/* Id sockets read as inline code: own case, on a black chip. */
.tb-port-label.is-id {
  text-transform: none;
  letter-spacing: normal;
  padding: 1px 5px;
  border-radius: 4px;
  background: #000;
  color: #e6e6e6;
}

.tb-output-id-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 2;
  max-width: calc(100% - 28px);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-pop-params.tb-crop-pane > .take-workflow-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(--action);
  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(--action);
  background: #16281b;
}

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

.tb-pop-gen.tb-crop-bar .take-workflow-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);
}

/* A selection started in a field stays in it: the card's settings and
   Generate bar aren't page text (Arc otherwise grows a drag or select-all in
   the count into the whole column, tinting every other field). */
.tb-pop-params,
.tb-pop-gen {
  -webkit-user-select: none;
  user-select: none;
}

.tb-pop-params :is(input, textarea, [contenteditable="true"]),
.tb-pop-gen :is(input, textarea) {
  -webkit-user-select: text;
  user-select: text;
}

/* Solid field backgrounds (what 4% white over the card's #121212 comes to):
   Arc redraws see-through backgrounds lighter while another field has
   focus, so the card's fields lit up whenever one was clicked. */
.tb-pop :is(.take-workflow-field, .take-workflow-count, .feat-dropdown-btn) {
  background-color: #1b1b1b;
}

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

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

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

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

.tb-pop-params.tb-trim-pane > .take-workflow-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-frame.is-audio {
  flex: 0 0 auto;
  min-height: 96px;
  height: 96px;
}

.tb-trim-frame audio {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.tb-trim-audio-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.tb-trim-audio-mark svg {
  width: 28px;
  height: 28px;
}

.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: #252525;
  touch-action: none;
  cursor: ew-resize;
}

.tb-trim-track.is-wave {
  height: 48px;
}

.tb-trim-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

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

.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-workflow-run {
  flex: 1 1 auto;
}

.tb-pop-params.tb-mute-pane > .take-workflow-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;
}

/* Frame: scrub to a still with a slider and single-frame steps. */
.tb-frame-scrub {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.tb-frame-range {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--action);
}

.tb-frame-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.tb-frame-step:hover {
  background: #202020;
  color: var(--text);
}

.tb-frame-step svg {
  width: 14px;
  height: 14px;
}

.tb-frame-time {
  flex-shrink: 0;
  min-width: 52px;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
}

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

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

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

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

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

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

.tb-speed-frame.is-audio {
  flex: 0 0 auto;
  min-height: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-speed-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tb-speed-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tb-speed-preset {
  appearance: none;
  height: 28px;
  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-speed-preset.is-on {
  border-color: var(--action);
  background: #16281b;
}

.tb-speed-readout {
  flex: 0 0 40px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
}

.tb-pop-gen.tb-speed-bar .take-workflow-run {
  flex: 1 1 auto;
}

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

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

.tb-silence-wave {
  position: relative;
  flex: 0 0 auto;
  height: 96px;
  min-height: 96px;
  border-radius: 12px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-silence-wave-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: inherit;
}

.tb-silence-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tb-silence-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

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

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

.tb-pop-gen.tb-silence-bar .take-workflow-run {
  flex: 1 1 auto;
}

.tb-or-pane .take-workflow-label:last-child {
  flex: 1 1 auto;
  min-height: 0;
}

.tb-or-pane .take-workflow-label:last-child .take-workflow-field-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.tb-or-pane textarea.take-workflow-field {
  flex: 1 1 auto;
  min-height: 160px;
  height: 100%;
  resize: none;
}

.tb-or-pane .tb-pop-gen .take-workflow-run {
  flex: 1 1 auto;
}

.tb-url-pane .tb-url-mode {
  margin-top: 6px;
}

.tb-url-pane .take-workflow-label {
  flex: 0 0 auto;
}

.tb-url-pane .tb-pop-gen .take-workflow-run {
  flex: 1 1 auto;
}

.tb-wf-run-pane .feat-dropdown {
  width: 100%;
}

.tb-wf-run-pane .tb-pop-gen .take-workflow-run {
  flex: 1 1 auto;
}

.tb-or-out {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #e8e8e8;
  padding: 4px 0 12px;
  user-select: text;
  -webkit-user-select: text;
}

.tb-or-out.is-error {
  color: #ff8a80;
}

.tb-pop-params.tb-match-pane > .take-workflow-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-workflow-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-workflow-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.is-solo {
  flex: 1 1 auto;
}

.tb-wf-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tb-wf-group + .tb-wf-group {
  margin-top: 16px;
}

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

.tb-wf-item {
  cursor: default;
  width: 100%;
}

.tb-wf-pane .take-workflow-label {
  flex: 0 0 auto;
}

.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: 4px 16px 16px;
}

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

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

.tb-take.is-selected {
  border-color: var(--border);
}

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

.tb-take-media {
  width: 100%;
  aspect-ratio: var(--tb-ar, 9 / 16);
  background: #0a0a0a;
  overflow: hidden;
  border-radius: inherit;
}

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

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

.take-workflow-run {
  appearance: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: var(--action);
  color: var(--action-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

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

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

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

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

.feat-dropdown.take-workflow-field {
  padding: 0;
  border: none;
  background: transparent;
}

.take-workflow-label .feat-dropdown-btn {
  height: auto;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  border-color: var(--border);
  font-size: 0.82rem;
  font-weight: 500;
}

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

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

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

/* ---- Settings tab ---- */
.settings-panel .feat-status {
  color: var(--accent);
}

.settings-panel .feat-status.error {
  color: #ff6b63;
}

.settings-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
}

.settings-section .feat-strip-label {
  margin-bottom: 2px;
}

.settings-section .feat-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.settings-section .feat-strip-head .feat-strip-label {
  margin-bottom: 0;
}

.settings-auto-apply {
  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;
}

.settings-auto-apply:hover {
  color: #fff;
  background: #232323;
}

.settings-auto-apply:disabled {
  opacity: 0.55;
  cursor: default;
}

.settings-auto-apply svg {
  width: 14px;
  height: 14px;
}

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

.settings-watch-list[hidden],
.settings-watch-add[hidden],
.settings-watch-builder[hidden],
#settingsAutoActions[hidden],
#settingsAutoCancel[hidden] {
  display: none !important;
}

.settings-watch-add {
  width: 100%;
  justify-content: center;
}

.settings-watch-builder {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #151515;
}

#settingsAutoSave {
  margin-left: auto;
}

.settings-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #151515;
}

.settings-account-email {
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-watch-list .watch-item-del {
  width: auto;
  min-width: 28px;
  padding: 0 8px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.settings-watch-list .watch-item-edit {
  width: 28px;
  min-width: 28px;
  padding: 0;
}

.settings-section .login-field {
  width: 100%;
}

.settings-custom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-custom-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.settings-custom-row,
.settings-custom-add {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 6px;
  align-items: start;
}

.settings-custom-add {
  grid-template-columns: 110px 1fr auto;
}

.settings-custom-row input,
.settings-custom-add input,
.settings-custom-row textarea,
.settings-custom-add textarea {
  appearance: none;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
}

.settings-custom-row textarea,
.settings-custom-add textarea {
  min-height: 38px;
  max-height: 280px;
  resize: vertical;
  line-height: 1.35;
  overflow-y: auto;
}

.settings-custom-row .watch-item-del,
.settings-custom-add .explore-btn {
  margin-top: 1px;
}

.settings-custom-row input:focus,
.settings-custom-add input:focus,
.settings-custom-row textarea:focus,
.settings-custom-add textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: #1e1e1e;
}

.settings-custom-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.settings-seg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-seg-row .settings-seg-field {
  min-width: 0;
}

.settings-seg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-seg {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
}

.settings-seg-btn {
  flex: 1;
  appearance: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
}

.settings-seg-btn:hover {
  color: #fff;
}

.settings-seg-btn.is-active {
  color: #fff;
  background: #313131;
}

.settings-fitness-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 1.15fr) minmax(5.2rem, 0.85fr) minmax(5.5rem, 0.95fr) minmax(4.5rem, 0.85fr) minmax(4.5rem, 0.85fr) minmax(4.5rem, 0.85fr);
  gap: 6px;
  align-items: end;
}

.settings-fitness-row.is-custom-recipe .settings-fitness-until,
.settings-fitness-row.is-custom-recipe .settings-fitness-threshold {
  display: none;
}

.settings-fitness-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.settings-fitness-field:focus-within {
  z-index: 2;
}

.settings-fitness-field > span {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.03em;
}

.settings-fitness-row .feat-dropdown-btn {
  height: 37px;
  padding: 0 10px;
  font-size: 0.88rem;
  font-weight: 500;
}

.settings-fitness-num {
  appearance: none;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
}

.settings-fitness-num:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: #1e1e1e;
}

.settings-fitness-num.is-invalid {
  border-color: rgba(248, 113, 113, 0.55);
}

@media (max-width: 560px) {
  .settings-seg-row {
    grid-template-columns: 1fr;
  }

  .settings-fitness-row {
    grid-template-columns: 1fr 1fr;
  }
}

.settings-custom-row .watch-item-del {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
}

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

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

.tb-adjust-frame {
  position: relative;
  flex: 1 1 42%;
  min-height: 160px;
  border-radius: 12px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-adjust-svg {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

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

.tb-adjust-frame .take-workflow-locked {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}

.tb-adjust-controls {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 4px;
}

.tb-adjust-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tb-adjust-reset {
  appearance: none;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.tb-adjust-reset:hover:not(:disabled) {
  color: #fff;
}

.tb-adjust-reset:disabled {
  opacity: 0.4;
  cursor: default;
}

.tb-adjust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.tb-adjust-label {
  flex: 0 0 92px;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-adjust-range {
  flex: 1 1 auto;
  min-width: 0;
  height: 4px;
  margin: 0;
  appearance: none;
  background: #383838;
  border-radius: 99px;
  outline: none;
}

.tb-adjust-range::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: pointer;
}

.tb-adjust-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: pointer;
}

.tb-adjust-num {
  flex: 0 0 48px;
  width: 48px;
  height: 26px;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #1b1b1b;
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  text-align: center;
}

/* Shake preview: clip box sized to the video (shake-card fitView) so the
   transform moves the picture, not the letterbox. */
.tb-shake-view {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

.tb-adjust-frame .tb-shake-view video {
  transform-origin: center;
  will-change: transform;
}

.tb-shake-dice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0 4px;
}

.tb-shake-dice svg {
  width: 16px;
  height: 16px;
}

.tb-pop-gen.tb-adjust-bar .take-workflow-run {
  flex: 1 1 auto;
}

/* ---- Planning tab ---- */
.main.planning-main {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  --pg-live-fill: #060606;
  --pg-draft-fill: var(--surface-solid);
}

.planning-main .planning-panel {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.pg-board-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 8;
  align-items: center;
  justify-content: center;
  background: var(--surface) var(--tile-surface) repeat;
}

.planning-panel.is-loading .pg-board-loading {
  display: flex;
}

.planning-panel.is-loading .pg-canvas-wrap,
.planning-panel.is-loading .pg-draft-focus {
  visibility: hidden;
  pointer-events: none;
}

.pg-board-spinner {
  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;
}

.pg-workspace {
  --pg-rail: 221px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.planning-panel.is-draft-focus .pg-workspace,
.planning-panel.is-draft-focus .pg-canvas-wrap {
  display: none;
}

.pg-rail {
  flex: 0 0 var(--pg-rail, 221px);
  width: var(--pg-rail, 221px);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.pg-rail-resize {
  appearance: none;
  flex: none;
  width: 12px;
  margin: 0 -6px;
  align-self: stretch;
  position: relative;
  z-index: 6;
  padding: 0;
  border: none;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.pg-rail-resize::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}

.pg-rail-resize:hover::after,
.pg-rail-resize:focus-visible::after,
body.is-rail-resizing .pg-rail-resize::after {
  background: #646464;
}

body.is-rail-resizing,
body.is-rail-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.pg-rail-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px 8px;
  font-size: 0.82rem;
  font-weight: 650;
  color: #fff;
  letter-spacing: -0.02em;
}

.pg-rail-title .ag-group-add {
  margin-top: 0;
}

.pg-rail-title-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-rail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pg-rail-gen {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pg-rail-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 6px 8px 6px 6px;
  border-radius: 10px;
  border: 1.5px dashed var(--gen-line, var(--border-strong));
  background: #171717;
  color: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.pg-rail-head:hover {
  border-color: var(--gen-line, rgba(255, 255, 255, 0.28));
}

.pg-rail-head .pg-draft-row {
  flex-wrap: nowrap;
}

.pg-rail-head .pg-gen-title {
  margin-left: 2px;
  font-size: 0.92rem;
  font-weight: 600;
}

.pg-rail-head .ag-group-add,
.pg-rail-head .ag-group-note {
  margin-top: 0;
}

.pg-rail-name {
  appearance: none;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: grab;
  overflow: hidden;
}

.pg-rail-name:hover {
  background: transparent;
}

.pg-rail.is-dragging-chip .pg-rail-name,
.pg-rail.is-dragging-chip .pg-gen-title,
.pg-canvas.is-dragging-chip .pg-gen-title {
  pointer-events: none;
}

.pg-rail.is-dragging-chip .pg-rail-name:hover,
.pg-rail.is-dragging-chip .pg-gen-title:hover,
.pg-canvas.is-dragging-chip .pg-gen-title:hover {
  background: transparent;
}

.pg-rail-name .draft-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
}

.pg-rail-head .pg-node-fork {
  width: 22px;
  height: 22px;
  margin-top: 0;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  color: var(--gen-line, var(--text-muted));
}

.pg-rail-head .pg-node-fork:hover {
  color: color-mix(in srgb, var(--gen-line) 55%, #fff);
  border-color: rgba(255, 255, 255, 0.35);
  background: #252525;
}

.pg-rail-head .pg-node-fork svg {
  width: 13px;
  height: 13px;
}

.pg-rail-exps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pg-rail .pg-draft:hover {
  background: #1c1c1c;
}

.pg-rail.is-dragging-chip .pg-draft:hover:not(.is-drop) {
  background: transparent;
}

.pg-rail.is-lineage-hover .pg-rail-head.is-dimmed,
.pg-rail.is-lineage-hover .pg-draft.is-dimmed {
  opacity: 0.25;
}

.pg-rail.is-lineage-hover .pg-rail-head.is-lineage,
.pg-rail.is-lineage-hover .pg-rail-head.is-lineage-baseline {
  background: #1a1a1a;
}

.pg-rail.is-compatible {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -1px;
}

.pg-rail.is-drop {
  outline: 1px solid rgba(255, 255, 255, 0.7);
  outline-offset: -1px;
}

.pg-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  border: 0;
  overflow: hidden;
  background: var(--pg-draft-fill);
}

.pg-draft-focus {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 18px;
  overflow: auto;
}

.pg-draft-focus[hidden] {
  display: none !important;
}

.pg-draft-focus .pg-export {
  position: sticky;
  margin: -14px -16px 8px;
}

.pg-draft-focus .drafts-head {
  flex: 0 0 auto;
  gap: 10px;
}

.pg-draft-focus-back {
  appearance: none;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-draft-focus-back:hover {
  color: #fff;
  background: #232323;
}

.pg-draft-focus-back svg {
  width: 16px;
  height: 16px;
}

.pg-draft-focus-title {
  appearance: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pg-draft-focus-title:hover {
  background: #1e1e1e;
}

.pg-draft-focus-title .ag-group-gen {
  font-size: 0.82rem;
}

.pg-draft-focus-title .draft-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
  font-weight: 650;
  color: #fff;
}

.pg-draft-focus-title .draft-item-label.is-empty {
  font-weight: 500;
  font-style: italic;
  color: rgba(255, 255, 255, 0.38);
}

.pg-draft-focus .drafts-head-actions .ag-group-add,
.pg-draft-focus .drafts-head-actions .ag-group-download {
  margin-top: 0;
}

.pg-draft-focus-list .draft-row {
  padding-left: 0;
}

.pg-export {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  margin: 0;
}

.pg-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: var(--pg-draft-fill);
  cursor: grab;
}

.pg-canvas.is-panning,
.pg-canvas.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.pg-space {
  position: relative;
}

.pg-board {
  position: relative;
  display: grid;
  grid-template: 1fr / 1fr;
  isolation: isolate;
  width: max-content;
  min-width: 100%;
  transform-origin: 0 0;
  padding: 0;
  overflow: visible;
}

.pg-edges {
  grid-area: 1 / 1;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  overflow: visible;
}

.pg-edges * {
  pointer-events: none !important;
}

.pg-edges path {
  fill: none;
  stroke-width: 2;
  opacity: 0;
}

.pg-edges path.is-active {
  opacity: 1;
}

.pg-edges path.is-active-baseline {
  opacity: 1;
}

.pg-board.is-lineage-hover .lin-node.is-dimmed,
.pg-board.is-lineage-hover .pg-draft.is-dimmed {
  opacity: 0.25;
}

.pg-board.is-lineage-hover .lin-node.is-lineage-baseline,
.pg-board.is-lineage-hover .pg-draft.is-lineage-baseline {
  border-color: color-mix(in srgb, var(--gen-line) 58%, #fff);
}

.pg-board.is-lineage-hover .lin-node.is-lineage-baseline .pg-draft-icon,
.pg-board.is-lineage-hover .pg-draft.is-lineage-baseline .pg-draft-icon {
  color: color-mix(in srgb, var(--gen-line) 58%, #fff);
}

.pg-board-grid {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: flex;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
}

.pg-batch-group {
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 100%;
}

.pg-batch-col {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(295px, 310px);
  align-self: stretch;
  height: 100%;
  min-height: 100%;
  background: var(--pg-live-fill);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.08);
}

.pg-batch-group.is-live .pg-batch-col:first-child {
  box-shadow: none;
}

.pg-batch-col:not(.is-locked) {
  background: var(--pg-draft-fill);
}

.pg-add-batch-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  height: 100%;
  min-height: 100%;
  min-width: 88px;
  background: var(--pg-draft-fill);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.08);
}

.pg-batch-col.is-compatible {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -1px;
}

.pg-batch-col.is-drop {
  outline: 1px solid rgba(255, 255, 255, 0.7);
  outline-offset: -1px;
}

.pg-batch-col.is-insert {
  box-shadow: inset 3px 0 0 #fff;
}

.pg-batch-col.is-incompatible {
  opacity: 0.28;
  filter: grayscale(1);
  pointer-events: none;
}

.pg-batch-col.is-add-batch .pg-batch-head {
  cursor: default;
}

.pg-batch-col.is-add-batch .pg-batch-name.is-add {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  cursor: default;
  pointer-events: none;
}

.pg-batch-col.is-add-batch.is-compatible .pg-batch-name.is-add,
.pg-batch-col.is-add-batch.is-drop .pg-batch-name.is-add {
  color: #fff;
}

.pg-add-batch {
  position: relative;
  z-index: 3;
}

.pg-batch-head {
  grid-column: 1 / -1;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 10px 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: grab;
}

.pg-add-wrap {
  position: relative;
  flex: 0 0 auto;
}

.pg-add-wrap .ag-group-add {
  margin-top: 0;
}

.pg-add-wrap .ag-group-add svg {
  animation: none;
}

.pg-add-wrap .feat-import-menu {
  left: 0;
  right: auto;
  min-width: 168px;
  z-index: 20;
}

.pg-batch-name {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
  cursor: text;
}

.pg-batch-launch {
  flex: 0 0 auto;
  margin-top: 0;
}

.pg-batch-head .ag-group-download {
  flex: 0 0 auto;
  margin-top: 0;
  width: 22px;
  height: 22px;
}

.pg-batch-launch svg {
  animation: none;
}

.pg-unit {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pg-unit.is-gen-break {
  margin-top: 16px;
}

.pg-cell {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
  padding: 4px 8px 10px;
  border: 1px dashed transparent;
}

.pg-cell.is-drop {
  border-color: rgba(255, 255, 255, 0.35);
  background: #191919;
}

.pg-draft {
  position: relative;
  z-index: 4;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1.5px dashed var(--gen-line, var(--border-strong));
  background: #141414;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.pg-draft:hover {
  border-color: var(--gen-line, rgba(255, 255, 255, 0.28));
}

.pg-draft.is-selected {
  border-color: var(--gen-line, #fff);
}

.pg-draft.is-lifted {
  opacity: 0.28;
}

.pg-draft.is-nested {
  width: calc(100% - 10px);
  margin-left: 10px;
  border-color: var(--border-strong);
}

.pg-draft.is-nested:hover,
.pg-draft.is-nested.is-selected {
  border-color: rgba(255, 255, 255, 0.28);
}

.pg-draft.is-refresh .pg-draft-icon,
.pg-draft .pg-draft-icon {
  color: var(--gen-line, var(--text-muted));
}

.pg-draft-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.pg-draft-icon svg,
.pg-draft svg {
  pointer-events: none;
}

.pg-draft-icon svg {
  width: 14px;
  height: 14px;
}

.pg-draft-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 6px;
  row-gap: 1px;
  flex: 1 1 100%;
  min-width: 0;
  width: 100%;
}

.pg-draft.has-creatives {
  flex-wrap: wrap;
  align-items: flex-start;
  padding-bottom: 8px;
}

.pg-draft-creatives {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
}

.pg-draft-creatives .draft-row {
  min-width: 0;
  width: 100%;
}

.pg-draft-creatives .draft-item {
  padding: 5px 8px;
  border-radius: 8px;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.pg-draft-creatives .draft-item-open {
  gap: 0;
  min-width: 0;
  overflow: hidden;
  align-items: stretch;
}

.pg-draft-creatives .draft-item-name {
  display: flex;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.78rem;
}

.pg-draft-creatives .draft-item-cid {
  font-size: 0.72rem;
}

.pg-draft-creatives .draft-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-draft-creatives .draft-ready {
  width: 13px;
  height: 13px;
  border-radius: 3px;
}

.pg-draft .lin-node-creatives {
  flex: 1 1 100%;
  width: 100%;
  margin-top: 4px;
}

.pg-draft .ag-group-add {
  margin-top: 0;
}

.pg-add-batch {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  min-height: 44px;
  min-width: 88px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.pg-add-batch:hover {
  color: #fff;
}

.pg-board .lin-node {
  position: relative;
  z-index: 4;
  left: auto;
  top: auto;
  width: 100%;
  min-width: 0;
  cursor: default;
  pointer-events: auto;
  border-color: var(--gen-line, var(--border-strong));
}

.pg-board .lin-node:hover,
.pg-board .lin-node.is-selected {
  border-color: var(--gen-line, #fff);
}

.pg-board .lin-node-title.draft-item-name {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  column-gap: 6px;
  row-gap: 1px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.pg-board .lin-node-title .lin-node-fit,
.pg-draft.is-experiment-cluster > .pg-draft-row > .lin-node-fit,
.pg-draft.is-experiment-member > .pg-draft-row > .lin-node-fit,
.pg-lineage .pg-draft-row > .lin-node-fit {
  margin-left: auto;
  flex: 0 0 auto;
}

.pg-board .lin-node.is-live .pg-draft-icon {
  color: var(--gen-line, var(--text-muted));
}

.pg-board .lin-node-title .pg-gen-title,
.pg-draft-row .pg-gen-title {
  flex: 1 1 0;
  min-width: 0;
}

.pg-draft-row .pg-gen-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.pg-rail .pg-draft-row {
  align-items: center;
}

.pg-rail .pg-draft-row .pg-gen-title {
  font-size: 0.78rem;
}

.pg-rail .pg-gen-id {
  display: none;
  margin-top: 0;
}

.pg-gen-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pg-gen-title {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  margin: -2px -6px;
  padding: 2px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: inherit;
  overflow: hidden;
}

.pg-gen-id {
  display: block;
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  line-height: 1.25;
}

.pg-board .lin-node-title .pg-gen-title .draft-item-label,
.pg-gen-title .draft-item-label {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-board .ag-group-note,
.pg-rail .ag-group-note,
.pg-draft .ag-group-note {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.pg-ghost {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  opacity: 0.92;
  transform: rotate(2deg);
}

.pg-ghost .lin-node,
.pg-ghost .pg-draft {
  width: 295px;
}

.pg-ghost .pg-draft.is-experiment-cluster {
  width: 100%;
}

.pg-ghost .pg-draft.is-experiment-cluster .pg-draft {
  width: 100%;
}

.pg-ghost .pg-draft.is-experiment-cluster .pg-draft.is-pending-variant {
  width: 100%;
}

.pg-ghost-chip {
  transform: rotate(3deg);
}

.pg-ghost-chip .note-chip {
  position: relative;
  max-width: 220px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  padding: 0 3px 0 0;
  gap: 8px;
  overflow: hidden;
  align-items: center;
}

.pg-ghost-draft .draft-item {
  width: 260px;
  padding: 5px 8px;
  border-radius: 8px;
  gap: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.pg-ghost-draft .draft-item-open {
  gap: 0;
  min-width: 0;
  overflow: hidden;
}

.pg-ghost-draft .draft-item-name {
  display: flex;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.78rem;
}

.pg-ghost-draft .draft-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-ghost-chip .note-chip .note-chip-thumb,
.pg-ghost-chip .note-chip .note-chip-thumb-empty {
  flex: 0 0 calc(1.2em + 10px);
  width: calc(1.2em + 10px);
  height: calc(1.2em + 10px);
  max-width: calc(1.2em + 10px);
  max-height: calc(1.2em + 10px);
  border-radius: 0;
  object-fit: cover;
}

.pg-ghost-chip .note-chip .note-chip-label {
  padding: 5px 0;
}

.pg-board .lin-node-creative,
.pg-board .lin-node-creative .note-chip.lin-node-chip {
  pointer-events: auto !important;
  cursor: pointer;
}

.pg-board .lin-node-creative .note-chip.lin-node-chip {
  --lin-chip-icon: calc(1.2em + 10px);
  position: relative;
  border-radius: 8px;
  padding: 0 3px 0 0;
  gap: 8px;
  overflow: hidden;
  align-items: center;
  border-color: rgba(52, 152, 219, 0.4);
  background-color: #1a5276;
  background-image: linear-gradient(
    90deg,
    #3498db 0,
    #3498db var(--lin-chip-pct, 0%),
    #1a5276 var(--lin-chip-pct, 0%),
    #1a5276 100%
  );
}

.pg-board .lin-node-creative .note-chip.lin-node-chip.is-delivering {
  border-color: rgba(129, 236, 236, 0.75);
  background-image: linear-gradient(
    90deg,
    #81ecec 0,
    #81ecec var(--lin-chip-pct, 0%),
    #1a5276 var(--lin-chip-pct, 0%),
    #1a5276 100%
  );
}

.pg-board .lin-node-creative .note-chip.lin-node-chip .note-chip-thumb,
.pg-board .lin-node-creative .note-chip.lin-node-chip .note-chip-thumb-empty {
  flex: 0 0 calc(1.2em + 10px);
  width: calc(1.2em + 10px);
  height: calc(1.2em + 10px);
  max-width: calc(1.2em + 10px);
  max-height: calc(1.2em + 10px);
  border-radius: 0;
  object-fit: cover;
}

.pg-board .lin-node-creative .note-chip.lin-node-chip .note-chip-label {
  position: relative;
  z-index: 1;
  padding: 5px 0;
}

.pg-board .lin-chip-fit,
.pg-ghost-chip .lin-chip-fit {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  margin: 3px 0;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(8, 8, 8, 0.5);
  color: #fff;
  font-size: 0.72em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
}

.pg-board .lin-chip-fit.is-pending,
.pg-ghost-chip .lin-chip-fit.is-pending {
  color: rgba(255, 255, 255, 0.42);
  font-weight: 600;
}

.pg-board .lin-node-creative .note-chip.lin-node-chip:hover {
  border-color: rgba(255, 255, 255, 0.55);
  filter: brightness(1.18);
}

.pg-board.is-cmd .lin-node-creative .note-chip.lin-node-chip:hover {
  border-color: rgba(52, 152, 219, 0.4);
  filter: none;
}

.pg-board .note-chip.lin-node-chip.is-lifted,
.pg-draft-creatives .draft-item.is-lifted {
  opacity: 0.28;
}

.pg-canvas.is-dragging-chip .pg-draft.is-incompatible,
.pg-canvas.is-dragging-chip .lin-node.is-incompatible,
.pg-rail.is-dragging-chip .pg-draft.is-incompatible {
  opacity: 0.32;
}

.pg-canvas.is-dragging-chip .pg-draft.is-compatible,
.pg-canvas.is-dragging-chip .lin-node.is-compatible,
.pg-rail.is-dragging-chip .pg-draft.is-compatible,
.pg-rail.is-dragging-chip .pg-rail-head.is-compatible {
  opacity: 1;
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -1px;
}

.pg-draft.is-drop,
.pg-draft.is-drop:hover,
.lin-node.is-drop,
.lin-node.is-drop:hover,
.pg-rail-head.is-drop,
.pg-rail-head.is-drop:hover {
  outline: 1px solid rgba(255, 255, 255, 0.7);
  outline-offset: -1px;
  background: #1e1e1e;
}

.pg-node-fork {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-node-fork:hover {
  color: #fff;
  background: #272727;
}

.pg-node-fork svg {
  width: 14px;
  height: 14px;
}

.pg-gen-gear {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-gen-gear:hover {
  color: #fff;
  background: #272727;
}

.pg-gen-gear svg,
.pg-gen-promote svg {
  width: 14px;
  height: 14px;
}

.pg-gen-promote {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-gen-promote:hover {
  color: #fff;
  background: #272727;
}

.pg-creative-preview .creative-preview-title-row {
  display: flex;
}

.pg-lineage {
  position: relative;
  min-height: 100%;
}

.pg-lineage-stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 2px 12px;
}

.pg-lineage .pg-edges {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  overflow: visible;
}

.pg-lineage .pg-edges path {
  fill: none;
  stroke-width: 2;
  opacity: 1;
}

.pg-lineage .lin-node {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  min-width: 0;
  gap: 0;
  padding: 8px 10px;
  cursor: default;
  pointer-events: auto;
  border-color: var(--gen-line, var(--border-strong));
}

.pg-lineage .lin-node:hover,
.pg-lineage .lin-node.is-selected {
  border-color: var(--gen-line, #fff);
}

.pg-lineage .lin-node.is-live .pg-draft-icon {
  color: var(--gen-line, var(--text-muted));
}

.pg-lineage .pg-draft {
  width: 100%;
  cursor: default;
}

.pg-lineage .pg-draft-row .draft-item-name {
  flex: 1 1 auto;
  min-width: 0;
}

.pg-lineage .pg-draft-row .draft-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-lineage .lin-node-fit {
  margin-left: auto;
  flex: 0 0 auto;
}

/* Planning: gutter experiments, variant slots and the rail delete zone
   (ported from the local playground). */
.pg-gen-title[data-pg-rename],
.pg-gen-title[data-pg-rename-format],
.pg-rail-name[data-pg-rename-format],
.pg-variant-title[data-pg-rename-variant],
.pg-gen-title[data-pg-rename-baseline] {
  cursor: text;
}

.pg-gen-title.is-editing {
  overflow: visible;
}

.pg-gen-title-input {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  outline: none;
}

.ag-group-note.is-danger:hover {
  background: #331b1b;
  color: #ff6b6b;
}

.pg-board .pg-hydrate-check {
  color: rgba(255, 255, 255, 0.55);
}

.pg-board .pg-hydrate-check:hover {
  color: #fff;
}

.pg-draft.is-variant-leaf {
  cursor: default;
}

.pg-draft.is-variant-leaf .pg-draft-row {
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.pg-draft.is-variant-leaf .pg-gen-actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.pg-draft.is-variant-leaf .draft-item-name,
.pg-draft.is-variant-leaf .draft-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-draft.is-variant-leaf .pg-variant-id {
  width: 14px;
  min-width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 0.78rem;
  font-weight: 800;
}

.pg-draft-row .pg-variant-id {
  flex: 0 0 auto;
}

.pg-rail-exps .pg-draft.is-insert-before {
  box-shadow: inset 0 2px 0 #fff;
}

.pg-rail-exps .pg-draft.is-insert-after {
  box-shadow: inset 0 -2px 0 #fff;
}

.pg-rail-exps .draft-row.has-variant {
  cursor: grab;
}

.pg-rail-exps .draft-row.has-variant.is-baseline-variant {
  cursor: default;
}

.pg-rail-exps .draft-row.has-variant.is-lifted {
  opacity: 0.28;
}

.pg-rail-exps .draft-row.has-variant.is-insert-before {
  box-shadow: inset 0 2px 0 #fff;
}

.pg-rail-exps .draft-row.has-variant.is-insert-after {
  box-shadow: inset 0 -2px 0 #fff;
}

.pg-variant-id.is-baseline {
  color: var(--gen-line, var(--text-muted));
}

.pg-variant-id .pg-draft-icon,
.pg-variant-id svg {
  width: 12px;
  height: 12px;
  display: block;
}

.pg-draft.is-experiment-locked {
  cursor: default;
}

.pg-draft.is-experiment-cluster {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  padding: 6px 8px 8px;
  cursor: grab;
}

.pg-draft.is-experiment-cluster > .pg-draft-row {
  flex-wrap: nowrap;
  width: 100%;
  padding: 4px 0 6px;
  align-items: center;
}

.pg-draft.is-experiment-cluster.is-live {
  border-style: solid;
  cursor: default;
}

.pg-draft.is-experiment-cluster.is-live .pg-draft.is-experiment-member {
  border-style: solid;
}

.pg-draft.is-experiment-member .lin-node-creatives {
  flex: 1 1 100%;
  width: 100%;
}

.pg-experiment-members {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.pg-draft.is-experiment-member {
  width: 100%;
  margin-left: 0;
  border-color: var(--border-strong);
  cursor: default;
}

.pg-draft.is-experiment-member.is-pending-variant {
  width: 100%;
}

.pg-draft.is-experiment-member:hover,
.pg-draft.is-experiment-member.is-selected {
  border-color: rgba(255, 255, 255, 0.28);
}

.pg-draft.is-experiment-member .pg-draft-row {
  flex-wrap: nowrap;
}

.pg-draft.is-experiment-member .pg-variant-id {
  width: auto;
  min-width: 0.8em;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 0.72rem;
}

.pg-draft.is-experiment-member:not(.is-baseline-member) .pg-variant-id {
  margin-left: 2px;
}

.pg-board .lin-node.is-nested {
  width: calc(100% - 10px);
  margin-left: 10px;
}

.pg-preview-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 12px;
}

.pg-preview-actions .creative-preview-draft-btn {
  min-width: 108px;
}

.draft-item.is-variant-slot {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.pg-variant-title {
  flex: 1 1 auto;
  min-width: 0;
}

.pg-variant-title.is-editing {
  overflow: visible;
  min-width: 0;
  flex: 1 1 auto;
}

.pg-variant-remove {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-right: -3px;
  border: 0;
  border-radius: 5px;
  color: var(--text-muted);
}

.pg-variant-remove:hover {
  border: 0;
  color: #ff6b6b;
  background: #351c1c;
}

.pg-variant-remove svg {
  width: 11px;
  height: 11px;
}

.draft-row.has-variant,
.lin-node-creative.has-variant {
  align-items: center;
  gap: 6px;
}

.draft-row.has-variant .draft-item,
.lin-node-creative.has-variant .note-chip.lin-node-chip {
  flex: 1 1 auto;
  min-width: 0;
}

.draft-row.has-variant .pg-variant-id,
.lin-node-creative.has-variant .pg-variant-id {
  align-self: center;
  width: 12px;
  min-width: 12px;
  flex: 0 0 12px;
  margin-left: 3px;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 0.72rem;
}

.pg-variant-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--pg-variant, var(--gen-line)) 55%, transparent);
  background: color-mix(in srgb, var(--pg-variant, var(--gen-line)) 22%, transparent);
  color: var(--pg-variant, var(--gen-line));
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.lin-dialog.is-variant-builder .lin-dialog-card {
  width: min(480px, 100%);
}

.pg-variant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 8px;
}

.pg-variant-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pg-variant-row .creative-preview-copies-input {
  flex: 1 1 auto;
  min-width: 0;
}

.pg-variant-add {
  width: auto;
  height: 28px;
  padding: 0 10px;
  gap: 6px;
  border-style: dashed;
}

.pg-variant-add span {
  font-size: 0.78rem;
  font-weight: 600;
}

.pg-rail-trash {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 0;
  border: 1.5px dashed rgba(255, 107, 107, 0.42);
  background: #231515;
  color: rgba(255, 150, 146, 0.95);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.pg-rail.is-dragging-trash .pg-rail-trash {
  display: flex;
}

.pg-rail-trash svg {
  width: 16px;
  height: 16px;
}

.pg-rail-trash.is-drop {
  border-color: #ff6b6b;
  background: #451e1e;
  color: #ffd4d0;
}

/* Primary actions without a hover state of their own (white can't brighten). */
.creative-preview-copies-go:hover:not(:disabled),
.tb-confirm-yes:hover:not(:disabled),
.tb-lib-modal-create:hover:not(:disabled),
.take-workflow-run:hover:not(:disabled) {
  background: var(--action-hover);
}

/* ---- Workflows tab: template/pipeline cards with a node-graph thumbnail
   (layout from workflow-preview.js; styled like FYP Radar collections) ---- */
#templateList.wf-grid,
#compositionVersions.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  /* The list fills the panel height (it's the scroller); don't let rows
     stretch to fill it. */
  align-content: start;
  align-items: start;
}

/* Composition cards: the timeline on a plain ground (no dot grid). */
#compositionVersions .wf-thumb {
  background: #0f0f0f;
}

#templateList.wf-grid > .feat-empty,
#compositionVersions.wf-grid > .feat-empty {
  grid-column: 1 / -1;
}

.wf-card {
  position: relative;
  min-width: 0;
}

.wf-card-open {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color 160ms cubic-bezier(0.4, 0, 0.2, 1), transform 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

.wf-card-open:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.wf-card-open:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

/* Workflows tab, Versions (templates.js renderVersions): a class's versions
   on the left, the chosen one on the right. */
/* "N behind" on a version card: opens the update-all dialog. */
.wfv-behind {
  padding: 0;
  border: none;
  background: none;
  color: #5b8def;
  font: inherit;
  cursor: pointer;
}

.wfv-behind:hover {
  text-decoration: underline;
}

.wfv-modal {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

.wfv-modal-card {
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  overflow-y: auto;
  padding: 18px 18px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #1a1a1a var(--tile-menu) repeat;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.wfv-modal-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
}

.wfv-modal-sub {
  margin: 4px 0 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.wfv-modal-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: #ddd;
}

.wfv-modal-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
}

.wfv-modal-list.is-edited {
  color: var(--text-muted);
}

.wfv-modal-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wfv-modal-from {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.wfv-modal-edited {
  margin: 4px 0 6px;
}

.wfv-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.wfv-modal-cancel,
.wfv-modal-go {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.wfv-modal-cancel {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: #ddd;
}

.wfv-modal-go {
  border: none;
  background: #fff;
  color: #0a0a0a;
}

.wfv-modal-go:disabled {
  opacity: 0.5;
  cursor: default;
}

.wfv {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wfv-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wfv-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: #b8b8b8;
  cursor: pointer;
}

.wfv-back:hover {
  color: #fff;
}

.wfv-back svg {
  width: 15px;
  height: 15px;
}

.wfv-title-icon {
  display: inline-flex;
  color: #fff;
}

.wfv-title-icon svg {
  width: 18px;
  height: 18px;
}

/* The class's settings (versions-view.js settingsPopHtml): a gear at the
   head's right opening the editor's settings popup (planning-board-next.css
   .tb-wf-settings / .tb-wf-settings-pop), here for the class. */
.wfv-gear-wrap {
  margin-left: auto;
}

/* On a workflow card (the Workflows sub-tab): top right, over the
   thumbnail; its popup opens under it, above the cards next to it. */
/* .wf-card-scoped: planning-board-next.css (loaded later) makes
   .tb-wf-settings position: relative. */
.wf-card > .wfv-card-gear {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
}

.wf-card > .wfv-card-gear:has(> .tb-wf-settings-pop:not([hidden])) {
  z-index: 30;
}

/* Flipped where hanging right-aligned under the gear would leave the
   screen (versions-view.js placePop). */
.wfv-card-gear > .tb-wf-settings-pop.is-left {
  right: auto;
  left: 0;
}

.wfv-card-gear > .tb-wf-settings-pop.is-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.wfv-card-gear .wfv-gear {
  background: #141414;
}

.wfv-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: #b8b8b8;
  cursor: pointer;
}

.wfv-gear:hover,
.wfv-gear.is-on {
  color: #fff;
  border-color: var(--border-strong);
}

.wfv-gear svg {
  width: 15px;
  height: 15px;
}

/* The class name field, as in the editor's popup (scoped there to
   .take-workflow). */
.wf-versions-host .tb-wf-class-row .take-workflow-class {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  field-sizing: fixed;
  height: 30px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #232323;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
}

.wf-versions-host .tb-wf-class-row .take-workflow-class:focus {
  border-color: rgba(255, 255, 255, 0.28);
}

.wfv-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.wfv-muted {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.wfv-body {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

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

.wfv-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #141414;
  color: #ddd;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.wfv-item:hover {
  border-color: var(--border-strong);
}

.wfv-item.is-on {
  border-color: #fff;
}

.wfv-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wfv-n {
  font-weight: 700;
  color: #fff;
}

.wfv-head-badge {
  padding: 1px 6px;
  border-radius: 4px;
  background: #5b8def;
  color: #0a0a0a;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
}

.wfv-date {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.wfv-note {
  font-size: 0.78rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wfv-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.wfv-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #141414 var(--tile-card) repeat;
}

.wfv-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wfv-detail-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}


.wfv-link {
  padding: 0;
  border: none;
  background: none;
  color: #ddd;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.wfv-thumb {
  aspect-ratio: 2 / 1;
}

.wfv-section-title {
  margin: 4px 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wfv-changes {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #ddd;
}

.wfv-changes li {
  padding: 2px 0;
  word-break: break-word;
}

.wfv-uses-group + .wfv-uses-group {
  margin-top: 8px;
}

.wfv-uses-title {
  margin-bottom: 4px;
  font-size: 0.74rem;
  color: #b8b8b8;
}

.wfv-uses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wfv-use {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: #ddd;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}

.wfv-use:hover {
  border-color: var(--border-strong);
  color: #fff;
}

.wfv-use-where {
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .wfv-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.wf-thumb {
  display: block;
  aspect-ratio: 27 / 14;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.06) 1px, transparent 0) 0 0 / 10px 10px,
    #0f0f0f;
}

.wf-thumb-svg {
  display: block;
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.wf-thumb-wire {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1.25;
}

.wf-thumb-node rect {
  fill: #1b1b1b;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
}

.wf-thumb-node line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

/* Output nodes keep their classic green, as in the editor. */
.wf-thumb-node.is-output rect {
  stroke: var(--accent);
}

.wf-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 0;
}

.wf-name {
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-name {
  align-self: flex-start;
  max-width: 100%;
  margin: -1px -6px;
  padding: 1px 6px;
  border-radius: 6px;
  cursor: text;
  transition: background 120ms ease;
}

.wf-name:hover {
  background: #1e1e1e;
}

/* A workflow card's class icon, before its name. */
.wf-versions-host .wf-name {
  display: flex;
  align-items: center;
  gap: 7px;
}

.wf-name-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: #fff;
}

/* Version cards (Workflows / Compositions → Versions): nothing to rename
   on the card itself (settings are behind its gear), so no lift and no
   editable-looking name. A workflow's card opens its newest version. */
.wf-versions-host .wf-card-open,
.wf-versions-host .wf-card-open:hover {
  transform: none;
}

.wf-versions-host [data-version-kind="workflow"] .wf-card-open,
.wf-versions-host [data-version-kind="workflow"] .wf-card-open .wf-name {
  cursor: pointer;
}

.wf-versions-host .wf-name,
.wf-versions-host .wf-name:hover {
  background: transparent;
  cursor: default;
}

.wf-name-input {
  width: calc(100% + 12px);
  margin: -2px -6px -1px;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: #1e1e1e;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  outline: none;
}

.wf-sub .mono {
  font-family: var(--font-id);
}

/* Reorder handle: appears on hover over the thumbnail's corner. */
.wf-grip {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 22px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.7);
  opacity: 0;
  transition: opacity 160ms ease;
}

.wf-card:hover .wf-grip,
.wf-card.is-sorting .wf-grip {
  opacity: 1;
}

.wf-card.is-sorting .wf-card-open {
  opacity: 0.45;
}

/* ---- Settings → API keys (api-keys.js) ---- */
.api-keys {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-key-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #1a1a1a;
}

.api-key-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  font-size: 0.88rem;
}

.api-key-name {
  flex: 0 0 96px;
  font-weight: 650;
  color: #fff;
}

.api-key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-muted);
}

.api-key-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #535353;
}

.api-key-dot.is-set {
  background: var(--accent);
}

.api-key-account {
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-hint {
  font-family: var(--font-id);
  font-size: 0.8rem;
}

.api-key-when {
  font-size: 0.78rem;
}

.api-key-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.api-key-remove:hover {
  color: var(--spend);
}

.api-key-form {
  display: flex;
  gap: 8px;
}

.api-key-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #232323;
  color: #fff;
  font-family: var(--font-id);
  font-size: 0.82rem;
  outline: none;
}

.api-key-form input:focus {
  border-color: rgba(255, 255, 255, 0.28);
}

.api-key-error {
  font-size: 0.78rem;
  color: #ff8a80;
}

/* ---- Settings layout: section index + grouped cards of label/control rows ---- */
.settings-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 780px);
  justify-content: center;
  gap: 40px;
  padding: 8px 0 80px;
}

.settings-nav {
  position: sticky;
  top: 8px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav a {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 140ms ease, background 140ms ease;
}

.settings-nav a:hover {
  color: #fff;
}

.settings-nav a.is-current {
  color: #fff;
  background: #212121;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-width: 0;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 12px;
}

.settings-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-group-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.settings-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface) var(--tile-surface) repeat;
  overflow: visible;
}

.settings-card-pad {
  padding: 14px;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 16px 18px;
}

.settings-row + .settings-row {
  border-top: 1px solid var(--border);
}

.settings-row.is-stacked {
  grid-template-columns: 1fr;
  gap: 12px;
}

.settings-row-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.settings-row-label label,
.settings-row-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.settings-row-label p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.settings-row-label .mono,
.settings-custom-hint .mono {
  font-family: var(--font-id);
  font-size: 0.92em;
  color: #c7c7cc;
}

.settings-input {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
}

.settings-input.is-mono {
  font-family: var(--font-id);
  font-size: 0.82rem;
}

.settings-input.is-short {
  max-width: 180px;
  justify-self: end;
}

.settings-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: #1e1e1e;
}

.settings-row .settings-seg {
  justify-self: end;
  width: min(100%, 340px);
}

.settings-row[hidden] {
  display: none;
}

.settings-switch {
  appearance: none;
  justify-self: end;
  position: relative;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: #2d2d2d;
  cursor: pointer;
  transition: background 0.15s ease;
}

.settings-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.settings-switch:checked {
  background: #2ecc71;
}

.settings-switch:checked::after {
  transform: translateX(16px);
}

.settings-switch:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}

.settings-row .settings-fitness-row {
  width: 100%;
}

.settings-custom-hint {
  line-height: 1.45;
}

.settings-group .settings-watch-list,
.settings-group .api-keys {
  gap: 8px;
}

@media (max-width: 1000px) {
  .settings-layout {
    grid-template-columns: minmax(0, 780px);
    padding-top: 0;
  }

  .settings-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .settings-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .settings-input.is-short,
  .settings-row .settings-seg {
    justify-self: stretch;
    max-width: none;
    width: 100%;
  }
}

/* Workflow lanes: the lane on screen, picked from a row of chips over the
   canvas. Each chip's dot: grey = not done, amber = running, green = every
   per-lane node has output. */
.tb-lanes {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.tb-lanes[hidden] {
  display: none;
}

.tb-lane,
.tb-lanes-empty {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #1c1c1c;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.tb-lanes-empty {
  cursor: default;
}

.tb-lane:hover {
  color: var(--text);
}

.tb-lane.is-on {
  border-color: #5b9cf2;
  color: var(--text);
}

.tb-lane-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4a4a4a;
}

.tb-lane.is-done .tb-lane-dot {
  background: #3ecf8e;
}

.tb-lane.is-busy .tb-lane-dot {
  background: #f2b84b;
}

/* A node that runs once per lane reads as a small stack. */
.tb-node.is-laned {
  box-shadow: 4px 4px 0 -1px #161616, 4px 4px 0 0 var(--border-strong);
}

.tb-wf-lanes-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
}

/* Local sandbox (scripts/sandbox.js): always visible, so it is never taken
   for prod. */
.sandbox-badge {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 10000;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: #f2b84b;
  color: #1a1204;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: auto;
  cursor: default;
}

/* ExplorerApp.toast: above every screen, clicked away or gone after a few
   seconds. */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 3000;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px;
  transform: translateX(-50%);
  border-radius: 11px;
  background: #fff;
  color: #0a0a0a;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.app-toast[hidden] {
  display: none;
}

/* Input node with one media input: its drop area (empty) or the file. */
.tb-input-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 88px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.tb-input-drop svg {
  width: 18px;
  height: 18px;
}

.tb-input-drop:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.tb-input-drop.has-item {
  min-height: 0;
  border: none;
  overflow: hidden;
}

.tb-input-drop.is-busy {
  cursor: default;
}

.tb-input-drop.is-busy svg {
  animation: feat-spin 0.8s linear infinite;
}

/* Input node with several inputs (or a text one): a builder that edits each
   value on the card. An empty single drop area sizes the body too (not the
   preview's 16:9 box). */
.tb-node-body:has(> .tb-input-drop:not(.has-item)),
.tb-node-body:has(> .tb-input-build) {
  aspect-ratio: auto;
  background: transparent;
  overflow: visible;
}

.tb-input-build {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tb-input-fld {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  border-radius: 10px;
}

.tb-input-fld.is-drop {
  outline: 1px dashed rgba(255, 255, 255, 0.55);
  outline-offset: -1px;
}

.tb-input-fld-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tb-input-text {
  display: block;
  width: 100%;
  box-sizing: border-box;
  field-sizing: content;
  min-height: 34px;
  max-height: 220px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a0a0a;
  color: #eee;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.4;
  resize: none;
  overflow: auto;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.tb-input-text:focus {
  outline: none;
  border-color: var(--border-strong);
}

.tb-input-text::placeholder {
  color: var(--text-muted);
}

.tb-input-fld .tb-input-drop.has-item {
  border-radius: 10px;
  background: #0a0a0a;
}

.tb-input-fld .tb-input-drop.has-item img,
.tb-input-fld .tb-input-drop.has-item video {
  display: block;
  width: 100%;
  height: auto;
}

.tb-input-tiles-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.tb-input-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #0a0a0a;
  overflow: hidden;
}

.tb-input-tile img,
.tb-input-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tb-input-tile.is-add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.tb-input-tile.is-add:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.tb-input-tile.is-add svg {
  width: 16px;
  height: 16px;
}

.tb-input-tile.is-busy svg {
  animation: feat-spin 0.8s linear infinite;
}

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

.tb-input-tile:hover .tb-input-tile-rm {
  display: flex;
}

.tb-input-tile-rm svg {
  width: 12px;
  height: 12px;
}

.tb-input-none {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Workflow card ⋯ menu: Duplicate / Archive rows. */
.wfv-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  margin-top: 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.wfv-action:hover {
  background: #232323;
}

.wfv-action svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Archived workflows: last in the grid, dashed and faded (the ⋯ stays
   full strength, to unarchive). */
.wf-card.is-archived > .wf-card-open {
  border-style: dashed;
  opacity: 0.45;
}

/* Docs: links (Cmd/Ctrl-click opens) and images. */
a.note-link {
  color: #5b9cff;
  text-decoration: underline;
  text-decoration-color: rgba(91, 156, 255, 0.45);
  text-underline-offset: 2px;
  cursor: text;
}

a.note-link:hover {
  text-decoration-color: #5b9cff;
}

.note-img {
  display: block;
  margin: 8px 0;
  user-select: none;
}

.note-img img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #1b1b1b;
}

.note-img.is-uploading img {
  opacity: 0.5;
}

/* A draft's + menu: types under their class (icon and name, not a button). */
.feat-import-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 2px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
}

.feat-import-group svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.feat-import-item.is-version.is-type {
  padding-left: 35px;
}

/* ---- Workflows tab: a shelf per class (versions-view.js shelvesHtml) ----
   Its icon, name and gear, then its types as cards and a + tile. Types
   drag between shelves. */
#templateList.wfs-host {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* A transparent border and padding: dragging a type over the shelf colors
   the border, drawn inside the shelf so the scroller can't clip it. */
.wfs-shelf {
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 20px;
}

.wfs-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.wfs-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: #fff;
}

.wfs-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.wfs-gear {
  position: relative;
  margin-left: auto;
}

/* The shelf gear's popup hangs right-aligned under it, like a card's. */
.wfs-gear > .tb-wf-settings-pop.is-left {
  right: auto;
  left: 0;
}

.wfs-gear > .tb-wf-settings-pop.is-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.wfs-shelf:has(.wfs-gear > .tb-wf-settings-pop:not([hidden])) {
  position: relative;
  z-index: 30;
}

.wfs-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.wfs-shelf.is-drop {
  border-color: rgba(255, 255, 255, 0.28);
}

.wf-card.is-dragging {
  opacity: 0.4;
}

.wfs-add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 0;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

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

.wfs-add svg {
  width: 18px;
  height: 18px;
}

/* A class's icon in a type's Class menu (not the menu's check mark). */
.tb-wf-comps-field .wfs-pop-icon,
.tb-wf-comps-opt .wfs-pop-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-left: 0;
  stroke-width: 2;
  visibility: visible;
  color: inherit;
}

.tb-wf-comps-field .tb-wf-comps-tags:has(.wfs-pop-icon) {
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
}
