:root {
  --ink: #1a1d21; --ink-2: #4a5160; --ink-3: #626978; --line: #e3e1db; --line-2: #d2cfc7;
  --canvas: #f6f5f1; --surface: #ffffff; --sunk: #f0eee8;
  --accent: #1f4fd8; --accent-ink: #ffffff; --accent-soft: #e8eefc;
  --good: #0f7a4a; --good-soft: #e2f4ea; --warn: #8a5a00; --warn-soft: #fbf0d3; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 22, 26, .05), 0 6px 18px rgba(20, 22, 26, .05);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 680; } h2 { font-size: 17px; font-weight: 650; } h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 12px; } a { color: var(--accent); } small, .muted { color: var(--ink-3); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }

/* shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brandpick { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; margin-bottom: 10px; }
.brandpick svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.brandpick:hover { background: var(--sunk); }
.avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.brandpick .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.brandpick .sub { font-size: 12px; color: var(--ink-3); display: block; font-weight: 400; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 520; }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding-top: 12px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.main { padding: 26px 34px 80px; max-width: 1240px; width: 100%; min-width: 0; }
.stack > *, .grid > * { min-width: 0; }
.banner { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); border: 1px solid #ecd9a4; margin-bottom: 20px; font-size: 14px; }
.banner.live { background: var(--good-soft); color: var(--good); border-color: #bfe3cf; }
.banner b { font-weight: 680; } .banner .grow { flex: 1; }
.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead .grow { flex: 1; min-width: 200px; } .pagehead p { margin: 4px 0 0; color: var(--ink-3); }
.crumb { font-size: 13px; color: var(--ink-3); text-decoration: none; display: inline-block; margin-bottom: 4px; }
.crumb:hover { color: var(--accent); }

/* building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; } .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.top { align-items: flex-start; } .grow { flex: 1; min-width: 0; } .stack { display: flex; flex-direction: column; gap: 14px; }
.sp { height: 16px; }
.btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--sunk); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .btn.primary:hover { background: #1a43b8; }
.btn.danger { color: var(--bad); border-color: #efc4bf; } .btn.danger:hover { background: var(--bad-soft); }
.btn.go { background: var(--good); border-color: var(--good); color: #fff; } .btn.go:hover { background: #0c653d; }
.btn.small { padding: 4px 9px; font-size: 13px; } .btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); } .btn.ghost:hover { background: var(--sunk); }
.btn svg { width: 16px; height: 16px; }
label.f, div.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.f > span.hint, div.f > span.hint { display: block; font-weight: 400; color: var(--ink-3); margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=datetime-local], select, textarea {
  font: inherit; color: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); margin-top: 5px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; } textarea.code { font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; min-height: 320px; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); margin-top: 5px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; } .check input { margin-top: 3px; flex: none; }
.inline { width: auto; display: inline-block; margin-top: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 620; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--accent-soft); color: var(--accent); }
table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 12px; font-weight: 620; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fbfaf8; }
td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; } tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafaf7; } td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); } .empty h2 { color: var(--ink); margin-bottom: 6px; } .empty .btn { margin-top: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; } .stat b { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .stat span { font-size: 13px; color: var(--ink-3); }
.stat small { font-size: 12px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; } .tabs button { font: inherit; font-weight: 600; background: none; border: 0; padding: 9px 14px; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; } .seg button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-2); } .seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 16px; font-size: 13px; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; } .kv dt { color: var(--ink-3); } .kv dd { margin: 0; word-break: break-word; }
code, .mono { font: 13px ui-monospace, "Cascadia Mono", Consolas, monospace; } pre.snip { background: #17191d; color: #e8e6e1; padding: 14px; border-radius: 8px; overflow-x: auto; font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.note { background: var(--sunk); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); } .note.bad { background: var(--bad-soft); color: var(--bad); } .note.good { background: var(--good-soft); color: var(--good); } .note.warn { background: var(--warn-soft); color: var(--warn); }
ul.plain { list-style: none; margin: 0; padding: 0; } .checklist li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); } .checklist li:last-child { border: 0; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: 12px; color: #fff; } .dot.done { background: var(--good); border-color: var(--good); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; } .bars div { flex: 1; background: var(--accent); border-radius: 2px; min-height: 2px; opacity: .85; } .bars div.dry { background: #b9c2d6; } .bars div.zero { background: var(--line); }
.timeline li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: start; font-size: 14px; } .timeline li:last-child { border: 0; }
.timeline .ic { width: 22px; height: 22px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-size: 11px; color: var(--ink-2); margin-top: 1px; } .timeline time { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }

/* modal + toast */
.scrim { position: fixed; inset: 0; background: rgba(22, 24, 28, .45); display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); width: min(560px, 100%); padding: 22px; } .modal.wide { width: min(900px, 100%); } .modal.full { width: min(1280px, 100%); }
.modal > header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; } .modal > header h2 { flex: 1; font-size: 19px; } .modal > footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: #1d2025; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-size: 14px; } .toast.bad { background: var(--bad); }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 60; min-width: 230px; max-height: 70vh; overflow-y: auto; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--ink); text-decoration: none; } .menu button:hover, .menu a:hover { background: var(--sunk); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; } .menu .lbl { font-size: 12px; color: var(--ink-3); padding: 4px 10px; }

