@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

.website-tracking-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}

.website-tracking-toggle input[type='checkbox'] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.website-tracking-toggle input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.website-tracking-details {
  max-width: 240px;
  margin-top: 8px;
}

#workspace .website-tracking-details .field input[readonly] {
  min-height: 32px;
  height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

:root {
  color-scheme: light dark;

  /* Core HSL Palette - Elevated Slate & Meta Modern Theme */
  --bg-dark-base: #12161f;
  --bg-dark-surface: #1a212f;
  --bg-dark-card: #232c3d;
  --bg-dark-glass: rgba(26, 33, 47, 0.82);

  --color-primary: #3b82f6;
  --color-primary-strong: #2563eb;
  --color-primary-soft: rgba(59, 130, 246, 0.15);
  --color-primary-glow: rgba(59, 130, 246, 0.35);

  --color-accent: #6366f1;
  --color-accent-soft: rgba(99, 102, 241, 0.15);

  --color-canvas: #141a26;
  --color-surface: rgba(26, 33, 47, 0.88);
  --color-surface-card: #1e2637;
  --color-surface-subtle: rgba(35, 44, 61, 0.6);
  --color-surface-hover: rgba(56, 68, 92, 0.7);
  --color-locked-control: rgba(15, 23, 42, 0.6);
  --color-template-panel: linear-gradient(145deg, rgba(59, 130, 246, 0.08), rgba(24, 32, 47, 0.78) 56%);
  --color-dropdown-panel: #151d2b;
  --color-dropzone: rgba(15, 23, 42, 0.6);
  --color-segment-track: rgba(0, 0, 0, 0.2);
  --color-review-card: rgba(30, 38, 55, 0.62);
  --color-review-gradient: linear-gradient(180deg, rgba(30, 38, 55, 0.86), rgba(20, 26, 38, 0.62));
  --color-review-success-gradient: linear-gradient(145deg, rgba(16, 185, 129, 0.08), rgba(30, 38, 55, 0.58) 58%);
  --color-review-danger-gradient: linear-gradient(145deg, rgba(244, 63, 94, 0.08), rgba(30, 38, 55, 0.58) 58%);

  --color-text: #f8fafc;
  --color-text-soft: #e2e8f0;
  --color-muted: #94a3b8;
  --color-muted-dark: #64748b;

  --color-border: rgba(255, 255, 255, 0.12);
  --color-border-soft: rgba(255, 255, 255, 0.07);
  --color-border-active: rgba(59, 130, 246, 0.6);

  --color-danger: #f43f5e;
  --color-danger-soft: rgba(244, 63, 94, 0.15);
  --color-success: #10b981;
  --color-success-soft: rgba(16, 185, 129, 0.15);
  --color-warning: #f59e0b;
  --color-warning-soft: rgba(245, 158, 11, 0.15);

  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-float: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);

  --topbar-height: 68px;
  --control-height: 44px;
  --radius-control: 10px;
  --radius-panel: 14px;
  --radius-pill: 999px;
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
}

[data-theme='light'] {
  color-scheme: light;
  --bg-dark-base: #f6f8fc;
  --bg-dark-surface: #ffffff;
  --bg-dark-card: #ffffff;
  --bg-dark-glass: rgba(255, 255, 255, 0.88);
  --color-canvas: #f3f6fb;
  --color-surface: rgba(255, 255, 255, 0.92);
  --color-surface-card: #ffffff;
  --color-surface-subtle: rgba(226, 232, 240, 0.68);
  --color-surface-hover: #edf3fc;
  --color-locked-control: #eef2f7;
  --color-template-panel: linear-gradient(145deg, rgba(59, 130, 246, 0.08), #f7f9fd 58%);
  --color-dropdown-panel: #ffffff;
  --color-dropzone: #eef2f7;
  --color-segment-track: #e2e8f0;
  --color-review-card: #f7f9fc;
  --color-review-gradient: linear-gradient(180deg, #f8fafc, #eef3f9);
  --color-review-success-gradient: linear-gradient(145deg, rgba(16, 185, 129, 0.12), #f2fbf7 62%);
  --color-review-danger-gradient: linear-gradient(145deg, rgba(244, 63, 94, 0.1), #fff6f8 62%);
  --color-text: #172033;
  --color-text-soft: #334155;
  --color-muted: #64748b;
  --color-muted-dark: #94a3b8;
  --color-border: rgba(15, 23, 42, 0.14);
  --color-border-soft: rgba(15, 23, 42, 0.08);
  --color-border-active: rgba(37, 99, 235, 0.55);
  --color-primary-soft: rgba(37, 99, 235, 0.1);
  --color-danger-soft: rgba(225, 29, 72, 0.1);
  --color-success-soft: rgba(5, 150, 105, 0.1);
  --color-warning-soft: rgba(217, 119, 6, 0.12);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.13), 0 0 0 1px rgba(15, 23, 42, 0.05);
  --shadow-float: 0 20px 40px -10px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--color-canvas);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: hidden;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 40%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button,
select,
label[for],
label:has(input[type="file"]) {
  cursor: pointer;
}

button {
  border: 0;
  background: transparent;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

/* Skip link */
.skip-link {
  position: fixed;
  z-index: 110;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  transform: translateY(-150%);
  background: var(--bg-dark-card);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-control);
  color: var(--color-text);
  font-weight: 600;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Topbar Header */
.topbar {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(360px, 1fr);
  align-items: center;
  gap: 16px;
  height: var(--topbar-height);
  padding: 0 20px;
  background: var(--bg-dark-glass);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.brand-copy small {
  color: var(--color-muted);
  font-size: 0.74rem;
}

/* Workspace Navigation Switcher */
.workspace-mode-nav {
  display: inline-flex;
  position: relative;
  gap: 4px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

.workspace-mode-pill {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 0;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  box-shadow: 0 3px 10px rgba(47, 107, 240, 0.35);
  transition:
    transform 450ms cubic-bezier(.65, 0, .35, 1),
    width 450ms cubic-bezier(.65, 0, .35, 1);
  pointer-events: none;
}

.workspace-mode-pill::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  background-position: 200% 0;
  background-size: 200% 100%;
  opacity: 0;
}

.workspace-mode-nav.is-flowing .workspace-mode-pill::after {
  animation: workspace-tab-flow 450ms cubic-bezier(.65, 0, .35, 1);
}

@keyframes workspace-tab-flow {
  0% {
    background-position: 200% 0;
    opacity: 0.9;
  }

  60% {
    opacity: 0.6;
  }

  100% {
    background-position: -40% 0;
    opacity: 0;
  }
}

.workspace-mode-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.84rem;
  font-weight: 650;
  position: relative;
  z-index: 1;
  transition: color 350ms ease;
}

.workspace-mode-button span {
  font-size: 0.72rem;
  opacity: 0.8;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
}

.workspace-mode-button:hover {
  color: var(--color-primary-soft);
}

.workspace-mode-button.is-active {
  color: #ffffff;
}

/* Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-card);
  color: var(--color-text-soft);
  box-shadow: var(--shadow-sm);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--color-border-active);
  background: var(--color-surface-hover);
  color: var(--color-primary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[data-theme='light'] body {
  background-image:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 40%);
}

[data-theme='light'] .workspace-mode-nav {
  background: rgba(226, 232, 240, 0.72);
}

[data-theme='light'] .workspace-mode-button:hover {
  color: var(--color-primary-strong);
}

@media (prefers-reduced-motion: reduce) {
  .workspace-mode-pill {
    transition: none;
  }

  .workspace-mode-nav.is-flowing .workspace-mode-pill::after {
    animation: none;
  }
}

/* Guided setup progress: Campaign → Ad Set → Ad → Review & Publish. */
.progress-review-content {
  gap: 12px;
}

.setup-progress {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-review-gradient);
}

.setup-progress-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.setup-progress-heading h3 {
  margin: 3px 0 0;
  color: var(--color-text);
  font-size: .96rem;
}

.setup-progress-heading>strong {
  color: var(--color-primary);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}

.setup-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-surface-subtle);
}

.setup-progress-track>span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transition: width 220ms ease-out;
}

.setup-step-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-step {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: 11px;
  background: var(--color-surface-card);
}

.setup-step-button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 60px;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  color: var(--color-text-soft);
  text-align: left;
  background: var(--color-surface-card);
  cursor: pointer;
  transition: border-color 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
}

.setup-step-button:hover {
  border-color: var(--color-border-active);
  background: var(--color-surface-hover);
}

.setup-step-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.setup-step.is-current .setup-step-button {
  background: var(--color-primary-soft);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.setup-step.is-current {
  border-color: var(--color-border-active);
}

.setup-step.is-locked .setup-step-button {
  color: var(--color-muted);
  background: var(--color-surface-subtle);
}

.setup-step.has-missing:not(.is-locked) {
  border-color: color-mix(in srgb, var(--color-danger) 42%, var(--color-border));
}

.setup-step-index {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  color: var(--color-muted);
  background: var(--color-surface-subtle);
  font-size: .76rem;
  font-weight: 800;
}

.setup-step-index svg,
.tree-progress-lock svg {
  width: 15px;
  height: 15px;
}

.setup-step.is-complete .setup-step-index {
  border-color: color-mix(in srgb, var(--color-success) 48%, transparent);
  color: var(--color-success);
  background: var(--color-success-soft);
}

.setup-step.is-current .setup-step-index {
  border-color: var(--color-primary);
  color: #fff;
  background: var(--color-primary);
}

.setup-step-copy,
.setup-step-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.setup-step-copy strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: .79rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-step-copy small,
.setup-step-meta small {
  color: var(--color-muted);
  font-size: .66rem;
  line-height: 1.35;
}

.setup-step-meta {
  justify-items: end;
  text-align: right;
}

.setup-step-meta b {
  color: var(--color-muted);
  font-size: .66rem;
  font-weight: 700;
}

.setup-step.is-complete .setup-step-meta b {
  color: var(--color-success);
}

.setup-step.is-current .setup-step-meta b {
  color: var(--color-primary);
}

.setup-step.has-missing .setup-step-meta small {
  color: var(--color-danger);
  font-weight: 700;
}

.setup-missing-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 8px 8px 48px;
  list-style: none;
}

.setup-missing-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 7px;
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--color-danger) 34%, transparent);
  border-radius: 8px;
  color: var(--color-danger);
  text-align: left;
  background: var(--color-danger-soft);
  cursor: pointer;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.setup-missing-item:hover {
  border-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger-soft) 80%, var(--color-surface-card));
}

.setup-missing-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-danger-soft);
}

.setup-missing-mark {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: .68rem;
  font-weight: 800;
}

.setup-missing-item>span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.setup-missing-item strong {
  color: var(--color-danger);
  font-size: .72rem;
}

.setup-missing-item small {
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: .64rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-missing-arrow {
  font-size: .8rem;
  font-weight: 800;
  text-align: right;
}

.setup-step-complete-copy,
.setup-step-lock-copy {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0 10px 10px 48px;
  color: var(--color-muted);
  font-size: .68rem;
  line-height: 1.45;
}

.setup-step-complete-copy {
  color: var(--color-success);
  font-weight: 700;
}

.setup-step-complete-copy svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.progress-validation-summary {
  margin-top: 0;
}

.progress-action-footer .progress-next-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tree-node-row.is-progress-locked:not(.is-selected) {
  opacity: .68;
}

.tree-node-row.is-progress-locked .tree-node-main {
  cursor: help;
}

.tree-progress-lock {
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  color: var(--color-muted);
  background: var(--color-surface-subtle);
}

.has-progress-error {
  position: relative;
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 2px var(--color-danger-soft) !important;
}

.field.has-progress-error,
.smart-resource-picker.has-progress-error,
.expand-select.has-progress-error,
.adset-setup-schedule-row.has-progress-error,
.audience-compact-custom.has-progress-error,
.audience-compact-header.has-progress-error {
  padding: 8px;
  border: 1px solid var(--color-danger);
  border-radius: 10px;
}

[data-progress-invalid='true']:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-danger-soft);
}

@media (max-width: 640px) {
  .setup-progress {
    padding: 12px;
  }

  .setup-step-button {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 64px;
  }

  .setup-step-meta {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: auto auto;
    justify-content: start;
    justify-items: start;
    text-align: left;
  }

  .setup-missing-list,
  .setup-step-complete-copy,
  .setup-step-lock-copy {
    padding-left: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .setup-progress-track>span,
  .setup-step-button,
  .setup-missing-item {
    transition: none;
  }
}

/* Unified expandable data selectors */
.expand-select {
  position: relative;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  background: var(--color-surface);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.expand-select.is-open {
  border-color: var(--color-primary);
  border-radius: 11px 11px 0 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.expand-select.is-open.is-dropup {
  border-radius: 0 0 11px 11px;
}

.expand-select>.field-label {
  display: block;
  margin-bottom: 7px;
}

.expand-select-trigger {
  width: 100%;
  min-height: var(--control-height, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.expand-select-trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 55%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface));
}

.expand-select.is-open .expand-select-trigger {
  background: color-mix(in srgb, var(--color-primary) 3%, var(--color-surface));
}

.expand-select-trigger-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.expand-select-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--color-primary) 13%, var(--color-surface));
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 800;
}

.expand-select-trigger-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-muted);
  font-weight: 650;
}

.expand-select-trigger-text.is-selected {
  color: var(--color-text);
}

.expand-select-chevron {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-surface-subtle);
  border: 1px solid transparent;
  transition: background .22s ease, border-color .22s ease, color .22s ease;
}

.expand-select-chevron svg {
  width: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .32s cubic-bezier(.34, 1.56, .64, 1);
}

.expand-select.is-open .expand-select-chevron {
  border-color: color-mix(in srgb, var(--color-danger) 34%, var(--color-border));
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
  color: var(--color-danger);
}

.expand-select.is-open .expand-select-chevron svg {
  transform: rotate(180deg) scale(1.08);
}

.expand-select-expand {
  position: absolute;
  top: calc(100% - 1px);
  right: auto;
  left: 0;
  z-index: 80;
  max-height: var(--floating-panel-max-height, 360px);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 0 0 11px 11px;
  background: var(--color-dropdown-panel);
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .24s;
}

.expand-select.is-open .expand-select-expand {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.expand-select.is-dropup .expand-select-expand {
  top: auto;
  bottom: calc(100% - 1px);
  border-radius: 11px 11px 0 0;
  transform: translateY(6px);
}

.expand-select.is-dropup.is-open .expand-select-expand {
  transform: translateY(0);
}

.expand-select-expand-inner {
  max-height: var(--floating-panel-max-height, 360px);
  overflow: auto;
}

.expand-select-body {
  padding: 9px;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  border-radius: 0;
  background: var(--color-dropdown-panel);
  box-shadow: none;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity .22s ease .08s, transform .3s cubic-bezier(.22, 1, .36, 1) .08s;
}

.expand-select.is-open .expand-select-body {
  opacity: 1;
  transform: translateY(0);
}

.expand-select-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  margin-bottom: 8px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-muted) 8%, var(--color-surface));
}

.expand-select-search svg {
  width: 16px;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 2;
}

.expand-select-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
}

.expand-select-options {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 2px;
}

.expand-select-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}

.expand-select-option:hover,
.expand-select-option.is-active {
  background: var(--color-surface-subtle);
  border-color: var(--color-border);
}

.expand-select-option.is-selected {
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
}

.expand-select-option:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.expand-select-option-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.expand-select-option-copy strong {
  overflow-wrap: anywhere;
}

.expand-select-option-copy small {
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.expand-select-option-check {
  width: 18px;
  opacity: 0;
  color: var(--color-primary);
}

.expand-select-option-check svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

.expand-select-option.is-selected .expand-select-option-check {
  opacity: 1;
}

.expand-select-empty {
  margin: 10px;
  color: var(--color-muted);
  text-align: center;
}

.expand-select-empty.is-hidden {
  display: none;
}

.expand-select.is-disabled {
  opacity: .6;
}

.audience-custom-picker-row .expand-select {
  min-width: 0;
}

.audience-age-input {
  width: 92px;
  position: relative;
}

.audience-age-input .expand-select {
  width: 100%;
  border-radius: 12px;
  box-sizing: border-box;
}

.audience-age-input .expand-select.is-open {
  border-radius: 12px 12px 0 0 !important;
  border-bottom-color: transparent !important;
}

.audience-age-input .expand-select-avatar {
  display: none;
}

.audience-age-input .expand-select-trigger {
  min-height: 38px;
  padding: 6px 8px;
  box-sizing: border-box;
}

.audience-age-input .expand-select-trigger-left {
  width: 100%;
  justify-content: center;
}

.audience-age-input .expand-select-trigger-text {
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.audience-age-input .expand-select-expand {
  left: -1.5px !important;
  right: -1.5px !important;
  width: calc(100% + 3px) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  border-top: none !important;
  border-radius: 0 0 12px 12px !important;
}

.audience-age-input .expand-select-body {
  padding: 4px 2px !important;
  border-top: none !important;
}

.audience-age-input .expand-select-expand-inner,
.audience-age-input .expand-select-options {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.audience-age-input .expand-select-expand-inner::-webkit-scrollbar,
.audience-age-input .expand-select-options::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.audience-age-input .expand-select-options {
  max-height: 220px;
  padding: 2px;
  overflow-x: hidden;
}

.audience-age-input .expand-select-option {
  justify-content: center;
  text-align: center;
  min-height: 34px;
  padding: 4px;
  margin-block: 1px;
  border-radius: 8px;
  box-sizing: border-box;
}

.audience-age-input .expand-select-option-copy {
  display: flex;
  justify-content: center;
  width: 100%;
}

.audience-age-input .expand-select-option-copy strong {
  font-size: 0.88rem;
  text-align: center;
}

.audience-age-input .expand-select-option-check {
  display: none;
}

@media (prefers-reduced-motion: reduce) {

  .expand-select-trigger,
  .expand-select-chevron svg,
  .expand-select-expand,
  .expand-select-body {
    transition: none;
  }
}

/* Shared action confirmation */
.action-confirmation {
  width: min(92vw, 460px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 24px 80px rgba(2, 6, 23, .42);
}

.action-confirmation::backdrop {
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(6px);
}

.action-confirmation-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 15px;
  padding: 24px;
}

.action-confirmation-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(239, 68, 68, .28);
  border-radius: 14px;
  background: rgba(239, 68, 68, .12);
  color: #ef4444;
  font-size: 21px;
  font-weight: 800;
}

.action-confirmation[data-tone='warning'] .action-confirmation-icon {
  border-color: rgba(245, 158, 11, .3);
  background: rgba(245, 158, 11, .12);
  color: #f59e0b;
}

.action-confirmation-copy {
  min-width: 0;
}

.action-confirmation-copy h2 {
  margin: 3px 0 8px;
  font-size: 1.16rem;
}

.action-confirmation-copy p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.action-confirmation-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 5px;
}

.action-confirmation-actions button {
  min-width: 104px;
  min-height: 42px;
}

@media (max-width: 520px) {
  .action-confirmation-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 20px;
  }

  .action-confirmation-icon {
    width: 40px;
    height: 40px;
  }

  .action-confirmation-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Branded ACTIVE publication confirmation */
.publish-confirmation {
  width: min(92vw, 500px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.38);
}

.publish-confirmation::backdrop {
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(6px);
}

.publish-confirmation-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
}

.publish-confirmation-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.13);
  color: #f59e0b;
  font-size: 22px;
  font-weight: 800;
}

.publish-confirmation-copy {
  min-width: 0;
}

.publish-confirmation-copy h2 {
  margin: 3px 0 8px;
  font-size: 1.2rem;
}

.publish-confirmation-copy p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.publish-confirmation-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
}

.publish-confirmation-note>span {
  color: #f59e0b;
  font-weight: 800;
}

.publish-confirmation-note p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.publish-confirmation-note strong {
  color: var(--color-text);
}

.publish-confirmation-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.publish-confirmation-actions button {
  min-height: 42px;
  padding-inline: 18px;
}

@media (max-width: 520px) {
  .publish-confirmation-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 20px;
  }

  .publish-confirmation-icon {
    width: 40px;
    height: 40px;
  }

  .publish-confirmation-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Duplicate Ad Set quantity dialog */
