/* Dolphin Control "ops-console" theme in the spirit of TheOptimizer:
   light partner-style sidebar with grouped nav, dense data tables with text
   statuses, totals cards with colored underlines. Closed token layer.
   No external fonts (CSP default-src 'self'): system stack only. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --sidebar: #35393d;
  --sidebar-2: #45494e;
  --sidebar-text: #c9ccd1;
  --sidebar-dim: #a3a8ad;
  --nav-bg: linear-gradient(180deg, #ffffff 0%, #f3f6fa 100%);
  --nav-text: #2f3a46;
  --nav-muted: #5f6b76;
  --nav-icon: #64748b;
  --nav-hover: #e9edf3;
  --nav-active-bg: linear-gradient(135deg, #2772bd 0%, #1f6ab8 55%, #185a9e 100%);
  --nav-active-text: #ffffff;
  --nav-active-shadow: 0 6px 14px rgba(31, 106, 184, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --text: #333333;
  --text-2: #555555;
  --muted: #5f6b76;
  --border: #e3e6ea;
  --border-strong: #767676;
  --primary: #1f6ab8;
  --primary-h: #185a9e;
  --primary-a: #144a82;
  --primary-tint: #eaf3fd;
  --primary-tint-tx: #175b9c;
  --primary-ring: #bcd8f5;
  --ok: #1e9e50;
  --ok-bg: #e9f7ee;
  --ok-bd: #bfe6c9;
  --ok-tx: #17723c;
  --warn: #b45309;
  --warn-bg: #fff8e6;
  --warn-bd: #f5d9a0;
  --warn-tx: #92400e;
  --bad: #e05252;
  --bad-bg: #fdeeee;
  --bad-bd: #f6c9c9;
  --bad-tx: #b23a3a;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --sh-1: 0 1px 2px rgba(51, 51, 51, 0.07);
  --sh-2: 0 3px 10px rgba(51, 51, 51, 0.09);
  --sh-3: 0 10px 28px rgba(51, 51, 51, 0.18);
  --ease: ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
::selection { color: #fff; background: var(--primary); }
* { scrollbar-color: #94a3b8 var(--bg); scrollbar-width: thin; }
body { margin: 0; min-width: 320px; overflow-x: clip; background-color: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease), transform 150ms var(--ease); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }

/* Sidebar (premium ops-console: cool-gray gradient shell, tabular group
   rhythm, one brand-blue gradient reserved for wayfinding — logo mark and
   the active pill — plus a single 2px-stroke SVG icon family) */
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 14px; background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column; border-right: 1px solid #e2e8f0; }
.brand-block { display: flex; align-items: center; gap: 12px; padding: 2px 8px 20px; border-bottom: 1px solid #e2e8f0; }
.brand-block strong { display: block; font-size: 16px; font-weight: 800; color: var(--nav-text); letter-spacing: -0.02em; }
.brand-block span { display: block; margin-top: 2px; color: var(--nav-muted); font-size: 12px; }
.brand-logo { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgba(31, 106, 184, 0.18); }
.login-brand-logo { width: 56px; height: 56px; margin-bottom: 20px; border-radius: 14px; }
.primary-nav { display: grid; gap: 2px; margin-top: 16px; }
.nav-group { margin: 18px 12px 8px; color: var(--nav-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.nav-button { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border: 0; border-radius: var(--r-lg); color: var(--nav-text); background: transparent; text-align: left; font-size: 15px; font-weight: 600; width: 100%; transition: transform 150ms var(--ease); }
.nav-button svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--nav-icon); transition: transform 150ms var(--ease); }
.nav-button:hover { background: var(--nav-hover); }
.nav-button:hover svg { color: var(--nav-text); transform: translateX(1px); }
.nav-button:active { transform: translateY(1px); }
.nav-button.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 700; box-shadow: var(--nav-active-shadow); }
.nav-button.active svg { color: var(--nav-active-text); }
.nav-button.active:hover svg { transform: none; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid #e2e8f0; color: var(--nav-muted); font-size: 12px; }
.sidebar-logout { margin-top: 8px; padding: 0; border: 0; background: transparent; color: var(--nav-text); font-size: 12px; font-weight: 600; text-align: left; }
.sidebar-logout:hover { color: var(--primary); }
.sidebar-footer .connection-line { color: var(--nav-muted); }
.connection-line { display: flex; align-items: center; gap: 8px; color: #e2e8f0; margin-bottom: 4px; font-weight: 600; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sidebar-dim); flex: 0 0 auto; }
.status-dot.ready { background: #2fbf5f; box-shadow: 0 0 0 3px rgba(47, 191, 95, 0.2); }
.sidebar-footer .connection-line .status-dot:not(.ready) { background: var(--sidebar-dim); box-shadow: none; }
.status-dot.warning { background: #f5a623; }
.status-dot.danger { background: #e05252; }

/* Workspace */
.workspace { min-width: 0; max-width: 100%; padding: 0 32px 72px; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.topbar h1, .section-heading h2 { margin: 2px 0 0; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.topbar h1 { font-size: 20px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.topbar-actions, .section-heading, .legend-row, .form-footer, .queue-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.health-pill { min-height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); background: var(--surface); font-size: 12px; font-weight: 600; box-shadow: var(--sh-1); }
.health-pill.ready { border-color: var(--ok-bd); color: var(--ok-tx); background: var(--ok-bg); }
.health-pill.error { border-color: var(--bad-bd); color: var(--bad-tx); background: var(--bad-bg); }
.safety-lock { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--bad-bd); border-radius: var(--r-sm); color: var(--bad-tx); background: var(--bad-bg); font-size: 13px; font-weight: 600; }
.safety-lock:hover { border-color: var(--bad); }
.safety-lock.open { border-color: var(--warn-bd); color: var(--warn-tx); background: var(--warn-bg); }
.safety-lock svg, button svg { width: 16px; height: 16px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-2); box-shadow: var(--sh-1); }
.icon-button:hover { border-color: var(--primary-ring); color: var(--primary); }
.icon-button:active { transform: translateY(1px); box-shadow: none; }
.notice { margin: 16px 0; padding: 12px 16px 12px 14px; border: 1px solid var(--primary-ring); border-left: 4px solid var(--primary); border-radius: var(--r-sm); background: var(--primary-tint); color: var(--primary-tint-tx); font-size: 13px; font-weight: 600; box-shadow: var(--sh-1); }
.notice.error { border-color: var(--bad-bd); border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad-tx); cursor: pointer; }
.view { display: none; padding-top: 24px; }
.view.active { display: block; animation: reveal 180ms var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Metrics */
.metric-strip { display: grid; grid-template-columns: repeat(6, minmax(105px, 1fr)); gap: 12px; border: 0; background: transparent; }
.metric { position: relative; min-height: 86px; padding: 12px 16px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); overflow: hidden; }
.metric:last-child { border-right: 1px solid var(--border); }
.metric::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--primary); }
.metric:nth-child(2)::after { background: var(--ok); }
.metric:nth-child(3)::after { background: var(--primary); }
.metric:nth-child(4)::after { background: #9aa0a6; }
.metric:nth-child(5)::after { background: #f5a623; }
.metric:nth-child(6)::after { background: var(--bad); }
.metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.metric strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.alert-metric strong { color: var(--bad); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr); gap: 24px; margin-top: 24px; }
.panel-section { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.maintenance-section { margin-top: 20px; }
.maintenance-summary { display: grid; gap: 6px; color: var(--text); font-size: 13px; }
.maintenance-summary small { color: var(--muted); font-size: 12px; }
.maintenance-summary + .maintenance-summary { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.section-heading h2 { font-size: 20px; }
.page-heading { margin-bottom: 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-description { max-width: 65ch; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Buttons: one primary per view, quiet secondary, borderless tertiary */
.primary-button, .secondary-button, .danger-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; }
.primary-button { border: 1px solid var(--primary-h); background: var(--primary); color: #fff; box-shadow: var(--sh-1); }
.primary-button:hover { background: var(--primary-h); }
.primary-button:active { background: var(--primary-a); transform: translateY(1px); box-shadow: none; }
.primary-button:disabled, .secondary-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.secondary-button { border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.secondary-button:hover { border-color: var(--primary-ring); color: var(--primary); }
.secondary-button:active { transform: translateY(1px); box-shadow: none; }
.danger-button { border: 1px solid var(--bad); background: var(--bad); color: #fff; }
.danger-button:hover { background: var(--bad-tx); }
.danger-button:active { transform: translateY(1px); }
.text-button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--primary-tint-tx); font-size: 13px; font-weight: 600; }
.text-button:hover { background: var(--primary-tint); text-decoration: none; }
.text-button:hover { color: var(--primary-h); text-decoration: underline; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
thead th { position: sticky; top: 0; padding: 8px 12px; color: #6b7280; background: var(--surface-2); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; z-index: 1; }
tbody td { padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: middle; line-height: 1.45; }
.table-wrap td > strong { display: block; }
.table-wrap td > small { display: inline-block; margin-top: 2px; }
tbody tr:hover td { background: var(--surface-2); }
.compact-table { margin-top: 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 2px; border: 0; border-radius: 0; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.ready, .badge.done, .badge.completed_after_cancel_request { color: var(--ok); background: transparent; border: 0; }
.badge.queued, .badge.running, .badge.cancel_requested, .badge.running_not_interruptible { color: var(--warn); background: transparent; border: 0; }
.badge.failed, .badge.partial, .badge.failed_after_cancel_request, .badge.cancelled, .badge.cancelled_before_start, .badge.queued_tasks_cancelled, .badge.setup { color: var(--bad); background: transparent; border: 0; }
.job-list, .bundle-list, .queue-list { display: grid; gap: 12px; margin-top: 16px; }
.empty-state { padding: 32px 16px; border: 1px dashed var(--border); border-radius: var(--r-md); color: var(--muted); background: var(--surface); text-align: center; font-size: 13px; }
.empty-state.error-text { color: var(--bad-tx); border-color: var(--bad-bd); background: var(--bad-bg); }
.empty-selection { color: var(--muted); font-size: 12px; align-self: center; }
.job-row, .bundle-item, .queue-item { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.job-row { padding: 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.job-row strong, .bundle-item strong { display: block; font-size: 14px; }
.job-row small, .bundle-item small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Builder layout */
.split-workspace { display: grid; grid-template-columns: minmax(480px, 1.3fr) minmax(300px, 0.7fr); gap: 24px; align-items: start; }
.builder-pane, .library-pane { min-width: 0; max-width: 100%; padding: 20px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.library-filter { margin: 0 0 12px; }
.library-filter input { height: 36px; }
.field-grid { display: grid; gap: 12px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-columns { grid-template-columns: 1fr 0.7fr 1fr; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span, fieldset legend { color: var(--text-2); font-size: 13px; font-weight: 600; }
.field > span small { font-weight: 400; color: var(--muted); font-size: 12px; }
.field > small { color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 65ch; }
input, select, textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); outline: none; }
input, select { height: 38px; padding: 0 12px; }
textarea { resize: vertical; min-height: 76px; padding: 10px 12px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
fieldset { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.error-text { color: var(--bad-tx); }

/* Segmented + pills + tiles */
.segmented-control { display: inline-grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); margin-top: 8px; border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); padding: 3px; gap: 3px; }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.segmented-control span { height: 34px; display: grid; place-items: center; padding: 0 14px; border-radius: 5px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.segmented-control label + label span { border-left: 0; }
.segmented-control input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--sh-1); }
.segmented-control input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.three-way { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.choice-tile { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; box-shadow: var(--sh-1); }
.choice-tile:hover { border-color: var(--primary-ring); }
.choice-tile:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.choice-tile:has(input:disabled) { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.media-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
.media-item:hover { border-color: var(--primary-ring); }
.media-select { min-width: 0; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: center; cursor: pointer; }
.choice-tile input, .media-item input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.choice-tile > span, .media-select > span { min-width: 0; }
.choice-tile strong, .media-item strong { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.choice-tile small, .media-item small { display: block; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.media-list { max-height: 260px; overflow: auto; display: grid; gap: 6px; margin-top: 8px; }
.choice-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.choice-pills label { cursor: pointer; }
.choice-pills input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; }
.choice-pills span { display: inline-flex; min-height: 30px; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-2); background: var(--surface); font-size: 12px; font-weight: 600; }
.choice-pills span:hover { border-color: var(--primary-ring); color: var(--primary); }
.choice-pills input:checked + span { border-color: var(--primary-bd, var(--primary-ring)); color: var(--primary-tint-tx); background: var(--primary-tint); }
.choice-pills input:disabled + span { opacity: 0.5; cursor: not-allowed; text-decoration: line-through; }
.choice-pills input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Switch */
.switch-control { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; }
.switch-control > span:not(.switch-track) { display: grid; gap: 2px; min-width: 0; }
.switch-control strong { display: block; font-size: 13px; color: var(--text); }
.switch-control small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 65ch; }
.switch-control input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; }
.switch-track { position: relative; width: 34px; height: 20px; flex: 0 0 auto; border-radius: 999px; background: #cbd5e1; transition: background 150ms var(--ease); }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform 150ms var(--ease); }
.switch-control input:checked + .switch-track { background: var(--primary); }
.switch-control input:checked + .switch-track::after { transform: translateX(14px); }
.switch-control input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.large-switch { margin-top: 4px; font-size: 13px; }

/* Advanced settings + settings cards */
.advanced-settings { margin: 20px 0 16px; padding: 14px 16px; border: 1px solid var(--primary-ring); border-radius: var(--r-md); background: var(--primary-tint); }
.advanced-settings > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; color: var(--primary-tint-tx); }
.advanced-settings > summary::-webkit-details-marker { display: none; }
.advanced-settings > summary::before { content: "▾"; color: var(--primary); font-size: 16px; }
.advanced-settings:not([open]) > summary::before { content: "▸"; }
.advanced-settings > summary strong, .advanced-settings > summary small { display: block; }
.advanced-settings > summary strong { font-size: 13px; }
.advanced-settings > summary small { margin-top: 2px; color: var(--text-2); font-size: 12px; font-weight: 400; }
.advanced-settings-badge { padding: 4px 10px; border-radius: 999px; background: #dbeafe; color: var(--primary-tint-tx); font-size: 11px; font-weight: 600; white-space: nowrap; }
.settings-span-2 { grid-column: 1 / -1; }
.settings-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 65ch; }
.settings-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.settings-value { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; border-radius: var(--r-sm); background: var(--primary-tint); color: var(--primary-tint-tx); font-size: 12px; font-weight: 600; }
.settings-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.settings-row .settings-label { margin: 0; }
.field-disabled { opacity: 0.55; }
.budget-error { color: var(--bad-tx) !important; font-weight: 600; }

/* Account onboarding */
.account-setup-panel { margin: 0 0 20px; padding: 20px; border: 1px solid var(--primary-ring); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-2); }
.account-setup-heading, .account-setup-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.account-setup-heading { margin-bottom: 16px; }
.account-setup-heading h3 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.account-setup-heading p, .account-setup-footer p { max-width: 65ch; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-fields { padding-top: 8px; border-top: 1px solid var(--border); }
.account-setup-footer { align-items: center; padding-top: 16px; border-top: 1px solid var(--border); }
.account-setup-footer p { margin: 0; }
.placement-pills span { min-height: 34px; padding-inline: 14px; }

/* Preset editor */
.preset-workspace { grid-template-columns: minmax(620px, 1.45fr) minmax(310px, 0.55fr); }
.preset-builder-pane { background: var(--surface-2); }
.preset-builder-pane .page-heading { padding: 2px 2px 4px; }
.preset-identity-card { display: grid; grid-template-columns: 28px minmax(260px, 1fr) minmax(190px, 0.65fr); gap: 16px; align-items: center; margin-bottom: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-1); }
.preset-identity-card .field { margin: 0; }
.completion-mark { position: relative; width: 22px; height: 22px; border: 2px solid var(--ok); border-radius: 50%; background: var(--ok-bg); }
.completion-mark::after { content: ""; position: absolute; top: 5px; left: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.identity-fixed { display: grid; gap: 2px; padding-left: 16px; border-left: 1px solid var(--border); }
.identity-fixed span, .fact-grid span, .source-policy span { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.identity-fixed strong { font-size: 14px; }
.identity-fixed small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.preset-section { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-1); overflow: hidden; }
.preset-section > summary { min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; background: var(--surface); }
.preset-section > summary:hover { background: var(--surface-2); }
.preset-section > summary::-webkit-details-marker { display: none; }
.preset-section > summary::before { content: ""; width: 10px; height: 10px; flex: 0 0 auto; border: 2px solid var(--ok); border-radius: 50%; background: var(--ok-bg); }
.preset-section > summary > span:first-of-type { min-width: 0; margin-right: auto; }
.preset-section > summary strong, .preset-section > summary small { display: block; }
.preset-section > summary strong { color: var(--text); font-size: 14px; }
.preset-section > summary small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.section-state { display: inline-flex; align-items: center; gap: 8px; color: var(--ok); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.section-state::after { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 150ms var(--ease); }
.preset-section:not([open]) .section-state::after { transform: rotate(-45deg); }
.preset-section-body { padding: 20px; border-top: 1px solid var(--border); background: var(--surface); }
.section-fields { margin-top: 16px; }
.settings-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.settings-form-grid > .switch-control { min-height: 38px; margin: 16px 0 12px; }
.editor-stepper { position: sticky; top: 0; z-index: 5; display: grid; max-width: 100%; grid-template-columns: repeat(7, 1fr); gap: 1px; margin: 4px 0 16px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--border); box-shadow: var(--sh-1); }
.editor-stepper a { min-width: 0; padding: 10px 4px; overflow: hidden; color: var(--text-2); background: var(--surface); font-size: 12px; font-weight: 600; text-align: center; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.editor-stepper a:hover { color: var(--primary); background: var(--primary-tint); }
.fact-grid, .source-policy { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--border); }
.fact-grid > div, .source-policy > div { display: grid; gap: 4px; min-height: 62px; align-content: center; padding: 10px 14px; background: var(--surface-2); }
.fact-grid strong, .source-policy strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.source-policy { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.radio-card-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.radio-card-group > legend { grid-column: 1 / -1; margin-bottom: 2px; }
.radio-card-group > label { position: relative; display: block; cursor: pointer; }
.radio-card-group > label > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.radio-card-group > label > span { min-height: 78px; display: grid; gap: 4px; align-content: center; padding: 12px 12px 12px 40px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); transition: border-color 150ms var(--ease), background-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.radio-card-group > label > span::before { content: ""; position: absolute; top: 27px; left: 14px; width: 16px; height: 16px; border: 1px solid #cbd5e1; border-radius: 50%; background: var(--surface); }
.radio-card-group > label:hover > span { border-color: var(--primary-ring); }
.radio-card-group > label > input:checked + span { border-color: var(--primary); background: var(--primary-tint); box-shadow: inset 0 0 0 1px var(--primary); }
.radio-card-group > label > input:checked + span::before { border: 5px solid var(--primary); }
.radio-card-group > label > input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.radio-card-group strong, .radio-card-group small { display: block; }
.radio-card-group strong { font-size: 13px; }
.radio-card-group small { color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 65ch; }
.money-field .input-affix { display: grid; grid-template-columns: 1fr auto; padding: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
.money-field .input-affix:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.money-field .input-affix input { border: 0; box-shadow: none; }
.money-field .input-affix b { align-self: center; padding: 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.unavailable-grid { display: grid; gap: 1px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--border); }
.feature-row { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--surface-2); }
.feature-row strong, .feature-row small { display: block; }
.feature-row strong { color: var(--text-2); font-size: 12px; }
.feature-row small { max-width: 65ch; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.feature-row b { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.disabled-feature { background: var(--surface-2); }

/* Preset side pane */
.preset-side-pane { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.preset-readiness { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.preset-readiness h2 { margin: 2px 0 4px; font-size: 16px; }
.preset-readiness p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.readiness-score { width: 68px; height: 68px; display: grid; place-content: center; gap: 0; text-align: center; border: 5px solid var(--ok-bd); border-top-color: var(--ok); border-radius: 50%; background: var(--surface); overflow: hidden; }
.readiness-score strong { font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.readiness-score span { max-width: 56px; color: var(--muted); font-size: 6.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.3; overflow-wrap: break-word; }
.preset-live-summary { grid-column: 1 / -1; display: grid; gap: 0; margin: 4px 0 0; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.preset-live-summary > div { display: grid; grid-template-columns: 80px 1fr; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.preset-live-summary > div:first-child { border-top: 0; }
.preset-live-summary dt { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.preset-live-summary dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.preset-library-heading { margin-top: 20px; }
.targeting-search { display: grid; grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1.2fr) 150px auto; gap: 8px; align-items: end; margin: 4px 0 16px; padding: 14px; border: 1px solid var(--primary-ring); border-radius: var(--r-md); background: var(--primary-tint); }
.targeting-search .field { margin: 0; }
.targeting-results { grid-column: 1 / -1; max-height: 220px; overflow: auto; display: grid; gap: 4px; }
.targeting-result { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); text-align: left; }
.targeting-result:hover { border-color: var(--primary-ring); background: var(--primary-tint); }
.targeting-result strong, .targeting-result small { display: block; }
.targeting-result strong { font-size: 13px; }
.targeting-result small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.targeting-result > div { display: flex; align-items: center; gap: 8px; }
.targeting-selection-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 38px; margin-top: 8px; }
.targeting-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 8px 6px 12px; border: 1px solid var(--primary-ring); border-radius: 999px; background: var(--primary-tint); }
.targeting-chip span, .targeting-chip strong, .targeting-chip small { display: block; min-width: 0; }
.targeting-chip strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--primary-tint-tx); }
.targeting-chip small { color: var(--text-2); font-size: 11px; }
.targeting-chip button { border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 16px; line-height: 1; border-radius: 50%; width: 22px; height: 22px; padding: 4px; margin: -4px; background-clip: content-box; }
.targeting-chip button:hover { color: var(--bad); background: var(--bad-bg); }

.language-picker-row { display: flex; gap: 12px; align-items: flex-end; margin: 8px 0; }

.language-filter-field { flex: 1 1 auto; margin: 0; }

#targeting-language-reload { flex: 0 0 auto; }

.language-pills { max-height: 172px; overflow: auto; padding: 4px 2px; align-content: flex-start; }

.language-pills .locale-id { opacity: 0.65; font-weight: 400; margin-left: 6px; }
.dayparting-list { display: grid; gap: 6px; }
.dayparting-row { display: grid; grid-template-columns: 18px 52px 1fr 1fr; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.dayparting-row:hover { border-color: var(--primary-ring); }
.dayparting-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.dayparting-row > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.dayparting-row input[type="time"] { height: 34px; }

/* Repeatables */
.repeatable-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.repeatable-heading strong, .repeatable-heading small { display: block; }
.repeatable-heading strong { font-size: 13px; }
.repeatable-heading small { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 65ch; }
.repeatable-list { display: grid; gap: 8px; }
.variant-row { padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.variant-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.variant-row .field:last-child, .macro-row .field { margin-bottom: 0; }
.macro-list { display: grid; gap: 8px; margin-bottom: 16px; }
.macro-row { display: grid; grid-template-columns: minmax(130px, 0.45fr) minmax(180px, 1fr) auto; gap: 8px; align-items: end; }
.spintax-preview { display: grid; gap: 4px; padding: 10px 14px; border: 1px solid var(--ok-bd); border-radius: var(--r-md); background: var(--ok-bg); }
.spintax-preview span { color: var(--ok-tx); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.spintax-preview strong { font-size: 13px; overflow-wrap: anywhere; }
.spintax-preview.invalid { border-color: var(--bad-bd); background: var(--bad-bg); }
.spintax-preview.invalid span { color: var(--bad-tx); }
.preset-list { display: grid; gap: 12px; margin-top: 16px; }
.preset-item { padding: 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.legacy-item { background: var(--warn-bg); border-color: var(--warn-bd); }
.library-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.library-item-head > div { min-width: 0; }
.library-item-head strong, .library-item-head small { display: block; }
.library-item-head strong { font-size: 14px; }
.library-item-head small { margin-top: 2px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pinned-summary { display: grid; gap: 2px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--primary-ring); border-left: 4px solid var(--primary); border-radius: var(--r-sm); background: var(--primary-tint); }
.pinned-summary strong { font-size: 13px; color: var(--primary-tint-tx); }
.pinned-summary span { color: var(--text-2); font-size: 12px; line-height: 1.5; }

/* Campaign blocks */
.campaign-blocks-heading { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.campaign-block-list { display: grid; gap: 12px; }
.campaign-block { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); overflow: hidden; }
.campaign-block-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.campaign-block-head > div { min-width: 0; }
.campaign-block-head strong, .campaign-block-head span { display: block; }
.campaign-block-head .block-title { max-width: 100%; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.block-kicker { margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.linked-fields { position: relative; padding: 16px 16px 0; }
.linked-fields::after { content: "linked"; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; color: var(--primary-tint-tx); background: #dbeafe; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.campaign-block .media-fieldset { padding: 0 16px 16px; }
.block-media-count { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.block-mini-list { display: grid; gap: 4px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.block-mini-list span { overflow: hidden; color: var(--text-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.block-mini-list small { color: var(--primary); font-weight: 600; }
.form-actions { display: flex; gap: 8px; }
.sticky-form-footer { position: sticky; bottom: 0; z-index: 4; margin: 20px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--border); background: rgba(255, 255, 255, 0.96); box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06); }
.form-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-footer > span { color: var(--muted); font-size: 12px; }
.bundle-item { padding: 16px; }
.bundle-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.bundle-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Queue */
.queue-actions { display: flex; gap: 8px; }
.queue-toolbar { min-height: 44px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.toolbar-filter { min-width: 220px; margin: 0; }
.toolbar-filter > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.toolbar-filter input, .toolbar-filter select { height: 32px; font-size: 12px; }
.queue-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.queue-pager .pager-buttons { display: flex; gap: 8px; }
.spend-chart { width: 100%; height: auto; display: block; }
.spend-bar { fill: var(--primary); }
.spend-tick { fill: var(--muted); font-size: 10px; }
.status-legend { display: flex; align-items: center; gap: 6px; }
.status-legend .status-dot { width: 10px; height: 10px; }
.queue-item { padding: 0; overflow: hidden; }
.queue-header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 12px; padding: 16px; }
.queue-header > div { min-width: 0; }
.queue-header h3 { margin: 0 0 2px; font-size: 15px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.queue-header p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.progress-track { width: 100%; height: 6px; display: block; border: 0; border-radius: 0; background: var(--border); appearance: none; }
.progress-track::-webkit-progress-bar { background: var(--border); }
.progress-track::-webkit-progress-value { background: var(--ok); border-radius: 0 3px 3px 0; }
.progress-track::-moz-progress-bar { background: var(--ok); }
.task-details { border-top: 1px solid var(--border); }
.task-details > summary { min-height: 42px; display: flex; align-items: center; padding: 0 16px; cursor: pointer; color: var(--primary-tint-tx); font-size: 13px; font-weight: 600; }
.task-details > summary:hover { background: var(--primary-tint); }
.task-details .task-grid { border-top: 0; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; border-top: 1px solid var(--border); background: var(--border); }
.task-row { padding: 12px 14px; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.task-recovery { display: block; padding: 0; }
.task-recovery > summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; cursor: pointer; list-style-position: inside; }
.task-recovery > summary:hover { background: var(--surface-2); }
.task-recovery > summary > span { min-width: 0; }
.task-recovery > summary strong, .task-recovery > summary small { display: block; overflow-wrap: anywhere; }
.task-recovery > summary strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.task-recovery > summary small { margin-top: 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-recovery.needs-attention > summary { background: var(--bad-bg); }
.recovery-body { padding: 0 14px 14px; border-top: 1px solid var(--border); }
.recovery-error { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--bad-bd); border-left: 4px solid var(--bad); border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad-tx); overflow-wrap: anywhere; font-size: 12px; }
.recovery-error small { display: block; margin-top: 4px; color: var(--bad-tx); }
.recovery-summary { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.recovery-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 65ch; }
.recovery-tree { margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); list-style: none; overflow: hidden; }
.recovery-tree li { min-height: 36px; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(80px, auto); align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border); font-size: 12px; }
.recovery-tree li:first-child { border-top: 0; }
.recovery-tree li.recovery-child { padding-left: 28px; background: var(--surface-2); }
.recovery-tree code { color: var(--text-2); font-size: 11px; overflow-wrap: anywhere; text-align: right; font-variant-numeric: tabular-nums; }
.object-state { min-width: 60px; padding: 3px 8px; border-radius: 999px; background: var(--bad-bg); color: var(--bad-tx); border: 1px solid var(--bad-bd); font-size: 11px; font-weight: 600; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.object-state.recorded { background: var(--ok-bg); color: var(--ok-tx); border-color: var(--ok-bd); }
.recovery-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Dialogs */
dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-3); }
dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.dialog-content { position: relative; padding: 24px 48px 24px 24px; }
.dialog-content h2 { margin: 4px 0 8px; font-size: 20px; letter-spacing: -0.01em; }
.dialog-content p:not(.eyebrow) { margin: 0 0 16px; color: var(--text-2); font-size: 13px; line-height: 1.5; max-width: 65ch; }
#dialog-message { white-space: pre-line; }
.dialog-close { position: absolute; top: 12px; right: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.wide-dialog { width: min(840px, calc(100vw - 32px)); }
#media-preview-video { width: 100%; max-height: 65vh; border-radius: var(--r-md); background: #0f172a; }
.media-preview-meta { margin-top: 8px !important; font-variant-numeric: tabular-nums; }
.preflight-banner { margin: 12px 0 16px; padding: 10px 14px; border: 1px solid var(--ok-bd); border-left: 4px solid var(--ok); border-radius: var(--r-sm); background: var(--ok-bg); color: var(--ok-tx); font-size: 13px; font-weight: 600; }
.preflight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0 0 20px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.preflight-grid > div { padding: 10px 14px; background: var(--surface); min-width: 0; }
.preflight-grid dt { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.preflight-grid dd { margin: 4px 0 0; font-size: 13px; overflow-wrap: anywhere; min-width: 0; }
.preflight-content h3 { margin: 16px 0 8px; font-size: 14px; }
.preflight-list { max-height: 180px; margin: 0; padding: 0; overflow: auto; list-style: none; border: 1px solid var(--border); border-radius: var(--r-md); }
.preflight-list li { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; }
.preflight-list li:first-child { border-top: 0; }
.preflight-list strong, .preflight-list small { display: block; }
.preflight-list strong { font-size: 13px; }
.preflight-list small { margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--sidebar); }
.login-card { width: min(440px, 100%); padding: 32px; border: 1px solid var(--sidebar-2); border-radius: var(--r-lg); border-top: 4px solid var(--primary); background: var(--surface); box-shadow: var(--sh-3); }
.login-card h1 { margin: 4px 0 8px; font-size: 26px; letter-spacing: -0.02em; }
.login-card > p:not(.eyebrow) { color: var(--text-2); font-size: 13px; line-height: 1.5; }
.login-form { margin-top: 20px; }
.login-submit { width: 100%; margin-top: 4px; min-height: 42px; font-size: 15px; }
.login-footnote { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px !important; color: var(--muted); line-height: 1.5; }

/* CSS-glyph icons (no external icon font allowed by CSP) */
[data-lucide]::before { content: "•"; display: inline-block; font-weight: 700; }
[data-lucide="x"]::before { content: "×"; font-size: 18px; }
[data-lucide="play"]::before { content: "▶"; }
[data-lucide="refresh-cw"]::before, [data-lucide="database-zap"]::before { content: "↻"; }
[data-lucide="lock-keyhole"]::before { content: "▣"; }
[data-lucide="lock-keyhole-open"]::before { content: "□"; }
[data-lucide="layout-dashboard"]::before { content: "▦"; }
[data-lucide="contact-round"]::before { content: "◎"; }
[data-lucide="layers-3"]::before { content: "≡"; }
[data-lucide="list-checks"]::before, [data-lucide="list-plus"]::before { content: "☷"; }
[data-lucide="save"]::before { content: "↓"; }
[data-lucide="scan-search"]::before { content: "⌕"; }
[data-lucide="circle-stop"]::before { content: "■"; }
[data-lucide="plus"]::before { content: "+"; font-size: 18px; }
[data-lucide="trash-2"]::before { content: "×"; font-size: 17px; }
[data-lucide="sliders-horizontal"]::before { content: "≛"; }
[data-lucide="archive"]::before { content: "▤"; }

@media (max-width: 1060px) {
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .overview-grid, .split-workspace, .preset-workspace { grid-template-columns: 1fr; }
  .library-pane { order: -1; }
  .preset-side-pane { position: static; order: 0; max-height: none; }
  .targeting-search { grid-template-columns: 1fr 1fr; }
  .targeting-search .targeting-results { grid-column: 1 / -1; }
  .topbar, .queue-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .queue-header { display: flex; flex-wrap: wrap; }
  .queue-header > div { flex: 1 1 220px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 12px; }
  .brand-block { padding: 0 4px 12px; }
  .primary-nav { grid-template-columns: repeat(5, 1fr); margin-top: 12px; }
  .nav-group { display: none; }
  .nav-button { min-height: 54px; justify-content: center; flex-direction: column; gap: 4px; padding: 6px 4px; font-size: 11px; }
  .nav-button svg { width: 22px; height: 22px; }
  .nav-button.active { border-radius: var(--r-md); }
  .sidebar-footer { margin-top: 12px; padding-top: 12px; }
  .workspace { padding: 0 16px 32px; }
  .topbar { min-height: 76px; }
  .topbar h1 { font-size: 20px; }
  .safety-lock span:last-child { display: none; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .two-columns, .three-columns, .choice-grid, .settings-form-grid { grid-template-columns: 1fr; }
  .builder-pane, .library-pane, .panel-section { padding: 16px; }
  .queue-header { grid-template-columns: 1fr auto; }
  .queue-header .secondary-button { grid-column: 1 / -1; }
  .status-legend { display: none; }
  .queue-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-filter { min-width: 0; width: 100%; }
  .queue-actions { width: 100%; flex-wrap: wrap; }
  .preflight-grid { grid-template-columns: 1fr; }
  .settings-span-2 { grid-column: auto; }
  .topbar-actions { gap: 8px; }
  .health-pill { display: none; }
  .editor-stepper { overflow-x: auto; grid-template-columns: repeat(7, minmax(88px, 1fr)); }
  .preset-identity-card { grid-template-columns: 24px 1fr; }
  .preset-identity-card .identity-fixed { grid-column: 2; padding: 12px 0 0; border-top: 1px solid var(--border); border-left: 0; }
  .fact-grid, .source-policy, .radio-card-group { grid-template-columns: 1fr; }
  .targeting-search { grid-template-columns: 1fr; }
  .targeting-results { grid-column: 1; }
  .language-picker-row { flex-direction: column; align-items: stretch; }
  #targeting-language-reload { width: 100%; }
  .dayparting-row { grid-template-columns: 24px minmax(0, 1fr); }
  .dayparting-row input[type="time"] { grid-column: 2; }
  .repeatable-heading, .form-footer { align-items: flex-start; flex-direction: column; }
  .account-setup-heading, .account-setup-footer, .page-heading { align-items: stretch; flex-direction: column; }
  .page-actions, .page-actions button, .account-setup-footer .form-actions, .account-setup-footer button { width: 100%; }
  input, select, textarea { font-size: 16px; }
  .repeatable-heading .secondary-button, .form-actions, .form-actions button { width: 100%; }
  .macro-row { grid-template-columns: 1fr auto; }
  .macro-row .field:nth-child(2) { grid-column: 1; }
  .macro-row .icon-button { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .linked-fields::after { display: none; }
  .sticky-form-footer { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Spend dashboard: morning-briefing hierarchy — verdict, hero KPIs, money
   flow with metric tabs, return mix, spreadsheet-grade breakdown tables.
   Only existing tokens are used; numerals stay tabular. */
.spend-verdict { margin: 12px 0 0; color: var(--text-2); font-size: 13px; }
.spend-verdict strong { color: var(--text); font-variant-numeric: tabular-nums; }
.spend-verdict:empty { display: none; }
.spend-kpis { grid-template-columns: repeat(5, minmax(120px, 1fr)); margin-top: 12px; }
.spend-kpis .metric::after { background: var(--border); }
.spend-kpis .metric small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.spend-kpis .metric-hero { border-color: var(--primary-ring); background: var(--primary-tint); }
.spend-kpis .metric-hero::after { height: 4px; background: var(--primary); }
.spend-kpis .metric-hero strong { color: var(--primary-tint-tx); font-size: 30px; }
.spend-flow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.spend-flow .panel-section { margin-top: 0; }
.metric-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.metric-tab { min-height: 30px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; }
.metric-tab:hover { color: var(--primary); }
.metric-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--sh-1); }
.spend-grid { stroke: var(--border); stroke-width: 1; }
.spend-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.spend-donut-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; }
.spend-donut { width: 140px; height: 140px; }
.donut-track { fill: none; stroke: var(--primary); stroke-width: 16; opacity: 0.22; }
.donut-revenue { fill: none; stroke: var(--ok); stroke-width: 16; stroke-linecap: butt; }
.donut-center-value { fill: var(--text); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-center-label { fill: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.donut-legend { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.donut-legend li { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: baseline; gap: 8px; font-size: 12px; }
.donut-legend strong { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.donut-legend span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.donut-dot { width: 10px; height: 10px; align-self: center; border-radius: 50%; }
.donut-dot-spend { background: var(--primary); }
.donut-dot-revenue { background: var(--ok); }
th.num, td.num { text-align: right; }
.th-sort { display: inline-flex; align-items: center; gap: 2px; min-height: 24px; padding: 0 2px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; font: inherit; white-space: nowrap; }
th.num .th-sort { margin-left: auto; }
.th-sort:hover { color: var(--primary); }
.totals-row td { border-top: 2px solid var(--border-strong); background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.spend-value { font-variant-numeric: tabular-nums; }
.share-bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.share-bar > span { display: block; height: 100%; background: var(--primary); }
.share-pct { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

@media (max-width: 1060px) {
  .spend-flow { grid-template-columns: 1fr; }
  .spend-kpis { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .spend-kpis { grid-template-columns: repeat(2, 1fr); }
  .spend-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut-legend { width: 100%; }
}
