/* MathonGo Notification Panel
   Base: deep navy surfaces, hairline borders, one accent per channel (emerald = WhatsApp, MathonGo blue = Email). */
:root {
  color-scheme: light dark;
  --bg:#F1F4F9; --panel:#FFFFFF; --raised:#F6F8FC; --field:#F2F5FA;
  --ink:#0B1220; --muted:#5C687E; --line:#E2E7F0; --line-strong:#CDD5E3;
  --accent:#1B9E6C; --accent-2:#137A52; --accent-ink:#fff; --accent-rgb:27,158,108;
  --bad:#D13438; --ok:#13794B;
  --shadow:0 1px 2px rgba(11,18,32,.05), 0 12px 32px -12px rgba(11,18,32,.14);
  --display:"Plus Jakarta Sans", system-ui, sans-serif;
  --body:"Hanken Grotesk", system-ui, sans-serif;
  --mono:"IBM Plex Mono", ui-monospace, monospace;
  --head:64px;
}
body[data-channel="email"] { --accent:#0075FF; --accent-2:#005FD1; --accent-ink:#fff; --accent-rgb:0,117,255; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#070A12; --panel:#0E1420; --raised:#121A29; --field:#0A0F19;
    --ink:#EEF2FA; --muted:#8B96AC; --line:rgba(255,255,255,.07); --line-strong:rgba(255,255,255,.14);
    --accent:#34C98B; --accent-2:#1FA971; --accent-ink:#04140D; --accent-rgb:52,201,139;
    --bad:#FF7B7B; --ok:#4ADE80;
    --shadow:0 1px 0 rgba(255,255,255,.03) inset, 0 24px 48px -24px rgba(0,0,0,.6);
  }
  body[data-channel="email"] { --accent:#4D9AFF; --accent-2:#0075FF; --accent-ink:#031026; --accent-rgb:77,154,255; }
}