.duplicate-adset-dialog {
  width: min(92vw, 500px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 24px 80px rgba(2, 6, 23, .4);
}

.duplicate-adset-dialog::backdrop {
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(6px);
}

.duplicate-adset-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
}

.duplicate-adset-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  font-size: .9rem;
  font-weight: 800;
}

.duplicate-adset-copy {
  min-width: 0;
}

.duplicate-adset-copy h2 {
  margin: 3px 0 8px;
  font-size: 1.2rem;
}

.duplicate-adset-copy p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.duplicate-adset-source,
.duplicate-adset-field {
  grid-column: 1 / -1;
}

.duplicate-adset-source {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: 12px;
  background: var(--color-surface-subtle);
}

.duplicate-adset-source span,
.duplicate-adset-field label {
  color: var(--color-muted);
  font-size: .78rem;
  font-weight: 700;
}

.duplicate-adset-source strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duplicate-adset-field {
  display: grid;
  gap: 7px;
}

.duplicate-adset-field input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 700;
}

.duplicate-adset-field input:focus-visible {
  border-color: var(--color-primary);
  outline: 3px solid color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.duplicate-adset-field input[aria-invalid='true'] {
  border-color: #ef4444;
  outline-color: rgba(239, 68, 68, .18);
}

.duplicate-adset-field small {
  color: var(--color-muted);
}

.duplicate-adset-field .field-error {
  color: #ef4444;
  font-weight: 700;
}

.duplicate-adset-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.duplicate-adset-actions button {
  min-width: 110px;
  min-height: 42px;
}

@media (max-width: 520px) {
  .duplicate-adset-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 20px;
  }

  .duplicate-adset-icon {
    width: 40px;
    height: 40px;
  }

  .duplicate-adset-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

[data-theme='light'] ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
}

.connection-account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: 220px;
  padding: 6px 10px 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.connection-account-control {
  position: relative;
}

.connection-account-button[aria-expanded='true'] .connection-account-chevron {
  transform: rotate(90deg);
}

.connection-account-chevron {
  transition: transform 180ms ease;
}

.connection-account-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  padding: 7px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: 0 18px 54px rgba(2, 6, 23, 0.28);
}

.connection-account-menu[hidden] {
  display: none;
}

.connection-account-menu button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--color-text);
  text-align: left;
}

.connection-account-menu button:hover,
.connection-account-menu button:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  outline: none;
}

.connection-account-menu button.is-danger {
  color: #ef4444;
}

.connection-account-menu button.is-danger:hover,
.connection-account-menu button.is-danger:focus-visible {
  background: rgba(239, 68, 68, 0.1);
}

.connection-account-menu strong,
.connection-account-menu small {
  display: block;
}

.connection-account-menu strong {
  font-size: 0.8rem;
}

.connection-account-menu small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.account-menu-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 800;
}

.is-danger .account-menu-icon {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.disconnect-meta-confirmation {
  width: min(92vw, 500px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.38);
}

.disconnect-meta-confirmation::backdrop {
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(6px);
}

.disconnect-meta-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
}

.disconnect-meta-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 24px;
  font-weight: 800;
}

.disconnect-meta-copy h2 {
  margin: 3px 0 8px;
  font-size: 1.2rem;
}

.disconnect-meta-copy p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.disconnect-meta-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.button-danger {
  min-height: 42px;
  padding-inline: 18px;
  border: 1px solid #dc2626;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-weight: 700;
}

.button-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.connection-account-button:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.08);
  border-color: color-mix(in srgb, var(--color-primary) 36%, var(--color-border));
  transform: translateY(-1px);
}

.connection-account-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-account-chevron {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  opacity: 0.65;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-muted-dark);
}

.connection-account-button.is-connected {
  color: var(--color-success);
  background: var(--color-success-soft);
  border-color: rgba(16, 185, 129, 0.3);
}

.connection-account-button.is-connected .connection-dot {
  background: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
  animation: pulseDot 2s infinite;
}

[data-theme='light'] .connection-account-button:not(.is-connected) {
  background: rgba(255, 255, 255, 0.82);
}

@keyframes pulseDot {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Buttons */
.button-primary,
.button-secondary,
.icon-button,
.mobile-nav-button,
.mobile-review-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 16px;
  border-radius: var(--radius-control);
  font-size: 0.86rem;
  font-weight: 650;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.button-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-strong) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.button-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.button-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.button-primary:disabled {
  background: rgba(59, 130, 246, 0.25);
  color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

.button-secondary {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-soft);
}

.button-secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--color-text);
}

.icon-button {
  min-width: var(--control-height);
  padding: 0 10px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-soft);
}

.icon-button:hover:not(:disabled) {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.add-button {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--color-primary);
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: var(--radius-control);
}

.add-button:hover:not(:disabled) {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.mobile-nav-button,
.mobile-review-button {
  display: none;
}

/* Workspace Layout Shell */
.workspace-shell {
  display: grid;
  grid-template-columns: 340px minmax(500px, 1fr);
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  background: var(--color-canvas);
  overflow: hidden;
}

.workspace-tree,
.workspace-editor,
.workspace-review {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

/* Left Sidebar - Tree View */
.workspace-tree {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg-dark-surface);
  border-right: 1px solid var(--color-border);
  overflow-x: hidden;
}

.pane-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 14px;
  background: var(--bg-dark-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-soft);
  box-sizing: border-box;
}

.pane-header h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.eyebrow,
.node-type-label,
.empty-kicker {
  color: var(--color-primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tree-list {
  padding: 12px 8px;
  overflow-x: hidden;
}

.tree-group+.tree-group {
  margin-top: 10px;
}

.tree-children {
  margin-left: 12px;
  padding-left: 6px;
  border-left: 1px dashed var(--color-border-soft);
}

.tree-node-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-bottom: 3px;
  border-radius: var(--radius-control);
  background: transparent;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.tree-node-row.has-open-menu,
.tree-node-row:has(.node-action-menu) {
  z-index: 35;
}

.tree-node-row:hover {
  background: var(--color-surface-subtle);
}

.tree-node-row.is-selected {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18) 0%, rgba(99, 102, 241, 0.1) 100%);
  border: 1px solid var(--color-border-active);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.tree-node-row.is-selected::before {
  content: '';
  position: absolute;
  z-index: 3;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.tree-node-row.has-run-progress {
  border: 1px solid color-mix(in srgb, var(--tree-progress-color, var(--color-primary)) 24%, transparent);
}

.tree-node-row.has-run-progress::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 1px;
  border-radius: calc(var(--radius-control) - 1px);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tree-progress-color, var(--color-primary)) 20%, transparent),
    color-mix(in srgb, var(--tree-progress-color, var(--color-primary)) 9%, transparent));
  pointer-events: none;
  transform: scaleX(var(--tree-progress-ratio, 0));
  transform-origin: left center;
  transition: transform 260ms cubic-bezier(.2, .8, .2, 1), background-color 180ms ease;
}

.tree-node-row.is-run-completed {
  --tree-progress-color: var(--color-success);
}

.tree-node-row.is-run-completed_with_errors {
  --tree-progress-color: var(--color-danger);
}

.tree-node-row.is-run-needs_review {
  --tree-progress-color: var(--color-warning);
}

.tree-node-row.has-run-progress>.node-disclosure,
.tree-node-row.has-run-progress>.node-disclosure-spacer,
.tree-node-row.has-run-progress>.tree-node-main,
.tree-node-row.has-run-progress>.tree-node-progress-action,
.tree-node-row.has-run-progress>.node-menu-button {
  position: relative;
  z-index: 1;
}

.tree-node-main {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 4px 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: var(--radius-control);
  overflow: hidden;
}

.tree-node-progress-action {
  display: grid;
  flex: 0 0 50px;
  width: 50px;
  min-width: 50px;
  min-height: 40px;
  place-items: center;
  padding: 3px 2px;
  border: 0;
  border-radius: 7px;
  background: color-mix(in srgb, var(--tree-progress-color, var(--color-primary)) 10%, transparent);
  color: var(--color-text);
  cursor: pointer;
}

.tree-node-progress-action:hover,
.tree-node-progress-action:focus-visible {
  background: color-mix(in srgb, var(--tree-progress-color, var(--color-primary)) 18%, transparent);
}

.tree-node-progress-action:focus-visible {
  outline: 2px solid var(--tree-progress-color, var(--color-primary));
  outline-offset: -2px;
}

.tree-node-progress-copy {
  display: grid;
  min-width: 0;
  place-items: center;
  line-height: 1.05;
}

.tree-node-progress-copy strong {
  color: var(--tree-progress-color, var(--color-primary));
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.tree-node-progress-copy small {
  width: 46px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: .56rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.tree-node-campaign .node-mark {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.tree-node-adSet .node-mark {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.tree-node-ad .node-mark {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.node-copy {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  margin-left: 6px;
}

.node-copy strong,
.node-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-copy strong {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--color-text);
}

.node-copy small {
  color: var(--color-muted);
  font-size: 0.7rem;
}

.node-menu-button {
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  place-items: center;
  min-height: 28px;
  margin-left: auto;
  margin-right: 2px;
  padding: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.node-disclosure {
  display: inline-flex;
  flex: 0 0 24px;
  width: 24px;
  min-width: 24px;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-height: 24px;
  margin-left: 1px;
  margin-right: 1px;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  color: var(--color-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.node-disclosure-spacer {
  display: inline-block;
  flex: 0 0 24px;
  width: 24px;
  min-width: 24px;
}

.node-menu-button:hover,
.node-disclosure:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

.node-disclosure .icon-bounce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--color-surface-subtle);
  transition: background 250ms ease, border-color 250ms ease, transform 250ms ease;
}

.node-disclosure .icon-bounce svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(180deg);
  transition: transform 420ms cubic-bezier(.34, 1.56, .64, 1);
}

.node-disclosure:not(.is-collapsed) .icon-bounce {
  border-color: color-mix(in srgb, var(--color-primary) 22%, transparent);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-subtle));
  color: var(--color-primary);
}

.node-disclosure.is-collapsed .icon-bounce svg {
  transform: rotate(0deg);
}

.node-disclosure.is-bouncing:not(.is-collapsed) .icon-bounce svg {
  animation: disclosure-bounce-open 420ms cubic-bezier(.34, 1.56, .64, 1);
}

.node-disclosure.is-bouncing.is-collapsed .icon-bounce svg {
  animation: disclosure-bounce-close 420ms cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes disclosure-bounce-open {
  0% {
    transform: rotate(0deg) scale(.9);
  }

  70% {
    transform: rotate(190deg) scale(1.08);
  }

  100% {
    transform: rotate(180deg) scale(1);
  }
}

@keyframes disclosure-bounce-close {
  0% {
    transform: rotate(180deg) scale(.9);
  }

  70% {
    transform: rotate(-10deg) scale(1.08);
  }

  100% {
    transform: rotate(0deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {

  .node-disclosure .icon-bounce,
  .node-disclosure .icon-bounce svg {
    animation: none;
    transition: none;
  }
}

/* Seeding workspace — UI/UX Pro Max design-system pass */
.workspace-seeding-shell {
  width: min(100%, 1080px);
  padding: var(--space-6) var(--space-6) 88px;
}

.workspace-seeding-header {
  margin-bottom: var(--space-3);
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--bg-dark-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.workspace-seeding-header h1,
.seeding-composer-heading h2 {
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  letter-spacing: -.02em;
}

.workspace-seeding-context {
  margin-bottom: var(--space-4);
  padding: 11px 14px;
  border-color: color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-primary) 7%, var(--bg-dark-surface));
}

.seeding-editor {
  gap: var(--space-4);
}

.seeding-composer {
  gap: var(--space-4);
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--bg-dark-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .04);
}

.seeding-composer-heading {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-soft);
}

.seeding-template-card-picker,
.seeding-template-library {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--bg-dark-surface);
  box-shadow: none;
}

.seeding-template-library summary {
  min-height: 58px;
  padding: 12px 16px;
}

.seeding-template-library-content {
  gap: var(--space-3);
  padding: 14px 16px 16px;
}

.seeding-card-list {
  gap: var(--space-3);
}

.seeding-card {
  gap: var(--space-3);
  padding: var(--space-4);
  overflow: visible;
  border-radius: 10px;
  background: var(--bg-dark-surface);
  box-shadow: none;
}

.seeding-card:hover {
  border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
}

.seeding-card-heading {
  min-height: 38px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-soft);
}

.seeding-card-index {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--color-primary);
  box-shadow: none;
}

.seeding-order-actions {
  gap: 6px;
}

.seeding-icon-button,
.seeding-order-actions .row-remove {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-subtle);
}

.seeding-card-content {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: var(--space-3);
}

.seeding-message-field textarea {
  min-height: 148px;
  border-radius: 9px;
  background: var(--bg-dark-surface);
}

.seeding-image-control {
  min-height: 148px;
  padding: var(--space-3);
  border-color: color-mix(in srgb, var(--color-primary) 32%, var(--color-border));
  border-radius: 9px;
  background: var(--color-surface-subtle);
}

.seeding-thumbnail {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
}

.seeding-add-comment {
  min-height: 42px;
  border-style: dashed;
}

[data-theme='light'] .workspace-seeding-header,
[data-theme='light'] .seeding-composer,
[data-theme='light'] .seeding-card,
[data-theme='light'] .seeding-template-library {
  background: #ffffff;
}

@media (max-width: 900px) {
  .seeding-card-content {
    grid-template-columns: 1fr;
  }

  .seeding-image-control {
    min-height: 128px;
  }
}

@media (max-width: 720px) {
  .workspace-seeding-shell {
    padding: var(--space-3) var(--space-3) 72px;
  }

  .workspace-seeding-header,
  .seeding-composer {
    padding: var(--space-4);
  }

  .seeding-card {
    padding: var(--space-3);
  }
}

.node-action-menu {
  position: absolute;
  top: calc(100% - 4px);
  right: 6px;
  z-index: 25;
  display: grid;
  min-width: 200px;
  padding: 6px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-float);
  animation: scaleFadeIn 0.15s ease-out;
}

@keyframes scaleFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.node-action-menu-item {
  min-height: 36px;
  padding: 8px 12px;
  background: transparent;
  border-radius: 6px;
  color: var(--color-text-soft);
  font-size: 0.82rem;
  text-align: left;
}

.node-action-menu-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.node-action-menu-item.is-destructive {
  color: var(--color-danger);
}

.node-action-menu-item.is-destructive:hover {
  background: var(--color-danger-soft);
}

.tree-footer,
.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-muted);
  font-size: 0.74rem;
}

/* Center Column - Editor */
.workspace-editor {
  background: var(--color-canvas);
}

.editor-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "breadcrumbs status"
    "title status";
  column-gap: 12px;
  row-gap: 2px;
  padding: 6px 20px;
  background: var(--bg-dark-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumbs {
  grid-area: breadcrumbs;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  color: var(--color-muted);
  font-size: 0.66rem;
  line-height: 1.2;
  white-space: nowrap;
}

.breadcrumbs span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-title-row {
  display: contents;
}

.editor-title-row > .editor-header-action {
  grid-area: status;
  justify-self: end;
  max-width: 100%;
}

.editor-title-row > .editor-header-action[hidden] {
  display: none;
}

.editor-header-action .publish-button {
  min-height: 44px;
  width: auto;
  margin: 0;
  padding: 8px 14px;
  white-space: normal;
}

.editor-title-row>div {
  grid-area: title;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.editor-title-row h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-title-row .node-type-label {
  flex: 0 0 auto;
  font-size: 0.6rem;
  line-height: 1.1;
}

.paused-badge,
.locked-tag,
.readiness-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--color-warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-warning);
  font-size: 0.72rem;
  font-weight: 750;
}

.editor-header .paused-badge {
  grid-area: status;
  align-self: center;
  min-height: 24px;
  padding-inline: 9px;
  font-size: 0.65rem;
  line-height: 1;
  white-space: nowrap;
}

.editor-body {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 24px 28px 16px;
}

.editor-progress-footer {
  position: static;
  display: flex;
  width: min(100%, 960px);
  margin: 0 auto;
  justify-content: flex-end;
  padding: 0 28px calc(24px + env(safe-area-inset-bottom));
  background: transparent;
}

.editor-progress-footer[hidden] {
  display: none;
}

.editor-progress-footer .publish-button {
  width: min(100%, 280px);
}

.editor-section {
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.editor-section:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.editor-section:has(.smart-resource-picker.is-open) {
  position: relative;
  z-index: 30;
  overflow: visible;
}

.editor-section+.editor-section {
  margin-top: 18px;
}

.section-heading {
  padding: 18px 22px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--color-border-soft);
}

.section-heading h2,
.subsection-heading h3,
.review-section h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 750;
  color: var(--color-text);
}

.section-heading p,
.subsection-heading p,
.advantage-banner p,
.safety-section p,
.audience-column p {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.section-content {
  padding: 22px;
}

.field-stack {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  gap: 16px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-label {
  color: var(--color-text-soft);
  font-size: 0.8rem;
  font-weight: 650;
}

/* Forms & Inputs */
input,
select,
textarea,
.locked-control {
  width: 100%;
  min-height: var(--control-height);
  padding: 10px 14px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  color: var(--color-text);
  font-size: 0.88rem;
  transition: all 0.18s ease;
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: var(--color-border-active);
  background: var(--color-surface-hover);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
  background: var(--bg-dark-card);
}

.locked-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--color-locked-control);
  border-color: var(--color-border-soft);
  color: var(--color-muted);
}

.locked-control>span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Choice Cards (Radio / Checkbox style) */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  min-height: 90px;
  padding: 16px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  transition: all 0.2s ease;
}

.choice-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.choice-card.is-selected {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.15);
}

.choice-card input,
.segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.radio-mark {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid var(--color-muted-dark);
  border-radius: 50%;
  transition: all 0.18s ease;
}

.choice-card.is-selected .radio-mark {
  border: 6px solid var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary-glow);
}

.choice-card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
}

.choice-card small,
.field-help {
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 0.76rem;
}

/* Field row (budget input + helper text next to each other) */
.field-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.field-row .field-help {
  margin-top: 12px;
  flex: 1 1 0;
}

/* Advantage+ audience banner (on/off summary strip) */
.advantage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.advantage-banner strong {
  color: var(--color-text);
  font-size: 0.9rem;
}

.off-switch {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
}

.off-switch span {
  width: 16px;
  height: 16px;
  background: var(--color-muted-dark);
  border-radius: 50%;
}

/* Locked Messenger destination row */
.locked-route {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.route-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.locked-route strong {
  display: block;
  font-size: 0.86rem;
  color: var(--color-text);
}

.locked-route small {
  color: var(--color-muted);
  font-size: 0.76rem;
}

/* Compact conversion, budget and schedule card */
.editor-section:has(.adset-setup-compact) .section-heading {
  padding-block: 12px 10px;
}

.editor-section:has(.adset-setup-compact) .section-content {
  padding: 12px 14px 14px;
}

.adset-setup-compact {
  display: grid;
  gap: 8px;
}

.adset-setup-route-row,
.adset-setup-schedule-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.adset-setup-schedule-row {
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

.adset-locked-value,
.adset-messenger-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface-muted);
  font-size: .76rem;
}

.adset-locked-value {
  flex: 1 1 0;
  color: var(--color-text);
}

.adset-locked-value svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 2.2;
}

.adset-locked-value span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.adset-messenger-chip {
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--color-success) 9%, var(--color-surface-card));
  border-color: color-mix(in srgb, var(--color-success) 25%, var(--color-border));
}

.adset-budget-field,
.adset-date-field {
  display: grid;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface-card);
}

.adset-budget-field {
  flex: 1.35 1 0;
  gap: 2px;
  padding: 7px 10px;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.adset-date-field {
  flex: 1 1 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
}

.adset-budget-field>span:first-child,
.adset-date-field>span {
  color: var(--color-muted);
  font-size: .68rem;
  white-space: nowrap;
}

.adset-budget-field>span:first-child {
  color: var(--color-primary);
  font-weight: 700;
}

.adset-budget-input {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.adset-budget-input input,
.adset-date-field input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.adset-budget-input input {
  font-size: 1rem;
  font-weight: 750;
}

.adset-budget-input b {
  color: var(--color-muted);
  font-size: .78rem;
}

.adset-date-field input {
  font-size: .74rem;
}

.adset-setup-notice {
  margin: 0;
  color: var(--color-muted);
  font-size: .72rem;
}

@media (max-width: 720px) {

  .adset-setup-route-row,
  .adset-setup-schedule-row {
    flex-wrap: wrap;
  }

  .adset-locked-value,
  .adset-budget-field,
  .adset-date-field {
    flex-basis: calc(50% - 4px);
  }

  .adset-messenger-chip {
    flex: 1 1 100%;
  }
}

/* Messenger conversation composer */
.conversation-shell {
  display: grid;
  gap: 16px;
}

.conversation-new-template-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-muted);
}

