/* FormSMTP dashboard styles. Design tokens live in tokens.css (shared with the marketing site). */

/* Base ------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.5 var(--font-ui);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--ink); }
h1 { font-family: var(--font-display); font-weight: 650; font-size: 28px; letter-spacing: -0.035em; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--ink); text-decoration-color: var(--accent-strong); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--ink-2); }
code {
  font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-3); color: var(--ink);
  padding: 1px 5px; border-radius: 5px;
}
.icon { flex-shrink: 0; display: block; }
.muted { color: var(--ink-2); }
.muted .icon, .icon.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.error { color: var(--stamp); font-size: 13px; }
.error:empty { display: none; }
.err { color: var(--stamp); font-size: 12px; margin-top: 2px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span2 { grid-column: span 2; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Buttons ---------------------------------------------------------------------------------------- */
.btn {
  font: inherit; font-size: 13.5px; font-weight: 550; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r-ctl); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-xs); text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .icon { color: currentColor; opacity: 0.85; }
.btn.primary {
  background: var(--primary); border-color: var(--primary); color: var(--on-primary);
  box-shadow: 0 1px 2px rgba(20, 20, 19, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger, .btn.danger-outline { color: var(--stamp); }
.btn.danger-outline:hover, .btn.danger:hover { background: var(--stamp-soft); border-color: color-mix(in srgb, var(--stamp) 45%, transparent); color: var(--stamp); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; border-radius: 8px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: none; color: var(--ink-2); cursor: pointer; text-decoration: none; flex-shrink: 0;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover:not(:disabled) { background: var(--stamp-soft); color: var(--stamp); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }

.inline-link { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; font-weight: 500; }

/* Forms ------------------------------------------------------------------------------------------ */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: 13px; color: var(--ink); }
label small { font-weight: 400; font-size: 12.5px; line-height: 1.45; }
input, select, textarea {
  font: inherit; font-size: 14px; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  padding: 0 11px; height: 38px; width: 100%; box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { padding: 9px 11px; height: auto; resize: vertical; line-height: 1.5; }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a90a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
input[type=checkbox]:not(.switch), input[type=radio] {
  appearance: none; width: 17px; height: 17px; padding: 0; margin: 0; flex-shrink: 0; cursor: pointer;
  display: inline-grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 5px;
  background: var(--surface); box-shadow: none; transition: background-color 0.12s, border-color 0.12s;
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:not(.switch):hover, input[type=radio]:hover { border-color: var(--ink-3); }
input[type=checkbox]:not(.switch):checked, input[type=radio]:checked { background: var(--primary); border-color: var(--primary); }
input[type=checkbox]:not(.switch):checked::after {
  content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type=radio]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--on-primary); }
input[type=range] { height: auto; padding: 0; border: 0; box-shadow: none; background: none; accent-color: var(--primary); }
input[type=color] { padding: 3px; cursor: pointer; }
input[type=file] { height: auto; padding: 8px; }
textarea.mono { font-family: var(--font-mono); font-size: 12.5px; }

label.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }

/* switch toggle */
.switch-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
.switch-row strong { font-weight: 550; }
input.switch {
  appearance: none; width: 38px; height: 22px; border-radius: 999px; border: 0; position: relative;
  background: var(--line-strong); cursor: pointer; transition: background-color 0.18s; box-shadow: none;
}
input.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.18s;
}
input.switch:checked { background: var(--primary); }
input.switch:checked::after { background: var(--on-primary); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.search-field { flex-direction: row; align-items: center; gap: 0; position: relative; flex: 1 1 240px; font-weight: 400; }
.search-field .icon { position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.search-field input { padding-left: 34px; }

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.narrow { max-width: 240px; }

/* segmented control (shadcn-style tabs) */
.segmented, .seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px;
  background: var(--surface-3); align-self: flex-start; max-width: 100%;
}
.segmented.full { display: flex; align-self: stretch; }
.segmented.full button { flex: 1; }
.segmented.scroll { overflow-x: auto; scrollbar-width: none; }
.segmented button, .seg button {
  font: inherit; font-size: 13px; font-weight: 550; border: 0; background: none; color: var(--ink-2);
  height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented button:hover, .seg button:hover { color: var(--ink); }
.segmented button.active, .seg button.active {
  background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(21, 26, 45, 0.1), 0 0 0 1px var(--line);
}
.segmented .count, .chip .count {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: var(--surface-2);
  border-radius: 999px; padding: 0 6px; line-height: 18px; margin-left: 2px;
}
.segmented button.active .count { background: var(--primary-soft); color: var(--primary-ink); }
.seg.small button { height: 26px; padding: 0 9px; font-size: 12px; }
.align-seg button { min-width: 32px; padding: 0 8px; }

/* chips & tags */
.chip {
  font: inherit; font-size: 12.5px; font-weight: 550; height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.active { background: var(--primary-soft); color: var(--primary-ink); border-color: color-mix(in srgb, var(--accent-strong) 55%, transparent); }
.chip.static { cursor: default; font-family: var(--font-mono); font-size: 12px; font-weight: 400; height: 24px; padding: 0 8px; }
.chip.missing { border-style: dashed; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-soft); }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.pill {
  display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--ink-2);
}

/* status badges: <span class="badge s-sent"><i></i>Sent</span> */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--surface-3); color: var(--ink-2);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.s-sent, .badge.s-completed { background: var(--ok-soft); color: var(--ok); }
.badge.s-failed { background: var(--stamp-soft); color: var(--stamp); }
.badge.s-queued, .badge.s-scheduled, .badge.s-sending { background: var(--primary-soft); color: var(--primary-ink); }
.badge.s-sending i { animation: pulse 1.4s ease-in-out infinite; }
.badge.s-skipped, .badge.s-cancelled, .badge.s-draft { background: var(--surface-3); color: var(--ink-2); }
@keyframes pulse { 50% { opacity: 0.3; } }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.status-dot.sent { background: var(--ok); }
.status-dot.failed { background: var(--stamp); }

