:root {
  --ink: #151a2d;
  --ink-2: #3b4160;
  --muted: #6b7090;
  --line: #e3e3ee;
  --paper: #f7f7fb;
  --card: #ffffff;
  --brand: #5b4bdb;
  --brand-ink: #ffffff;
  --brand-soft: #eeebfd;
  --ok: #1f8a5b;
  --ok-soft: #e3f4ec;
  --warn: #b7791f;
  --warn-soft: #fbf1df;
  --err: #c0392b;
  --err-soft: #fbe6e3;
  --info-soft: #e8eef8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 33, 46, .05), 0 6px 24px rgba(22, 33, 46, .06);
  --display: "Bricolage Grotesque", "Manrope", system-ui, sans-serif;
  --sans: "Manrope", system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.5; }
a { color: var(--ink); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
code { background: #eeeef6; padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #dfe5ee; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.side .logo { font-family: var(--display); font-size: 21px; color: #fff; text-decoration: none; padding: 4px 10px 14px; display: flex; gap: 8px; align-items: center; }
.side .logo i { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); display: inline-block; }
.side a.nav { display: flex; gap: 10px; align-items: center; color: #c7d0dc; text-decoration: none; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.side a.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.nav.on { background: rgba(255,255,255,.12); color: #fff; }
.side .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8794a6; padding: 14px 10px 4px; }
.side .badge { margin-left: auto; background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 8px; }
.side .foot { margin-top: auto; padding-top: 14px; font-size: 13px; color: #9aa6b6; }
.side .foot a { color: #c7d0dc; }
.main { padding: 26px 34px 60px; max-width: 1240px; width: 100%; min-width: 0; }
.caption-preview, .card { overflow-wrap: anywhere; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.credits-pill { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-weight: 700; font-size: 13px; text-decoration: none; }
.credits-pill b { color: var(--brand); }
select.brand-switch { font-weight: 700; }
.btn.menu-btn { display: none; }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stat { font-family: var(--display); font-size: 32px; font-weight: 600; line-height: 1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 16px; font: 700 14px var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #efeff7; filter: none; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 700; background: #eeeef6; color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.err { background: var(--err-soft); color: var(--err); }
.chip.info { background: var(--info-soft); color: #33507a; }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.flash.ok { background: var(--ok-soft); color: #145c3d; }
.flash.error { background: var(--err-soft); color: #8e2a1f; }
.notice { display: flex; gap: 12px; align-items: center; background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.notice .spacer { flex: 1; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; text-decoration: none; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--brand); }
.tabs a .n { font-size: 12px; background: #f1ede6; border-radius: 99px; padding: 0 7px; margin-left: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=datetime-local], input[type=time], input[type=search], select, textarea {
  width: 100%; border: 1px solid #d6d6e4; border-radius: 10px; padding: 9px 12px; font: 500 14px var(--sans); background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[type=color] { width: 44px; height: 38px; border: 1px solid #d6d6e4; border-radius: 10px; padding: 3px; background: #fff; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice .box { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; cursor: pointer; height: 100%; }
.choice input:checked + .box { border-color: var(--brand); background: var(--brand-soft); }
.choice input:focus-visible + .box { outline: 2px solid var(--brand); }
.choice .box b { display: block; margin-bottom: 3px; }
.choice .box span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.slider-row { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.slider-row span:first-child { order: 1; }
.slider-row span:last-child { order: 2; text-align: right; }
.slider-row input { order: 3; grid-column: 1 / -1; }
.swatches { display: flex; gap: 14px; flex-wrap: wrap; }
.swatches .sw { text-align: center; font-size: 12px; font-weight: 700; }

/* ---------- wizard ---------- */
.wiz { display: grid; grid-template-columns: 230px 1fr; gap: 28px; }
.wiz-steps { list-style: none; padding: 0; margin: 0; position: sticky; top: 20px; align-self: start; }
.wiz-steps li { display: flex; gap: 10px; align-items: center; padding: 8px 0; color: var(--muted); font-weight: 700; }
.wiz-steps li .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; background: #fff; }
.wiz-steps li.done .dot { background: var(--ink); color: #fff; border-color: var(--ink); }
.wiz-steps li.on { color: var(--ink); }
.wiz-steps li.on .dot { border-color: var(--brand); color: var(--brand); }
.wiz-steps a { text-decoration: none; color: inherit; }
.wiz-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.preview-tile { width: 100%; max-width: 360px; aspect-ratio: 4/5; border-radius: 12px; background: #eee center/cover; box-shadow: var(--shadow); }

/* ---------- posts ---------- */
.post-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.post-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.post-card .thumb { aspect-ratio: 4/5; background: #f1ede6 center/cover; display: grid; place-items: center; color: var(--muted); font-weight: 700; text-decoration: none; }
.post-card .thumb.text { padding: 18px; font-size: 14px; line-height: 1.45; color: var(--ink-2); place-items: start; overflow: hidden; font-weight: 500; }
.post-card .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.post-card .sel { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; accent-color: var(--brand); }
.post-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.slides { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.slides img { height: 420px; border-radius: 10px; scroll-snap-align: start; box-shadow: var(--shadow); }
.caption-preview { white-space: pre-wrap; background: #faf8f4; border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 3px solid #e7e1d7; border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { background: #f5f2ec; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; background: #fff; }
.cal .day.other { background: #faf8f4; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal .day.drop { background: var(--brand-soft); }
.cal .num { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.cal .ev { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; background: #f5f2ec; border-radius: 7px; padding: 3px 6px; margin-bottom: 4px; text-decoration: none; color: var(--ink); border-left: 3px solid #b9b2a5; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal .ev[draggable=true] { cursor: grab; }
.cal .ev.ready { border-left-color: var(--warn); }
.cal .ev.approved, .cal .ev.scheduled { border-left-color: #3c6fb3; }
.cal .ev.published { border-left-color: var(--ok); }
.cal .ev.failed { border-left-color: var(--err); }
.cal .ev img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex: none; }

/* ---------- public ---------- */
.pub-nav { display: flex; align-items: center; gap: 18px; padding: 18px 28px; max-width: 1160px; margin: 0 auto; }
.pub-nav .logo { font-family: var(--display); font-size: 22px; text-decoration: none; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.pub-nav .logo i { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); display: inline-block; }
.pub-nav a { text-decoration: none; font-weight: 700; white-space: nowrap; }
.hero h1 { overflow-wrap: break-word; }
.pub { max-width: 1160px; margin: 0 auto; padding: 0 28px 80px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 40px 0 60px; overflow: hidden; }
.hero h1 { font-size: 54px; line-height: 1.04; }
.hero p.lead { font-size: 19px; color: var(--ink-2); max-width: 34em; }
.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; transform: rotate(-2deg); }
.hero-art div { border-radius: 14px; aspect-ratio: 4/5; box-shadow: var(--shadow); padding: 16px; display: flex; align-items: flex-end; font-family: var(--display); font-size: 20px; font-weight: 600; }
.feature h3 { font-size: 17px; }
.price-card { display: flex; flex-direction: column; }
.price-card .amt { font-family: var(--display); font-size: 40px; font-weight: 600; }
.price-card ul { padding-left: 18px; margin: 10px 0 18px; }
.auth-box { max-width: 420px; margin: 40px auto; }
footer.pub-foot { border-top: 1px solid var(--line); padding: 24px 28px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 30; width: 260px; left: -270px; transition: left .2s; }
  .side.open { left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .main { padding: 18px 16px 50px; }
  .g2, .g3, .g4, .post-layout { grid-template-columns: minmax(0, 1fr); }
  .wiz { grid-template-columns: 1fr; }
  .wiz-steps { position: static; display: flex; gap: 6px; overflow-x: auto; }
  .wiz-steps li .label { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .pub-nav { padding: 14px 16px; gap: 12px; }
  .pub { padding: 0 16px 60px; }
  .hero h1 { font-size: 38px; }
  .cal .day { min-height: 80px; }
  .slides img { height: 300px; }
}

/* ---------- magic outreach ---------- */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.meter { height: 8px; background: #ececf5; border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter.ok i { background: var(--ok); } .meter.warn i { background: var(--warn); } .meter.err i { background: var(--err); }
.dns { display: flex; gap: 6px; flex-wrap: wrap; }
.source-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.source-grid .box .ico { font-size: 20px; font-weight: 800; display: inline-block; width: 30px; height: 30px; text-align: center; line-height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }
.step-card { border-left: 4px solid var(--brand); }
.step-card .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.step-card textarea { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.wait { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 13px; margin: 10px 0 10px 18px; }
.wait input { width: 70px; }
.email-preview { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.email-preview .subj { font-weight: 800; margin-bottom: 8px; display: block; white-space: normal; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.vars code { cursor: pointer; }
.ub { display: flex; flex-direction: column; }
.ub a.row-link { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; align-items: center; }
.ub a.row-link:hover { background: #fafaff; }
.ub a.row-link.unread { background: #f6f5ff; }
.ub a.row-link.unread .who { font-weight: 800; }
.ub .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ub .snip { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ub .snip b { color: var(--ink); font-weight: 700; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.msg.out { background: #f8f8fc; }
.msg + .msg { margin-top: 10px; }
.msg .meta { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.msg .body { white-space: pre-wrap; font-size: 14px; }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 14px; }
.check-list li { margin-bottom: 6px; }
.check-list .done { text-decoration: line-through; color: var(--muted); }
table.leads td { font-size: 13.5px; }
table.leads td.nowrap { white-space: nowrap; }
.sticky-actions { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0; border-top: 1px solid var(--line); margin-top: 12px; z-index: 2; }
@media (max-width: 960px) {
  .ub a.row-link { grid-template-columns: minmax(0, 1fr) auto; }
  .ub a.row-link .snip { grid-column: 1 / -1; }
}
.grid > .card + .card { margin-top: 0; }
@media (max-width: 960px) { .sticky-actions { position: static; } }
.split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 960px) { .split { grid-template-columns: minmax(0, 1fr); } .split > div[style*="sticky"] { position: static !important; } }
@media (max-width: 960px) { .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat { font-size: 26px; } }
