/* Promotion → Abandoned Cart.
   Same shell as the other split-admin pages; a quieter, flatter surface
   treatment so the email preview is the loudest thing on screen. */

:root {
  --ac-ink: #101828;
  --ac-muted: #667085;
  --ac-line: #e4e8ef;
  --ac-soft: #f7f9fc;
  --ac-blue: #1f5eff;
  --ac-blue-dark: #1648cf;
  --ac-green: #067647;
  --ac-amber: #b54708;
  --ac-red: #b42318;
  --ac-radius: 14px;
}

html, body { margin: 0; padding: 0; min-height: 100%; }
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }

body.split-admin.ac-page {
  background: #f4f6f9;
  color: var(--ac-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.ac-main { width: 100%; min-width: 0; padding: 0 32px 60px; }

/* Hero ------------------------------------------------------------- */
.ac-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; padding: 30px 0 22px;
}
.ac-eyebrow {
  display: block; color: var(--ac-blue); font-size: 11px; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase; margin-bottom: 8px;
}
.ac-hero h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.ac-hero p { margin: 8px 0 0; color: var(--ac-muted); font-size: 14px; }
.ac-hero-side { display: flex; align-items: center; gap: 10px; }
.ac-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  border: 1px solid var(--ac-line); background: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--ac-muted); white-space: nowrap;
}
.ac-status .ac-dot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.ac-status.is-live { color: var(--ac-green); border-color: #bbf0d5; background: #f0fdf6; }
.ac-status.is-live .ac-dot { background: var(--ac-green); }
.ac-status.is-paused { color: var(--ac-amber); border-color: #fbdab3; background: #fffaf2; }
.ac-status.is-paused .ac-dot { background: var(--ac-amber); }

/* Stats -------------------------------------------------------------- */
.ac-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.ac-stat {
  background: #fff; border: 1px solid var(--ac-line); border-radius: var(--ac-radius);
  padding: 16px 18px;
}
.ac-stat span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ac-muted); }
.ac-stat strong { display: block; margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.ac-stat small { display: block; margin-top: 4px; font-size: 11px; color: var(--ac-muted); }

/* Tabs --------------------------------------------------------------- */
.ac-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ac-line); margin-bottom: 20px; overflow-x: auto; }
.ac-tab {
  border: 0; background: none; padding: 11px 14px; font: 600 13px/1 inherit;
  color: var(--ac-muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.ac-tab:hover { color: var(--ac-ink); }
.ac-tab.is-active { color: var(--ac-blue); border-bottom-color: var(--ac-blue); }

.ac-panel { display: none; }
.ac-panel.is-active { display: block; }

/* Cards -------------------------------------------------------------- */
.ac-card { background: #fff; border: 1px solid var(--ac-line); border-radius: var(--ac-radius); overflow: hidden; }
.ac-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--ac-line);
}
.ac-card-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ac-card-head p { margin: 3px 0 0; font-size: 12px; color: var(--ac-muted); }
.ac-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.ac-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.ac-split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* Buttons and controls ------------------------------------------------ */
.ac-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 13px; border: 1px solid #d6dce7; border-radius: 9px;
  background: #fff; color: #344054; font: 600 12px/1 inherit; cursor: pointer; transition: .15s;
}
.ac-btn:hover:not(:disabled) { border-color: #aeb9cb; background: #f9fafb; }
.ac-btn.primary { border-color: var(--ac-blue); background: var(--ac-blue); color: #fff; }
.ac-btn.primary:hover:not(:disabled) { background: var(--ac-blue-dark); border-color: var(--ac-blue-dark); }
.ac-btn.sm { min-height: 30px; padding: 0 10px; font-size: 11px; }
.ac-btn:disabled { opacity: .5; cursor: not-allowed; }
.ac-btn-loading { display: none; align-items: center; gap: 7px; }
.ac-btn.is-loading .ac-btn-label { display: none; }
.ac-btn.is-loading .ac-btn-loading { display: inline-flex; }
.ac-spinner {
  display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: ac-spin .7s linear infinite;
}
@keyframes ac-spin { to { transform: rotate(360deg); } }

.ac-icon-btn {
  display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #dce2eb;
  border-radius: 8px; background: #fff; color: #475467; cursor: pointer; font-size: 20px; line-height: 1;
}
.ac-icon-btn:hover { border-color: #aab7cb; color: var(--ac-blue); }

.ac-input-sm, .ac-select-sm {
  height: 34px; border: 1px solid #d7dde8; border-radius: 9px; padding: 0 10px;
  background: #fff; color: var(--ac-ink); font: 12px/1 inherit; outline: 0;
}
.ac-input-sm { min-width: 210px; }
.ac-input-sm:focus, .ac-select-sm:focus { border-color: #8eacf9; box-shadow: 0 0 0 3px rgba(31, 94, 255, .1); }

/* Forms --------------------------------------------------------------- */
.ac-form { display: grid; gap: 14px; }
.ac-form-pad { padding: 18px; }
.ac-field { display: grid; gap: 6px; min-width: 0; }
.ac-field > span { font-size: 11px; font-weight: 700; color: #344054; letter-spacing: .01em; }
.ac-field > span small { font-weight: 500; color: #98a2b3; text-transform: none; letter-spacing: 0; }
.ac-field input, .ac-field select, .ac-field textarea {
  width: 100%; border: 1px solid #d7dde8; border-radius: 10px; padding: 9px 11px;
  background: #fff; color: var(--ac-ink); font: 13px/1.5 inherit; outline: 0;
}
.ac-field textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px;
  line-height: 1.6; resize: vertical; min-height: 260px;
}
.ac-field input:focus, .ac-field select:focus, .ac-field textarea:focus {
  border-color: #8eacf9; box-shadow: 0 0 0 3px rgba(31, 94, 255, .1);
}
.ac-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ac-inline { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
.ac-hint { font-size: 11px; color: var(--ac-muted); line-height: 1.5; }
.ac-hint code { background: var(--ac-soft); border: 1px solid var(--ac-line); border-radius: 5px; padding: 1px 4px; font-size: 10px; }

.ac-segment { display: inline-flex; padding: 3px; background: var(--ac-soft); border: 1px solid var(--ac-line); border-radius: 10px; }
.ac-segment button {
  border: 0; background: none; padding: 7px 12px; border-radius: 8px;
  font: 600 12px/1 inherit; color: var(--ac-muted); cursor: pointer;
}
.ac-segment button.is-active { background: #fff; color: var(--ac-ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

.ac-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12px; font-weight: 600; color: #344054; }
.ac-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ac-switch > span {
  width: 38px; height: 22px; border-radius: 999px; background: #d0d5dd; position: relative; transition: .18s; flex: 0 0 38px;
}
.ac-switch > span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: .18s;
}
.ac-switch input:checked + span { background: var(--ac-green); }
.ac-switch input:checked + span::after { transform: translateX(16px); }
.ac-switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(31, 94, 255, .2); }
.ac-switch em { font-style: normal; }
.ac-switch.big em { font-size: 14px; font-weight: 700; }

/* Template list -------------------------------------------------------- */
.ac-list { padding: 8px; display: grid; gap: 6px; max-height: 640px; overflow: auto; }
.ac-list-item {
  display: grid; gap: 5px; width: 100%; text-align: left; padding: 12px;
  border: 1px solid transparent; border-radius: 11px; background: #fff; cursor: pointer;
}
.ac-list-item:hover { background: var(--ac-soft); }
.ac-list-item.is-active { border-color: #c7d7ff; background: #f4f7ff; }
.ac-list-item strong { font-size: 13px; font-weight: 700; line-height: 1.35; }
.ac-list-item small { font-size: 11px; color: var(--ac-muted); }
.ac-list-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.ac-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .02em; background: #eef2f7; color: #475467;
}
.ac-pill.on { background: #ecfdf3; color: var(--ac-green); }
.ac-pill.off { background: #f2f4f7; color: #667085; }
.ac-pill.warn { background: #fff8ef; color: var(--ac-amber); }
.ac-pill.bad { background: #fef3f2; color: var(--ac-red); }
.ac-pill.info { background: #eff4ff; color: var(--ac-blue); }

/* Editor + preview ------------------------------------------------------ */
/* Compose and Preview are alternate views of the same card rather than two
   columns: the email is 600px wide, which a sidebar cannot show honestly. */
.ac-editor-body { display: block; }
.ac-view { display: none; }
.ac-view.is-active { display: block; }
.ac-editor-body .ac-form.is-active { display: grid; padding: 18px; }
.ac-view-switch button { min-width: 78px; }
.ac-preview { padding: 18px; background: var(--ac-soft); }
.ac-preview.is-active { display: grid; gap: 10px; align-content: start; }
.ac-preview-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ac-preview-head .ac-select-sm { flex: 1; min-width: 220px; max-width: 340px; }
.ac-preview-head-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.ac-preview-stage { display: grid; justify-items: center; }
/* The mobile width is set inline by the width switch — see abandoned-cart-page.js. */
.ac-preview-note { margin: 0; font-size: 11px; color: var(--ac-muted); line-height: 1.45; }
.ac-preview-subject {
  display: grid; gap: 3px; padding: 10px 12px; background: #fff;
  border: 1px solid var(--ac-line); border-radius: 10px;
}
.ac-preview-subject span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ac-muted); }
.ac-preview-subject strong { font-size: 13px; font-weight: 600; line-height: 1.4; }
.ac-preview iframe {
  width: 100%; max-width: 680px; height: 900px; border: 1px solid var(--ac-line);
  border-radius: 10px; background: #fff;
}
.ac-decision {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; border-radius: 10px;
  font-size: 11px; line-height: 1.45; border: 1px solid var(--ac-line); background: #fff;
}
.ac-decision.is-send { background: #f0fdf6; border-color: #bbf0d5; color: var(--ac-green); }
.ac-decision.is-wait { background: #eff4ff; border-color: #c7d7ff; color: var(--ac-blue); }
.ac-decision.is-skip { background: #fff8ef; border-color: #fbdab3; color: var(--ac-amber); }

.ac-token-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.ac-token {
  border: 1px solid #d7dde8; background: #fff; border-radius: 999px; padding: 4px 9px;
  font: 600 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; color: #475467; cursor: pointer;
}
.ac-token:hover { border-color: var(--ac-blue); color: var(--ac-blue); }
.ac-token.block { background: #f4f7ff; border-color: #c7d7ff; color: var(--ac-blue); }

.ac-logo-preview {
  display: grid; place-items: center; padding: 14px; background: #fff;
  border: 1px dashed var(--ac-line); border-radius: 10px; min-height: 62px;
}
.ac-logo-preview img { max-width: 240px; max-height: 46px; }

/* Tables ---------------------------------------------------------------- */
.ac-table-wrap { overflow: auto; max-height: 640px; }
.ac-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ac-table th {
  position: sticky; top: 0; z-index: 1; padding: 10px 14px; background: #fafbfd; color: var(--ac-muted);
  text-transform: uppercase; letter-spacing: .06em; font-size: 9px; text-align: left; border-bottom: 1px solid var(--ac-line);
}
.ac-table td { padding: 11px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.ac-table tr:last-child td { border-bottom: 0; }
.ac-table tbody tr:hover td { background: #fbfcff; }
.ac-table strong { display: block; font-size: 12px; }
.ac-table small { display: block; color: var(--ac-muted); margin-top: 2px; font-size: 11px; }
.ac-table .ac-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; color: #667085; }
.ac-table input[type="text"], .ac-table select {
  width: 100%; border: 1px solid #dce2eb; border-radius: 8px; padding: 6px 8px; font: 12px/1.4 inherit; background: #fff; outline: 0;
}
.ac-table input[type="text"]:focus, .ac-table select:focus { border-color: #8eacf9; box-shadow: 0 0 0 3px rgba(31, 94, 255, .1); }

.ac-cart-summary {
  display: grid; gap: 3px; padding: 12px 14px; background: var(--ac-soft);
  border: 1px solid var(--ac-line); border-radius: 10px; font-size: 12px;
}
.ac-cart-summary strong { font-size: 13px; }
.ac-cart-summary span { color: var(--ac-muted); }
.ac-row-send { white-space: nowrap; }

/* Webhooks + run output --------------------------------------------------- */
.ac-webhooks { display: grid; gap: 8px; padding: 14px 18px; }
.ac-webhook { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.ac-webhook code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; color: var(--ac-muted); }
.ac-run-actions { display: flex; gap: 8px; }
.ac-run-output {
  margin: 0; padding: 12px; background: #0f172a; color: #cbd5e1; border-radius: 10px;
  font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; max-height: 200px; overflow: auto; white-space: pre-wrap;
}

.ac-sticky-save {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 16px; padding: 12px 16px; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(6px); border: 1px solid var(--ac-line); border-radius: var(--ac-radius); font-size: 12px; color: var(--ac-muted);
}

/* Empty states, dialog, toast ---------------------------------------------- */
.ac-empty { display: grid; justify-items: center; text-align: center; padding: 60px 20px; }
.ac-empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: #eff4ff; font-size: 22px; }
.ac-empty h3 { margin: 14px 0 5px; font-size: 15px; }
.ac-empty p { margin: 0; color: var(--ac-muted); font-size: 12px; }
.ac-empty-inline { padding: 18px; text-align: center; color: var(--ac-muted); font-size: 12px; }

.ac-dialog {
  width: min(520px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 16px;
  box-shadow: 0 26px 80px rgba(15, 23, 42, .26); color: var(--ac-ink);
}
.ac-dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); }
.ac-dialog form { margin: 0; }
.ac-dialog-head { display: flex; justify-content: space-between; gap: 20px; padding: 20px; border-bottom: 1px solid var(--ac-line); }
.ac-dialog-head h2 { margin: 0; font-size: 17px; letter-spacing: -.015em; }
.ac-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--ac-line); background: #fafbfc; }

.ac-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 100; padding: 12px 15px;
  background: #101828; color: #fff; border-radius: 10px; box-shadow: 0 12px 35px rgba(15, 23, 42, .25); font-size: 12px;
}
.ac-toast.is-error { background: var(--ac-red); }
.ac-toast.is-success { background: #067647; }

/* Responsive ---------------------------------------------------------------- */
@media (max-width: 1280px) {
  .ac-preview-head-actions { margin-left: 0; }
}
@media (max-width: 1100px) {
  .ac-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ac-split, .ac-split-even { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ac-main { padding: 0 14px 40px; }
  .ac-hero { flex-direction: column; padding: 22px 0 16px; }
  .ac-hero h1 { font-size: 23px; }
  .ac-field-row, .ac-inline { grid-template-columns: 1fr; }
  .ac-card-head { flex-direction: column; align-items: flex-start; }
  .ac-head-actions { justify-content: flex-start; }
  .ac-input-sm { min-width: 0; width: 100%; }
}
