/* AK LEADS Connect — Menus step 2 · Email group. Loads after menus.css; tokens from styles.css only. */

/* brand switcher strip + period bar */
.brandbar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.brandbar-in { display: flex; align-items: center; gap: 8px 10px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.brandbar-in::-webkit-scrollbar { display: none; }
.bb-l { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); white-space: nowrap; margin-left: 6px; }
.bb-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.perbar { display: flex; align-items: flex-end; gap: 8px 12px; flex-wrap: wrap; }
.field.inline { grid-auto-flow: column; align-items: center; gap: 8px; }
.field.inline .input { width: auto; }

/* alerts severity dot */
.sev { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--pos); }
.sev.warn { background: var(--warn-c); } .sev.bad { background: var(--neg); }

/* who's on the list */
.stack { display: flex; height: 14px; gap: 2px; border-radius: var(--r-sm); overflow: hidden; margin: 4px 0 14px; }
.stack i { display: block; min-width: 3px; }
.stack-l { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 20px; font-size: var(--fs-sm); }
.stack-l li { display: grid; grid-template-columns: 10px 1fr auto 3.2em; gap: 8px; align-items: center; }
.stack-l .sw { width: 10px; height: 10px; border-radius: 2px; }
.stack-l .muted { text-align: right; }
.reqs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--sp-4) 12px; }
.card-b:not(.flush) > .reqs { padding: 0 0 12px; }
.warns { margin: 8px 0 12px; padding: 10px 12px 10px 28px; border: 1px solid color-mix(in oklch, var(--warn-c) 40%, transparent); background: var(--warn-soft); border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.5; }

/* previews */
.pv-subj { font-size: var(--fs-sm); margin-bottom: 10px; display: grid; gap: 2px; }
.pv-frame { display: block; width: 100%; height: 380px; border: 1px solid var(--line); border-radius: var(--r-md); background: oklch(95% 0.006 85); }
.pv-frame.tall { height: 560px; }
.dialog.wide { width: min(680px, 100%); }
.dialog.wide .pv-frame { height: 60vh; }

/* series */
.how { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--fs-sm); line-height: 1.5; max-width: 80ch; }
.ab + .ab { border-top: 1px solid var(--line-soft); }
.ab-h { padding: 12px var(--sp-4) 6px; font-size: var(--fs-sm); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tbl tr.win td { background: var(--pos-soft); }
.trig { margin: 0 0 4px; font-size: var(--fs-md); }
.ser-n { margin: 0 0 12px; font-size: var(--fs-sm); }
.fs.stop { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: center; }
.fs.stop legend { width: 100%; }
.sq { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: none; }
.sq-s { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.sq-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; border: 1px solid var(--line); color: var(--muted); }
.sq-s.send .sq-n { background: var(--text); color: var(--bg); border-color: var(--text); }
.sq-s.end .sq-n, .sq-s.sunset .sq-n { background: var(--bg-3); color: var(--text); }
.sq-b { min-width: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.sq-t { font-size: var(--fs-md); }
.sq-sub { color: var(--muted); }
.sq-stats { color: var(--muted); font-size: var(--fs-xs); }
.sq-acts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.sq-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sq-edit .select { width: auto; max-width: 280px; }
.sq-tools { display: flex; gap: 2px; }
.sq-tools .icon-btn { width: 30px; height: 30px; font-weight: 700; }
.sq-tools .icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.sq-add { padding: 4px 0 4px 40px; }
.sq-add .btn { height: 24px; border-style: dashed; color: var(--muted); }
.sq-add .btn:hover { color: var(--text); }
.sq.is-edit .sq-s { border-top: 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.inform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 10px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.inform .input { width: auto; flex: 1 1 200px; }
.input.w-num, .inform .input.w-num { width: 76px; flex: none; }
.input.w-mid { width: 160px; flex: none; }
.input.w-wide { width: min(360px, 100%); }

/* library + editor */
.row-acts { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; justify-content: flex-end; }
.linkbtn.danger { color: var(--neg); text-decoration-color: color-mix(in oklch, var(--neg) 40%, transparent); }
.sub-h.flat { margin: 16px 0 6px; }
.input.file { height: auto; padding: 7px 10px; }
.ed, .fe { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: start; }
.ed-r, .fe-r { position: sticky; top: 132px; display: grid; gap: 8px; }
.form-grid.one { grid-template-columns: 1fr; }
.ed-modes { margin: 4px 0 14px; flex-wrap: wrap; }
.ed-fields { display: grid; gap: 12px; }
.code-ta { min-height: 280px; font-size: 12px; }
.rows.links .row { padding: 8px 0; }
.rows.links .select { width: auto; min-width: 220px; }
.small { font-size: var(--fs-sm); }

/* subscribers */
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gtile { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--bg-2); color: var(--text); }
.gtile:hover { background: var(--bg-3); }
.gtile.on { border-color: var(--text); background: var(--bg-3); }
.gt-h { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }
.gt-h .sw { width: 10px; height: 10px; border-radius: 2px; }
.gtile b { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.gt-d { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.gt-r { font-size: var(--fs-xs); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--muted); font-size: var(--fs-sm); }
.chip:hover { background: var(--bg-3); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; }
.seg-grid .fs > .field-l { display: block; margin: 8px 0 6px; }
.pair { display: flex; align-items: center; gap: 6px; }
.pair .input { flex: 1 1 0; min-width: 0; }
.btn-row .field { min-width: 240px; }
.btn-row.flush-top { margin-top: 0; }
.prof { margin-top: 14px; }
.facts.four { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* forms editor */
.fe-l { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
.fold-sec { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--bg); }
.fold-sec summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: var(--fs-sm); list-style: none; display: flex; align-items: center; gap: 8px; }
.fold-sec summary::before { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.fold-sec[open] summary::before { transform: rotate(45deg); }
.fold-sec summary::-webkit-details-marker { display: none; }
.fold-b { padding: 4px 12px 14px; display: grid; gap: 12px; }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 12px; }
.color { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.color input { width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: none; }

/* do not email */
.verdict-box { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); font-size: var(--fs-sm); }
.verdict-box b { font-size: var(--fs-md); }
.verdict-box ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.verdict-box.ok { background: var(--pos-soft); border-color: color-mix(in oklch, var(--pos) 40%, transparent); }
.verdict-box.bad { background: var(--neg-soft); border-color: color-mix(in oklch, var(--neg) 40%, transparent); }
.verdict-box.grey { background: var(--bg-3); }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px var(--sp-4); justify-content: flex-end; }
.pager .muted { margin-right: auto; font-size: var(--fs-sm); }
.lead-p.pad { padding: 0 var(--sp-4); }
.ai-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 0; font-size: var(--fs-sm); }
.ai-steps > div { padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--bg); }
.ai-steps p { margin: 4px 0 0; color: var(--muted); }
.ai-steps pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; }