.seeding-new-template-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-muted);
}

.seeding-new-template-bar .field {
  gap: 4px;
}

.seeding-new-template-bar input,
.seeding-new-template-bar button {
  min-height: 38px;
}

.conversation-new-template-bar .field {
  gap: 4px;
}

.conversation-new-template-bar input,
.conversation-new-template-bar button {
  min-height: 38px;
}

@media (max-width: 640px) {

  .conversation-new-template-bar,
  .seeding-new-template-bar {
    grid-template-columns: 1fr;
  }
}

.conversation-destination {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-accent-soft));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-control);
}

.conversation-destination>div {
  min-width: 0;
  flex: 1;
}

.conversation-destination strong,
.conversation-destination small {
  display: block;
}

.conversation-destination strong {
  color: var(--color-text);
  font-size: 0.9rem;
}

.conversation-destination small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.76rem;
}

.destination-logo,
.messenger-avatar,
.mini-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #ffffff;
  font-weight: 800;
}

.destination-logo {
  width: 38px;
  height: 38px;
  font-size: 0.84rem;
  box-shadow: 0 5px 16px var(--color-primary-glow);
}

.locked-tag,
.conversation-status-pill {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 750;
}

.locked-tag {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.conversation-composer {
  padding: 18px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
}

.conversation-composer-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-soft);
}

.conversation-composer-heading h3 {
  margin: 3px 0 4px;
  color: var(--color-text);
  font-size: 1.06rem;
  line-height: 1.35;
}

.conversation-composer-heading p {
  margin: 0;
  max-width: 620px;
  color: var(--color-muted);
  font-size: 0.79rem;
}

.conversation-status-pill {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  white-space: nowrap;
}

.conversation-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  align-items: start;
  gap: 20px;
}

.conversation-form {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.conversation-message-field textarea {
  min-height: 168px;
  resize: vertical;
  line-height: 1.55;
}

.conversation-message-field code {
  color: var(--color-primary);
}

.conversation-subsection {
  padding: 14px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.conversation-subsection-heading,
.action-card-heading,
.conversation-preview-label,
.conversation-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-subsection-heading {
  align-items: flex-start;
  margin-bottom: 12px;
}

.conversation-subsection-heading strong,
.conversation-subsection-heading small {
  display: block;
}

.conversation-subsection-heading strong {
  color: var(--color-text);
  font-size: 0.88rem;
}

.conversation-subsection-heading small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.73rem;
}

.conversation-subsection-heading>span {
  padding: 3px 8px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-pill);
  color: var(--color-primary);
  font-size: 0.7rem;
  font-weight: 750;
}

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

.conversation-action-card {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  padding: 12px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.action-card-heading {
  grid-column: 1 / -1;
}

.action-card-heading strong {
  color: var(--color-text-soft);
  font-size: 0.78rem;
}

.conversation-subsection .inline-add-button {
  width: 100%;
  margin-top: 10px;
  border-style: dashed;
}

.conversation-preview {
  position: sticky;
  top: 16px;
  min-width: 0;
  padding: 12px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}

.conversation-preview-label {
  margin-bottom: 10px;
}

.conversation-preview-label strong {
  color: var(--color-text-soft);
  font-size: 0.78rem;
}

.conversation-preview-label small {
  color: var(--color-muted);
  font-size: 0.68rem;
}

.conversation-preview-heading {
  justify-content: flex-start;
  padding: 10px 12px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-soft);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.conversation-preview-heading>div,
.conversation-preview-heading strong,
.conversation-preview-heading small {
  display: block;
  min-width: 0;
}

.conversation-preview-heading strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-preview-heading small {
  color: var(--color-muted);
  font-size: 0.64rem;
}

.messenger-avatar {
  width: 30px;
  height: 30px;
  font-size: 0.7rem;
}

.conversation-phone-screen {
  display: flex;
  flex-direction: column;
  min-height: 370px;
  padding: 12px 10px 10px;
  overflow: hidden;
  background:
    linear-gradient(rgba(20, 26, 38, 0.82), rgba(20, 26, 38, 0.82)),
    radial-gradient(circle at 20% 10%, var(--color-primary-soft), transparent 42%);
  border: 1px solid var(--color-border-soft);
  border-radius: 0 0 12px 12px;
}

.preview-spacer {
  flex: 1 1 70px;
  min-height: 50px;
}

.preview-message-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.mini-avatar {
  width: 24px;
  height: 24px;
  font-size: 0.58rem;
}

.preview-bubble {
  max-width: calc(100% - 32px);
  padding: 10px 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: var(--color-surface-hover);
  border-radius: 14px 14px 14px 4px;
  color: var(--color-text-soft);
  font-size: 0.73rem;
  line-height: 1.45;
}

.preview-actions {
  display: grid;
  gap: 6px;
  margin: 7px 0 0 31px;
}

.preview-actions button {
  min-height: 44px;
  padding: 7px 10px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
}

.preview-actions button small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 0.6rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 10px;
  padding: 5px 8px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.68rem;
}

.preview-composer span {
  flex: 1;
}

.conversation-preview>p {
  margin: 9px 2px 0;
  color: var(--color-muted);
  font-size: 0.65rem;
  text-align: center;
}

.conversation-json-preview,
.conversation-template-library {
  overflow: hidden;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.template-card-picker {
  padding: 18px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 14px;
  background: var(--color-template-panel);
}

.template-card-picker-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.template-card-picker-heading h3 {
  margin: 3px 0 0;
  color: var(--color-text);
  font-size: 1rem;
}

.template-card-picker-heading p {
  margin: 5px 0 0;
  color: var(--color-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.template-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.template-card-picker-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.template-card-dropdown {
  position: relative;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-locked-control);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.template-card-dropdown>summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  user-select: none;
  caret-color: transparent;
  list-style: none;
}

.template-card-dropdown>summary::-webkit-details-marker {
  display: none;
}

.template-card-dropdown[open]>summary {
  background: color-mix(in srgb, var(--color-primary) 3%, var(--color-surface));
}

.template-card-dropdown[open] {
  border-color: #3b82f6;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.template-card-dropdown[open].is-dropup {
  border-radius: 0 0 10px 10px;
}

.template-dropdown-current {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.template-dropdown-current small {
  color: var(--color-muted);
  font-size: 0.66rem;
}

.template-dropdown-current strong {
  color: var(--color-text-soft);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
}

.template-dropdown-chevron {
  color: var(--color-muted);
  transition: transform 160ms ease;
}

.template-card-dropdown[open] .template-dropdown-chevron {
  transform: rotate(180deg);
}

.template-card-dropdown-panel {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  left: 0;
  z-index: 85;
  width: 100%;
  max-height: var(--floating-panel-max-height, 380px);
  overflow: hidden;
  visibility: hidden;
  border: 1px solid var(--color-border);
  border-radius: 0 0 10px 10px;
  background: var(--color-dropdown-panel);
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .24s;
}

.template-card-dropdown[open] .template-card-dropdown-panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.template-card-dropdown.is-dropup .template-card-dropdown-panel {
  top: auto;
  bottom: calc(100% - 1px);
  border-radius: 10px 10px 0 0;
  transform: translateY(5px);
}

.template-card-dropdown.is-dropup[open] .template-card-dropdown-panel {
  transform: translateY(0);
}

.template-card-dropdown-panel .template-card-grid {
  max-height: var(--floating-panel-max-height, 380px);
  padding: 10px;
  overflow: auto;
  grid-template-columns: minmax(0, 1fr);
}

.template-quick-save {
  min-height: 54px;
  white-space: nowrap;
}

.template-dropdown-plus {
  position: relative;
  display: inline-flex;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface-subtle);
  color: var(--color-text-soft);
  pointer-events: none;
  user-select: none;
  transition: color 220ms ease, border-color 220ms ease, background 220ms ease, transform 320ms cubic-bezier(.34, 1.56, .64, 1);
}

.template-dropdown-plus .line-h,
.template-dropdown-plus .line-v {
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 320ms cubic-bezier(.34, 1.56, .64, 1);
}

.template-dropdown-plus .line-v {
  transform: rotate(90deg);
}

.template-card-dropdown[open] .template-dropdown-plus {
  border-color: rgba(59, 130, 246, 0.38);
  background: rgba(59, 130, 246, 0.12);
  color: var(--color-primary);
  transform: rotate(45deg);
}

.template-choice-card {
  display: flex;
  min-width: 0;
  min-height: 70px;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  background: var(--color-locked-control);
  color: var(--color-text-soft);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.template-choice-wrap {
  position: relative;
  min-width: 0;
}

.template-choice-wrap.is-deleting {
  opacity: .45;
  pointer-events: none;
  transition: opacity .16s ease;
}

.template-choice-wrap .template-choice-card {
  width: 100%;
  padding-right: 42px;
}

.template-choice-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.template-choice-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.template-choice-delete:hover:not(:disabled),
.template-choice-delete:focus-visible {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.template-choice-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.48);
  background: rgba(30, 64, 175, 0.12);
}

.template-choice-card.is-selected {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.16);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16);
}

.template-choice-card.is-create {
  border-style: dashed;
}

.template-choice-mark {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  font-weight: 800;
}

.template-choice-card.is-selected .template-choice-mark {
  background: #2563eb;
  color: #fff;
}

.template-choice-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.template-choice-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-choice-copy strong {
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.template-choice-copy small,
.template-card-empty {
  color: var(--color-muted);
  font-size: 0.7rem;
}

.template-card-empty {
  align-self: center;
  margin: 0;
}

.required-feature-badge {
  padding: 5px 9px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  font-size: 0.68rem;
  font-weight: 750;
}

.seeding-template-card-picker+.seeding-composer,
.conversation-template-card-picker+.conversation-destination {
  margin-top: 14px;
}

@media (max-width: 768px) {
  .template-card-picker-controls {
    grid-template-columns: 1fr;
  }

  .template-card-dropdown-panel {
    width: 100%;
  }

  .template-quick-save {
    min-height: 44px;
  }
}

.conversation-json-preview>summary,
.conversation-template-library>summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.conversation-json-preview>summary::-webkit-details-marker,
.conversation-template-library>summary::-webkit-details-marker {
  display: none;
}

.conversation-json-preview>summary span,
.conversation-json-preview>summary small,
.conversation-template-library>summary strong,
.conversation-template-library>summary small {
  display: block;
}

.conversation-json-preview>summary span,
.conversation-template-library>summary strong {
  color: var(--color-text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.conversation-json-preview>summary small,
.conversation-template-library>summary small {
  color: var(--color-muted);
  font-size: 0.69rem;
}

.conversation-json-preview pre {
  max-height: 260px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.conversation-template-library {
  background: var(--color-surface-card);
  border-color: var(--color-border);
}

.conversation-template-summary-action {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: 0.74rem;
  font-weight: 700;
}

.conversation-template-summary-action::after {
  content: ' ↓';
}

.conversation-template-library[open] .conversation-template-summary-action::after {
  content: ' ↑';
}

.conversation-template-library-content {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--color-border-soft);
}

.conversation-template-name {
  max-width: 560px;
}

@media (max-width: 1199px) {
  .conversation-builder {
    grid-template-columns: 1fr;
  }

  .conversation-preview {
    position: static;
    max-width: 420px;
    width: 100%;
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  .conversation-composer {
    padding: 14px;
  }

  .conversation-composer-heading,
  .conversation-destination,
  .conversation-template-library>summary {
    align-items: flex-start;
  }

  .conversation-composer-heading,
  .conversation-template-library>summary {
    flex-direction: column;
  }

  .conversation-destination {
    flex-wrap: wrap;
  }

  .conversation-destination>div {
    flex-basis: calc(100% - 52px);
  }

  .locked-tag {
    margin-left: 50px;
  }

  .conversation-action-card {
    grid-template-columns: 1fr;
  }

  .template-picker-row,
  .template-actions {
    grid-template-columns: 1fr;
  }

  .template-actions>* {
    width: 100%;
  }
}

/* Subsection heading spacing (used inside targeting/location/audience blocks) */
.subsection-heading {
  margin: 22px 0 14px;
}

.subsection-heading h3 {
  margin: 0 0 2px;
}

/* Targeting / location shared block wrapper */
.targeting-block {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border-soft);
}

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

.country-lock {
  flex: 0 0 auto;
  padding: 4px 10px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-pill);
  color: var(--color-primary);
  font-size: 0.7rem;
  font-weight: 700;
}

.location-search-panel {
  margin-top: 14px;
  padding: 14px;
  background: var(--color-surface-subtle);
  border-radius: var(--radius-control);
}

/* Segmented tab groups (location side, targeting category) */
.segmented-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 12px;
  background: var(--color-segment-track);
  border-radius: var(--radius-pill);
}

.segmented-tabs button {
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.segmented-tabs button.is-active {
  background: var(--color-primary);
  color: #ffffff;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input {
  flex: 1 1 0;
}

.search-results {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
  text-align: left;
  color: var(--color-text-soft);
  font-size: 0.82rem;
}

.search-result:hover {
  border-color: var(--color-border-active);
  background: var(--color-surface-hover);
}

.search-result strong {
  color: var(--color-text);
  font-size: 0.84rem;
}

.search-result small {
  color: var(--color-muted);
}

.search-result>span:last-child {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: 0.76rem;
  font-weight: 700;
}

.location-source-note {
  margin: 10px 0 0;
  color: var(--color-muted-dark);
  font-size: 0.72rem;
}

.custom-location-entry {
  margin-top: 10px;
  border: 1px dashed var(--color-border-active);
  border-radius: var(--radius-control);
  background: var(--color-surface);
}

.custom-location-entry summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px 11px;
  cursor: pointer;
  list-style: none;
}

.custom-location-entry summary::-webkit-details-marker {
  display: none;
}

.custom-location-entry summary > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 1rem;
}

.custom-location-entry summary strong,
.custom-location-entry summary small {
  grid-column: 2;
}

.custom-location-entry summary strong {
  color: var(--color-text);
  font-size: 0.8rem;
}

.custom-location-entry summary small {
  margin-top: -7px;
  color: var(--color-muted);
  font-size: 0.68rem;
}

.custom-location-entry[open] {
  border-style: solid;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.custom-location-entry-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(110px, 0.8fr)) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--color-border-soft);
}

.custom-location-entry-fields label {
  display: grid;
  gap: 5px;
}

.custom-location-entry-fields label > span:first-child {
  color: var(--color-muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.custom-location-entry-fields input,
.custom-location-entry-fields .button-secondary {
  min-height: 42px;
}

.custom-location-radius-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
  background: var(--color-surface);
}

.custom-location-radius-input input {
  min-width: 0;
  border: 0;
  box-shadow: none;
}

.custom-location-radius-input b {
  padding-right: 10px;
  color: var(--color-muted);
  font-size: 0.7rem;
}

.selected-location-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.selected-location-chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  max-height: 122px;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
  scrollbar-color: var(--color-border) transparent;
  scrollbar-width: thin;
}

.selected-location-chips:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.selected-location-chips::-webkit-scrollbar {
  width: 8px;
}

.selected-location-chips::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: padding-box;
}

.selected-location-chips > .chip {
  flex: 0 0 auto;
  max-width: 100%;
  margin: 0;
}

.radius-location-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 8px 8px 12px;
  background: var(--color-primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-control);
}

.radius-location-card.is-excluded {
  background: var(--color-danger-soft);
  border-color: rgba(244, 63, 94, 0.3);
}

.custom-location-card {
  overflow: hidden;
  border: 1px solid rgba(59, 130, 246, 0.32);
  border-radius: calc(var(--radius-control) + 2px);
  background: var(--color-surface);
}

.custom-location-card.is-excluded {
  border-color: rgba(244, 63, 94, 0.35);
}

.custom-location-map {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  background: var(--color-surface-subtle);
  z-index: 0;
}

.location-map-canvas {
  display: block;
  width: 100%;
  height: 260px;
  min-height: 260px;
  border: 0;
}

.location-map-status {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 26px;
  z-index: 1000;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}

.location-map-status[hidden] { display: none; }
.location-map-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 60px);
}

.location-map-edit, .location-map-link, .location-map-retry {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 10px;
  min-height: 36px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}

.location-map-edit[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
}
.custom-location-map.is-picking .location-map-canvas { cursor: crosshair; }
.location-picker-map { border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.location-map-heading { display: grid; gap: 4px; padding: 10px 12px; }
.location-map-heading small, .location-search-hint, .location-geocoder-credit { color: var(--color-text-muted); font-size: 12px; }
.location-search-hint { margin: 8px 0; line-height: 1.5; }
.location-search-status { margin: 8px 0; padding: 8px 10px; font-size: 13px; line-height: 1.5; }
.location-search-status.is-error { color: var(--color-danger); }
.location-geocoder-credit { margin: 8px 0; }
.location-results { max-height: 290px; overflow-y: auto; }
.location-results .search-result { gap: 16px; min-height: 58px; padding: 10px 12px; }
.location-results .search-result > span:first-child { display: grid; gap: 4px; min-width: 0; text-align: left; }
.location-results .search-result small { display: block; font-size: 12px; line-height: 1.4; white-space: normal; }
.location-results .search-result > span:last-child { flex-shrink: 0; }

.custom-location-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-top: 1px solid var(--color-border-soft);
}

.custom-location-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.custom-location-copy > span {
  display: grid;
  min-width: 0;
}

.custom-location-copy strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-location-copy small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.68rem;
}

.radius-location-copy,
.radius-location-control,
.radius-location-control > span:last-child {
  display: flex;
  align-items: center;
}

.radius-location-copy {
  min-width: 0;
  gap: 9px;
}

.radius-location-copy > span {
  display: grid;
  min-width: 0;
}

.radius-location-copy strong,
.radius-location-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radius-location-copy strong {
  color: var(--color-text);
  font-size: 0.82rem;
}

.radius-location-copy small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.7rem;
}

.radius-location-control {
  gap: 8px;
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.radius-location-control > span:last-child {
  gap: 5px;
  padding-right: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.radius-location-control input {
  width: 68px;
  min-height: 38px;
  padding: 0 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--color-text);
  font-weight: 750;
  text-align: right;
}

.radius-location-control input:focus {
  box-shadow: none;
  outline: 0;
}

.radius-location-control b {
  color: var(--color-muted);
  font-size: 0.72rem;
}

.radius-location-remove {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-muted);
  font-size: 1rem;
}

.radius-location-remove:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