/* Cards & callouts ------------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-head p { margin-top: 3px; font-size: 13px; }

.callout {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--primary-soft); color: var(--ink); font-size: 13.5px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 30%, transparent);
}
.callout > .icon { color: var(--primary-ink); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout.warn > .icon { color: var(--warn); }
.callout.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.callout.ok > .icon { color: var(--ok); }
.callout p + p { margin-top: 4px; }

.disclosure { border-top: 1px solid var(--line); padding-top: 12px; }
.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 550; font-size: 13px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon { transition: transform 0.15s; color: var(--ink-3); }
.disclosure[open] > summary .icon { transform: rotate(90deg); }
.disclosure[open] > summary { margin-bottom: 10px; }

/* Login ------------------------------------------------------------------------------------------ */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); background: var(--canvas); }
.login-art {
  position: relative; overflow: hidden; margin: 12px; border-radius: 24px; padding: 44px 48px 36px;
  background:
    radial-gradient(60% 50% at 85% 10%, rgba(203, 243, 79, 0.10), transparent 70%),
    radial-gradient(circle, rgba(255, 255, 255, 0.06) 1px, transparent 1.2px) 0 0 / 20px 20px,
    #141413;
  color: #f1f0eb; display: flex;
}
:root[data-theme="dark"] .login-art { box-shadow: inset 0 0 0 1px #262624; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.login-card .brand.stacked { flex-direction: column; gap: 10px; align-self: center; }
.login-copy { display: flex; flex-direction: column; gap: 8px; text-align: center; margin-bottom: 8px; }
.login-copy h1 { font-size: 36px; letter-spacing: -0.045em; }
.login-hint { line-height: 1.5; text-align: center; padding-top: 16px; border-top: 1px solid var(--line); }
.login-hint code { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); }
.pass-field { position: relative; display: flex; align-items: center; }
.pass-field input { height: 46px; padding: 0 44px 0 40px; border-radius: 12px; font-size: 14.5px; }
.pass-lock { position: absolute; left: 13px; color: var(--ink-3); pointer-events: none; }
.pass-field .icon-btn { position: absolute; right: 7px; }
.login-card .btn.lg { height: 48px; border-radius: 12px; font-size: 15px; }

/* auth forms */
.login-panel { overflow-y: auto; }
.oauth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oauth-grid.one { grid-template-columns: 1fr; }
.oauth-grid.three > :first-child { grid-column: span 2; }
.oauth-btn { height: 44px; border-radius: 12px; gap: 10px; font-size: 14px; background: var(--sheet); }
.oauth-btn svg { flex-shrink: 0; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12.5px; margin: 2px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.login-card label { position: relative; }
.login-card input:not([type=checkbox]) { height: 46px; border-radius: 12px; font-size: 14.5px; background: var(--sheet); }
.login-card .pass-field input { padding-left: 40px; }
.label-link { position: absolute; right: 0; top: 0; font-weight: 500; font-size: 12.5px; color: var(--ink-2); }
.login-foot { text-align: center; color: var(--ink-2); font-size: 13.5px; }
.login-foot a { font-weight: 600; }
.login-card .btn.lg .icon { margin-left: 2px; }
.login-card .callout { font-size: 13px; }
.sent-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 6px; background: var(--accent); color: var(--on-accent); }
.ok-text { color: var(--ok); font-size: 13px; text-align: center; }
.ok-text:empty { display: none; }
.login-card .error { text-align: center; }