@media (max-width: 1024px) {
  .ed, .fe { grid-template-columns: 1fr; }
  .ed-r, .fe-r { position: static; }
  .pv-frame.tall { height: 460px; }
}
@media (max-width: 760px) {
  .bb-r { margin-left: 0; width: 100%; justify-content: space-between; }
  .sq-s { grid-template-columns: 26px minmax(0, 1fr); }
  .sq-tools { grid-column: 2; }
  .sq-add { padding-left: 0; }
  .chip { height: 44px; }
  .btn-row .field { min-width: 0; flex: 1 1 100%; }
  .field.inline { grid-auto-flow: row; }
  .row-acts { justify-content: flex-start; }
}

/* ───────── Email v2 · brand picker (top bar): type segmented control + one brand button → dropdown / bottom sheet ───────── */
.bp-type button { min-width: 0; }
.bp-static { display: inline-flex; align-items: center; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; }
.btn.bp-brand { max-width: 240px; font-weight: 600; }
.bp-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* the current choice in the page header */
.crumb .bp-cur { color: var(--text); font-weight: 650; }
.crumb .bp-sep { color: var(--faint); margin: 0 2px; }
.bp-reset { margin-left: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: var(--r-pill); height: 20px; padding: 0 8px 0 6px; font-size: 11px; font-weight: 600; }
.bp-reset::before { content: "×"; margin-right: 4px; color: var(--muted); }
.bp-reset:hover { background: var(--bg-3); }
/* dropdown (desktop) */
#popBrand { min-width: 280px; max-height: min(70vh, 520px); overflow: auto; padding-top: 0; }
.bp-sheet-h { display: none; }
.bp-search { padding: 8px 6px 4px; position: sticky; top: 0; background: var(--bg-2); z-index: 1; }
.bp-opt[hidden], .bp-none[hidden] { display: none; }
.bp-none { margin: 0; padding: 10px; color: var(--muted); font-size: var(--fs-sm); }
.bp-list .pop-sub:first-child { padding-top: 8px; }
.bp-rows .row { padding-top: 8px; padding-bottom: 8px; }
.brandbar { justify-content: flex-end; }