@media (max-width: 640px) {
  .radius-location-card {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .radius-location-control {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
  }

  .radius-location-remove {
    grid-column: 2;
    grid-row: 1;
  }

  .custom-location-entry-fields {
    grid-template-columns: 1fr 1fr;
  }

  .custom-location-entry-fields label:first-child,
  .custom-location-entry-fields .button-secondary {
    grid-column: 1 / -1;
  }

  .custom-location-toolbar {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .custom-location-toolbar .radius-location-control {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
  }
}

/* Two-column include/exclude layouts (locations, custom audiences) */
.location-columns,
.audience-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.location-column,
.audience-column {
  padding: 14px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
}

.audience-column select {
  margin-top: 10px;
}

.audience-column-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audience-column-title strong {
  font-size: 0.86rem;
  color: var(--color-text);
}

.audience-column-title span {
  min-width: 22px;
  padding: 1px 7px;
  background: var(--color-surface-subtle);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

/* Chips (selected regions / audiences / targeting terms) */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 12px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  color: var(--color-text-soft);
  font-size: 0.78rem;
}

.chip-blue {
  background: var(--color-primary-soft);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.chip-red {
  background: var(--color-danger-soft);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

.chip button {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: inherit;
  font-size: 0.72rem;
  opacity: 0.75;
}

.chip button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.empty-chip-copy {
  color: var(--color-muted-dark);
  font-size: 0.78rem;
  font-style: italic;
}

@media (max-width: 768px) {

  .location-columns,
  .audience-columns {
    grid-template-columns: 1fr;
  }
}

/* Unified audience card (Vị trí / Độ tuổi / Giới tính / Nhắm mục tiêu chi tiết),
   modeled after Meta Ads Manager's single bordered targeting box. */
.audience-card {
  margin-top: 16px;
  padding: 4px 18px 18px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}

.audience-card-custom {
  margin-top: 0;
  padding: 18px;
}

.audience-card-section {
  padding-top: 18px;
}

.audience-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--color-border-soft);
}

.audience-section-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.audience-section-label-plain {
  align-items: center;
}

.audience-flag {
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1.4;
}

.audience-section-label strong {
  display: block;
  font-size: 0.9rem;
  color: var(--color-text);
}

.audience-section-label small {
  color: var(--color-muted);
  font-size: 0.76rem;
}

.subsection-heading-flush {
  margin-top: 0;
}

.audience-demo-row {
  display: grid;
  gap: 18px;
}

.audience-field .field-label {
  display: block;
  margin-bottom: 8px;
}

.audience-age-range {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 220px;
}

.audience-age-input {
  width: 100%;
  min-height: var(--control-height);
  padding: 10px 12px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  color: var(--color-text);
  text-align: center;
}

.audience-age-sep {
  flex: 0 0 auto;
  color: var(--color-muted-dark);
}

.audience-locale-summary {
  display: grid;
  gap: 3px;
  min-height: var(--control-height);
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--bg-dark-surface);
}

.audience-locale-summary strong {
  color: var(--color-text);
  font-size: 0.86rem;
}

.audience-locale-summary small {
  color: var(--color-muted);
  font-size: 0.74rem;
}

.audience-custom-picker-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

/* Compact unified audience editor */
.editor-section:has(.audience-compact) .section-heading {
  display: none;
}

.editor-section:has(.audience-compact) .section-content {
  padding: 0;
}

.audience-compact {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.audience-compact-header,
.audience-advantage-status,
.audience-compact-top {
  display: flex;
  align-items: center;
}

.audience-compact-header {
  justify-content: space-between;
  gap: 12px;
}

.audience-compact-header>div:first-child strong,
.audience-compact-header>div:first-child small,
.audience-advantage-status b,
.audience-advantage-status small {
  display: block;
}

.audience-compact-header>div:first-child strong {
  color: var(--color-text);
  font-size: .86rem;
}

.audience-compact-header small {
  margin-top: 1px;
  color: var(--color-muted);
  font-size: .68rem;
}

.audience-advantage-status {
  flex: 0 0 auto;
  gap: 8px;
  text-align: right;
}

.audience-advantage-status b {
  color: var(--color-text);
  font-size: .72rem;
}

.audience-compact-top {
  align-items: stretch;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--color-border-soft);
}

.audience-compact-top>.saved-audience-picker {
  flex: .8 1 0;
  min-width: 0;
}

.audience-compact-custom {
  flex: 1.2 1 0;
  min-width: 0;
}

.audience-compact .template-library,
.audience-compact .audience-card,
.audience-compact .audience-card-custom,
.audience-compact-body {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.audience-compact .template-library-heading,
.audience-compact .audience-section-label-plain {
  display: none;
}

.audience-compact .template-library>.field,
.audience-compact .audience-card-custom .audience-card-section {
  padding: 0;
}

.audience-compact .template-library-heading+.field,
.audience-compact .audience-card-custom .audience-card-section {
  margin: 0;
}

.audience-compact .audience-custom-picker-row {
  gap: 8px;
  margin: 0;
}

.audience-compact .audience-custom-picker-row .expand-select-avatar {
  display: none;
}

.audience-compact .audience-custom-picker-row .expand-select-trigger {
  min-height: 44px;
  padding-inline: 12px 8px;
}

.audience-compact .audience-custom-picker-row .expand-select-trigger-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  -webkit-line-clamp: unset;
}

.audience-custom-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.saved-audience-select-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.audience-compact .audience-custom-field .field-label,
.audience-compact-top .saved-audience-select-field>.field-label {
  margin: 0;
  color: var(--color-muted);
  font-size: .68rem;
  font-weight: 650;
}

.audience-compact-top select {
  min-height: 36px;
  padding-block: 6px;
  font-size: .76rem;
}

.audience-compact-top .chip-list,
.audience-compact .saved-audience-empty,
.audience-compact .template-modified-note,
.audience-compact .saved-audience-summary {
  margin-top: 6px;
}

.audience-compact-top .saved-audience-empty,
.audience-compact-top .chip-list:has(.empty-chip-copy) {
  display: none;
}

.audience-compact-body {
  display: grid;
  gap: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--color-border-soft);
}

.audience-compact .audience-card-section {
  padding-top: 0;
}

.audience-compact .audience-section-label {
  margin-bottom: 6px;
}

.audience-compact .location-search-panel {
  padding: 8px;
}

.audience-compact .audience-demo-row {
  grid-template-columns: minmax(120px, .7fr) minmax(180px, 1fr) minmax(150px, 1fr);
  align-items: end;
  gap: 10px;
}

.audience-compact .audience-field .field-label {
  margin-bottom: 4px;
  font-size: .7rem;
}

.audience-compact .audience-age-input,
.audience-compact .audience-locale-summary {
  min-height: 36px;
  padding: 6px 9px;
}

.audience-compact .subsection-heading {
  margin-bottom: 7px;
}

.audience-compact .subsection-heading h3 {
  font-size: .78rem;
}

.audience-compact .subsection-heading p {
  display: none;
}

.audience-compact .detailed-targeting {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.audience-compact .detailed-targeting .subsection-heading,
.audience-compact .detailed-targeting .selected-targeting {
  grid-column: 1 / -1;
}

.audience-compact .audience-template-manager,
.audience-compact .audience-meta-readonly {
  margin-top: 0;
  padding-top: 9px;
  border-top: 1px solid var(--color-border-soft);
}

@media (max-width: 1280px) {
  .audience-compact-top {
    flex-direction: column;
  }

  .audience-compact-top>.saved-audience-picker,
  .audience-compact-custom {
    width: 100%;
  }
}

@media (max-width: 800px) {

  .audience-compact .audience-demo-row,
  .audience-compact .detailed-targeting {
    grid-template-columns: 1fr;
  }

  .audience-compact .detailed-targeting>* {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .audience-custom-picker-row {
    grid-template-columns: 1fr;
  }
}

.chip-tag {
  padding: 1px 6px;
  margin-right: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chip-red .chip-tag {
  background: rgba(244, 63, 94, 0.22);
}

.chip-blue .chip-tag {
  background: rgba(59, 130, 246, 0.22);
}

.creative-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: stretch;
  gap: 16px;
}

.creative-copy-fields {
  grid-template-rows: minmax(200px, 1fr) auto;
  min-width: 0;
}

.creative-copy-fields .field:first-child textarea {
  height: 100%;
  min-height: 200px;
}

.creative-layout .media-uploader-shell {
  min-width: 0;
  min-height: 100%;
}

/* Media Uploader */
.media-uploader-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  min-width: 0;
  max-width: 100%;
  padding: 20px;
  background: var(--color-dropzone);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-panel);
  text-align: center;
  transition: all 0.2s ease;
}

.media-uploader-shell .media-dropzone {
  flex: 1;
}

.media-dropzone:hover {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.05);
}

.media-dropzone.is-dragover {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-dropzone));
  transform: scale(1.01);
}

.media-dropzone.has-media {
  border-style: solid;
  border-color: var(--color-border);
}

.media-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.media-empty-trigger {
  display: flex;
  width: 100%;
  min-height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.media-empty-trigger strong {
  color: var(--color-text);
  font-size: 0.95rem;
}

.media-empty-trigger strong span {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.media-empty-trigger small {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.upload-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--color-primary);
}

.upload-mark svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-upload-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-network-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.media-network-path {
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.76rem;
}

.media-network-path:focus {
  border-color: var(--color-primary);
  outline: 3px solid color-mix(in srgb, var(--color-primary) 16%, transparent);
}

.media-network-submit {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 55%, var(--color-border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  color: var(--color-primary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.media-network-submit:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 16%, var(--color-surface));
}

.media-network-submit:disabled,
.media-network-path:disabled {
  cursor: wait;
  opacity: 0.55;
}

@media (max-width: 640px) {
  .media-network-upload {
    grid-template-columns: 1fr;
  }
}

.media-upload-overlay {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-top: 14px;
}

.media-upload-copy {
  display: grid;
  gap: 3px;
  text-align: left;
}

.media-upload-copy>strong {
  color: var(--color-primary);
  font-size: 1.2rem;
}

.media-upload-copy>span {
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 700;
}

.media-upload-copy small,
.media-transfer-stats {
  color: var(--color-muted);
  font-size: 0.72rem;
}

.media-upload-copy small {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.media-transfer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.media-transfer-stats b {
  font-weight: 400;
}

.media-progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-border) 70%, transparent);
}

.media-progress-track>span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width 0.2s ease;
}

.media-upload-footer {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-top: 12px;
  text-align: left;
}

.media-upload-success {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.media-upload-success>b {
  color: var(--color-success);
  line-height: 1.35;
}

.media-upload-meta {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.media-upload-meta>strong {
  color: var(--color-text);
  font-size: .78rem;
}

.media-upload-filename {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: .72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.media-upload-size {
  color: var(--color-muted);
  font-size: .7rem;
}

.media-upload-footer .media-upload-actions {
  flex: 0 0 auto;
  align-self: end;
}

@media (max-width: 640px) {
  .media-upload-footer {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .media-upload-footer .media-upload-actions {
    justify-content: flex-start;
  }
}

.media-replace-trigger,
.media-remove-trigger {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.media-remove-trigger {
  color: var(--color-danger, #e11d48);
}

.conversation-image-picker {
  position: relative;
  overflow: hidden;
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  background: var(--color-dropzone);
}

.conversation-image-empty {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--color-text);
  cursor: pointer;
}

.conversation-image-empty small,
.conversation-image-meta small {
  color: var(--color-muted);
}

.conversation-image-picker>img {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: cover;
}

.conversation-image-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.conversation-image-meta>span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.conversation-image-meta label,
.conversation-image-meta button {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.conversation-image-meta button {
  color: var(--color-danger, #e11d48);
}

.preview-conversation-image {
  width: calc(100% - 28px);
  max-height: 150px;
  margin: 0 14px 8px;
  border-radius: 12px;
  object-fit: cover;
}

.media-preview-frame {
  display: flex;
  width: 100%;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  border-radius: var(--radius-panel);
  background: color-mix(in srgb, var(--color-surface) 82%, #000 18%);
}

.media-preview-frame img,
.media-preview-frame video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(65vh, 520px);
  object-fit: contain;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-md);
}

.media-preview-frame video {
  min-height: 280px;
}

/* Right Sidebar - Review & Validation */
.workspace-review {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--bg-dark-surface);
  border-left: 1px solid var(--color-border);
}

.review-header {
  align-items: flex-start;
  padding: 16px;
}

.review-header h2 {
  margin: 3px 0 0;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.review-header .readiness-score {
  min-height: 26px;
  padding: 0 10px;
}

.review-header .readiness-score.is-ready {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}

.review-header .readiness-score.is-incomplete {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.1);
  color: var(--color-muted);
}

.review-content {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 14px;
}

.review-publish-footer {
  align-items: stretch;
  padding: 12px;
  background: var(--bg-dark-surface);
}

.review-publish-footer .publish-button {
  width: 100%;
  min-height: 44px;
}

.review-section {
  padding: 15px;
  border: 1px solid var(--color-border-soft);
  border-radius: 12px;
  background: var(--color-review-card);
}

.review-section.validation-summary.is-valid {
  border-color: rgba(16, 185, 129, 0.22);
  background: var(--color-review-success-gradient);
}

.review-section.validation-summary.has-errors {
  border-color: rgba(244, 63, 94, 0.28);
  background: var(--color-review-danger-gradient);
}

.review-section.validation-summary.is-incomplete {
  border-color: var(--color-border-soft);
  background: var(--color-review-card);
}

.review-incomplete-copy {
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.review-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--color-muted);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.review-section-heading h3 {
  font-size: 0.88rem;
  line-height: 1.35;
}

.validation-status-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  font-size: 0.82rem;
  font-weight: 800;
}

.has-errors .validation-status-icon {
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
}

.review-success-copy {
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.review-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-card {
  padding: 14px 16px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-sm);
}

.review-card.has-error {
  border-color: rgba(244, 63, 94, 0.4);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.1) 0%, rgba(17, 24, 39, 0.8) 100%);
}

.review-card.is-ok {
  border-color: rgba(16, 185, 129, 0.3);
}

.review-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 700;
}

.review-card-body {
  margin-top: 6px;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.review-progress-overview {
  padding: 18px 16px 16px;
  background:
    radial-gradient(circle at 22% 24%, rgba(59, 130, 246, 0.11), transparent 38%),
    var(--color-review-gradient);
  border-bottom: 1px solid var(--color-border-soft);
}

.review-progress-heading,
.review-progress-summary,
.campaign-progress-heading,
.campaign-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-progress-heading h3 {
  margin: 2px 0 0;
  color: var(--color-text);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.review-progress-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  font-size: 0.66rem;
  font-weight: 700;
}

.review-progress-summary {
  justify-content: flex-start;
  margin-top: 16px;
}

.review-progress-ring {
  position: relative;
  display: grid;
  flex: 0 0 126px;
  place-items: center;
  width: 126px;
  height: 126px;
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.12));
}

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

.review-progress-ring-track,
.review-progress-ring-value {
  fill: none;
  stroke-width: 7;
}

.review-progress-ring-track {
  stroke: rgba(148, 163, 184, 0.14);
}

.review-progress-ring-value {
  stroke: #60a5fa;
  stroke-linecap: round;
  stroke-dasharray: 100;
  transition: stroke-dashoffset 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.review-progress-ring-copy {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--color-text);
}

.review-progress-percent {
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.review-progress-check {
  position: absolute;
  top: -18px;
  color: #6ee7b7;
  font-size: 0.78rem;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.42);
  animation: reviewCheckIn 260ms ease-out both;
}

.review-progress-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.review-progress-copy strong {
  color: var(--color-text-soft);
  font-size: 0.82rem;
}