/* login showcase */
.ls { display: flex; flex-direction: column; justify-content: space-between; gap: 28px; width: 100%; max-width: 760px; margin: 0 auto; }
.ls-brand { display: flex; align-items: center; gap: 12px; }
.ls-brand .brand-name { font-size: 22px; color: #f1f0eb; }
.ls-copy h2 { font-size: clamp(34px, 3.6vw, 54px); font-weight: 700; letter-spacing: -0.05em; line-height: 1.02; color: #f1f0eb; }
.ls-copy em { font-style: normal; color: #cbf34f; }
.ls-copy p { margin-top: 14px; font-size: 16px; color: #a8a59d; max-width: 600px; }
.ls-stage { position: relative; flex: 1; min-height: 410px; max-height: 470px; }
.ls-card {
  position: absolute; border-radius: 16px; background: #1c1c1a; border: 1px solid #2c2c29; color: #f1f0eb;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6); padding: 14px 16px; font-size: 12px;
}
.ls-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; color: #a8a59d; }
.ls-card-head strong { color: #f1f0eb; font-size: 13.5px; font-weight: 600; flex: 1; }
.ls-card-head > span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.ls-log { left: 0; top: 0; width: 64%; transform: rotate(-2.5deg); animation: float 7s ease-in-out infinite; }
.ls-row { display: grid; grid-template-columns: 8px 1.2fr 1.3fr auto 52px; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #2a2a27; }
.ls-row i { width: 7px; height: 7px; border-radius: 50%; background: #cbf34f; }
.ls-row i.bad { background: #ff6b6b; }
.ls-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-to, .ls-when { color: #8a877f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-when { text-align: right; }
.ls-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #cbf34f; color: #141413; }
.ls-pill.bad { background: #ff6b6b; }
.ls-heat { right: 0; top: 14px; width: 32%; background: #f6f5f0; border-color: #e6e3dc; color: #141413; transform: rotate(3deg); animation: float 8s ease-in-out -2s infinite; }
.ls-heat .ls-card-head, .ls-heat .ls-card-head strong { color: #141413; }
.ls-grid { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.ls-grid b { aspect-ratio: 1; border-radius: 50%; background: #e7e4dc; }
.ls-grid b.h1 { background: #e3f5b0; } .ls-grid b.h2 { background: #c8ea6e; } .ls-grid b.h3 { background: #a6d332; } .ls-grid b.h4 { background: #7fb312; }
.ls-code { left: 16%; top: 168px; width: 64%; padding: 14px 14px 10px; transform: rotate(1.5deg); animation: float 9s ease-in-out -4s infinite; }
.ls-code pre { background: #121211; padding: 12px 14px; border-radius: 10px; font-size: 11.5px; line-height: 1.6; }
.ls-copy-btn { border: 1px solid #34342f; border-radius: 7px; padding: 3px 8px; }
.ls-feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.ls-feats li { display: flex; gap: 12px; align-items: flex-start; padding: 0 16px; }
.ls-feats li:first-child { padding-left: 0; }
.ls-feats li + li { border-left: 1px solid #2c2c29; }
.ls-feats li > span { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #22221f; color: #cbf34f; flex-shrink: 0; }
.ls-feats strong { display: block; font-size: 14px; color: #f1f0eb; }
.ls-feats small { display: block; font-size: 12.5px; color: #8a877f; line-height: 1.45; margin-top: 2px; }
@media (max-width: 1280px) { .ls-row { grid-template-columns: 8px 1fr auto 46px; } .ls-to { display: none; } }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }

/* Shell ------------------------------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
html, body { overflow-x: clip; }
.sidebar {
  position: sticky; top: 10px; height: calc(100vh - 20px); margin: 10px; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 12px 14px; overflow-y: auto; background: var(--sheet); border-radius: var(--r-sheet);
  box-shadow: var(--shadow-sheet); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.sidebar > .brand { padding: 4px 8px 6px; }

.switch-menu { position: relative; }
.switch-btn {
  list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
}
.switch-btn::-webkit-details-marker { display: none; }
.switch-btn:hover { border-color: var(--line-strong); }
.switch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.switch-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em;
  font-family: var(--font-display);
}
.avatar.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 11px; background: var(--primary-soft); color: var(--primary-ink); }

.menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; padding: 6px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 1px; max-height: 60vh; overflow-y: auto;
  animation: pop-in 0.12s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-label { font-size: 12px; color: var(--ink-3); padding: 6px 8px 4px; font-weight: 500; }
.menu-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-weight: 500; font-size: 13.5px;
}
.menu-item:hover { background: var(--surface-3); color: var(--ink); }
.menu-item.active .icon { color: var(--primary-ink); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 2px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 16px 10px 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 11px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 13.5px;
  border: 0; background: none; font-family: inherit; cursor: pointer; width: 100%; text-align: left;
}
.nav-item .icon { color: var(--ink-3); }
.nav-item:hover { color: var(--ink); background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--ink); }
.nav-item.active .icon { color: var(--primary-ink); }
.theme-track {
  width: 32px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; flex-shrink: 0;
  transition: background-color 0.18s;
}
.theme-track i {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.18s;
}
#theme-btn[aria-pressed="true"] .theme-track { background: var(--accent); }
#theme-btn[aria-pressed="true"] .theme-track i { transform: translateX(14px); background: var(--on-accent); }
#theme-btn .grow { text-align: right; color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.user-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.user-chip {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px;
  color: var(--ink); text-decoration: none;
}
.user-chip:hover, .user-chip.active { background: var(--surface-2); color: var(--ink); }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; }
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mail { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
img.avatar { object-fit: cover; background: var(--surface-3); }
.avatar.lg { width: 52px; height: 52px; border-radius: 50%; font-size: 18px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; padding-top: 12px; border-top: 1px solid var(--line); }

.sheet-wrap { padding: 10px 10px 10px 0; min-width: 0; }
.sheet {
  background: var(--sheet); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet);
  min-height: calc(100vh - 20px); display: flex; flex-direction: column; min-width: 0;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.sheet-head {
  height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 28px; border-bottom: 1px solid var(--line);
  position: sticky; top: 10px; z-index: 10; background: color-mix(in srgb, var(--sheet) 88%, transparent);
  backdrop-filter: blur(10px); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
}
.menu-btn { display: none; margin-left: -8px; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13.5px; min-width: 0; }
.crumbs a { color: var(--ink-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { color: var(--ink-3); }
.main {
  padding: 28px 28px 48px; width: 100%;
  display: flex; flex-direction: column; gap: 20px; min-width: 0;
}
.main.wide { max-width: none; }
.scrim { display: none; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 680px; }
.page-desc { color: var(--ink-2); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Empty states & loading */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px 32px; }
.empty-state .ill { width: 220px; height: auto; margin-bottom: 8px; }
.empty-state h2 { font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.empty-state p { color: var(--ink-2); max-width: 420px; }
.empty-state .row { margin-top: 10px; }
.mini-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; color: var(--ink-2); text-align: center; font-size: 13.5px; }
.mini-empty .icon { color: var(--ink-3); }
.welcome { max-width: 520px; margin: 6vh auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.welcome .ill { width: 240px; }
.welcome h1 { font-size: 34px; }
.welcome .btn { margin-top: 8px; }
.welcome.onboarding { max-width: 640px; margin-top: 4vh; gap: 14px; }
.welcome.onboarding h1 { font-size: 32px; letter-spacing: -0.04em; }
.founding-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--accent); color: var(--on-accent);
}
.provider-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; margin-top: 10px; }
.provider-tile {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px;
  transition: border-color 0.15s, transform 0.15s;
}
.provider-tile:hover { border-color: var(--accent-strong); transform: translateY(-1px); color: var(--ink); }
.onboard-steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; color: var(--ink-2); font-size: 13.5px; }
.onboard-steps li { display: inline-flex; align-items: center; gap: 8px; }
.onboard-steps span { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--ink); font-size: 12px; font-weight: 700; }
@media (max-width: 640px) { .provider-grid { grid-template-columns: 1fr 1fr; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 12px; }
.skeleton.line { height: 14px; border-radius: 6px; margin: 10px 0; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.skeleton-grid .skeleton { height: 118px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Tables ----------------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th {
  text-align: left; font-weight: 550; color: var(--ink-3); font-size: 12.5px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
  font-size: 12px; letter-spacing: 0.01em;
}
table.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.card:not(.flush) table.table th { background: none; padding-left: 8px; padding-right: 8px; }
.card:not(.flush) table.table td { padding-left: 8px; padding-right: 8px; }
.source { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.source .icon { color: var(--ink-3); }
.person { display: flex; align-items: center; gap: 10px; }

/* Overview --------------------------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { gap: 10px; padding: 16px 18px; }
.kpi-top { display: flex; align-items: center; gap: 9px; }
.chip-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.kpi.bad .chip-icon { background: var(--stamp-soft); color: var(--stamp); }
.kpi-label { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.kpi-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi-value { font-family: var(--font-display); font-size: 34px; font-weight: 650; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12.5px; color: var(--ink-3); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; width: 84px; }
.spark i { flex: 1; background: var(--accent-strong); border-radius: 2px; min-height: 3px; }
.spark i.zero { background: var(--line-strong); opacity: 1; }

.setup .card-head { align-items: center; }
.meter { width: 160px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent-strong); transition: width 0.4s ease; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.steps li { position: relative; min-width: 0; }
/* connector line from this step's dot to the next one */
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 11px; left: 32px; right: 8px; height: 2px; border-radius: 2px; background: var(--line);
}
.steps li.done:not(:last-child)::after { background: var(--accent-strong); }
.steps a {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 0 14px 2px 0; height: 100%;
  color: var(--ink); text-decoration: none; font-weight: 550; font-size: 13.5px; line-height: 1.35;
}
.steps a > .icon { display: none; }
.steps a:hover .grow { text-decoration: underline; text-decoration-color: var(--accent-strong); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.steps small { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; }
.step-mark {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: 12px; font-weight: 650; background: var(--sheet); color: var(--ink-2); font-family: var(--font-display);
  box-shadow: inset 0 0 0 1.5px var(--line-strong); position: relative; z-index: 1;
}
.steps li.done a { color: var(--ink-2); }
.steps li.done .step-mark { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.steps li:not(.done) a:hover .step-mark { box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); }

.activity .card-head { align-items: center; flex-wrap: wrap; }
.activity-body { display: flex; gap: 28px; align-items: flex-start; }
.activity-body .pm-wrap { flex: 0 1 auto; min-width: 0; }
.pm-stats { flex: 1; min-width: 160px; display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: 24px; margin-top: 26px; }
.pm-stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; }
.pm-stat + .pm-stat { border-top: 1px dashed var(--line); }
.pm-stat span { font-size: 12.5px; color: var(--ink-3); }
.pm-stat strong { font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.legend span { margin: 0 4px; }
.pm-wrap { --pm: 18px; --pm-gap: 7px; display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; }
.pm-days { display: grid; grid-template-rows: repeat(7, var(--pm)); gap: var(--pm-gap); padding-top: 26px; font-size: 11.5px; color: var(--ink-3); flex-shrink: 0; }
.pm-days span { line-height: var(--pm); }
.pm-body { flex-shrink: 0; }
.pm-months { display: grid; grid-template-columns: repeat(26, var(--pm)); column-gap: var(--pm-gap); height: 20px; margin-bottom: 6px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.pm-grid { display: grid; grid-template-columns: repeat(26, var(--pm)); gap: var(--pm-gap); }
.pm-col { display: grid; grid-template-rows: repeat(7, var(--pm)); gap: var(--pm-gap); }
/* each day is a little postmark: a dashed ring that fills in as volume grows */
.pm { display: block; width: var(--pm); height: var(--pm); border-radius: 50%; background: var(--surface-3); position: relative; }
.pm.l1 { border: 0; background: color-mix(in srgb, var(--accent-strong) 28%, transparent); }
.pm.l2 { border: 0; background: color-mix(in srgb, var(--accent-strong) 52%, transparent); }
.pm.l3 { border: 0; background: color-mix(in srgb, var(--accent-strong) 78%, transparent); }
.pm.l4 { border: 0; background: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-strong) 22%, transparent); }
.pm.future { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.pm.today { outline: 1.5px solid var(--ink-2); outline-offset: 2px; }
.pm.has-fail::after { content: ""; position: absolute; right: -2px; top: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--stamp); border: 2px solid var(--surface); }
.legend .pm { width: 12px; height: 12px; }
.legend .pm.l4 { box-shadow: none; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.three-col > div:empty { display: none; }
.feed { list-style: none; margin: -6px -8px; padding: 0; display: flex; flex-direction: column; }
.feed a, .feed-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.feed a:hover { background: var(--surface-2); color: var(--ink); }
.feed small { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-title { font-weight: 550; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex-shrink: 0; }

/* API & code ------------------------------------------------------------------------------------- */
.kv { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; flex-wrap: wrap; }
.kv-row + .kv-row { border-top: 1px solid var(--line); }
.kv-label { display: inline-flex; align-items: center; gap: 8px; width: 110px; font-weight: 550; font-size: 13px; color: var(--ink-2); }
.kv-label .icon { color: var(--ink-3); }
.kv-value { flex: 1; min-width: 180px; background: none; padding: 0; font-size: 13px; overflow-wrap: anywhere; }
.code-wrap { position: relative; }
/* syntax colors — code blocks are dark in both themes */
pre .t-s { color: #cbf34f; }
pre .t-k { color: #f1f0eb; }
pre .t-kw { color: #ffb86b; }
pre .t-n { color: #ff9e7a; }
pre .t-tag { color: #9ecbff; }
pre .t-c { color: #6f6c65; font-style: italic; }
pre.numbered code { counter-reset: ln; }
pre.numbered .ln::before {
  counter-increment: ln; content: counter(ln); display: inline-block; width: 2.2ch; margin-right: 18px;
  text-align: right; color: #4f4d48; user-select: none;
}

/* underline tabs (code snippets) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: -4px; }
.tabs button {
  font: inherit; font-size: 13px; font-weight: 550; border: 0; background: none; color: var(--ink-2); cursor: pointer;
  height: 38px; padding: 0 10px; white-space: nowrap; position: relative;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); }
.tabs button.active::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary);
}
pre {
  margin: 0; background: var(--code-bg); color: var(--code-ink); border-radius: 12px; padding: 18px;
  overflow-x: auto; font: 12.5px/1.65 var(--font-mono);
}
pre code { background: none; padding: 0; color: inherit; font: inherit; }
.code-copy { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, 0.08); color: #e6e9f5; border-color: rgba(255, 255, 255, 0.14); box-shadow: none; }
.code-copy:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.params { width: 100%; border-collapse: collapse; font-size: 13px; }
.params td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.params td:first-child { white-space: nowrap; width: 140px; }
.disclosure .muted.small { margin-top: 8px; }

/* Settings form ---------------------------------------------------------------------------------- */
.settings-form { display: flex; flex-direction: column; }
.set-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.set-section:first-child { padding-top: 4px; }
.set-intro h3 { font-size: 15px; margin-bottom: 6px; }
.set-intro p { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.set-fields { gap: 16px; }
.host-grid { grid-template-columns: 1fr 120px; }
.verify-result { font-size: 13px; }
.verify-result.ok { color: var(--ok); }
.verify-result.bad { color: var(--stamp); }
.form-actions {
  display: flex; align-items: center; gap: 10px; padding: 20px 0 12px; position: sticky; bottom: 0;
  background: linear-gradient(to top, var(--sheet) 75%, transparent);
}
.settings-form > .error { margin-top: 14px; }

/* Templates -------------------------------------------------------------------------------------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.tpl-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); overflow: hidden; text-align: left; font: inherit; color: inherit; padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tpl-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-pop); }
.tpl-card.starter { cursor: pointer; }
.tpl-card.starter:disabled { opacity: 0.6; cursor: progress; }
.tpl-link { display: block; }
.thumb { height: 216px; overflow: hidden; background: var(--surface-3); position: relative; border-bottom: 1px solid var(--line); }
.thumb iframe {
  width: 640px; height: 900px; border: 0; transform: scale(0.4); transform-origin: top left;
  position: absolute; left: 50%; margin-left: -128px; top: 12px; pointer-events: none; background: #fff;
  border-radius: 14px; box-shadow: 0 8px 30px rgba(21, 26, 45, 0.14);
}
.code-thumb { display: grid; place-items: center; background: var(--code-bg); }
.code-thumb pre { background: none; font-size: 12px; color: #9fb0d8; padding: 0; }
.tpl-meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tpl-name-row { display: flex; align-items: center; gap: 8px; }
.tpl-name { font-weight: 600; color: var(--ink); text-decoration: none; }
a.tpl-name:hover { color: var(--primary-ink); }
.tpl-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-actions { display: flex; align-items: center; gap: 2px; margin-top: 8px; }

/* editors (template + email) */
.editor-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-btn { margin-left: -6px; }
.editor-title { font-size: 22px; }
.title-input {
  font-family: var(--font-display); font-size: 22px; font-weight: 650; letter-spacing: -0.02em;
  border-color: transparent; background: transparent; box-shadow: none; width: auto; height: 40px;
  min-width: 180px; max-width: 440px; flex: 1 1 240px; padding: 0 8px;
}
.title-input:hover { border-color: var(--line); }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.save-state .icon { color: var(--ok); }
.save-state.dirty { color: var(--warn); }
.dot-warn { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }

.editor { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); gap: 20px; align-items: start; }
.editor-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.editor-preview {
  position: sticky; top: 76px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
  display: flex; flex-direction: column; height: calc(100vh - 100px); min-height: 520px; background: var(--surface);
}
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.inbox { flex: 1; min-width: 0; }
.inbox-from { font-weight: 600; font-size: 13.5px; }
.inbox-line { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.inbox-line strong { color: var(--ink); font-weight: 550; }
.frame-wrap {
  flex: 1; display: flex; justify-content: center; overflow: hidden;
  background-color: var(--surface-2);
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 16px 16px;
}
.preview-frame { width: 100%; height: 100%; border: 0; background: #fff; transition: width 0.25s ease; }
.frame-wrap.mobile { padding: 20px 0; }
.frame-wrap.mobile .preview-frame { width: 375px; border-radius: 28px; box-shadow: 0 0 0 9px #1b1f2c, 0 24px 48px -12px rgba(0, 0, 0, 0.4); }
.code-editor { min-height: 440px; font-size: 12.5px; line-height: 1.6; white-space: pre; tab-size: 2; }

details.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
details.panel > summary {
  cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 13.5px; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.75px solid var(--ink-3); border-bottom: 1.75px solid var(--ink-3);
  transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > *:not(summary) { margin: 0 14px; }
details.panel[open] { padding-bottom: 14px; }
details.panel > *:not(summary) + *:not(summary) { margin-top: 10px; }
.theme-grid { gap: 12px; }
.color-field { display: flex; gap: 6px; align-items: center; }
.color-field input[type=color] { width: 38px; height: 38px; flex-shrink: 0; }
.color-field input.mono { min-width: 0; }
.range-val { font-weight: 400; color: var(--ink-3); }

.blocks-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.blocks { display: flex; flex-direction: column; gap: 6px; }
.block-card { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.block-card:hover { border-color: var(--line-strong); }
.block-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.block-head { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 10px; cursor: pointer; }
.block-type {
  font-size: 11.5px; font-weight: 650; color: var(--primary-ink); background: var(--primary-soft);
  padding: 0 7px; height: 20px; line-height: 20px; border-radius: 5px; flex-shrink: 0;
}
.block-sum { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-tools { display: flex; gap: 1px; opacity: 0; transition: opacity 0.12s; }
.block-head:hover .block-tools, .block-card.selected .block-tools, .block-tools:focus-within { opacity: 1; }
@media (hover: none) { .block-tools { opacity: 1; } }
.block-body { padding: 14px 12px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.block-body .grid { gap: 12px; }
.add-blocks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px; border: 1.5px dashed var(--line-strong); border-radius: 12px; }
.add-blocks > span { width: 100%; font-weight: 550; color: var(--ink-2); }
.add-chip {
  font: inherit; font-size: 12.5px; font-weight: 550; height: 28px; padding: 0 10px 0 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.add-chip .icon { color: var(--primary-ink); }
.add-chip:hover { border-color: color-mix(in srgb, var(--accent-strong) 55%, var(--line)); background: var(--primary-soft); }
.empty-blocks { padding: 14px; text-align: center; }

details.popover { position: relative; }
details.popover > summary { list-style: none; }
details.popover > summary::-webkit-details-marker { display: none; }
.popover-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 300px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; animation: pop-in 0.12s ease-out;
}

/* Account ---------------------------------------------------------------------------------------- */
.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-row .small { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.conn-list { list-style: none; margin: 0; padding: 0; }
.conn-list li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.conn-list li + li { border-top: 1px solid var(--line); }
.conn-list small { display: block; margin-top: 1px; }
.conn-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); flex-shrink: 0; }
.conn-empty { padding: 18px; }
.plan-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.danger-zone { border-color: color-mix(in srgb, var(--stamp) 30%, var(--line)); }
.sub-line { display: block; }

/* Contacts --------------------------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar select { width: auto; flex: 0 1 180px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
#panel:empty { display: none; }
#contact-table .skeleton.line { margin: 14px 16px; }
#contact-table .empty-state { padding: 36px 16px; }

/* Emails ----------------------------------------------------------------------------------------- */
.list-card .list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line);
}
.list-card .list-row:last-child { border-bottom: 0; }
.list-card .list-row:hover { background: var(--surface-2); color: inherit; }
.list-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--ink-2); }
.list-icon.s-scheduled, .list-icon.s-sending { background: var(--primary-soft); color: var(--primary-ink); }
.list-icon.s-completed { background: var(--ok-soft); color: var(--ok); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.campaign-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 20px; align-items: start; }
#campaign-form fieldset.card { margin: 0; min-width: 0; }
#campaign-form legend { float: left; width: 100%; padding: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
#campaign-form legend .step-mark { background: var(--primary-soft); color: var(--primary-ink); }
#campaign-form legend + * { clear: both; }
fieldset:disabled { opacity: 0.72; }
.campaign-preview { position: sticky; top: 76px; }
.preview-card { padding: 0; gap: 0; overflow: hidden; }
.small-frame { flex: none; height: calc(100vh - 200px); min-height: 460px; }
.choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice {
  position: relative; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: 12px; cursor: pointer; font-weight: 400; transition: border-color 0.15s, background-color 0.15s;
}
.choice:hover { border-color: var(--ink-3); }
.choice input { position: absolute; top: 13px; right: 12px; }
.choice span { display: flex; flex-direction: column; gap: 3px; }
.choice span .icon { color: var(--ink-3); margin-bottom: 4px; }
.choice strong { font-weight: 600; font-size: 13.5px; }
.choice small { font-size: 12.5px; color: var(--ink-2); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.choice:has(input:checked) .icon { color: var(--primary-ink); }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.audience-count { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.audience-count:empty { display: none; }
.audience-count .icon { color: var(--primary-ink); }
.action-bar {
  display: flex; align-items: center; gap: 10px; position: sticky; bottom: 0; z-index: 5; padding: 14px 0;
  background: linear-gradient(to top, var(--sheet) 72%, transparent);
}
.status-banner { align-items: center; flex-wrap: wrap; }
.status-banner p { flex: 1; min-width: 220px; }
.status-banner .grow p { min-width: 0; }
.progress { height: 8px; background: var(--sheet); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent-strong); transition: width 0.3s; }
/* airmail stripe: the sending bar looks like the edge of an airmail envelope */
.progress.airmail span {
  background: repeating-linear-gradient(-45deg, var(--stamp) 0 7px, transparent 7px 11px, var(--ink) 11px 18px, transparent 18px 22px);
  background-size: 31px 100%; animation: airmail 0.9s linear infinite;
}
@keyframes airmail { to { background-position: 31px 0; } }

/* Page + side panel layout ------------------------------------------------------------------------ */
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.main-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rail-card { padding: 16px; gap: 12px; }
.rail.sticky { position: sticky; top: 76px; }
@media (max-height: 860px) { .rail.sticky { position: static; } }
.rail-card .card-head h2 { font-size: 14.5px; }
.rail-card .card-head p { font-size: 12.5px; }
.chip-icon.ok { background: var(--ok-soft); color: var(--ok); }
.chip-icon.bad { background: var(--stamp-soft); color: var(--stamp); }
.bad-text { color: var(--stamp); }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.tips li::marker { color: var(--ink-3); }

/* health */
.health-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; flex-shrink: 0; }
.health-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.health-dot.bad { background: var(--stamp); box-shadow: 0 0 0 4px var(--stamp-soft); }
.health-line { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 9px 10px; border-radius: 9px; }
.health-line .icon { margin-top: 2px; }
.health-line.ok { background: var(--ok-soft); color: var(--ok); }
.health-line.bad { background: var(--stamp-soft); color: var(--stamp); overflow-wrap: anywhere; }
.score { font-family: var(--font-display); font-weight: 700; font-size: 15px; padding: 3px 9px; border-radius: 8px; }
.score.ok { background: var(--ok-soft); color: var(--ok); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.score.bad { background: var(--stamp-soft); color: var(--stamp); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.checks li small { display: block; margin-top: 2px; font-size: 12px; }
.check-icon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.checks li.ok .check-icon { background: var(--accent); color: var(--on-accent); }
.checks li.bad .check-icon { background: var(--stamp-soft); color: var(--stamp); }
.record { display: block; margin-top: 5px; padding: 6px 8px; font-size: 11.5px; overflow-wrap: anywhere; line-height: 1.45; }
.small-callout { font-size: 12.5px; padding: 9px 10px; }
.small-callout .icon { color: var(--warn); margin-top: 1px; }
.small-label { font-size: 12.5px; }
.small-label input { height: 34px; font-size: 13px; }

/* usage & stats */
.usage { display: flex; align-items: baseline; gap: 6px; }
.usage-num { font-family: var(--font-display); font-size: 30px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.meter.wide { width: 100%; }
.meter.hot span { background: var(--stamp); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats.two { grid-template-columns: 1fr 1fr; }
.mini-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.mini-stats strong { font-family: var(--font-display); font-size: 19px; font-weight: 650; }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.split-bar .ok { background: var(--ok); }
.split-bar .bad { background: var(--stamp); }
.split-bar .skip { background: var(--line-strong); }
.run-result { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.run-result .split-bar { flex: 1; min-width: 60px; }
.card-head.padded { padding: 16px 18px 12px; }
.plain-link { color: var(--ink); text-decoration: none; }
.plain-link:hover { color: var(--primary-ink); }

/* failure reasons */
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reasons li { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.reasons li:last-child { border-bottom: 0; padding-bottom: 0; }
.reason-top { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.reason-count { font-weight: 700; color: var(--stamp); flex-shrink: 0; }
.reason-msg { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reasons p { margin-top: 3px; line-height: 1.45; }

/* horizontal bars (tags, sources) */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bars a, .bar-btn {
  display: grid; grid-template-columns: 96px 1fr 30px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font: inherit; font-size: 13px; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.bars a:hover, .bar-btn:hover { background: var(--surface-2); color: var(--ink); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent-strong); }
.bar-num { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.growth { display: flex; flex-direction: column; gap: 6px; }
.growth-head { display: flex; justify-content: space-between; align-items: baseline; }
.growth-head strong { color: var(--ok); }
.spark.wide { width: 100%; height: 36px; gap: 3px; }

/* schedule calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11.5px; color: var(--ink-3); padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1; border-radius: 8px; border: 0; background: none; font: inherit; font-size: 12.5px;
  color: var(--ink); display: grid; place-items: center; cursor: default; font-variant-numeric: tabular-nums;
}
.cal-day.past { color: var(--ink-3); opacity: 0.6; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--ink-2); font-weight: 650; }
.cal-day.has { background: var(--primary-soft); color: var(--primary-ink); font-weight: 650; cursor: pointer; }
.cal-day.has:hover { background: color-mix(in srgb, var(--accent-strong) 35%, transparent); }
.cal-day.sel { background: var(--primary); color: var(--on-primary); }
.cal-day i {
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); min-width: 5px; height: 5px; border-radius: 999px;
  background: var(--accent-strong); font-style: normal; font-size: 9px; line-height: 5px; color: transparent;
}
.cal-day.sel i { background: var(--on-primary); }
.cal-list-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; min-height: 30px; }
.feed.compact { margin: -4px -8px; }
.feed.compact a { padding: 7px 8px; }
.feed.compact .feed-icon { width: 28px; height: 28px; border-radius: 8px; }

/* contacts rail */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.sec-list { display: flex; flex-direction: column; gap: 10px; }
.sec-list > div { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sec-list > div > .muted:first-child { width: 100%; }

/* response codes */
.codes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.codes li { display: flex; align-items: center; gap: 8px; }
.code { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; flex-shrink: 0; }
.code.ok { background: var(--ok-soft); color: var(--ok); }
.code.warn { background: var(--warn-soft); color: var(--warn); }
.code.bad { background: var(--stamp-soft); color: var(--stamp); }

/* API playground */
.pg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pg-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pg-bar { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; }
.pg-bar select { width: auto; height: 32px; font-size: 12.5px; }
.method { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 2px 7px; border-radius: 5px; }
.pg-input { min-height: 260px; flex: 1; line-height: 1.55; white-space: pre; tab-size: 2; }
.pg-output { flex: 1; min-height: 260px; margin: 0; }
.pg-status { display: inline-flex; align-items: center; gap: 8px; }

/* logs */
.toolbar.plain { padding: 0; border: 0; }
.toolbar .segmented { flex-shrink: 0; }
.log-row { cursor: pointer; }
.log-row.open td { background: var(--surface-2); }
.log-detail td { background: var(--surface-2); padding-top: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; padding: 4px 0 6px; font-size: 13px; }
.detail-grid > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.detail-grid code { overflow-wrap: anywhere; }
.detail-grid .span-all { grid-column: 1 / -1; }
.detail-grid .row { flex-direction: row; }

.starter-list { list-style: none; margin: -4px -8px; padding: 0; display: flex; flex-direction: column; }
.starter-row {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px; border-radius: 10px; border: 0; background: none;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.starter-row:hover { background: var(--surface-2); }
.starter-row strong { display: block; font-size: 13.5px; font-weight: 600; }
.starter-row small { display: block; font-size: 12px; }
.starter-swatch { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35); }
.var-list { display: flex; flex-direction: column; gap: 2px; margin: -4px -8px; }
.var-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 8px;
  border: 0; background: none; font: inherit; cursor: pointer; text-align: left; color: var(--ink);
}
.var-row:hover { background: var(--surface-2); }
.var-row code { flex-shrink: 0; }
.var-row .muted { text-align: right; }
.mini-code { font-size: 12px; padding: 12px 14px; }

/* templates grid "new" tile */
.tpl-new {
  align-items: center; justify-content: center; gap: 8px; min-height: 290px; text-decoration: none; color: var(--ink);
  border: 1.5px dashed var(--line-strong); background: var(--surface-2); text-align: center;
}
.tpl-new:hover { border-color: var(--accent-strong); background: var(--primary-soft); color: var(--ink); box-shadow: none; }
.tpl-new .chip-icon { width: 42px; height: 42px; border-radius: 12px; }

@media (min-width: 1700px) {
  .with-rail { grid-template-columns: minmax(0, 1fr) 380px; }
}

/* Toast ------------------------------------------------------------------------------------------ */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 10px; font-weight: 550; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 50;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow-pop);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--stamp); color: #fff; }

/* Illustrations (SVG) ---------------------------------------------------------------------------- */
.ill { display: block; }
.ill .ill-dot { fill: var(--line-strong); }
.ill-card { fill: var(--sheet); stroke: var(--line-strong); stroke-width: 1.2; }
.ill-card.back { fill: var(--surface-3); stroke: var(--line); }
.ill-env { fill: var(--sheet); stroke: var(--line-strong); stroke-width: 1.4; }
.ill-shadow { fill: color-mix(in srgb, var(--accent) 35%, transparent); }
.ill-env-flap, .ill-env-line { fill: none; stroke: var(--line-strong); stroke-width: 1.4; stroke-linejoin: round; }
.ill-air-red { fill: var(--stamp); }
.ill-air-blue { fill: var(--ink); }
.ill-stamp-paper { fill: var(--sheet); stroke: var(--line-strong); stroke-width: 1; }
.ill-hole { fill: var(--canvas); }
.ill-stamp-art { fill: var(--primary-soft); }
.ill-stamp-mark { fill: var(--accent-strong); opacity: 0.85; }
.ill-stamp-sun { fill: var(--stamp); }
.ill-postmark { fill: none; stroke: var(--ink-3); stroke-width: 1.6; opacity: 0.75; }
.ill-wave { fill: none; stroke: var(--ink-3); stroke-width: 1.6; opacity: 0.6; stroke-linecap: round; }
.ill-text { fill: var(--line-strong); }
.ill-text.soft { fill: var(--surface-3); }
.ill-accent { fill: var(--accent-strong); }
.ill-accent-soft { fill: var(--primary-soft); }
.ill-button { fill: var(--ink); }
.ill-tagshape { fill: var(--primary-soft); }
.ill-tagshape.alt { fill: var(--stamp-soft); }
.ill-cal-top { fill: var(--accent-strong); }
.ill-icon { fill: none; stroke: var(--accent-strong); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ill-trail { fill: none; stroke: var(--accent-strong); stroke-width: 1.8; stroke-dasharray: 2 7; stroke-linecap: round; opacity: 0.6; }
.ill-plane { fill: var(--sheet); stroke: var(--accent-strong); stroke-width: 1.8; stroke-linejoin: round; }
.ill-plane-fold { fill: none; stroke: var(--accent-strong); stroke-width: 1.4; stroke-linejoin: round; }
.ill-float { animation: float 6s ease-in-out infinite; }
.ill-float.delay { animation-delay: -3s; }
@keyframes float { 50% { translate: 0 -8px; } }

/* Responsive ------------------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .with-rail { grid-template-columns: minmax(0, 1fr) 300px; }
  .pg { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .with-rail { grid-template-columns: minmax(0, 1fr); }
  .rail.sticky { position: static; }
  .rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor, .campaign-layout { grid-template-columns: 1fr; }
  .editor-preview, .campaign-preview { position: static; height: 640px; }
  .small-frame { height: 560px; }
  .set-section { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; height: 100vh; margin: 0; border-radius: 0; z-index: 40; background: var(--sheet);
    transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-pop);
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 19, 0.4); }
  .sheet-wrap { padding: 0; }
  .sheet { border-radius: 0; min-height: 100vh; border: 0; }
  .sheet-head { top: 0; border-radius: 0; padding: 0 16px; }
  .menu-btn { display: inline-grid; }
  .main { padding: 20px 16px 40px; }
  .two-col { grid-template-columns: 1fr; }
  .activity-body { flex-direction: column; gap: 8px; }
  .pm-stats { flex-direction: row; flex-wrap: wrap; border-left: 0; padding-left: 0; margin-top: 0; gap: 0 24px; width: 100%; }
  .pm-stat + .pm-stat { border-top: 0; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 23px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 26px; }
  .spark { display: none; }
  .steps { grid-template-columns: 1fr; gap: 14px; }
  .steps li:not(:last-child)::after { display: none; }
  .steps a { flex-direction: row; align-items: center; }
  .grid, .host-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .choice-row { grid-template-columns: 1fr; }
  .list-card .list-row { flex-wrap: wrap; }
  .list-side { align-items: flex-start; text-align: left; width: 100%; padding-left: 50px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .kv-label { width: auto; }
  .title-input { min-width: 0; font-size: 19px; }
  .skeleton-grid { grid-template-columns: 1fr 1fr; }
  .inline-form { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .toolbar .segmented { width: 100%; overflow-x: auto; }
}

/* Owner portal (#/admin) ------------------------------------------------------------------------- */
.btn.icon-only { width: 36px; padding: 0; }
.adm-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-2); margin-top: -8px; }
.adm-status b { color: var(--ink); font-variant-numeric: tabular-nums; }
.adm-status .sep { color: var(--ink-3); margin: 0 2px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); margin-right: 2px; }
.live-dot.on { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: live 2s ease-out infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.test-pill { background: var(--warn-soft); color: var(--warn); margin-left: 6px; }

.adm-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.adm-kpi { gap: 8px; padding: 16px 16px 14px; }
.adm-kpi-label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.adm-kpi-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.adm-kpi-value { font-size: 28px; font-weight: 650; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.adm-kpi-sub { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; border-radius: 999px; padding: 1px 7px 1px 5px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--stamp); background: var(--stamp-soft); }
.delta.flat { color: var(--ink-2); background: var(--surface-3); padding: 1px 7px; }

.adm-panel { gap: 14px; padding: 18px; }
.adm-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.adm-panel-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.adm-panel-head p { font-size: 12.5px; margin-top: 2px; }
.adm-empty { color: var(--ink-3); font-size: 13px; padding: 18px 0; text-align: center; }
.adm-more, .adm-foot { font-size: 12px; margin-top: -4px; }
.adm-h { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 650; letter-spacing: -0.02em; margin: 10px 0 -6px; }
.adm-h .icon { color: var(--ink-3); }
.adm-grid { display: grid; gap: 14px; align-items: start; }
.adm-grid.g-2-1 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.adm-grid.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-grid.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.adm-note { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12.5px; margin-top: 6px; }
.adm-note .icon { color: var(--ink-3); }

/* main chart */
.adm-main-chart { gap: 10px; padding: 16px 18px 12px; }
.adm-chart-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.sum-value { font-size: 26px; font-weight: 650; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.chart { position: relative; width: 100%; min-height: 230px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .ylab { fill: var(--ink-3); font-size: 11px; text-anchor: end; font-variant-numeric: tabular-nums; }
.chart .xlab { fill: var(--ink-3); font-size: 11px; text-anchor: middle; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .bar { fill: var(--series); }
.chart .guide { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 3; display: flex; flex-direction: column; gap: 3px;
  background: var(--sheet); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 8px 10px; font-size: 12px; white-space: nowrap;
}
.tip-date { color: var(--ink-3); font-size: 11.5px; }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip-row i { width: 8px; height: 8px; border-radius: 2px; background: var(--series); }
.tip-row b { color: var(--ink); margin-left: 10px; font-variant-numeric: tabular-nums; }
.chart-table { max-height: 320px; overflow-y: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ranked bar lists */
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.bar-list li { position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; font-size: 13px; isolation: isolate; }
.bl-bar { position: absolute; inset: 0 auto 0 0; z-index: -1; border-radius: 7px; background: color-mix(in srgb, var(--accent-strong) 26%, transparent); }
.bl-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.bl-label > a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.bl-label > a:hover { text-decoration: underline; }
.bl-label .icon { color: var(--ink-3); flex: none; }
.bl-extra { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.bl-val { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.bl-pct { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; width: 38px; text-align: right; }
.flag { font-size: 15px; line-height: 1; }

/* insights */
.insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ins { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.ins:first-child { border-top: 0; padding-top: 2px; }
.ins-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.ins.act .ins-ico { background: var(--primary-soft); color: var(--primary-ink); }
.ins.warn .ins-ico { background: var(--warn-soft); color: var(--warn); }
.ins.good .ins-ico { background: var(--ok-soft); color: var(--ok); }
.ins-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-weight: 600; font-size: 13.5px; }
.ins-tag { font-size: 10.5px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.ins.act .ins-tag { color: var(--primary-ink); }
.ins.warn .ins-tag { color: var(--warn); }
.ins.good .ins-tag { color: var(--ok); }
.ins p { color: var(--ink-2); font-size: 13px; margin-top: 3px; line-height: 1.5; }

/* funnel */
.funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.fn-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.fn-top b { font-variant-numeric: tabular-nums; }
.fn-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.fn-track span { display: block; height: 100%; border-radius: 999px; background: var(--series); }
.funnel small { display: block; font-size: 11.5px; margin-top: 4px; }

/* revenue stats */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; margin: 0; }
.stat-grid dt { font-size: 12px; color: var(--ink-3); }
.stat-grid dd { margin: 2px 0 0; font-size: 17px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-grid small { font-size: 11.5px; }
.founding-meter { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.flush-table .table-wrap { margin: 0 -18px -18px; }
.flush-table table.table th:first-child, .flush-table table.table td:first-child { padding-left: 18px; }
.acct { display: flex; flex-direction: column; min-width: 0; max-width: 240px; }
.acct small { font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; display: block; }

@media (max-width: 1400px) { .adm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .adm-grid.g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-grid.g-2-1 { grid-template-columns: minmax(0, 1fr); }
  .adm-grid.g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .adm-kpi-value { font-size: 23px; }
  .adm-grid.g-3 { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-actions .segmented { flex: 1; overflow-x: auto; }
}

/* Billing (account page) -------------------------------------------------------------------------- */
.bill-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plan-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
.plan-card.featured { border-color: color-mix(in srgb, var(--accent-strong) 70%, transparent); box-shadow: 0 0 0 3px var(--ring); }
.plan-card h4 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price b { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--ink-2); font-size: 13px; }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.plan-card li { display: flex; gap: 7px; align-items: flex-start; }
.plan-card li .icon { color: var(--ok); margin-top: 2px; flex: none; }
.plan-card .btn { margin-top: auto; }
.save-tag { font-size: 11px; font-weight: 650; color: var(--primary-ink); background: var(--primary-soft); border-radius: 999px; padding: 2px 7px; }
.sub-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
@media (max-width: 640px) { .plan-cards { grid-template-columns: 1fr; } }