@media (max-width: 760px) {
  /* header: show "Email › Lead gen › SafeU" above the title on phones too */
  body[data-area="mail"] .crumb.bp-on { display: block; font-size: 12px; margin-bottom: 2px; }
  .bp-reset { height: 28px; padding: 0 10px 0 8px; font-size: 12px; }
  /* type + brand on one row: segmented control shares the row with the brand button */
  /* 390px: All (~36) + E-commerce (~84) + Lead gen (~68) ≈ 196px; the brand button takes the rest (≈154px) and ellipsises */
  .page-ctl .bp-type { flex: none; }
  .page-ctl .bp-type button { flex: none; height: 38px; padding: 0 8px; font-size: 12px; }
  .page-ctl .btn.bp-brand { flex: 1 1 0; min-width: 0; max-width: none; height: 44px; justify-content: space-between; }
  .page-ctl .bp-static { height: 44px; }
  /* brand list = bottom sheet */
  #popBrand.open { position: fixed; top: auto !important; bottom: 0; left: 0 !important; right: 0; width: 100%; max-height: 72vh; border-radius: 12px 12px 0 0; padding: 0 8px calc(12px + env(safe-area-inset-bottom)); z-index: 95;
    box-shadow: 0 -12px 40px oklch(0% 0 0 / 0.45); }
  .bp-sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 6px 6px; position: sticky; top: 0; background: var(--bg-2); z-index: 2; font-size: var(--fs-md); }
  .bp-sheet-h::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; border-radius: 2px; background: var(--line); transform: translateX(-50%); }
  .bp-search { top: 50px; }
  #popBrand .pop-item { min-height: 48px; }
}

/* ───────── Email v3 · panels over the list (Preview, Who gets it, Send test, Edit) ───────── */
html.em-lock, html.em-lock body { overflow: hidden; }          /* list stays put behind the panel, same scroll position on close */
#emPanel[hidden] { display: none; }
.emp-scrim { position: fixed; inset: 0; z-index: 76; background: var(--scrim); }
.emp { position: fixed; z-index: 77; display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
/* sizes: Edit biggest (near full screen), Preview large, Who gets it = side panel, Send test = small dialog */
.emp-edit { inset: 16px; }
.emp-preview { top: 3vh; bottom: 3vh; left: 50%; transform: translateX(-50%); width: min(1080px, calc(100vw - 48px)); }
.emp-who { top: 0; right: 0; bottom: 0; width: min(720px, 100vw); border-radius: 0; border-width: 0 0 0 1px; }
.emp-test { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: 90vh; }
.emp-h { display: flex; align-items: flex-start; gap: 10px 16px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.emp-t { flex: 1 1 260px; min-width: 0; }
.emp-t h2 { margin: 0; font-size: var(--fs-lg); font-weight: 700; font-variation-settings: "wdth" 106; line-height: 1.25; overflow-wrap: anywhere; }
.emp-sub { margin-top: 3px; font-size: var(--fs-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.emp-x { width: 36px; height: 36px; }
.emp-b { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px 20px; overscroll-behavior: contain; }
.emp-f { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: var(--bg-2); }
.emp-sp { flex: 1 1 auto; }
.emp-meta { font-size: var(--fs-sm); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.emp .seg.sm button { height: 28px; }
/* editor inside the panel: preview column sticks to the panel's own scroll */
.emp-edit .ed-r { top: 0; }
.emp-edit .pv-frame.tall { height: calc(100vh - 260px); min-height: 420px; }
/* preview: desktop width or a 390px phone frame */
.emp-preview .emp-b { background: var(--bg); padding: 16px; }
.pv-stage { height: 100%; min-height: 420px; display: flex; justify-content: center; }
.pv-stage .pv-frame { height: 100%; min-height: 420px; }
.pv-stage.phone .pv-frame { width: 390px; max-width: 100%; border: 10px solid var(--bg-3); border-radius: 26px; }
@media (max-width: 1024px) { .emp-edit .pv-frame.tall { height: 520px; } }
@media (max-width: 760px) {
  /* phone: every panel is full screen; header + footer stay pinned */
  .emp-edit, .emp-preview, .emp-who, .emp-test { inset: 0; top: 0; left: 0; right: 0; bottom: 0; width: auto; max-height: none; transform: none; border-radius: 0; border: 0; }
  .emp-h { padding: 10px 10px 10px 16px; }
  .emp-t { flex-basis: calc(100% - 52px); }
  .emp-x { order: -1; width: 44px; height: 44px; }
  .emp-acts { width: 100%; }
  .emp-acts .emp-x { position: absolute; top: 8px; right: 8px; }
  .emp-b { padding: 14px 14px; }
  .emp-f { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .emp-f .btn { flex: 1 1 40%; justify-content: center; min-height: 44px; }
  .emp-f .emp-sp, .emp-f .emp-meta { display: none; }
  .emp .seg.sm button { height: 36px; }
  .pv-stage.phone .pv-frame { border-width: 6px; }
}

/* v2 on real data */
.perbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.perbar .seg::-webkit-scrollbar { display: none; }
.perbar .seg button { flex: none; }
.sq-s:not(.editing) { grid-template-columns: 28px minmax(0, 1fr); }
.sq-b { overflow-wrap: anywhere; }
.sq-acts .linkbtn { white-space: normal; text-align: left; }
.seg-row { align-items: center; }
#emWin[hidden] { display: none; }
.sq-b { grid-template-columns: minmax(0, 1fr); } .sq-b > * { min-width: 0; }
.sq-stats.num, .ser-n.num { white-space: normal; }