.review-progress-copy span {
  color: var(--color-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.review-progress-ring.is-completed .review-progress-ring-value {
  stroke: #34d399;
}

.review-progress-status.is-completed {
  border-color: rgba(16, 185, 129, 0.26);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}

.review-progress-overview.is-completed_with_errors,
.review-progress-overview.is-failed {
  background:
    radial-gradient(circle at 22% 24%, rgba(244, 63, 94, 0.1), transparent 38%),
    var(--color-review-gradient);
}

.review-progress-ring.is-completed_with_errors .review-progress-ring-value,
.review-progress-ring.is-failed .review-progress-ring-value {
  stroke: #fb7185;
}

.review-progress-status.is-completed_with_errors,
.review-progress-status.is-failed {
  border-color: rgba(244, 63, 94, 0.28);
  background: rgba(244, 63, 94, 0.1);
  color: #fda4af;
}

.review-progress-ring.is-needs_review .review-progress-ring-value {
  stroke: #fbbf24;
}

.review-progress-status.is-needs_review {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}

.review-campaign-progress {
  display: grid;
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--color-border-soft);
}

.review-campaign-label {
  padding: 13px 0 8px;
  color: var(--color-muted);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.campaign-progress-row {
  min-width: 0;
  width: 100%;
  padding: 10px 0 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.campaign-progress-row:hover {
  background: rgba(59, 130, 246, 0.07);
}

.campaign-progress-row:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.campaign-progress-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-progress-heading span {
  flex: 0 0 auto;
  color: #93c5fd;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.campaign-progress-track {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.14);
}

.campaign-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.28);
  transition: width 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.campaign-progress-row.is-completed .campaign-progress-fill {
  background: linear-gradient(90deg, #059669, #34d399);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.24);
}

.campaign-progress-row.is-completed_with_errors .campaign-progress-fill,
.campaign-progress-row.is-failed .campaign-progress-fill {
  background: #fb7185;
  box-shadow: none;
}

.campaign-progress-row.is-needs_review .campaign-progress-fill {
  background: #fbbf24;
  box-shadow: none;
}

.campaign-progress-meta {
  margin-top: 6px;
  color: var(--color-muted);
  font-size: 0.66rem;
}

.campaign-progress-meta small {
  color: var(--color-muted-dark);
  font-size: inherit;
}

@keyframes reviewCheckIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Drawers & Toast Notifications */
.results-drawer {
  position: fixed;
  z-index: 260;
  right: 0;
  top: var(--topbar-height);
  bottom: 0;
  width: min(100vw, 600px);
  background: var(--bg-dark-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-float);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.results-drawer.is-open {
  transform: translateX(0);
}

.results-sticky {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--bg-dark-surface);
  border-bottom: 1px solid var(--color-border-soft);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.results-header h2 {
  margin: 3px 0 0;
  font-size: 1rem;
}

.results-title-group {
  display: grid;
  gap: 2px;
}

.results-close-button {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-review-card);
  color: var(--color-text-soft);
  cursor: pointer;
  font-size: 1.2rem;
}

.results-close-button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.run-progress {
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: 12px;
  background: var(--color-review-gradient);
}

.run-progress-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.run-progress-metric {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.run-progress-metric strong {
  color: var(--color-text);
  font-size: 1.1rem;
}

.run-progress-metric span {
  color: var(--color-muted);
  font-size: 0.73rem;
}

.run-progress-phase {
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  font-size: 0.66rem;
  font-weight: 750;
}

.run-progress-track {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.18);
}

.run-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.run-progress-current {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 11px 0 0;
  color: var(--color-text-soft);
  font-size: 0.74rem;
  line-height: 1.45;
}

.run-progress-current>span {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 3px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.results-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.result-item {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--color-border-soft);
  border-radius: 12px;
  background: var(--color-review-card);
}

.result-status {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding-top: 2px;
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.result-status>span {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 3px;
  border-radius: 50%;
  background: #94a3b8;
}

.result-created .result-status {
  color: #10b981;
}

.result-created .result-status>span {
  background: #10b981;
}

.result-failed .result-status {
  color: #f43f5e;
}

.result-failed .result-status>span {
  background: #f43f5e;
}

.result-creating .result-status {
  color: #3b82f6;
}

.result-creating .result-status>span {
  background: #3b82f6;
}

.result-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.result-type {
  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-name {
  color: var(--color-text);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.result-identifiers {
  display: grid;
  gap: 4px;
  margin-top: 3px;
}

.result-identifier {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 7px;
  color: var(--color-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.result-identifier code {
  color: var(--color-text-soft);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.result-error-message {
  margin: 7px 0 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(244, 63, 94, 0.09);
  color: #fb7185;
  font-size: 0.74rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.seeding-results {
  margin: 0 14px 18px;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: 14px;
  background: var(--color-review-card);
}

.seeding-results-summary {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border-bottom: 1px solid var(--color-border-soft);
}

.seeding-summary-heading {
  display: grid;
  min-width: 0;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 8px;
}

.seeding-summary-heading .eyebrow {
  grid-column: 1 / -1;
}

.seeding-summary-heading h3 {
  min-width: 0;
  margin: 0;
  font-size: 0.88rem;
}

.seeding-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(66px, 1fr));
  gap: 7px;
}

.seeding-stat {
  display: grid;
  min-width: 66px;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--color-canvas);
  text-align: center;
}

.seeding-stat strong {
  color: var(--color-text);
  font-size: 0.78rem;
}

.seeding-stat span {
  color: var(--color-muted);
  font-size: 0.62rem;
  white-space: nowrap;
}

.seeding-summary-actions {
  display: flex;
  justify-content: flex-end;
}

.seeding-summary-actions button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.68rem;
}

.seeding-campaign {
  display: grid;
  gap: 12px;
  margin: 12px 14px;
  padding: 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: 12px;
  background: var(--color-surface-card);
}

.seeding-campaign-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.seeding-campaign-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.seeding-campaign-copy small {
  color: var(--color-primary);
  font-size: 0.65rem;
  font-weight: 800;
}

.seeding-campaign-copy h4 {
  margin: 0;
  color: var(--color-text);
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.seeding-campaign-copy span {
  color: var(--color-muted);
  font-size: 0.7rem;
}

.seeding-campaign-percent {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: 1rem;
}

.seeding-campaign-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-canvas);
}

.seeding-campaign-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width 240ms ease;
}

.seeding-post-links {
  display: grid;
  gap: 7px;
}

.seeding-post-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--color-canvas);
}

.seeding-post-link>span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.seeding-post-link small {
  color: var(--color-muted);
  font-size: 0.64rem;
}

.seeding-post-link strong {
  min-width: 0;
  color: var(--color-text-soft);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.seeding-post-link a {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: 0.68rem;
  font-weight: 800;
  text-decoration: none;
}

.seeding-campaign-errors {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(244, 63, 94, 0.28);
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.07);
}

.seeding-campaign-errors>strong {
  color: #fb7185;
  font-size: 0.72rem;
}

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

.seeding-failure>div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.seeding-failure strong {
  color: var(--color-text);
  font-size: 0.7rem;
}

.seeding-failure span {
  color: var(--color-text-soft);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.seeding-comment-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.seeding-comment-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.64rem;
}

.seeding-empty {
  margin: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--color-text-soft);
  font-size: 0.74rem;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .result-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .result-identifier {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .run-progress-summary {
    align-items: flex-start;
  }

  .run-progress-metric {
    flex-direction: column;
    gap: 2px;
  }

  .seeding-results-summary {
    grid-template-columns: 1fr;
  }

  .seeding-summary-actions {
    justify-content: stretch;
  }

  .seeding-summary-actions button {
    width: 100%;
  }

  .seeding-campaign-heading,
  .seeding-post-link,
  .seeding-failure {
    align-items: flex-start;
  }

  .seeding-post-link,
  .seeding-failure {
    flex-direction: column;
  }
}

.activity-history-workspace {
  height: calc(100vh - var(--topbar-height));
  padding: 24px;
  overflow: auto;
  background: var(--color-canvas);
}

.activity-history-workspace[hidden] {
  display: none;
}

.workspace-shell[hidden] {
  display: none;
}

.activity-history-workspace .history-shell {
  width: min(1500px, 100%);
  min-height: 100%;
  margin: 0 auto;
}

.history-shell {
  display: grid;
  align-content: start;
  gap: 20px;
}

.history-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 2px 2px;
}

.history-header-copy {
  display: grid;
  gap: 4px;
}

.history-eyebrow {
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-header h1,
.history-header h2,
.history-header p {
  margin: 0;
}

.history-header h1,
.history-header h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: -0.035em;
}

.history-header p {
  color: var(--color-muted);
  font-size: 0.86rem;
}

.history-header-actions {
  display: flex;
  gap: 10px;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.history-filters label {
  display: grid;
  gap: 7px;
}

.history-filters label>span {
  color: var(--color-muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.history-filters input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-card);
}

.history-date-filter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.history-date-filter>div:first-child {
  display: grid;
  flex: 1;
  gap: 4px;
}

.history-filter-label {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.history-date-trigger {
  min-width: 130px;
}

.history-clear-filter {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-weight: 750;
}

.history-date-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 170px minmax(560px, 1fr);
  width: min(820px, calc(100vw - 72px));
  overflow: hidden;
  border: 1px solid var(--color-border-active);
  border-radius: 16px;
  background: var(--color-surface-card);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

.history-date-presets {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
}

.history-date-presets button {
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  font-weight: 700;
  text-align: left;
}

.history-date-presets button:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.history-calendar-panel {
  min-width: 0;
}

.history-calendars {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 34px;
  align-items: start;
  gap: 10px;
  padding: 18px 14px 12px;
}

.history-calendar-month h3 {
  margin: 0 0 14px;
  font-size: 0.88rem;
  text-align: center;
}

.history-weekdays,
.history-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 3px;
}

.history-weekdays span {
  padding-bottom: 7px;
  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.history-calendar-grid button,
.history-month-nav {
  min-width: 0;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
}

.history-calendar-grid button:hover {
  background: var(--color-primary-soft);
}

.history-calendar-grid button.is-outside {
  color: var(--color-muted);
  opacity: 0.35;
}

.history-calendar-grid button.is-in-range {
  border-radius: 0;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.history-calendar-grid button.is-selected {
  background: var(--color-primary);
  color: #fff;
  font-weight: 850;
}

.history-month-nav {
  color: var(--color-muted);
  font-size: 1.25rem;
}

.history-month-nav:hover {
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.history-date-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-top: 1px solid var(--color-border);
}

.history-date-footer>div:first-child {
  display: grid;
  gap: 3px;
}

.history-date-footer small {
  color: var(--color-muted);
}

.history-date-footer>div:last-child {
  display: flex;
  gap: 8px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-summary {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.history-summary:hover {
  transform: translateY(-1px);
  border-color: var(--color-border-active);
  box-shadow: var(--shadow-md);
}

.history-summary-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 17px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.history-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--color-success-soft);
  color: var(--color-success);
  font-size: 1rem;
  font-weight: 900;
}

.history-summary.has-errors .history-status-icon {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.history-summary-content {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.history-summary-topline,
.history-summary-meta,
.history-summary-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-summary-topline {
  justify-content: space-between;
}

.history-summary-topline strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.93rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-summary-topline time {
  color: var(--color-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.history-summary-meta>span,
.history-summary-counts>span {
  padding: 4px 9px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.history-summary-counts .history-count-created {
  border-color: rgba(16, 185, 129, 0.22);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.history-summary-counts .history-count-failed {
  border-color: rgba(244, 63, 94, 0.22);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.history-summary-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.history-loading,
.history-empty,
.history-error {
  padding: 32px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  text-align: center;
}

.history-empty p {
  margin: 6px 0 0;
}

.history-load-more {
  display: flex;
  justify-content: center;
}

@media (max-width: 760px) {
  .activity-history-workspace {
    padding: 16px;
  }

  .history-filters {
    grid-template-columns: 1fr;
  }

  .history-date-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .history-date-popover {
    left: 0;
    right: auto;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .history-date-presets {
    grid-template-columns: repeat(2, 1fr);
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .history-calendars {
    grid-template-columns: 34px 1fr 34px;
  }

  .history-calendar-month+.history-calendar-month {
    display: none;
  }

  .history-date-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .history-summary-main {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .history-summary-action {
    grid-column: 2;
  }

  .history-summary-topline {
    align-items: flex-start;
    flex-direction: column;
  }
}

.campaign-preset-card {
  display: grid;
  gap: 14px;
}

.campaign-preset-picker {
  width: 100%;
}

.campaign-preset-picker .template-choice-copy small {
  white-space: normal;
}

.campaign-preset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.campaign-preset-form .button-primary {
  min-height: 42px;
  white-space: nowrap;
}

.campaign-preset-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  color: var(--color-muted);
  font-size: 12px;
}

.campaign-preset-summary span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
  background: var(--color-surface-subtle);
  overflow-wrap: anywhere;
}

.campaign-preset-summary b {
  color: var(--color-text);
  font-size: 11px;
}

@media (max-width: 640px) {
  .campaign-preset-form,
  .campaign-preset-summary {
    grid-template-columns: 1fr;
  }

  .campaign-preset-form .button-primary {
    width: 100%;
  }
}

.history-report-table-wrap {
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}

.history-seeding-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--color-danger) 60%, transparent);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--bg-dark-card));
}

.history-seeding-alert-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-danger);
  color: white;
  font-weight: 800;
}

.history-seeding-alert strong,
.history-seeding-alert p,
.history-seeding-alert small {
  display: block;
}

.history-seeding-alert p {
  margin: 3px 0 0;
  color: var(--color-text);
}

.history-seeding-alert small {
  margin-top: 6px;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.history-report-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}

.history-report-table th,
.history-report-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--color-border-soft);
  text-align: left;
  vertical-align: top;
}

.history-report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-card);
  color: var(--color-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-report-table td {
  color: var(--color-text-soft);
  font-size: 0.84rem;
}

.history-seeding-cell {
  display: grid;
  justify-items: start;
  gap: 6px;
  min-width: 120px;
}

.history-seeding-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.history-seeding-status-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.13);
  color: #6ee7b7;
}

.history-seeding-status-progress {
  border-color: rgba(59, 130, 246, 0.32);
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
}

.history-seeding-status-error {
  border-color: rgba(244, 63, 94, 0.32);
  background: rgba(244, 63, 94, 0.13);
  color: #fda4af;
}

.history-seeding-status-review {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.13);
  color: #fcd34d;
}

.history-seeding-status-empty {
  border-color: var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-muted);
}

.history-seeding-error {
  display: -webkit-box;
  max-width: 220px;
  overflow: hidden;
  color: #fda4af;
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-post-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 94px;
}

.history-post-action {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.history-post-action:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  transform: translateY(-1px);
}

.history-post-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 24%, transparent);
  outline-offset: 2px;
}

.history-post-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-copy-success-icon {
  display: none;
}

.history-copy-link.is-copied {
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
  color: var(--color-success);
}

.history-copy-link.is-copied .history-copy-icon {
  display: none;
}

.history-copy-link.is-copied .history-copy-success-icon {
  display: block;
}

.toast-region {
  position: fixed;
  z-index: 100;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-control);
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Seeding Workspace Smart Layout */
.workspace-seeding-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 20px 28px 80px;
}

.workspace-seeding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  padding: 16px 20px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-md);
}

.workspace-seeding-header h1,
.seeding-composer-heading h2 {
  margin: 3px 0 0;
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--color-text);
}

.workspace-seeding-header p,
.seeding-composer-heading p {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 0.84rem;
}

.workspace-seeding-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-linked-status {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-warning-soft);
  color: var(--color-warning);
  font-size: 0.76rem;
  font-weight: 750;
}

.workspace-linked-status.is-ready {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.workspace-seeding-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--color-primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius-control);
}

.workspace-seeding-context strong {
  display: block;
  font-size: 0.96rem;
  color: var(--color-text);
}

.workspace-seeding-context small {
  color: var(--color-text-soft);
  text-align: right;
}

.seeding-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seeding-composer {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border-active);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-md);
}

.seeding-composer-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.seeding-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 min(100%, 250px);
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
}

.seeding-template-library {
  display: grid;
  gap: 0;
  padding: 0;
  background: var(--bg-dark-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  overflow: hidden;
}

.seeding-template-library summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

.seeding-template-library summary::-webkit-details-marker {
  display: none;
}

.seeding-template-library summary strong,
.seeding-template-library summary small {
  display: block;
}

.seeding-template-library summary small {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.seeding-template-summary-action {
  color: var(--color-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.seeding-template-library[open] .seeding-template-summary-action {
  font-size: 0;
}

.seeding-template-library[open] .seeding-template-summary-action::after {
  content: 'Thu gọn';
  font-size: 0.82rem;
}

.seeding-template-library-content {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
  border-top: 1px solid var(--color-border-soft);
}

.seeding-card-list {
  display: grid;
  gap: 16px;
}

.seeding-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: var(--bg-dark-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.seeding-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.seeding-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.seeding-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seeding-card-title strong,
.seeding-card-title small {
  display: block;
}

.seeding-card-title small {
  margin-top: 1px;
  color: var(--color-muted);
  font-size: 0.75rem;
}

.seeding-card-index {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.seeding-order-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.seeding-icon-button {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 6px;
  font-size: 0.8rem;
}

.seeding-card-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: stretch;
  gap: 16px;
}

.seeding-message-field textarea {
  min-height: 156px;
  resize: vertical;
}

.seeding-image-control {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 156px;
  gap: 12px;
  padding: 16px;
  background: var(--color-dropzone);
  border: 1px dashed rgba(96, 165, 250, 0.55);
  border-radius: var(--radius-control);
  text-align: center;
}

.seeding-image-control>.media-file-input {
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.seeding-thumbnail {
  width: 100%;
  max-width: 160px;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
}

.seeding-image-empty {
  display: grid;
  gap: 4px;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.seeding-image-empty strong {
  color: var(--color-text-soft);
  font-size: 0.88rem;
}

.seeding-image-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.seeding-add-comment {
  justify-self: start;
}

/* Review Pane Formatting */
.workspace-review ol,
.workspace-review ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--color-text-soft);
  font-size: 0.82rem;
  line-height: 1.6;
}

.workspace-review li {
  margin-bottom: 8px;
  color: var(--color-muted);
}

.workspace-review code {
  padding: 2px 6px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 4px;
  color: #60a5fa;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

/* Responsive adjustments */
@media (max-width: 1199px) {
  .workspace-shell {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .workspace-review {
    display: none;
  }

  .seeding-card-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .workspace-seeding-shell {
    padding: 16px 14px 56px;
  }

  .workspace-seeding-header,
  .workspace-seeding-context,
  .seeding-composer-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-seeding-actions,
  .workspace-seeding-context small {
    justify-content: space-between;
    text-align: left;
  }

  .seeding-toggle-row {
    flex-basis: auto;
    width: 100%;
  }

  .seeding-card {
    padding: 16px;
  }

  .seeding-card-content {
    grid-template-columns: 1fr;
  }

  .seeding-template-library summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Seeding composer: Facebook-like input proportions and mobile-safe workspace. */
.workspace-seeding-shell,
.workspace-seeding-shell * {
  box-sizing: border-box;
}

.workspace-seeding-shell {
  width: 100%;
  max-width: 1080px;
  min-width: 0;
}

.seeding-editor {
  width: 100%;
  min-width: 0;
}

.seeding-composer {
  width: 100%;
  min-width: 0;
}

.seeding-card-list,
.seeding-card,
.seeding-card-content {
  width: 100%;
  min-width: 0;
}

.seeding-card {
  overflow: hidden;
}

.seeding-card-content {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
}

.seeding-message-field {
  min-width: 0;
}

.seeding-message-field textarea {
  width: 100%;
  min-height: 112px;
  max-height: 240px;
  line-height: 1.5;
}

.seeding-image-control {
  min-width: 0;
  min-height: 112px;
}

@media (max-width: 768px) {
  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
    overflow: visible;
  }

  .workspace-tree {
    display: none;
  }

  .workspace-editor {
    overflow: visible;
    width: 100%;
  }

  .workspace-review {
    display: none;
  }

  .workspace-seeding-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px;
  }

  .workspace-seeding-header {
    width: 100%;
  }

  .workspace-seeding-context {
    width: 100%;
  }

  .seeding-composer {
    padding: 16px;
  }

  .seeding-card {
    padding: 14px;
  }

  .seeding-card-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .seeding-message-field textarea {
    min-height: 118px;
    max-height: 220px;
  }

  .seeding-image-control {
    min-height: 132px;
  }

  .seeding-image-actions {
    flex-wrap: wrap;
  }
}

/* Compatibility guardrails for legacy mobile card checks and motion sensitivity. */
@media (max-width: 760px) {
  .seeding-card-content {
    grid-template-columns: 1fr;
  }

  .seeding-thumbnail {
    max-width: 160px;
    max-height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .review-progress-ring-value,
  .campaign-progress-fill,
  .review-progress-check {
    animation: none !important;
    transition: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}




/* Compatibility guardrails for legacy mobile card checks and motion sensitivity. */
@media (max-width: 760px) {
  .seeding-card-content {
    grid-template-columns: 1fr;
  }

  .seeding-thumbnail {
    max-width: 160px;
    max-height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Accessible tree-node action menu states. */
.node-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, .12));
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.node-action-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, .12));
  border-radius: 10px;
  background: var(--color-surface-card, #182234);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .24);
}

.node-action-menu.opens-upward {
  top: auto;
  bottom: calc(100% + 6px);
  transform-origin: bottom right;
}

.node-action-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.node-action-menu-item:hover {
  background: var(--color-surface-hover, rgba(51, 65, 85, .7));
}

.node-action-menu-item.is-destructive {
  color: var(--color-danger, #f87171);
}

.node-action-menu-item:focus-visible {
  outline: 2px solid var(--color-primary, #3b82f6);
  outline-offset: 2px;
}

.workspace-shell>.workspace-seeding-shell {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  overflow-y: auto;
}

.workspace-seeding-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-seeding-layout>.workspace-seeding-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  overflow-y: auto;
}

.workspace-seeding-layout>.workspace-review {
  min-width: 0;
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
  overflow-y: auto;
}

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

  .workspace-seeding-layout>.workspace-review {
    position: fixed;
  }
}

.workspace-shell:has(.workspace-seeding-shell) {
  overflow-y: auto;
}

.gender-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: fit-content;
  max-width: max-content;
}

.segmented-control {
  display: inline-flex;
  width: fit-content;
  max-width: max-content;
  align-self: flex-start;
  gap: 3px;
  padding: 4px;
  background: var(--color-segment-track);
  border: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
  border-radius: 9999px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.segment {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 16px;
  border-radius: 9999px;
  color: var(--color-muted, #64748b);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.segment:hover:not(.is-selected) {
  color: var(--color-text, #0f172a);
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}

.segment.is-selected {
  background: var(--color-primary, #2563eb);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

/* Audience Demographics Row Layout */
.audience-demo-row {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  flex-wrap: wrap;
}

.audience-demo-row .audience-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audience-age-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audience-age-sep {
  color: var(--color-muted, #94a3b8);
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
}

.locale-field-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.locale-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-soft, #475569);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.locale-badge svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--color-muted, #64748b);
  stroke-width: 2;
}

/* Grouped, human-readable review issues */
.issue-groups {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.issue-group {
  padding: 10px 12px;
  background: var(--bg-dark-card);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-control);
}

.issue-group-jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0 6px;
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px dashed var(--color-border-soft);
}

.issue-group-jump:hover {
  color: var(--color-primary);
}

.issue-group-heading {
  padding-bottom: 6px;
  color: var(--color-text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.issue-group-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.issue-item-jump {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.issue-item-jump>span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.issue-item-jump small {
  color: var(--color-danger);
  font-weight: 800;
}

.issue-item-jump b {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.issue-item-jump:hover {
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
  background: var(--color-danger-soft);
  transform: translateX(2px);
}

.issue-item-jump:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-danger) 28%, transparent);
  outline-offset: 2px;
}

.issue-item-arrow {
  color: var(--color-danger);
  font-size: 15px;
  font-weight: 900;
}

.is-validation-highlight {
  position: relative;
  z-index: 1;
  border-color: var(--color-danger) !important;
  background: color-mix(in srgb, var(--color-danger) 9%, var(--color-surface)) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-danger) 18%, transparent), 0 12px 30px color-mix(in srgb, var(--color-danger) 12%, transparent) !important;
  animation: validation-highlight-pulse 700ms ease 2;
}

@keyframes validation-highlight-pulse {
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--color-danger) 12%, transparent), 0 12px 30px color-mix(in srgb, var(--color-danger) 16%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {

  .issue-item-jump,
  .is-validation-highlight {
    transition: none;
    animation: none;
  }
}

.issue-group-list li {
  display: grid;
  gap: 2px;
}

.issue-group-list small {
  color: var(--color-danger);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.issue-group-list span {
  color: var(--color-text-soft);
  font-size: 0.8rem;
}

.saved-audience-picker {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-card);
}

.audience-library-alert,
.audience-meta-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.audience-library-alert {
  border: 1px solid color-mix(in srgb, var(--color-danger) 45%, var(--color-border));
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface-card));
  color: var(--color-danger);
}

.audience-template-manager {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-top: 2px;
}

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

.audience-meta-readonly {
  border: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-text-soft);
}

.button-danger-subtle {
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--color-danger) 42%, var(--color-border));
  border-radius: 9px;
  background: transparent;
  color: var(--color-danger);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button-danger-subtle:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
}

@media (max-width: 768px) {
  .audience-template-manager {
    grid-template-columns: 1fr;
  }

  .audience-template-actions>button,
  .audience-meta-readonly>button {
    flex: 1 1 auto;
  }

  .audience-meta-readonly {
    align-items: stretch;
    flex-direction: column;
  }
}

.saved-audience-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-text-soft);
  font-size: 13px;
}

.saved-audience-empty {
  justify-content: space-between;
  background: var(--color-surface-subtle);
}

.saved-audience-empty a {
  color: var(--color-primary);
  font-weight: 700;
}

.saved-audience-lock {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border: 1px solid var(--color-border-active);
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-text-soft);
  font-size: 13px;
}

