/* Campaigns: broadcasts, contacts, segments, lists and newsletter settings.
   Uses the tokens from style.css only, so light and dark themes both work. */

.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; }
.pad-x { padding-left: 20px; padding-right: 20px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-actions.spread-row { justify-content: space-between; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-text, var(--accent)); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.input.narrow { width: 96px; }
.input.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.color-input { width: 64px; height: 36px; padding: 3px; cursor: pointer; }
.input-affix { display: inline-flex; align-items: stretch; min-width: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--input-bg); overflow: hidden; }
.input-affix > span { display: flex; align-items: center; padding: 0 10px; background: var(--bg-inset); color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.input-affix > .input { min-width: 0; border: 0; border-radius: 0; background: transparent; }
.input-affix > .input:focus { box-shadow: none; }
.input-affix:focus-within { box-shadow: var(--focus-ring); }

/* Skeletons */
.skeleton-wrap { display: grid; gap: 16px; }
.skeleton-line { display: block; height: 12px; margin: 10px 0; border-radius: 6px; }
.skeleton-block { display: block; height: 96px; margin-top: 12px; }
.w-30 { width: 30%; } .w-40 { width: 40%; } .w-70 { width: 70%; } .w-90 { width: 90%; }
.skeleton-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.skeleton-kpis .skeleton-block { height: 88px; margin: 0; }
.skeleton-chart { height: 240px; }
.skeleton-table { padding: 16px 20px; }

/* Chips and tags */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--chip-bg); color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.chip:hover { background: var(--bg-hover); }
.tag-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 160px; padding: 1px 8px; border-radius: 999px; background: var(--badge-bg); color: var(--text-dim); font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-chip.more { background: transparent; }
.tag-chip button { padding: 0 2px; border: 0; background: none; color: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.tag-chip button:hover { color: var(--red); }
.tag-editor { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.tag-add .input { width: 140px; }

/* Composer */
.compose-grid { display: grid; gap: 16px; }
.compose-head { padding: 0; }
.compose-head .compose-row { grid-template-columns: 76px minmax(0, 1fr) auto; padding: 0 18px; }
.compose-head .compose-row:last-child { border-bottom: 0; }
.compose-head .callout, .compose-head .field-help { margin: 12px 18px; }
.compose-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.compose-head-tools { display: flex; align-items: center; gap: 8px; }
.input.bare { width: 100%; min-height: 44px; border: 0; background: transparent; box-shadow: none; padding: 0; font-size: 14px; }
.input.bare:focus { box-shadow: none; outline: none; }
select.input.bare { cursor: pointer; }
.char-count { color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.char-count.warn { color: var(--amber); }
.compose-body { padding: 0; overflow: hidden; }
.compose-body > .note { margin: 0; padding: 10px 18px; border-top: 1px solid var(--border); }
.compose-body #bc-html-wrap { padding: 14px 18px; }
.block-editor-host { min-height: 360px; }
.editor-loading { padding: 18px; }
.editor-loading .panel { border: 0; padding: 0; }
.compose-name { max-width: 420px; }
.schedule-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--blue-soft, var(--bg-inset)); }
.schedule-banner > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--badge-blue-bg); color: var(--blue); }
.schedule-banner > span svg { width: 15px; height: 15px; }
.schedule-banner > div { flex: 1; min-width: 0; }
.schedule-banner p { margin: 2px 0 0; color: var(--text-dim); font-size: 13px; }