/* email editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); gap: 20px; align-items: start; }
.blocks { display: flex; flex-direction: column; gap: 10px; }
.block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; } .block > header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; } .block > header b { flex: 1; font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.addrow { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; border: 1px dashed var(--line-2); border-radius: var(--radius); align-items: center; } .addrow span { font-size: 13px; color: var(--ink-3); margin-right: 4px; }
.preview { position: sticky; top: 16px; } .preview .frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; margin: 0 auto; transition: width .15s; } .preview iframe { width: 100%; height: 640px; border: 0; display: block; }
.preview .subj { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; } .preview .subj b { display: block; } .preview .subj span { color: var(--ink-3); font-size: 13px; }

/* rules */
.rules { display: flex; flex-direction: column; gap: 8px; } .rule { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--sunk); border-radius: 8px; padding: 8px; } .rule select, .rule input { width: auto; margin-top: 0; min-width: 0; } .rule input[type=number] { width: 76px; } .rule input[type=text] { width: 170px; }

/* flow builder */
.flowwrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; }
.flow { display: flex; flex-direction: column; align-items: center; }
.node { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.node.trigger { background: #17191d; color: #fff; border-color: #17191d; } .node.trigger small { color: #b6bcc8; }
.node > header { display: flex; align-items: center; gap: 8px; } .node > header b { flex: 1; } .node .kind { font-size: 11.5px; font-weight: 680; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.node .meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); margin-top: 8px; flex-wrap: wrap; } .node .subject { margin-top: 4px; }
.node.delay { background: #fbfaf8; } .node.delay .rowin { display: flex; gap: 8px; align-items: center; } .node.delay input { width: 80px; margin: 0; } .node.delay select { width: auto; margin: 0; }
.wire { width: 2px; height: 16px; background: var(--line-2); }
.plus { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 17px; line-height: 1; color: var(--ink-2); display: grid; place-items: center; padding: 0; } .plus:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.split { width: 100%; display: flex; flex-direction: column; align-items: center; } .branches { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: 100%; margin-top: 4px; }
.branch { display: flex; flex-direction: column; align-items: center; border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 10px 10px 4px; min-width: 0; } .branch > .tag { font-size: 12px; font-weight: 680; padding: 1px 10px; border-radius: 999px; margin-bottom: 6px; } .branch.yes > .tag { background: var(--good-soft); color: var(--good); } .branch.no > .tag { background: var(--sunk); color: var(--ink-2); }
.endcap { font-size: 12.5px; color: var(--ink-3); padding: 4px 12px; border-radius: 999px; background: var(--sunk); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; } .auth .card { width: min(420px, 100%); padding: 28px; box-shadow: var(--shadow); } .auth h1 { margin-bottom: 6px; } .auth .logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.brandgrid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.brandcard { display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: inherit; } .brandcard:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .brandpick { width: auto; margin: 0; } .nav { display: flex; flex-wrap: nowrap; gap: 2px; overflow-x: auto; max-width: 100%; order: 3; flex-basis: 100%; } .nav a { white-space: nowrap; padding: 10px 12px; } .side .foot { margin: 0 0 0 auto; padding: 0; flex-direction: row; }
  .main { padding: 18px 16px 60px; } .editor, .flowwrap, .cols-2, .cols-3 { grid-template-columns: 1fr; } .cols-4 { grid-template-columns: 1fr 1fr; } .preview { position: static; } .branches { grid-template-columns: 1fr; }
  .card.flush { overflow-x: auto; } .side .foot a, .side .foot button { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* rich text box */
.rte { border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); margin-top: 4px; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 5px 6px; border-bottom: 1px solid var(--line); background: #fbfaf8; border-radius: 8px 8px 0 0; }
.rte-bar .tb { font: inherit; font-size: 13px; min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; }
.rte-bar .tb:hover:not(:disabled) { background: var(--sunk); border-color: var(--line); } .rte-bar .tb:disabled { opacity: .4; cursor: default; }
.rte-bar .tb[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.rte-bar .tbsel { width: auto; margin: 0; padding: 3px 6px; font-size: 13px; height: 28px; max-width: 150px; }
.rte-bar .tbsep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
.rte-bar .tbcolor { position: relative; display: inline-grid; place-items: center; min-width: 28px; height: 28px; font-weight: 700; font-size: 13px; cursor: pointer; border-radius: 6px; }
.rte-bar .tbcolor:hover { background: var(--sunk); }
.rte-bar .tbcolor input { position: absolute; left: 4px; right: 4px; bottom: 2px; width: auto; height: 5px; padding: 0; border: 0; margin: 0; border-radius: 2px; cursor: pointer; }
.rte-bar .tbcolor.mark { background: #fff8c5; }
.rte-area { padding: 12px 14px; line-height: 1.6; outline: none; overflow-wrap: anywhere; }
.rte-area:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, white); border-radius: 0 0 8px 8px; }
.rte-area p { margin: 0 0 16px; } .rte-area p:last-child { margin-bottom: 0; } .rte-area ul, .rte-area ol { margin: 0 0 16px; padding-left: 24px; }
.rte-area a { color: var(--accent); text-decoration: underline; }
.rte-source { border: 0; border-radius: 0 0 8px 8px; margin: 0; }
.sig-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); } .sig-list li:last-child { border: 0; }
.preview .subj small { display: block; font-size: 12px; margin-bottom: 2px; }
.rte { font-weight: 400; color: var(--ink); }
.sms-phone{background:#f1f2f4;border:1px solid var(--line);border-radius:22px;padding:18px 14px;max-width:320px;width:100%;min-height:150px;align-self:start;justify-self:center;box-sizing:border-box}
.sms-bubble{background:#e5e5ea;color:#111;border-radius:18px 18px 18px 4px;padding:10px 13px;font:15px/1.4 -apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;white-space:pre-wrap;overflow-wrap:anywhere;max-width:92%;display:inline-block}
.sms-editor textarea{margin:0}
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea { border-color: #85888f; }
.toast { display: flex; gap: 10px; align-items: flex-start; } .toast-x { background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.btn.busy { opacity: .7; cursor: progress; } .btn.busy::after { content: "…"; }
.skip { border: 1px solid var(--line-2); font: inherit; cursor: pointer; }
.modal footer { position: sticky; bottom: 0; background: var(--surface); }
.flow { max-width: 100%; min-width: 0; } .flow .node { max-width: 100%; }
@media (max-width: 640px) { .banner .more { display: none; } .banner { margin-bottom: 12px; padding: 8px 12px; } code { word-break: break-all; } }