.saved-audience-lock strong {
  color: var(--color-primary);
}

.saved-audience-fields {
  display: grid;
  gap: 16px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.saved-audience-fields:disabled,
.saved-audience-fields:disabled * {
  opacity: 1;
}

.saved-audience-fields:disabled input,
.saved-audience-fields:disabled select,
.saved-audience-fields:disabled button {
  cursor: not-allowed;
}


.run-progress-error {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #f3b4b4;
  border-left: 4px solid #d64545;
  border-radius: 12px;
  background: #fff6f6;
  color: #7b1f1f;
}

.run-progress-error-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.run-progress-error-heading span:not(.run-progress-error-icon) {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.run-progress-error-heading strong {
  display: block;
  margin-top: 2px;
  color: #5d1212;
}

.run-progress-error-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-weight: 800;
}

.run-progress-error p {
  margin: 10px 0 0;
  line-height: 1.45;
}

.run-progress-error dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.run-progress-error dl div {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.run-progress-error dt {
  font-size: 11px;
  color: #9a5555;
}

.run-progress-error dd {
  margin: 3px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.run-progress-error small {
  display: block;
  margin-top: 10px;
  color: #8f4040;
  line-height: 1.4;
}

.history-run-card {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgba(23, 39, 72, .05);
}

.history-run-card.has-errors {
  border-color: color-mix(in srgb, var(--color-danger) 34%, var(--color-border));
}

.history-run-card-summary {
  display: grid;
  grid-template-columns: 40px minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  cursor: pointer;
  list-style: none;
  transition: background 160ms ease;
}

.history-run-card-summary::-webkit-details-marker {
  display: none;
}

.history-run-card-summary:hover {
  background: var(--color-surface-subtle);
}

.history-run-card-summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 28%, transparent);
  outline-offset: -3px;
}

.history-run-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--color-success-soft);
  color: var(--color-success);
  font-size: 16px;
  font-weight: 900;
}

.history-run-card.has-errors .history-run-status-icon {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.history-run-card-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-run-card-copy strong {
  color: var(--color-text);
  font-size: 13px;
}

.history-run-card-copy small {
  overflow: hidden;
  color: var(--color-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-run-card-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.history-run-card-stats>span {
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
}

.history-run-card-summary .history-resume-run {
  padding: 6px 12px;
  font-size: 12px;
}

.history-run-card-stats>.is-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.history-run-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  transition: background 250ms ease, color 250ms ease, transform 250ms ease;
}

.history-run-toggle-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 300ms cubic-bezier(.4, 0, .2, 1);
}

.history-run-card[open] .history-run-toggle-icon {
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-subtle));
  color: var(--color-primary);
}

.history-run-card[open] .history-run-toggle-icon svg {
  transform: rotate(180deg);
}

.history-run-card-content {
  overflow: hidden;
  max-height: 0;
  padding: 0 16px;
  border-top: 1px solid transparent;
  opacity: 0;
  transition: max-height 320ms ease, padding 300ms ease, opacity 220ms ease, border-color 300ms ease;
}

.history-run-card[open] .history-run-card-content {
  max-height: 6000px;
  padding: 12px 16px 16px;
  border-top-color: var(--color-border-soft);
  opacity: 1;
}

.history-run-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.history-run-card-header h3 {
  margin: 3px 0 0;
  font-size: 15px;
}

.history-run-eyebrow {
  color: var(--color-muted);
  font-size: 12px;
}

.history-run-report {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font-weight: 700;
  white-space: nowrap;
}

.history-campaign-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.history-campaign-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.history-campaign-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--color-primary) 42%, var(--color-border));
  box-shadow: 0 10px 24px rgba(23, 39, 72, .10);
}

.history-campaign-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 30%, transparent);
  outline-offset: 2px;
  border-color: var(--color-primary);
}

.history-campaign-card.is-failed {
  border-color: color-mix(in srgb, var(--color-danger) 38%, var(--color-border));
  background: linear-gradient(155deg, var(--color-surface) 0%, color-mix(in srgb, var(--color-danger-soft) 55%, var(--color-surface)) 100%);
}

.history-campaign-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-success-soft);
  color: var(--color-success);
  font-size: 17px;
  font-weight: 900;
}

.history-campaign-card.is-failed .history-campaign-card-icon {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.history-campaign-card.is-pending .history-campaign-card-icon {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.history-campaign-card-body {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.history-campaign-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history-campaign-card-heading strong {
  min-width: 0;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
}

.history-campaign-card-heading time {
  flex: 0 0 auto;
  color: var(--color-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.history-campaign-card-account {
  overflow: hidden;
  color: var(--color-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-campaign-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-campaign-card-metrics span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(86, 124, 205, .09);
  color: var(--color-muted);
  font-size: 12px;
}

.history-campaign-card-metrics .history-campaign-status.is-created {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.history-campaign-card-metrics .history-campaign-status.is-failed {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.history-campaign-card-metrics .history-campaign-status.is-pending {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.history-campaign-progress {
  display: grid;
  gap: 5px;
  width: min(420px, 100%);
}

.history-campaign-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
}

.history-campaign-progress-value {
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.history-campaign-progress-track {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-subtle));
}

.history-campaign-progress-track>span {
  display: block;
  width: var(--history-progress);
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width 320ms cubic-bezier(.4, 0, .2, 1);
}

.history-campaign-progress.is-created .history-campaign-progress-value {
  color: var(--color-success);
}

.history-campaign-progress.is-created .history-campaign-progress-track>span {
  background: var(--color-success);
}

.history-campaign-progress.is-failed .history-campaign-progress-value {
  color: var(--color-danger);
}

.history-campaign-progress.is-failed .history-campaign-progress-track>span {
  background: var(--color-danger);
}

.history-campaign-progress.is-pending .history-campaign-progress-value {
  color: var(--color-warning);
}

.history-campaign-progress.is-pending .history-campaign-progress-track>span {
  background: var(--color-warning);
}

.history-campaign-card-error {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-campaign-card-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.history-campaign-card-action b {
  font-size: 22px;
  line-height: 1;
  transition: transform 160ms ease;
}

.history-campaign-card:hover .history-campaign-card-action b {
  transform: translateX(3px);
}

@media (max-width: 760px) {
  .history-run-card-summary {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .history-run-card-stats {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .history-run-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-run-card-content {
    padding: 4px 10px 10px;
  }

  .history-campaign-card-grid {
    grid-template-columns: 1fr;
  }

  .history-campaign-card {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 14px;
  }

  .history-campaign-card-icon {
    width: 36px;
    height: 36px;
  }

  .history-campaign-card-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .history-campaign-card-action {
    grid-column: 2;
    justify-self: start;
  }
}

.results-campaign-filter,
.history-campaign-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-subtle);
}

.history-campaign-filter div {
  display: grid;
  gap: 3px;
}

.history-campaign-filter span {
  color: var(--color-muted);
  font-size: 12px;
}

.history-diagnostics {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
}

.history-diagnostics-heading h3,
.history-diagnostics-heading p {
  margin: 4px 0 0;
}

.history-diagnostics-heading p {
  color: var(--color-muted);
}

.history-diagnostics-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-diagnostic-item {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-left: 4px solid #dc4545;
  border-radius: 10px;
  background: var(--color-surface-subtle);
}

.history-diagnostic-item>div,
.history-diagnostic-item dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.history-diagnostic-item>div span,
.history-diagnostic-item dt {
  color: var(--color-muted);
  font-size: 12px;
}

.history-diagnostic-item dl,
.history-diagnostic-item dd,
.history-diagnostic-item p {
  margin: 0;
}

.history-diagnostic-item dl div {
  display: grid;
  gap: 2px;
}

.history-diagnostic-item p {
  color: #dc4545;
  overflow-wrap: anywhere;
}

.history-retry-ad {
  justify-self: start;
}

@media (max-width: 720px) {

  .results-campaign-filter,
  .history-campaign-filter {
    align-items: stretch;
    flex-direction: column;
  }
}


.smart-resource-picker-shell {
  position: relative;
  min-width: 0;
}

.smart-resource-picker-shell>.field-label {
  display: block;
  margin-bottom: 8px;
}

.expand-select.smart-resource-picker {
  position: relative;
  overflow: visible;
}

.smart-resource-picker {
  min-width: 0;
}

.smart-resource-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  transition: background 180ms ease;
}

.smart-resource-trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 44%, var(--color-border));
}

.smart-resource-picker.is-open .smart-resource-trigger {
  background: color-mix(in srgb, var(--color-primary) 3%, var(--color-surface));
}

.smart-resource-trigger:disabled {
  cursor: not-allowed;
  background: var(--color-surface-subtle);
  opacity: .74;
}

.smart-resource-trigger-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.smart-resource-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #dce9ff, #bfcef1);
  color: #355782;
  font-size: 12px;
  font-weight: 800;
}

.smart-resource-trigger-text {
  min-width: 0;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-resource-trigger-text.is-selected {
  color: var(--color-text);
  font-weight: 650;
}

.smart-resource-chevron {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--color-muted);
}

.smart-resource-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  transition: transform 220ms cubic-bezier(.23, 1, .32, 1);
}

.smart-resource-picker.is-open .smart-resource-chevron svg {
  transform: rotate(180deg);
}

.smart-resource-panel {
  position: absolute;
  top: calc(100% - 1px);
  right: auto;
  left: 0;
  z-index: 90;
  width: 100%;
  max-height: var(--floating-panel-max-height, 420px);
  overflow: hidden;
  visibility: hidden;
  border: 1px solid var(--color-border);
  border-radius: 0 0 11px 11px;
  background: var(--color-dropdown-panel);
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .24s;
}

.smart-resource-picker.is-open .smart-resource-panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.smart-resource-picker.is-dropup .smart-resource-panel {
  top: auto;
  bottom: calc(100% - 1px);
  border-radius: 11px 11px 0 0;
  transform: translateY(6px);
}

.smart-resource-picker.is-dropup.is-open .smart-resource-panel {
  transform: translateY(0);
}

.smart-resource-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--color-surface-subtle);
}

.smart-resource-search svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--color-muted);
  stroke-linecap: round;
  stroke-width: 2.2;
}

.smart-resource-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
}

.smart-resource-options {
  max-height: 360px;
  overflow: auto;
  padding: 0 6px 6px;
}

.smart-resource-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  transition: background 120ms ease;
}

.smart-resource-option[hidden] {
  display: none;
}

.smart-resource-option:hover,
.smart-resource-option:focus-visible,
.smart-resource-option.is-active {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  outline: 0;
}

.smart-resource-option.is-selected {
  background: color-mix(in srgb, var(--color-primary) 13%, transparent);
}

.smart-resource-option.is-restricted {
  border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  cursor: not-allowed;
  opacity: 1;
}

.smart-resource-option.is-restricted:hover {
  background: var(--color-danger-soft);
}

.smart-resource-option.is-restricted .smart-resource-avatar {
  background: color-mix(in srgb, var(--color-danger) 16%, var(--color-surface));
  color: var(--color-danger);
}

.smart-resource-option.is-restricted .smart-resource-option-copy small {
  color: var(--color-danger);
  white-space: normal;
}

.smart-resource-restricted-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-danger) 14%, var(--color-surface));
  color: var(--color-danger);
  font-size: 10px;
  font-weight: 800;
}

.smart-resource-trigger.is-restricted {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.smart-resource-option-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.smart-resource-option-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-resource-option-copy small {
  overflow: hidden;
  color: var(--color-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-resource-option-copy mark {
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--color-warning) 34%, transparent);
  color: inherit;
  font-weight: 800;
}

.smart-resource-check {
  width: 17px;
  height: 17px;
  opacity: 0;
  color: var(--color-primary);
}

.smart-resource-option.is-selected .smart-resource-check {
  opacity: 1;
}

.smart-resource-check svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.smart-resource-empty {
  margin: 10px 4px;
  padding: 14px;
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}

.smart-resource-empty.is-hidden {
  display: none;
}

/* Campaign workspace — UI/UX Pro Max design-system pass */
.workspace-shell:not([hidden]) {
  background: var(--color-canvas);
}

.workspace-tree,
.workspace-review {
  background: var(--bg-dark-surface);
  border-color: var(--color-border-soft);
}

.workspace-editor {
  background: var(--color-canvas);
}

.editor-body {
  width: min(100%, 1040px);
  padding: var(--space-6) var(--space-6) 88px;
}

.editor-section {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--bg-dark-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 5px 16px rgba(15, 23, 42, .035);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.editor-section:hover {
  border-color: color-mix(in srgb, var(--color-primary) 20%, var(--color-border));
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 22px rgba(15, 23, 42, .055);
}

.editor-section+.editor-section {
  margin-top: var(--space-4);
}

.section-heading {
  padding: var(--space-4) 20px var(--space-3);
  border-bottom: 1px solid var(--color-border-soft);
  background: transparent;
}

.section-heading h2,
.subsection-heading h3 {
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  font-size: .94rem;
  font-weight: 750;
  letter-spacing: -.015em;
}

.section-heading p,
.subsection-heading p {
  margin-top: 3px;
  font-size: .76rem;
  line-height: 1.45;
}

.section-content {
  padding: 18px 20px 20px;
}

.field-stack,
.field-grid {
  gap: var(--space-3);
}

.field-label {
  margin-bottom: 6px;
  color: var(--color-text-soft);
  font-size: .75rem;
  font-weight: 650;
}

.field input:not([type='radio']):not([type='checkbox']):not([type='file']),
.field select,
.field textarea,
.section-content>select,
.audience-age-input {
  min-height: 42px;
  border-color: var(--color-border);
  border-radius: 9px;
  background: var(--bg-dark-surface);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input:not([type='radio']):not([type='checkbox']):not([type='file']):hover:not(:disabled),
.field select:hover:not(:disabled),
.field textarea:hover:not(:disabled),
.audience-age-input:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.audience-age-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent);
}

.locked-control {
  min-height: 42px;
  border: 1px solid var(--color-border-soft);
  border-radius: 9px;
  background: var(--color-locked-control);
}

.choice-card {
  min-height: 74px;
  border-radius: 10px;
  background: var(--bg-dark-surface);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.choice-card:hover {
  border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
  transform: none;
}

.choice-card.is-selected {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 7%, var(--bg-dark-surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.tree-node-row {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: border-color 160ms ease, background 160ms ease;
}

.tree-node-row:hover {
  background: var(--color-surface-hover);
}

.tree-node-row.is-selected {
  border-color: color-mix(in srgb, var(--color-primary) 38%, transparent);
  background: color-mix(in srgb, var(--color-primary) 11%, var(--bg-dark-surface));
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.tree-node-main strong {
  font-size: .8rem;
  font-weight: 650;
}

.tree-node-main small {
  color: var(--color-muted);
  font-size: .68rem;
}

.tree-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 58px;
  padding: 8px 10px;
  border-top: 1px solid var(--color-border);
  background: var(--bg-dark-surface);
  color: var(--color-text-soft);
}

.tree-footer-stat {
  display: grid;
  place-items: center;
  gap: 1px;
  min-width: 0;
  padding: 4px 6px;
  border-right: 1px solid var(--color-border-soft);
  text-align: center;
}

.tree-footer-stat:last-child {
  border-right: 0;
}

.tree-footer-stat b {
  color: var(--color-text);
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  font-size: .86rem;
  font-weight: 750;
  line-height: 1.15;
}

.tree-footer-stat small {
  overflow: hidden;
  max-width: 100%;
  color: var(--color-muted);
  font-size: .64rem;
  font-weight: 550;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme='light'] .tree-footer {
  background: #ffffff;
  color: #334155;
}

.smart-resource-trigger {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.smart-resource-panel {
  border-radius: 0 0 11px 11px;
  background: var(--color-dropdown-panel);
  box-shadow: var(--shadow-float);
}

.smart-resource-picker.is-dropup .smart-resource-panel {
  border-radius: 11px 11px 0 0;
}

.smart-resource-search {
  min-height: 40px;
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface-subtle);
}

.smart-resource-option {
  min-height: 48px;
  border-radius: 7px;
}

.smart-resource-option:hover,
.smart-resource-option:focus-visible,
.smart-resource-option.is-active {
  background: color-mix(in srgb, var(--color-primary) 9%, var(--color-dropdown-panel));
}

.smart-resource-option.is-selected {
  background: color-mix(in srgb, var(--color-primary) 14%, var(--color-dropdown-panel));
}

.audience-card,
.advantage-banner,
.saved-audience-lock {
  border-radius: 10px;
  box-shadow: none;
}

.workspace-review .review-section,
.workspace-review .review-progress-card {
  border-radius: 10px;
}

[data-theme='light'] body {
  background-image: none;
}

[data-theme='light'] .editor-section,
[data-theme='light'] .smart-resource-trigger,
[data-theme='light'] .choice-card {
  background: #ffffff;
}

[data-theme='dark'] .editor-section {
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
}

@media (max-width: 1180px) {
  .editor-body {
    padding-inline: var(--space-4);
  }
}

@media (max-width: 720px) {
  .editor-body {
    padding: var(--space-3) var(--space-3) 72px;
  }

  .section-heading {
    padding: var(--space-3) var(--space-4);
  }

  .section-content {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Final page overrides — Seeding, History, Review */
.workspace-seeding-shell {
  width: min(100%, 1080px);
  padding: var(--space-6) var(--space-6) 88px;
}

.workspace-seeding-header,
.seeding-composer {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--bg-dark-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .04);
}

.workspace-seeding-header {
  margin-bottom: var(--space-3);
  padding: 18px 20px;
}

.workspace-seeding-context {
  margin-bottom: var(--space-4);
  border-color: color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-primary) 7%, var(--bg-dark-surface));
}

.seeding-editor,
.seeding-composer {
  gap: var(--space-4);
}

.seeding-composer {
  padding: 20px;
}

.seeding-composer-heading {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-soft);
}

.seeding-template-card-picker,
.seeding-template-library {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--bg-dark-surface);
  box-shadow: none;
}

.seeding-template-library summary {
  min-height: 58px;
  padding: 12px 16px;
}

.seeding-template-library-content {
  gap: var(--space-3);
  padding: 14px 16px 16px;
}

.seeding-card-list {
  gap: var(--space-3);
}

.seeding-card {
  gap: var(--space-3);
  padding: var(--space-4);
  overflow: visible;
  border-radius: 10px;
  background: var(--bg-dark-surface);
  box-shadow: none;
}

.seeding-card:hover {
  border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
}

.seeding-card-heading {
  min-height: 38px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-soft);
}

.seeding-card-index {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--color-primary);
  box-shadow: none;
}

.seeding-order-actions {
  gap: 6px;
}

.seeding-icon-button,
.seeding-order-actions .row-remove {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-subtle);
}

.seeding-card-content {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: var(--space-3);
}

.seeding-message-field textarea {
  min-height: 148px;
  border-radius: 9px;
  background: var(--bg-dark-surface);
}

.seeding-image-control {
  min-height: 148px;
  padding: var(--space-3);
  border-color: color-mix(in srgb, var(--color-primary) 32%, var(--color-border));
  border-radius: 9px;
  background: var(--color-surface-subtle);
}

.seeding-thumbnail {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
}

.seeding-add-comment {
  min-height: 42px;
  border-style: dashed;
}

.activity-history-workspace .history-shell {
  width: 100%;
  max-width: 1760px;
}

.history-header h1,
.history-header h2 {
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  letter-spacing: -.025em;
}

.history-date-filter,
.history-run-card,
.history-diagnostics,
.history-report-table-wrap {
  border-radius: 12px;
  background: var(--bg-dark-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.history-run-card {
  border-color: var(--color-border);
}

.history-run-card-summary {
  min-height: 68px;
  padding: 13px 16px;
}

.history-run-card-summary:hover {
  background: color-mix(in srgb, var(--color-primary) 5%, var(--bg-dark-surface));
}

.history-run-status-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.history-run-card-stats>span {
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface-subtle);
}

.history-run-card-content {
  padding-inline: 14px;
}

.history-run-card[open] .history-run-card-content {
  padding: 12px 14px 14px;
}

.history-campaign-card-grid {
  gap: 8px;
}

.history-campaign-card {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--bg-dark-surface);
  box-shadow: none;
  transition: border-color 160ms ease, background 160ms ease;
}