* { box-sizing:border-box; }
body {
  margin:0; font:15px/1.55 var(--body); color:var(--ink); background:var(--bg);
  background-image:radial-gradient(900px 480px at 85% -8%, rgba(0,117,255,.07), transparent 70%), radial-gradient(800px 460px at -8% 105%, rgba(52,201,139,.06), transparent 70%);
  background-attachment:fixed; -webkit-font-smoothing:antialiased;
}
[hidden] { display:none !important; }
button, input, select, textarea { font:inherit; color:inherit; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
code { font:500 .86em var(--mono); }

/* ---------- home: choose a channel (always dark) ---------- */
.choose {
  --panel:#0E1420; --ink:#EEF2FA; --muted:#93A0B8; --line:rgba(255,255,255,.08); --line-strong:rgba(255,255,255,.18);
  min-height:100vh; color:var(--ink); display:flex; flex-direction:column;
  background:radial-gradient(1100px 560px at 78% -10%, rgba(0,117,255,.20), transparent 70%), radial-gradient(900px 520px at 5% 110%, rgba(52,201,139,.14), transparent 70%), #060913;
}
.nav, .hero, .cards { width:100%; max-width:1240px; margin:0 auto; padding-left:clamp(20px,5vw,56px); padding-right:clamp(20px,5vw,56px); }
.nav { padding-top:28px; }
.brand { display:flex; align-items:center; gap:12px; white-space:nowrap; color:var(--muted); font-weight:500; }
.brand img { height:28px; width:auto; display:block; }
.hero { padding-top:clamp(40px,9vh,96px); }
.hero h1 { font:700 clamp(36px,5.2vw,66px)/1.08 var(--display); letter-spacing:-.03em; margin:0 0 18px; max-width:16ch; }
.hero p { margin:0; font-size:18px; color:var(--muted); max-width:44ch; }
.cards { display:grid; grid-template-columns:1fr 1fr; gap:22px; padding-top:44px; padding-bottom:72px; }
@media (max-width:820px) { .cards { grid-template-columns:1fr; } }

.choice { --tint:#34C98B; --tint-rgb:52,201,139; display:flex; flex-direction:column; text-decoration:none; color:inherit; border-radius:26px; overflow:hidden;
  border:1px solid var(--line); background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  transition:transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.choice.is-em { --tint:#4D9AFF; --tint-rgb:77,154,255; }
.choice:hover, .choice:focus-visible { transform:translateY(-5px); border-color:rgba(var(--tint-rgb),.55); box-shadow:0 36px 70px -34px rgba(var(--tint-rgb),.55); }
.choice:focus-visible { outline:2px solid var(--tint); outline-offset:3px; }
.art { height:262px; display:grid; place-items:center; overflow:hidden; border-bottom:1px solid var(--line);
  background:radial-gradient(120% 110% at 50% -10%, rgba(var(--tint-rgb),.26), transparent 62%), linear-gradient(180deg, rgba(255,255,255,.035), transparent); }
.info { padding:28px 30px 30px; display:flex; flex-direction:column; gap:10px; flex:1; }
.info h2 { font:700 32px/1.1 var(--display); margin:0; letter-spacing:-.02em; }
.info p { margin:0; color:var(--muted); max-width:46ch; }
.meta { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-top:auto; padding-top:18px; font-size:13px; color:var(--muted); }
.go { flex:none; width:42px; height:42px; border-radius:50%; display:grid; place-items:center; color:var(--tint); background:rgba(var(--tint-rgb),.14); border:1px solid rgba(var(--tint-rgb),.35); transition:background .25s, color .25s; }
.go svg { width:18px; height:18px; }
.choice:hover .go, .choice:focus-visible .go { background:var(--tint); color:#04140D; }

/* recent sends */
.recent { width:100%; max-width:1240px; margin:0 auto; padding:0 clamp(20px,5vw,56px) 72px; }
.recent h2 { font:700 24px/1.2 var(--display); letter-spacing:-.02em; margin:0 0 4px; }
.recent header p { margin:0 0 18px; color:var(--muted); }
.jobs { border:1px solid var(--line); border-radius:18px; overflow:hidden; background:rgba(255,255,255,.025); }
.jobs .job { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(130px,1fr) minmax(150px,auto); gap:16px; align-items:center; width:100%; height:auto; padding:16px 22px; border:0; border-radius:0; background:transparent; color:inherit; text-align:left; font-weight:400; }
.jobs .job + .job { border-top:1px solid var(--line); }
.jobs .job:hover { background:rgba(255,255,255,.045); }
.jobs .empty { margin:0; padding:28px 22px; color:var(--muted); }
.job b { display:block; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.job small { display:block; color:var(--muted); font-size:13px; }
.job .right { display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
.mini { display:block; height:5px; border-radius:3px; background:var(--line-strong); overflow:hidden; margin-bottom:6px; }
.mini i { display:block; height:100%; background:#4D9AFF; transition:width .4s ease; }
.st { display:inline-block; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:600; border:1px solid currentColor; }
.st.running { color:#4D9AFF; } .st.finished { color:#34C98B; } .st.interrupted { color:#E3B341; } .st.failed { color:#FF7B7B; }
@media (max-width:700px) { .jobs .job { grid-template-columns:1fr auto; } .jobs .job > :nth-child(2) { display:none; } }

/* mock: WhatsApp chat */
.chat { width:min(330px,82%); display:flex; flex-direction:column; gap:10px; }
.bub { padding:12px 14px; border-radius:16px; font-size:13px; line-height:1.45; }
.bub i { display:block; height:7px; border-radius:4px; background:rgba(255,255,255,.2); margin-top:6px; }
.bub i:first-child { margin-top:0; } .bub i.s { width:58%; }
.bub.in { align-self:flex-start; width:60%; background:rgba(255,255,255,.08); border-top-left-radius:4px; }
.bub.out { align-self:flex-end; width:88%; background:#0F5C3D; color:#E9FFF4; border-top-right-radius:4px; box-shadow:0 10px 30px -12px rgba(0,0,0,.6); }
.bub .tag { display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font:500 11px var(--mono); color:#7FE6B8; margin-bottom:6px; }
.bub p { margin:0; color:inherit; font-size:13px; }
.bub code, .mail code { padding:1px 6px; border-radius:5px; background:rgba(255,255,255,.16); }
.bub .cta { display:block; margin-top:10px; padding-top:8px; border-top:1px solid rgba(255,255,255,.16); text-align:center; font-weight:600; color:#8FF0C4; }
/* mock: email */
.mail { width:min(350px,84%); padding:16px; border-radius:14px; background:#F6F8FC; color:#0B1220; box-shadow:0 24px 50px -20px rgba(0,0,0,.7); font-size:12px; }
.mail .subj { display:flex; flex-direction:column; gap:2px; margin-bottom:12px; padding-bottom:10px; border-bottom:1px solid #DCE2EE; }
.mail .subj b { font-weight:600; color:#5C687E; font-size:11px; }
.mail code { background:#E1ECFF; color:#0050B3; }
.mail .blk { height:58px; border-radius:9px; background:linear-gradient(135deg,#0075FF,#5AA5FF); margin-bottom:12px; }
.mail i { display:block; height:7px; border-radius:4px; background:#D5DCE9; margin-bottom:7px; } .mail i.s { width:62%; }
.mail .cta { display:inline-block; margin-top:6px; padding:6px 14px; border-radius:7px; background:#0075FF; color:#fff; font-weight:600; }
@media (prefers-reduced-motion: reduce) { .choice, .go { transition:none; } .choice:hover { transform:none; } }

/* ---------- workspace shell ---------- */
.bar { position:sticky; top:0; z-index:6; height:var(--head); display:flex; align-items:center; gap:14px; padding:0 24px;
  background:color-mix(in srgb, var(--panel) 78%, transparent); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border-bottom:1px solid var(--line); }
.bar .brand { color:var(--muted); }
.pill { display:inline-flex; align-items:center; gap:8px; padding:6px 12px; border-radius:999px; background:var(--raised); border:1px solid var(--line); font-weight:600; font-size:14px; white-space:nowrap; }
.dot { width:8px; height:8px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px rgba(var(--accent-rgb),.18); }
.bar .grow { flex:1; min-width:0; display:flex; gap:10px; align-items:center; justify-content:flex-end; }
.bar input#campaign { max-width:250px; }
.chip { font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:36ch; }
@media (max-width:900px) { .bar { height:auto; flex-wrap:wrap; padding:12px 16px; } .bar .grow { justify-content:flex-start; flex-wrap:wrap; flex-basis:100%; } .brand span { display:none; } }

label { display:block; font-size:13px; font-weight:600; margin:0 0 6px; } label small { font-weight:400; color:var(--muted); }
input, select, textarea { width:100%; height:42px; padding:0 12px; border:1px solid var(--line-strong); border-radius:10px; background:var(--field); transition:border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color:var(--muted); opacity:.7; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 4px rgba(var(--accent-rgb),.16); }
input[type=checkbox] { width:auto; height:auto; }
textarea { height:auto; padding:12px; font:13px/1.6 var(--mono); resize:vertical; tab-size:2; }
button { height:40px; padding:0 16px; border:1px solid var(--line-strong); background:var(--panel); border-radius:10px; cursor:pointer; font-weight:600; transition:border-color .15s, background .15s, transform .1s; }
button:hover { border-color:var(--muted); } button:active { transform:translateY(1px); }
button.primary { color:var(--accent-ink); border-color:transparent; background:linear-gradient(180deg, var(--accent), var(--accent-2)); box-shadow:0 8px 22px -8px rgba(var(--accent-rgb),.7), inset 0 1px 0 rgba(255,255,255,.25); }
button.primary:hover { filter:brightness(1.06); }
button:disabled { opacity:.45; cursor:default; }
.filebtn { display:inline-flex; align-items:center; height:40px; padding:0 16px; margin:0; border:1px solid var(--line-strong); border-radius:10px; background:var(--panel); cursor:pointer; font-weight:600; white-space:nowrap; transition:border-color .15s; }
.filebtn:hover { border-color:var(--muted); }
.err { color:var(--bad); } .ok { color:var(--ok); }

.card { background:var(--panel); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow); }
.card-h h2, .summary h3 { font:700 21px/1.2 var(--display); letter-spacing:-.015em; margin:0; }
.card-h p { margin:6px 0 0; color:var(--muted); font-size:14px; }
.card-h { margin-bottom:20px; }
.fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; align-items:end; }
.span2 { grid-column:span 2; } @media (max-width:560px) { .span2 { grid-column:auto; } }

/* ---------- whatsapp: form + summary ---------- */
.ws-wa { max-width:1120px; margin:0 auto; padding:32px 24px 140px; display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:24px; align-items:start; }
.ws-wa .col { display:grid; gap:24px; } .ws-wa .col > .card { padding:28px; }
.summary { position:sticky; top:calc(var(--head) + 24px); padding:24px; }
.summary h3 { margin-bottom:14px; }
.summary dl { margin:0; display:grid; gap:12px; } .summary dt { font-size:12px; color:var(--muted); } .summary dd { margin:2px 0 0; font-weight:500; overflow-wrap:anywhere; }
@media (max-width:980px) { .ws-wa { grid-template-columns:1fr; } .summary { position:static; order:-1; } }

/* variable mapping rows (email Variables tab and WhatsApp body variables) */
.vlist { display:grid; gap:10px; }
.vrow { display:grid; grid-template-columns:minmax(96px,150px) minmax(0,1fr); gap:8px 14px; align-items:center; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--raised); }
.vrow code { overflow:hidden; text-overflow:ellipsis; color:var(--accent); }
.vrow .vhint { grid-column:2; font-size:12px; color:var(--muted); } .vrow .vhint.bad { color:var(--bad); }
.vrow .vfixed { grid-column:2; }

/* ---------- email: wide workspace ---------- */
.ws-em { padding:20px 20px 140px; display:flex; flex-direction:column; gap:16px; }
.strip { padding:20px 24px; }
.strip summary { cursor:pointer; font:600 16px/1.3 var(--body); border-radius:6px; }.strip summary::marker { color:var(--muted); }
.strip summary:focus-visible { outline-offset:6px; }
.strip details[open] summary { margin-bottom:18px; }
.split { flex:1; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; min-height:max(640px, calc(100vh - 360px)); }
@media (max-width:1000px) { .split { grid-template-columns:1fr; } .pane { min-height:560px; } }
.pane { display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; }
.pane-head { display:flex; align-items:center; gap:12px; padding:0 16px; height:56px; border-bottom:1px solid var(--line); flex:none; }
.pane-head .sub { flex:1; min-width:0; color:var(--muted); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.seg { display:inline-flex; gap:2px; padding:3px; border-radius:11px; background:var(--field); border:1px solid var(--line); }
.seg button { height:30px; padding:0 12px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-weight:500; font-size:13px; }
.seg button:hover { color:var(--ink); }
.seg button[aria-pressed=true] { background:var(--panel); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,.25), 0 0 0 1px var(--line-strong); }
#tplPane, #userPane { flex:1; min-height:0; display:flex; flex-direction:column; }
#ejs { flex:1; border:0; border-radius:0; resize:none; padding:20px; background:var(--panel); min-height:0; box-shadow:none; font-size:14px; line-height:1.7; }
#ejs:focus { box-shadow:none; }
#varsPane { flex:1; min-height:0; overflow:auto; padding:18px; }
#varsPane p { margin:0 0 14px; color:var(--muted); font-size:13px; }
#userPane #sample { flex:1; display:flex; flex-direction:column; padding:18px; min-height:0; }
#userPane #sample textarea { flex:1; resize:none; }
.stage { flex:1; min-height:0; display:flex; justify-content:center; align-items:stretch; overflow:auto; padding:20px;
  background-color:var(--field); background-image:radial-gradient(var(--line-strong) 1px, transparent 1px); background-size:18px 18px; }
.stage iframe { border:0; background:#fff; width:100%; min-height:560px; border-radius:12px; box-shadow:0 18px 40px -18px rgba(0,0,0,.5); transition:width .25s ease, border-radius .25s ease; }
.stage.mobile iframe { width:390px; max-width:100%; border-radius:30px; box-shadow:0 0 0 8px #1B2233, 0 24px 50px -18px rgba(0,0,0,.6); }
#htmlSrc { margin:0; width:100%; padding:16px; border-radius:12px; background:var(--panel); font:12px/1.55 var(--mono); overflow:auto; white-space:pre-wrap; word-break:break-all; }
.banner { padding:10px 16px; font-size:13px; background:color-mix(in srgb, var(--bad) 12%, var(--panel)); color:var(--bad); border-bottom:1px solid var(--line); }
.banner.note { background:color-mix(in srgb, var(--accent) 10%, var(--panel)); color:var(--muted); }
@media (prefers-reduced-motion: reduce) { .stage iframe { transition:none; } }

/* ---------- floating action bar ---------- */
.dock { position:fixed; z-index:7; left:50%; bottom:20px; transform:translateX(-50%); width:fit-content; max-width:calc(100% - 32px);
  display:flex; align-items:center; gap:10px; padding:8px; border-radius:16px;
  background:color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--line-strong); box-shadow:0 18px 44px -14px rgba(0,0,0,.55); }
.dock .status { flex:1; min-width:min(360px, 60vw); padding:0 8px 0 10px; font-size:14px; }
.dock .status:has(#progress[hidden]):has(#dockMsg:empty) { display:none; } /* nothing to report: the bar is just the two buttons */
.bar-track { height:6px; background:var(--line-strong); border-radius:3px; overflow:hidden; margin-bottom:6px; max-width:440px; }
.bar-track i { display:block; height:100%; background:linear-gradient(90deg, var(--accent-2), var(--accent)); transition:width .4s ease; }
.dock details { margin-top:4px; } .dock summary { cursor:pointer; color:var(--bad); font-size:13px; }
.dock pre { margin:6px 0 0; max-height:160px; overflow:auto; font:12px var(--mono); white-space:pre-wrap; }
@media (max-width:560px) { .dock { flex-wrap:wrap; justify-content:flex-end; } .dock .status { flex-basis:100%; } }

/* ---------- dialogs ---------- */
dialog { border:1px solid var(--line-strong); border-radius:22px; padding:28px; width:min(580px,92vw); background:var(--panel); color:var(--ink); box-shadow:0 40px 90px -20px rgba(0,0,0,.6); }
dialog::backdrop { background:rgba(4,7,14,.62); backdrop-filter:blur(4px); }
dialog h3 { font:700 24px/1.2 var(--display); letter-spacing:-.02em; margin:0 0 8px; }
dialog p { margin:0 0 16px; color:var(--muted); }
dialog .actions { display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:12px; margin:18px 0; }
.stats div { padding:14px; border-radius:14px; background:var(--raised); border:1px solid var(--line); color:var(--muted); font-size:13px; }
.stats b { display:block; font:700 28px/1.2 var(--display); letter-spacing:-.02em; color:var(--ink); }
dialog pre { margin:0; padding:14px; background:var(--field); border:1px solid var(--line); border-radius:12px; max-height:240px; overflow:auto; font:12px/1.55 var(--mono); white-space:pre-wrap; }
.checks { display:flex; gap:22px; margin:8px 0 14px; } .checks label { display:flex; gap:8px; align-items:center; font-weight:500; margin:0; }