/* Preview */
.preview-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.preview-controls .field { flex: 1; min-width: 220px; max-width: 420px; margin: 0; }
.inbox-mock { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.inbox-avatar { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--avatar-bg); color: var(--text); font-weight: 600; }
.inbox-lines { min-width: 0; flex: 1; }
.inbox-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.inbox-top span { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.inbox-subject { margin-top: 2px; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-preview { color: var(--text-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Audience */
.choice-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0; border: 0; }
.choice-cards legend { margin-bottom: 8px; color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.choice-card { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; }
.choice-card:hover { background: var(--bg-inset); }
.choice-card:has(input:checked) { border-color: var(--accent-border, var(--accent)); background: var(--accent-soft); }
.choice-card:has(input:disabled) { opacity: .6; cursor: default; }
.choice-card input { margin-top: 3px; accent-color: var(--accent); }
.choice-card b { display: block; font-size: 13.5px; }
.choice-card small { display: block; color: var(--text-dim); font-size: 12.5px; }
.audience-count { min-height: 44px; margin-top: 8px; padding: 12px 14px; border-radius: 8px; background: var(--bg-inset); font-size: 14px; }
.audience-count b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* Review */
.review-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.review-summary h2 { font-size: 16px; }
.review-summary p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.review-summary.ready { border-color: var(--green-soft); }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.review-group { margin: 0 0 10px; color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; cursor: default; }
summary.review-group { cursor: pointer; margin: 0; }
details[open] > summary.review-group { margin-bottom: 10px; }
.review-list { display: grid; gap: 8px; }
.review-mark { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: 13px; }
.review-mark svg { width: 13px; height: 13px; }
.review-row.warn .review-mark { background: var(--badge-amber-bg); color: var(--amber); }
.review-row.block { border-color: var(--red-soft, var(--border)); }
.review-row.block .review-mark { background: var(--badge-red-bg); color: var(--red); }

/* Reports */
.report-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.delta { font-size: 11.5px; font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--text-faint); font-weight: 500; }
.send-more { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.send-more h2 { font-size: 15px; }
.send-more p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.send-more .input { width: 120px; }
.bar { display: inline-block; width: 90px; height: 6px; margin-right: 8px; border-radius: 999px; background: var(--track-bg); vertical-align: middle; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.w-share { width: 180px; }
.link-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-list { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.failed-line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.failed-point { fill: var(--red); }
.legend-failed::before { background: var(--red); }
.chart-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-pair .analytics-chart { width: 100%; height: auto; }

/* Contacts */
.contact-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-filters input[type=search] { flex: 1 1 220px; }
.contact-filters input[type=search], .contact-filters select { width: auto; min-width: 0; }
.contact-filters select { flex: 1 1 140px; max-width: 200px; }
.contact-filters select[hidden] { display: none; }
.check-cell { width: 36px; padding-right: 0 !important; }
.check-cell input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.bulk-bar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-popover, var(--bg-card)); box-shadow: var(--shadow-md); }
.bulk-bar[hidden] { display: none; }
.bulk-count { font-size: 13.5px; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.contact-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tags-row { align-items: flex-start; }

/* Segments */
.segment-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.segment-preview { position: sticky; top: 18px; }
.segment-preview h2 { margin-bottom: 8px; font-size: 14px; }
.segment-count { margin: 0 0 10px; font-size: 14px; }
.segment-count b { font-size: 22px; font-variant-numeric: tabular-nums; }
.sample-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sample-list li { display: grid; min-width: 0; }
.sample-list a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.sample-list small { color: var(--text-faint); font-size: 12px; }
.cond-list { display: grid; gap: 8px; }
.cond-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border-radius: 8px; background: var(--bg-inset); }
.cond-row .input { flex: 1 1 140px; min-width: 0; width: auto; }
.cond-row select.input { flex: 0 1 auto; }
.cond-row .input-affix { flex: 1 1 140px; }
.cond-join { width: 48px; color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.segment-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(560px, 100%); margin: 16px auto 0; text-align: left; }
.starter-card { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.starter-card:hover { border-color: var(--accent-border, var(--accent)); background: var(--accent-soft); }
.starter-card small { color: var(--text-dim); font-size: 12.5px; }

/* Newsletter settings */
.design-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.design-preview { background: var(--preview-stage); }
.design-sample { --sample-accent: #d1383d; padding: 24px; border-radius: 8px; background: #fff; color: #1f1f1f; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color-scheme: light; }
.design-sample[data-font=serif] { font-family: Georgia, "Times New Roman", serif; }
.design-sample[data-font=mono] { font-family: ui-monospace, Menlo, Consolas, monospace; }
.design-sample[data-align=center] { text-align: center; }
.design-sample h3 { margin: 0 0 8px; font-size: 20px; }
.design-sample p { margin: 0 0 14px; color: #3d3d3d; font-size: 14px; line-height: 1.55; }
.design-sample .small { margin: 16px 0 0; color: #8a8a8a; font-size: 11px; }
.design-button { display: inline-block; padding: 9px 16px; border-radius: 6px; background: var(--sample-accent); color: #fff; font-size: 14px; font-weight: 600; }
.wrap-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.wrap-form .field { flex: 1 1 160px; margin: 0; }

@media (max-width: 1024px) {
  .report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-kpis .kpi:nth-child(4) { border-left: 0; }
  .segment-layout, .design-layout { grid-template-columns: 1fr; }
  .segment-preview { position: static; }
}
@media (max-width: 768px) {
  .chart-pair, .choice-cards, .segment-starters { grid-template-columns: 1fr; }
  .report-kpis, .contact-kpis, .skeleton-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-kpis .kpi, .contact-kpis .kpi { border-left: 0; border-top: 1px solid var(--border); }
  .report-kpis .kpi:nth-child(-n+2), .contact-kpis .kpi:nth-child(-n+2) { border-top: 0; }
  .report-kpis .kpi:nth-child(even), .contact-kpis .kpi:nth-child(even) { border-left: 1px solid var(--border); }
  .hide-sm { display: none !important; }
  .compose-head .compose-row { grid-template-columns: 64px minmax(0, 1fr) auto; padding: 0 14px; }
  .compose-head-top { flex-wrap: wrap; padding: 10px 14px; }
  .compose-body #bc-html-wrap { padding: 12px 14px; }
  .review-actions, .review-actions .btn { width: 100%; }
  .review-actions .btn { justify-content: center; flex: 1; }
  .send-more form { width: 100%; }
  .send-more .input { flex: 1; }
  .w-share { width: auto; }
  .link-cell { max-width: 200px; }
  .bulk-bar { top: 56px; }
  .bulk-actions .btn { flex: 1 1 auto; }
  .tag-editor { justify-content: flex-start; }
  .cond-join { width: 100%; }
  .cond-row .input, .cond-row select.input, .cond-row .input-affix { flex: 1 1 100%; }
  .cond-row .icon-btn { margin-left: auto; }
  .contact-filters select { flex: 1 1 calc(50% - 4px); max-width: none; }
}

/* .seg with links (period pickers) */
.seg a { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 6px; color: var(--text-dim); font: 500 13px var(--font); text-decoration: none; white-space: nowrap; }
.seg a:hover { color: var(--text); }
.seg a.active { background: var(--seg-active-bg); color: var(--text); font-weight: 600; }
.seg button { white-space: nowrap; }
.panel-heading > .seg { flex: none; }
.settings-row .input.color-input, .input.color-input { width: 64px; min-width: 64px; flex: none; }
.settings-row .input.narrow { width: 96px; }
.choice-card input { flex: none; width: auto; min-height: 0; }

/* The block editor's phone toolbar sticks below the mobile app bar. */
@media (max-width: 768px) { body { --editor-sticky-top: 52px; } }