.history-campaign-card:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--color-primary) 36%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 4%, var(--bg-dark-surface));
  box-shadow: none;
}

.history-campaign-card.is-failed {
  background: color-mix(in srgb, var(--color-danger) 5%, var(--bg-dark-surface));
}

.history-campaign-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.history-campaign-card-heading strong {
  font-size: 13px;
}

.history-campaign-card-metrics span {
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface-subtle);
  font-size: 11px;
}

.workspace-review {
  background: var(--bg-dark-surface);
}

.review-header {
  min-height: 72px;
  padding: 15px 14px;
  border-bottom: 1px solid var(--color-border-soft);
}

.review-content {
  gap: 10px;
  padding: 12px;
}

.review-section {
  padding: 13px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--bg-dark-surface);
}

.review-section.validation-summary.is-valid {
  border-color: color-mix(in srgb, var(--color-success) 32%, var(--color-border));
  background: color-mix(in srgb, var(--color-success) 6%, var(--bg-dark-surface));
}

.review-section.validation-summary.has-errors {
  border-color: color-mix(in srgb, var(--color-danger) 36%, var(--color-border));
  background: color-mix(in srgb, var(--color-danger) 6%, var(--bg-dark-surface));
}

.review-progress-overview {
  padding: 15px 14px;
  border-bottom: 1px solid var(--color-border-soft);
  background: var(--bg-dark-surface);
}

.review-progress-overview.is-completed_with_errors,
.review-progress-overview.is-failed {
  background: color-mix(in srgb, var(--color-danger) 5%, var(--bg-dark-surface));
}

.review-progress-summary {
  margin-top: 14px;
}

.review-progress-ring {
  flex-basis: 106px;
  width: 106px;
  height: 106px;
  filter: none;
}

.review-progress-percent {
  font-size: 1.3rem;
}

.review-campaign-progress {
  margin-top: 14px;
}

.campaign-progress-row {
  padding: 10px 8px;
  border-radius: 7px;
}

.campaign-progress-row:hover {
  background: color-mix(in srgb, var(--color-primary) 7%, var(--bg-dark-surface));
}

.review-card {
  padding: 12px;
  border-radius: 9px;
  background: var(--bg-dark-surface);
  box-shadow: none;
}

.review-card.has-error {
  background: color-mix(in srgb, var(--color-danger) 6%, var(--bg-dark-surface));
}

[data-theme='light'] .workspace-seeding-header,
[data-theme='light'] .seeding-composer,
[data-theme='light'] .seeding-card,
[data-theme='light'] .seeding-template-library,
[data-theme='light'] .history-date-filter,
[data-theme='light'] .history-run-card,
[data-theme='light'] .history-campaign-card,
[data-theme='light'] .workspace-review,
[data-theme='light'] .review-section,
[data-theme='light'] .review-progress-overview,
[data-theme='light'] .review-card {
  background: #ffffff;
}

@media (max-width: 900px) {
  .seeding-card-content {
    grid-template-columns: 1fr;
  }

  .seeding-image-control {
    min-height: 128px;
  }

  .history-run-card-summary {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .history-run-card-stats {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .workspace-seeding-shell {
    padding: var(--space-3) var(--space-3) 72px;
  }

  .workspace-seeding-header,
  .seeding-composer {
    padding: var(--space-4);
  }

  .seeding-card {
    padding: var(--space-3);
  }

  .history-campaign-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .history-campaign-card-action {
    grid-column: 2;
    justify-self: start;
  }
}

/* Activity History — dedicated information hierarchy */
.history-shell {
  display: grid;
  gap: var(--space-4);
}

.history-header {
  margin: 0;
  padding: 2px 2px 0;
}

.history-report-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding-inline: 14px;
  white-space: nowrap;
}

.history-report-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.activity-history-report-dialog {
  width: min(94vw, 1180px);
  max-width: none;
  max-height: 90vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 28px 90px rgba(2, 6, 23, .38);
}

.activity-history-report-dialog::backdrop {
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(5px);
}

.activity-history-report-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: 90vh;
}

.activity-history-report-header,
.activity-history-report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
}

.activity-history-report-header {
  border-bottom: 1px solid var(--color-border-soft);
}

.activity-history-report-header h2,
.activity-history-report-header p {
  margin: 0;
}

.activity-history-report-header h2 {
  margin-top: 3px;
  font-size: 1.3rem;
}

.activity-history-report-header p {
  margin-top: 5px;
  color: var(--color-muted);
  font-size: .84rem;
}

.activity-history-report-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  font-size: 1.45rem;
  cursor: pointer;
}

.activity-history-report-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 22px;
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  font-size: .8rem;
}

.activity-history-report-meta strong {
  color: var(--color-text);
}

.activity-history-report-content {
  min-height: 240px;
  overflow: auto;
}

.history-report-dialog-table-wrap {
  min-width: 780px;
}

.history-report-dialog-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .84rem;
}

.history-report-dialog-table th,
.history-report-dialog-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border-soft);
  text-align: left;
  vertical-align: top;
}

.history-report-dialog-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: .72rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.history-report-dialog-table th:first-child,
.history-report-dialog-table td:first-child {
  width: 120px;
  white-space: nowrap;
}

.history-report-dialog-table th:nth-child(2),
.history-report-dialog-table td:nth-child(2) {
  width: 150px;
}

.history-report-dialog-table th:nth-child(3),
.history-report-dialog-table td:nth-child(3) {
  width: 260px;
}

.history-report-dialog-table a {
  color: var(--color-primary);
  overflow-wrap: anywhere;
}

.history-report-dialog-pending {
  color: var(--color-muted);
  font-style: italic;
}

.history-report-dialog-loading,
.history-report-dialog-empty {
  display: grid;
  place-content: center;
  min-height: 240px;
  padding: 32px;
  color: var(--color-muted);
  text-align: center;
}

.history-report-dialog-empty strong {
  color: var(--color-text);
}

.history-report-dialog-empty p {
  margin: 7px 0 0;
}

.activity-history-report-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--color-border-soft);
}

.activity-history-report-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
}

.activity-history-report-actions svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (max-width: 640px) {
  .activity-history-report-dialog {
    width: calc(100vw - 20px);
  }

  .activity-history-report-header,
  .activity-history-report-actions {
    padding: 16px;
  }

  .activity-history-report-meta {
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 16px;
  }
}

.history-date-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
}

.history-date-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}

.history-date-trigger svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.history-list-panel {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--bg-dark-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.history-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 62px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-soft);
}

.history-list-heading>div {
  display: grid;
  gap: 2px;
}

.history-list-heading strong {
  color: var(--color-text);
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  font-size: .88rem;
}

.history-list-heading span {
  color: var(--color-muted);
  font-size: .72rem;
}

.history-list-heading>b {
  display: grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: .78rem;
}

.history-list {
  gap: 0;
  padding: 0;
}

.history-run-card {
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.history-run-card:last-child {
  border-bottom: 0;
}

.history-run-card-summary {
  min-height: 72px;
  padding: 12px 16px;
}

.history-run-card[open] .history-run-card-summary {
  background: color-mix(in srgb, var(--color-primary) 4%, var(--bg-dark-surface));
}

.history-run-card-content {
  background: var(--color-surface-subtle);
}

.history-run-card[open] .history-run-card-content {
  padding: 12px;
}

.history-campaign-card {
  background: var(--bg-dark-surface);
}

.history-campaign-card-heading {
  align-items: flex-start;
}

.history-campaign-card-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.history-campaign-card-metrics b {
  color: var(--color-text-soft);
  font-weight: 750;
}

[data-theme='light'] .history-list-panel,
[data-theme='light'] .history-campaign-card {
  background: #ffffff;
}

@media (max-width: 720px) {
  .history-header {
    align-items: flex-start;
  }

  .history-date-filter {
    grid-template-columns: 1fr auto;
  }

  .history-clear-filter {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .history-run-card-summary {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .history-run-card-stats {
    grid-column: 2 / -1;
  }

  .history-list-heading {
    align-items: flex-start;
  }
}

/* Activity history: inline campaign accordion */
.history-campaign-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--bg-dark-surface);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.history-campaign-item.is-expanded {
  border-color: color-mix(in srgb, var(--color-primary) 55%, var(--color-border));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.history-campaign-item .history-campaign-card {
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.history-campaign-item.is-expanded .history-campaign-card {
  background: color-mix(in srgb, var(--color-primary) 7%, var(--bg-dark-surface));
}

.history-campaign-card-action b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-subtle);
}

.history-campaign-card-action svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  transition: transform 260ms cubic-bezier(.34, 1.56, .64, 1);
}

.history-campaign-item.is-expanded .history-campaign-card-action svg {
  transform: rotate(180deg);
}

.history-campaign-card:hover .history-campaign-card-action b {
  transform: none;
}

.history-campaign-detail-shell {
  display: grid;
  overflow: hidden;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 300ms cubic-bezier(.4, 0, .2, 1), opacity 220ms ease;
}

.history-campaign-item.is-expanded .history-campaign-detail-shell {
  grid-template-rows: 1fr;
  opacity: 1;
  animation: history-detail-open 300ms cubic-bezier(.4, 0, .2, 1);
}

.history-campaign-inline-detail {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0 16px;
  border-top: 0;
  background: color-mix(in srgb, var(--color-surface-subtle) 55%, var(--bg-dark-surface));
  transform: translateY(-6px);
  transition: padding 300ms cubic-bezier(.4, 0, .2, 1), border-color 220ms ease, transform 260ms ease;
}

.history-campaign-item.is-expanded .history-campaign-inline-detail {
  padding: 16px;
  box-shadow: inset 0 1px 0 var(--color-border);
  transform: translateY(0);
}

.history-campaign-inline-detail .history-report-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.history-campaign-inline-detail .history-report-table {
  min-width: 1360px;
}

.history-report-table th:nth-child(1),
.history-report-table td:nth-child(1) {
  width: 96px;
  min-width: 96px;
}

.history-report-table th:nth-child(2),
.history-report-table td:nth-child(2) {
  width: 170px;
  min-width: 170px;
}

.history-report-table th:nth-child(3),
.history-report-table td:nth-child(3) {
  width: 250px;
  min-width: 250px;
}

.history-report-table th:nth-child(4),
.history-report-table td:nth-child(4) {
  width: 190px;
  min-width: 190px;
}

.history-report-table th:nth-child(5),
.history-report-table td:nth-child(5) {
  width: 360px;
  min-width: 360px;
}

.history-report-table th:nth-child(6),
.history-report-table td:nth-child(6) {
  width: 150px;
  min-width: 150px;
}

.history-report-table th:nth-child(7),
.history-report-table td:nth-child(7) {
  width: 120px;
  min-width: 120px;
}

.history-report-table td:nth-child(2),
.history-report-table td:nth-child(3),
.history-report-table td:nth-child(4),
.history-report-table td:nth-child(5) {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.history-inline-state {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

[data-theme='light'] .history-campaign-item {
  background: #ffffff;
}

[data-theme='light'] .history-campaign-item.is-expanded .history-campaign-card {
  background: #f5f8ff;
}

[data-theme='light'] .history-campaign-inline-detail {
  background: #f8faff;
}

@keyframes history-detail-open {
  from {
    grid-template-rows: 0fr;
    opacity: 0;
  }

  to {
    grid-template-rows: 1fr;
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .history-campaign-inline-detail {
    padding-inline: 10px;
  }

  .history-campaign-item.is-expanded .history-campaign-inline-detail {
    padding-block: 10px;
  }

  .history-campaign-card-action span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {

  .history-campaign-item,
  .history-campaign-card-action svg,
  .history-campaign-detail-shell,
  .history-campaign-inline-detail {
    animation: none;
    transition: none;
  }
}

/* Dedicated age dropdowns */
.audience-age-input {
  width: 92px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.audience-age-input:hover,
.audience-age-input:focus {
  border: 0;
  box-shadow: none;
}

.age-dd {
  position: relative;
  width: 100%;
  overflow: visible;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--bg-dark-surface);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.age-dd-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: .84rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.age-dd-trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
}

.age-dd.open .age-dd-trigger {
  background: color-mix(in srgb, var(--color-primary) 3%, var(--color-surface));
}

.age-dd.open {
  border-color: var(--color-primary);
  border-radius: 9px 9px 0 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent);
}

.age-dd.open.is-dropup {
  border-radius: 0 0 9px 9px;
}

.age-dd-trigger svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--color-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  transition: transform 260ms cubic-bezier(.4, 0, .2, 1);
}

.age-dd.open .age-dd-trigger svg {
  transform: rotate(180deg);
}

.age-panel {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  left: 0;
  z-index: 85;
  max-height: min(var(--floating-panel-max-height, 350px), 350px);
  overflow: hidden;
  visibility: hidden;
  border: 1px solid var(--color-border);
  border-radius: 0 0 9px 9px;
  background: var(--color-dropdown-panel);
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .24s;
}

.age-dd.open .age-panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.age-dd.is-dropup .age-panel {
  top: auto;
  bottom: calc(100% - 1px);
  border-radius: 9px 9px 0 0;
  transform: translateY(5px);
}

.age-dd.is-dropup.open .age-panel {
  transform: translateY(0);
}

.age-panel-inner {
  max-height: min(var(--floating-panel-max-height, 350px), 350px);
  overflow-y: auto;
  padding: 5px;
}

.age-opt {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-soft);
  font: inherit;
  font-size: .82rem;
  text-align: left;
  cursor: pointer;
}

.age-opt:hover:not(:disabled),
.age-opt:focus-visible {
  outline: 0;
  background: var(--color-surface-hover);
}

.age-opt.selected {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 750;
}

.age-opt:disabled {
  display: none;
}

/* Calendar and 24-hour time picker */
.dt-field {
  position: relative;
  min-width: 0;
}

.field.dt-field {
  display: grid;
  gap: 6px;
}

.dt-field-label {
  display: block;
  margin: 0;
}

.dt-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--bg-dark-surface);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.dt-trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
}

.dt-field.open .dt-trigger {
  border-color: var(--color-primary);
  border-radius: 9px 9px 0 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent);
}

.dt-field.open.is-dropup .dt-trigger {
  border-radius: 0 0 9px 9px;
}

.dt-trigger .cal-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 2.2;
}

.dt-chevron {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--color-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  transition: transform 260ms cubic-bezier(.4, 0, .2, 1);
}

.dt-field.open .dt-chevron {
  transform: rotate(180deg);
}

.dt-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--color-muted);
  font-size: .8rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dt-value.filled {
  color: var(--color-text);
  font-weight: 650;
}

.adset-date-field.dt-field {
  display: grid;
  flex: 1 1 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
}

.adset-date-field .dt-trigger {
  min-height: 30px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.adset-date-field .dt-trigger .cal-icon {
  display: none;
}

.adset-date-field .dt-value {
  font-size: .74rem;
}

.dt-panel {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  z-index: 90;
  display: flex;
  width: min(370px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 0 0 12px 12px;
  background: var(--color-dropdown-panel);
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(.985);
  transform-origin: top left;
  transition: opacity 200ms ease, transform 240ms cubic-bezier(.22, 1, .36, 1), visibility 0s linear 240ms;
}

.dt-field.open .dt-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.dt-field.is-dropup .dt-panel {
  top: auto;
  bottom: calc(100% - 1px);
  border-radius: 12px 12px 0 0;
  transform: translateY(6px) scale(.985);
  transform-origin: bottom left;
}

.dt-field.is-dropup.open .dt-panel {
  transform: translateY(0) scale(1);
}

.adset-setup-schedule-row .dt-field:last-child .dt-panel {
  right: 0;
  left: auto;
  transform-origin: top right;
}

.cal-box {
  width: 250px;
  flex: 0 0 250px;
  padding: 12px;
  border-right: 1px solid var(--color-border-soft);
}

.cal-head,
.cal-nav,
.time-head,
.time-cols,
.cal-footer {
  display: flex;
  align-items: center;
}

.cal-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-month-label {
  color: var(--color-text);
  font-size: .82rem;
}

.cal-nav {
  gap: 4px;
}

.cal-nav-btn {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--bg-dark-surface);
  cursor: pointer;
}

.cal-nav-btn:hover {
  background: var(--color-surface-hover);
}

.cal-nav-btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--color-text-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.cal-weekdays,
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.cal-weekdays {
  margin-bottom: 4px;
  color: var(--color-muted-dark);
  font-size: .66rem;
}

.cal-days {
  gap: 2px;
}

.cal-day {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-soft);
  font: inherit;
  font-size: .76rem;
}

button.cal-day {
  cursor: pointer;
}

button.cal-day:hover,
button.cal-day:focus-visible {
  outline: 0;
  background: var(--color-surface-hover);
}

.cal-day.muted {
  color: color-mix(in srgb, var(--color-muted) 40%, transparent);
}

.cal-day.today {
  color: var(--color-primary);
  font-weight: 750;
}

.cal-day.selected {
  background: var(--color-primary);
  color: #fff;
  font-weight: 750;
}

.cal-footer {
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-soft);
}

.cal-footer button {
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-size: .72rem;
  font-weight: 750;
  cursor: pointer;
}

.cal-footer .clear-btn {
  color: var(--color-muted);
}

.time-box {
  display: flex;
  width: 120px;
  flex: 0 0 120px;
  flex-direction: column;
}

.time-head {
  padding: 12px 0 4px;
  color: var(--color-muted);
  font-size: .64rem;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.time-head span {
  flex: 1;
  text-align: center;
}

.time-cols {
  position: relative;
  flex: 1;
}

.time-cols::before {
  position: absolute;
  top: 50%;
  right: 6px;
  left: 6px;
  z-index: 0;
  height: 30px;
  border-radius: 8px;
  background: var(--color-primary-soft);
  content: '';
  pointer-events: none;
  transform: translateY(-50%);
}

.time-col {
  position: relative;
  z-index: 1;
  height: 180px;
  flex: 1;
  overflow-y: auto;
  padding: 75px 0;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
}

.time-col::-webkit-scrollbar {
  display: none;
}

.time-item {
  display: flex;
  width: 100%;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--color-muted) 58%, transparent);
  font: inherit;
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  scroll-snap-align: center;
  transition: color 150ms ease, font-size 150ms ease;
}

.time-item.active {
  color: var(--color-text);
  font-size: .94rem;
  font-weight: 800;
}

.time-confirm {
  min-height: 34px;
  margin: 8px;
  border: 0;
  border-radius: 7px;
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-size: .75rem;
  font-weight: 750;
  cursor: pointer;
}

.time-confirm:hover {
  background: var(--color-primary-strong);
}

.editor-section:has(.expand-select.is-open),
.editor-section:has(.age-dd.open),
.editor-section:has(.dt-field.open),
.editor-section:has(.template-card-dropdown[open]),
.template-card-picker:has(.template-card-dropdown[open]) {
  position: relative;
  z-index: 45;
  overflow: visible;
}

@media (max-width: 600px) {
  .dt-panel {
    width: min(250px, calc(100vw - 24px));
    flex-direction: column;
  }

  .cal-box {
    width: 100%;
    flex-basis: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border-soft);
  }

  .time-box {
    width: 100%;
    flex-basis: auto;
  }

  .time-col {
    height: 150px;
    padding-block: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .age-panel,
  .age-dd-trigger svg,
  .dt-panel,
  .dt-chevron,
  .time-item {
    scroll-behavior: auto;
    transition: none;
  }
}

/* =========================================================================
   Unified dropdown redesign — inspired by the "chọn mẫu seeding" reference:
   a colored circular chevron badge, a gradient avatar, a flatter borderless
   search pill, livelier option rows, and floating panels that genuinely
   grow open instead of only fading in. Applied consistently across every
   dropdown in the app: expand-select, smart-resource-picker (account/page
   pickers), the age dropdown, the datetime picker and the template card
   dropdown, plus the activity-history date-range trigger.
   ========================================================================= */

.expand-select-chevron,
.smart-resource-chevron {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-danger-soft);
  border: 1px solid color-mix(in srgb, var(--color-danger) 22%, transparent);
  color: var(--color-danger);
  transition: background .22s ease, border-color .22s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}

.expand-select.is-open .expand-select-chevron,
.smart-resource-picker.is-open .smart-resource-chevron {
  background: color-mix(in srgb, var(--color-danger) 16%, var(--color-danger-soft));
  border-color: color-mix(in srgb, var(--color-danger) 48%, transparent);
}

.smart-resource-chevron svg {
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1);
}

.smart-resource-picker.is-open .smart-resource-chevron svg {
  transform: rotate(180deg) scale(1.08);
}

/* Standalone chevron badge for pickers whose trigger icon isn't wrapped
   in a circle yet: age dropdown, datetime picker, activity-history date range. */
.dropdown-chevron-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-danger-soft);
  border: 1px solid color-mix(in srgb, var(--color-danger) 22%, transparent);
  transition: background .22s ease, border-color .22s ease;
}

.dropdown-chevron-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--color-danger);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1);
}

.age-dd.open .dropdown-chevron-badge,
.dt-field.open .dropdown-chevron-badge,
.history-date-trigger[aria-expanded="true"] .dropdown-chevron-badge {
  background: color-mix(in srgb, var(--color-danger) 16%, var(--color-danger-soft));
  border-color: color-mix(in srgb, var(--color-danger) 48%, transparent);
}

.age-dd.open .dropdown-chevron-badge svg,
.dt-field.open .dropdown-chevron-badge svg,
.history-date-trigger[aria-expanded="true"] .dropdown-chevron-badge svg {
  transform: rotate(180deg) scale(1.08);
}

/* Gradient avatars everywhere, matching the smart-resource-avatar look */
.expand-select-avatar {
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--color-primary) 20%, var(--color-surface)),
      color-mix(in srgb, var(--color-primary) 34%, var(--color-surface)));
}

/* Flatter, borderless search pills with a clear focus ring */
.expand-select-search,
.smart-resource-search {
  border-color: transparent;
  transition: box-shadow .18s ease, background .18s ease;
}

.expand-select-search:focus-within,
.smart-resource-search:focus-within {
  background: var(--color-surface-card);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

/* Slightly livelier option rows on hover */
.expand-select-option,
.smart-resource-option {
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.expand-select-option:hover,
.smart-resource-option:hover:not(.is-restricted) {
  transform: translateX(2px);
}

/* Floating panels now genuinely grow open instead of only fading/sliding in,
   echoing the reference's grid-template-rows expansion. */
.expand-select-expand,
.smart-resource-panel,
.age-panel,
.template-card-dropdown-panel {
  transition: opacity .2s ease, transform .24s cubic-bezier(.22, 1, .36, 1),
    max-height .32s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .24s;
}

.expand-select:not(.is-open) .expand-select-expand,
.smart-resource-picker:not(.is-open) .smart-resource-panel,
.age-dd:not(.open) .age-panel,
.template-card-dropdown:not([open]) .template-card-dropdown-panel {
  max-height: 0;
}

@media (prefers-reduced-motion: reduce) {

  .expand-select-chevron,
  .smart-resource-chevron,
  .smart-resource-chevron svg,
  .dropdown-chevron-badge,
  .dropdown-chevron-badge svg,
  .expand-select-expand,
  .smart-resource-panel,
  .age-panel,
  .template-card-dropdown-panel,
  .expand-select-option,
  .smart-resource-option {
    transition: none !important;
  }
}

/* =========================================================================
   Follow-up polish: never truncate a label with "…", and make the open
   panel read as one continuous, stretching box instead of a separate
   floating card — matching the "chọn mẫu seeding" reference more closely.
   ========================================================================= */

/* No more ellipsis: wrap up to two lines instead of cutting text off */
.expand-select-trigger-text,
.smart-resource-trigger-text {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  word-break: break-word;
}

.expand-select-trigger,
.smart-resource-trigger {
  align-items: center;
  padding-block: 10px;
}

.expand-select-trigger-left,
.smart-resource-trigger-left {
  align-items: center;
}

/* Seamless attach: the panel continues the trigger's own border and drops
   its top edge, so opening reads as the box genuinely stretching downward
   rather than a second card appearing with a gap. */
.expand-select-expand,
.smart-resource-panel,
.age-panel,
.template-card-dropdown-panel {
  border-top-color: transparent;
  box-shadow: 0 26px 48px -22px rgba(2, 6, 23, .5);
}

.expand-select.is-open .expand-select-expand,
.smart-resource-picker.is-open .smart-resource-panel,
.age-dd.open .age-panel,
.template-card-dropdown[open] .template-card-dropdown-panel {
  border-color: var(--color-primary);
  border-top-color: transparent;
}

.expand-select.is-dropup .expand-select-expand,
.smart-resource-picker.is-dropup .smart-resource-panel,
.age-dd.is-dropup .age-panel,
.template-card-dropdown.is-dropup .template-card-dropdown-panel {
  border-top-color: var(--color-border);
  border-bottom-color: transparent;
  box-shadow: 0 -26px 48px -22px rgba(2, 6, 23, .5);
}

.expand-select.is-dropup.is-open .expand-select-expand,
.smart-resource-picker.is-dropup.is-open .smart-resource-panel,
.age-dd.is-dropup.open .age-panel,
.template-card-dropdown.is-dropup[open] .template-card-dropdown-panel {
  border-top-color: var(--color-primary);
  border-bottom-color: transparent;
}

/* The trigger itself keeps a matching primary border while open, so the
   seam between trigger and panel disappears visually. */
.expand-select.is-open,
.smart-resource-picker.is-open {
  border-color: var(--color-primary);
}

/* Overlay dropdowns styled after chon-mau-seeding-keo-dai.html. */
.expand-select,
.expand-select.smart-resource-picker {
  position: relative;
  overflow: visible;
  border-radius: 12px;
  background: var(--color-surface);
}

.expand-select.is-open,
.expand-select.is-open.is-dropup,
.smart-resource-picker.is-open {
  border-radius: 12px 12px 0 0;
  border-color: var(--color-primary-strong, #2563eb);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 24%, transparent), 0 10px 24px -6px rgba(15, 23, 42, .22);
  z-index: 70;
}

.expand-select-expand,
.smart-resource-panel,
.expand-select.is-dropup .expand-select-expand,
.smart-resource-picker.is-dropup .smart-resource-panel {
  position: absolute !important;
  top: calc(100% - 1px) !important;
  right: -1px !important;
  bottom: auto !important;
  left: -1px !important;
  z-index: 80;
  display: block;
  width: auto !important;
  max-height: min(420px, calc(100vh - 96px));
  overflow: hidden;
  visibility: hidden;
  border: 1.5px solid var(--color-primary-strong, #2563eb);
  border-top-color: var(--color-border);
  border-radius: 0 0 12px 12px;
  background: var(--color-dropdown-panel);
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, .38);
  opacity: 0;
  pointer-events: none;
  transform-origin: top center;
  will-change: transform, opacity;
  transform: translateY(-8px);
  transition: opacity .22s cubic-bezier(.2, .8, .2, 1), transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s;
}

.expand-select.is-open .expand-select-expand,
.smart-resource-picker.is-open .smart-resource-panel,
.expand-select.is-dropup.is-open .expand-select-expand,
.smart-resource-picker.is-dropup.is-open .smart-resource-panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.expand-select-expand-inner,
.smart-resource-panel>.expand-select-expand-inner {
  min-height: 0;
  max-height: min(418px, calc(100vh - 98px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.expand-select-body {
  padding: 9px;
  border-top: 1px solid var(--color-border);
  background: var(--color-dropdown-panel);
  opacity: 1;
  transform: none;
  transition: none;
}

.expand-select.is-open .expand-select-body,
.smart-resource-picker.is-open .expand-select-body {
  opacity: 1;
  transform: translateY(0);
  transition-delay: .06s;
}

.expand-select-options,
.smart-resource-options {
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.template-card-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 10px 4px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--color-surface-subtle);
}

.template-card-search svg {
  width: 15px;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 2;
}

.template-card-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
}

.template-required-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 2px 0;
  color: #d99a00;
  font-size: .72rem;
}

.template-required-note span {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.template-card-empty.is-hidden {
  display: none;
}

/* Age dropdown styles are fully unified under .expand-select & .audience-age-input */

/* Conversation and seeding libraries use the same elevated overlay shell. */
.template-card-dropdown {
  position: relative;
  overflow: visible;
  border-radius: 12px;
  background: var(--color-surface);
}

.template-card-dropdown[open],
.template-card-dropdown[open].is-dropup {
  z-index: 125;
  border-radius: 12px 12px 0 0;
  border-color: var(--color-primary-strong, #2563eb);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 24%, transparent), 0 10px 24px -6px rgba(15, 23, 42, .22);
}

.template-card-dropdown-panel,
.template-card-dropdown.is-dropup .template-card-dropdown-panel {
  position: absolute !important;
  top: calc(100% - 1px) !important;
  right: -1px !important;
  bottom: auto !important;
  left: -1px !important;
  z-index: 150;
  width: auto !important;
  max-height: min(440px, calc(100vh - 96px));
  overflow: hidden;
  border: 1.5px solid var(--color-primary-strong, #2563eb);
  border-top-color: var(--color-border);
  border-radius: 0 0 12px 12px;
  background: var(--color-dropdown-panel);
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, .38);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: top center;
  will-change: transform, opacity;
  transform: translateY(-8px);
  transition: opacity .22s cubic-bezier(.2, .8, .2, 1), transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s;
}

.template-card-dropdown[open] .template-card-dropdown-panel,
.template-card-dropdown.is-dropup[open] .template-card-dropdown-panel {
  max-height: min(440px, calc(100vh - 96px));
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.template-card-dropdown-inner {
  max-height: min(438px, calc(100vh - 98px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.template-card-dropdown-panel .template-card-grid {
  max-height: none;
  overflow: visible;
}

.template-choice-delete {
  opacity: 0;
}

.template-choice-wrap:hover .template-choice-delete,
.template-choice-delete:focus-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .expand-select-expand,
  .smart-resource-panel,
  .expand-select-body,
  .template-card-dropdown-panel {
    transition: none;
  }
}

/* =========================================================================
   Responsive and accessibility hardening — 2026-09-01
   Keeps every workspace usable from 320px upward, exposes the compact review
   and structure drawers, and raises light-theme status contrast to WCAG AA.
   ========================================================================= */

[data-theme='light'] {
  --color-primary: #2563eb;
  --color-primary-strong: #1d4ed8;
  --color-muted: #526176;
  --color-muted-dark: #64748b;
  --color-success: #047857;
  --color-warning: #92400e;
  --color-danger: #be123c;
}

html,
body {
  max-width: 100%;
}

body {
  overflow-x: clip;
}

[hidden] {
  display: none !important;
}

button,
[role='button'],
label[for] {
  touch-action: manipulation;
}

.brand-mark {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
}

.workspace-mode-button,
.theme-toggle,
.connection-account-button,
.history-date-trigger {
  min-height: 44px;
}

.theme-toggle {
  width: 44px;
  height: 44px;
}

.theme-toggle [data-theme-icon],
.theme-toggle svg {
  display: block;
  width: 19px;
  height: 19px;
}

.theme-toggle svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.workspace-mode-button .workspace-mode-label,
.workspace-mode-button .workspace-mode-suffix,
.workspace-mode-button>span {
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: inherit;
  opacity: 1;
}

.workspace-mode-button .workspace-mode-suffix {
  margin-left: -2px;
}

.expand-select.is-open:not(.is-dropup) {
  border-bottom-color: transparent;
}

.smart-resource-picker.is-open:not(.is-dropup) {
  border-bottom-color: transparent;
}

.smart-resource-panel {
  right: -1px;
  left: -1px;
  width: auto;
  border-top: 0;
  border-right-color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.expand-select.is-dropup .expand-select-expand,
.smart-resource-picker.is-dropup .smart-resource-panel,
.age-dd.is-dropup .age-panel,
.template-card-dropdown.is-dropup .template-card-dropdown-panel {
  top: auto !important;
  bottom: calc(100% - 1px) !important;
  border-radius: 12px 12px 0 0;
  transform-origin: bottom center;
}

.expand-select.is-open.is-dropup,
.smart-resource-picker.is-open.is-dropup,
.age-dd.open.is-dropup,
.template-card-dropdown[open].is-dropup {
  border-radius: 0 0 12px 12px;
}

.age-opt,
.segment {
  min-height: 44px;
}

.node-disclosure,
.node-menu-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}

.node-disclosure-spacer {
  flex-basis: 44px;
  width: 44px;
  min-width: 44px;
}

.field input:not([type='radio']):not([type='checkbox']):not([type='file']):not([type='hidden']),
.field select,
.section-content>select,
.template-card-search input,
.age-dd-trigger,
.dt-trigger,
.action-confirmation-actions button,
.publish-confirmation-actions button,
.button-primary,
.button-danger,
.seeding-add-comment {
  min-height: 44px;
}

.seeding-capability-warning a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.seeding-new-template-bar .button-primary,
.conversation-new-template-bar .button-primary {
  min-height: 44px;
}

.seeding-image-control>.media-file-input {
  width: 1px;
  min-width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

[data-theme='light'] .workspace-mode-button:not(.is-active) {
  color: var(--color-text-soft);
}

[data-theme='light'] .workspace-mode-button.is-active,
[data-theme='light'] .workspace-mode-button.is-active:hover {
  color: #ffffff;
}

[data-theme='light'] .review-header .readiness-score.is-ready,
[data-theme='light'] .validation-status-icon {
  color: var(--color-success);
}

[data-theme='light'] .review-header .readiness-score.is-incomplete {
  color: var(--color-text-soft);
}

[data-theme='dark'] .eyebrow,
[data-theme='dark'] .node-type-label,
[data-theme='dark'] .empty-kicker {
  color: #60a5fa;
}

[data-theme='light'] .has-errors .validation-status-icon {
  color: var(--color-danger);
}

.workspace-mobile-backdrop {
  display: none;
}

@media (max-width: 1199px) {
  .mobile-review-button {
    display: inline-flex;
  }

  .workspace-shell {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .workspace-review,
  .workspace-seeding-layout>.workspace-review {
    position: fixed;
    z-index: 72;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    display: grid;
    width: min(92vw, 340px);
    height: auto;
    overflow: hidden;
    visibility: hidden;
    border-left: 1px solid var(--color-border);
    background: var(--bg-dark-surface);
    box-shadow: -18px 0 42px rgba(15, 23, 42, .2);
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1), opacity 180ms ease, visibility 0s linear 220ms;
  }

  .workspace-review.is-open,
  .workspace-seeding-layout>.workspace-review.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .workspace-seeding-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-mobile-backdrop.is-visible {
    position: fixed;
    z-index: 62;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, .42);
    cursor: default;
  }
}

@media (max-width: 1100px) {
  :root {
    --topbar-height: 120px;
  }

  .topbar {
    grid-template-areas:
      'brand actions'
      'navigation navigation';
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px 52px;
    gap: 8px 12px;
    height: var(--topbar-height);
    padding: 8px 12px;
  }

  .topbar-brand {
    grid-area: brand;
  }

  .brand-copy small {
    display: none;
  }

  .workspace-mode-nav {
    grid-area: navigation;
    display: grid;
    width: 100%;
    height: 52px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-mode-button {
    min-width: 0;
    justify-content: center;
    padding-inline: 10px;
  }

  .topbar-actions {
    grid-area: actions;
    min-width: 0;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .mobile-nav-button {
    display: inline-flex;
  }

  .editor-header {
    grid-template-areas: "title status";
    grid-template-rows: minmax(0, 1fr);
    min-height: 44px;
    column-gap: 8px;
    padding: 5px 12px;
  }

  .editor-header .breadcrumbs,
  .editor-title-row .node-type-label {
    display: none;
  }

  .editor-title-row h1 {
    font-size: 0.95rem;
  }

  .editor-header .paused-badge {
    min-height: 22px;
    padding-inline: 8px;
    font-size: 0.6rem;
  }

  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    min-height: 0;
    overflow: hidden;
  }

  .editor-progress-footer {
    padding: 0 12px calc(12px + env(safe-area-inset-bottom));
  }

  .editor-progress-footer .publish-button {
    width: 100%;
  }

  .workspace-editor,
  .workspace-seeding-layout>.workspace-seeding-shell {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .workspace-tree {
    position: fixed;
    z-index: 72;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    display: grid;
    width: min(92vw, 340px);
    height: auto;
    visibility: hidden;
    box-shadow: 18px 0 42px rgba(15, 23, 42, .2);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1), opacity 180ms ease, visibility 0s linear 220ms;
  }

  .workspace-tree.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .node-disclosure,
  .node-menu-button,
  .seeding-icon-button,
  .seeding-order-actions .row-remove {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .tree-node-row,
  .tree-node-main {
    min-height: 52px;
  }

  .activity-history-workspace {
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    padding: 12px;
  }

  .history-date-filter,
  .history-run-card-summary,
  .history-campaign-card {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    backdrop-filter: none;
  }

  .brand-copy {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .mobile-nav-button,
  .mobile-review-button {
    min-width: 44px;
    min-height: 44px;
    padding-inline: 10px;
    font-size: .74rem;
  }

  .mobile-nav-button svg,
  .mobile-review-button svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  .connection-account-button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    justify-content: center;
    padding: 0;
  }

  .connection-account-label,
  .connection-account-chevron {
    display: none;
  }

  .connection-account-menu {
    position: fixed;
    top: calc(var(--topbar-height) - 52px);
    right: 12px;
  }

  .workspace-mode-button {
    padding-inline: 6px;
    font-size: .76rem;
  }

  .workspace-mode-button .workspace-mode-suffix {
    display: none;
  }

  .editor-body,
  .workspace-seeding-shell {
    padding-right: 12px;
    padding-bottom: 80px;
    padding-left: 12px;
  }

  .two-columns,
  .three-columns,
  .choice-grid,
  .creative-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-date-filter {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-date-trigger,
  .history-clear-filter {
    width: 100%;
  }

  .history-clear-filter {
    grid-column: auto;
  }
}

@media (max-width: 420px) {
  .mobile-nav-button,
  .mobile-review-button {
    width: 44px;
    padding: 0;
  }

  .mobile-nav-button span,
  .mobile-review-button span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-tree,
  .workspace-review,
  .workspace-seeding-layout>.workspace-review,
  .tree-node-row.has-run-progress::after {
    transition: none;
  }
}

/* Campaign-owned seeding entry */
.campaign-seeding-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 20%, var(--color-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface-card));
}

.campaign-seeding-card.is-ready {
  border-color: color-mix(in srgb, var(--color-success) 30%, var(--color-border));
  background: color-mix(in srgb, var(--color-success) 5%, var(--color-surface-card));
}

.campaign-seeding-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.campaign-seeding-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.campaign-seeding-copy {
  min-width: 0;
}

.campaign-seeding-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.campaign-seeding-title-row strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-seeding-copy p {
  margin: 5px 0 0;
  color: var(--color-muted);
  font-size: .76rem;
}

.campaign-seeding-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--color-warning) 25%, transparent);
  border-radius: 999px;
  color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 9%, transparent);
  font-size: .68rem;
  font-weight: 750;
}

.campaign-seeding-status.is-ready {
  border-color: color-mix(in srgb, var(--color-success) 25%, transparent);
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 9%, transparent);
}

.campaign-seeding-open,
.workspace-seeding-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.campaign-seeding-open span,
.workspace-seeding-back span {
  font-size: 1rem;
  line-height: 1;
}

.campaign-seeding-picker {
  grid-column: 2 / -1;
  width: 100%;
  min-width: 0;
}

.campaign-seeding-picker>summary {
  min-height: 54px;
  background: color-mix(in srgb, var(--color-surface-card) 88%, var(--color-primary) 12%);
}

.campaign-seeding-card:has(.campaign-seeding-picker[open]) {
  position: relative;
  z-index: 45;
}

.campaign-seeding-picker .template-card-dropdown-panel {
  max-height: min(390px, calc(100vh - 112px));
}

.campaign-seeding-picker .template-card-dropdown-inner {
  max-height: min(388px, calc(100vh - 114px));
}

@media (max-width: 640px) {
  .campaign-seeding-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .campaign-seeding-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .campaign-seeding-title-row strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .campaign-seeding-open,
  .campaign-seeding-picker {
    grid-column: 1 / -1;
    width: 100%;
  }
}
