/* Cold Mail — "ink & saffron" theme */
:root {
  --paper: #f4efe6;
  --surface: #fffcf7;
  --surface-2: #f9f4ec;
  --ink: #1f1b16;
  --ink-2: #4a433b;
  --mute: #8a8073;
  --line: #e6ddcf;
  --line-2: #d9cdbb;
  --saffron: #d9822b;
  --saffron-ink: #8f4f12;
  --saffron-soft: #fbe9d4;
  --teal: #1f6f6b;
  --teal-soft: #dcefec;
  --brick: #b4432f;
  --brick-soft: #f7e0da;
  --indigo: #3e4c8f;
  --indigo-soft: #e2e5f4;
  --olive: #7a7a2e;
  --olive-soft: #eeeed7;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 24px -12px rgba(60, 40, 10, .18);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120f; --surface: #1c1915; --surface-2: #221e19; --ink: #f1eadf; --ink-2: #cfc5b6; --mute: #958a7b;
    --line: #2f2a23; --line-2: #3d362c; --saffron: #f0a04b; --saffron-ink: #f6bf7f; --saffron-soft: #3a2a17;
    --teal: #5cbcb2; --teal-soft: #173230; --brick: #e8806a; --brick-soft: #3a1f19; --indigo: #9aa6e6; --indigo-soft: #232843;
    --olive: #c6c46a; --olive-soft: #2c2c17; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14120f; --surface: #1c1915; --surface-2: #221e19; --ink: #f1eadf; --ink-2: #cfc5b6; --mute: #958a7b;
  --line: #2f2a23; --line-2: #3d362c; --saffron: #f0a04b; --saffron-ink: #f6bf7f; --saffron-soft: #3a2a17;
  --teal: #5cbcb2; --teal-soft: #173230; --brick: #e8806a; --brick-soft: #3a1f19; --indigo: #9aa6e6; --indigo-soft: #232843;
  --olive: #c6c46a; --olive-soft: #2c2c17; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line-2) 55%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--saffron-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; font-variation-settings: "opsz" 72; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.mute { color: var(--mute); }
.mono { font-family: var(--mono); font-size: 12.5px; }
pre { white-space: pre-wrap; font: inherit; margin: 0; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font-family: var(--serif); font-weight: 700; font-size: 18px;
  box-shadow: inset 0 -3px 0 var(--saffron);
}
.brand b { font-family: var(--serif); font-size: 18px; display: block; line-height: 1.1; }
.brand span { font-size: 11px; color: var(--mute); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2);
  font-weight: 500; position: relative;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--saffron-soft); color: var(--saffron-ink); }
.nav a.on::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--saffron); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--teal); color: var(--surface); border-radius: 99px; padding: 0 7px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.engine-mini { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.engine-mini .row { justify-content: space-between; }
.quota { font-size: 12px; color: var(--mute); }
.theme-btn { align-self: flex-start; }

.main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--mute); }
.page-head .grow { flex: 1; }

/* collapsible sidebar */
.side-toggle { padding: 6px; margin-left: auto; }
.side-toggle svg, .side-open svg { width: 18px; height: 18px; }
.side-open {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 30; width: 38px; height: 38px; place-items: center; cursor: pointer;
  border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.side-open:hover { border-color: var(--saffron); color: var(--saffron-ink); }
:root[data-side="closed"] .shell { grid-template-columns: 1fr; }
:root[data-side="closed"] .side { display: none; }
:root[data-side="closed"] .side-open { display: grid; }
:root[data-side="closed"] .main { padding-left: clamp(64px, 4vw, 72px); }

/* ---------- primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head .grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.btn {
  font: 600 13px var(--sans); display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--mute); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--saffron)); }
.btn.accent { background: var(--saffron); color: #1f1405; border-color: var(--saffron); }
.btn.accent:hover { background: color-mix(in srgb, var(--saffron) 85%, var(--ink)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--brick); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn svg { width: 15px; height: 15px; }

input, select, textarea {
  font: 14px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 12px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--saffron); box-shadow: 0 0 0 3px color-mix(in srgb, var(--saffron) 22%, transparent); }
textarea { width: 100%; resize: vertical; line-height: 1.55; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.field small { font-weight: 400; color: var(--mute); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* status chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.plain::before { display: none; }
.s-new, .s-enriched { color: var(--ink-2); }
.s-needs_review, .s-no_data { background: var(--saffron-soft); color: var(--saffron-ink); border-color: transparent; }
.s-drafted { background: var(--olive-soft); color: var(--olive); border-color: transparent; }
.s-approved, .s-sent { background: var(--indigo-soft); color: var(--indigo); border-color: transparent; }
.s-replied, .s-done { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.s-bounced, .s-unsubscribed { background: var(--brick-soft); color: var(--brick); border-color: transparent; }
.s-skip { opacity: .6; }

/* toggle */
.switch { position: relative; width: 44px; height: 24px; flex: none; cursor: pointer; border: 0; padding: 0; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch.on { background: var(--teal); }
.switch.on::after { transform: translateX(20px); }

.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); position: relative; flex: none; }
.pulse.live { background: var(--teal); }
.pulse.live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--teal); animation: ping 1.8s ease-out infinite; }
.pulse.stop { background: var(--brick); }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }

.bar { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--saffron); border-radius: 99px; transition: width .6s ease; }

/* ---------- dashboard ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 16px; }
.funnel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-top: 6px; }
.stage { position: relative; padding: 14px 12px 12px; border-top: 3px solid var(--line); cursor: pointer; transition: background .15s; border-radius: 0 0 10px 10px; }
.stage:hover { background: var(--surface-2); }
.stage .n { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stage .l { font-size: 12px; color: var(--mute); margin-top: 6px; }
.stage .fill { position: absolute; top: -3px; left: 0; height: 3px; background: var(--saffron); transition: width .8s ease; }
.stage .conv { display: inline-block; margin-top: 8px; font-size: 10.5px; color: var(--mute); font-family: var(--mono); background: var(--surface-2); border-radius: 99px; padding: 1px 7px; }
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { width: 118px; height: 118px; flex: none; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke: var(--teal); transition: stroke-dashoffset 1s ease; }
.ring text { font-family: var(--serif); font-size: 22px; font-weight: 600; fill: var(--ink); }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.tile .n { font-family: var(--serif); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--mute); font-size: 12.5px; }
.tile .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }

.chart { width: 100%; height: 170px; display: block; }
.chart .gridline { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .b-sent { fill: var(--indigo); }
.chart .b-fu { fill: color-mix(in srgb, var(--indigo) 45%, var(--surface)); }
.chart .b-rep { fill: var(--teal); }
.chart text { fill: var(--mute); font-size: 10px; font-family: var(--sans); }
.chart rect { transition: opacity .15s; }
.chart g.day:hover rect { opacity: .75; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; font-size: 13px; background: var(--surface); }
.chips a:hover { text-decoration: none; border-color: var(--saffron); }
.chips a.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chips a small { font-weight: 500; opacity: .7; margin-left: 4px; }

/* ---------- table ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search input { width: 100%; padding-left: 36px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--mute); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 11px var(--mono); color: var(--mute); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); padding: 11px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.sel { background: var(--saffron-soft); }
.who { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: #fff; flex: none; font-size: 14px; }
.who b { display: block; font-weight: 600; }
.who div span { color: var(--mute); font-size: 12px; display: block; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.steps { display: inline-flex; gap: 3px; }
.steps i { width: 14px; height: 6px; border-radius: 3px; background: var(--line-2); }
.steps i.on { background: var(--indigo); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; color: var(--mute); }
.empty { text-align: center; padding: 48px 20px; color: var(--mute); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 15, 8, .32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(620px, 100vw); background: var(--paper); z-index: 50;
  transform: translateX(102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); overflow-y: auto;
  border-left: 1px solid var(--line); box-shadow: -20px 0 50px -20px rgba(0,0,0,.35);
}
.drawer.open { transform: none; }
.drawer-inner { padding: 22px; }
.drawer-close { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); z-index: 2; }

/* lead panel */
.lead-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.lead-head .avatar { width: 52px; height: 52px; font-size: 22px; border-radius: 14px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.kv div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kv b { display: block; font-family: var(--serif); font-size: 18px; font-variant-numeric: tabular-nums; }
.kv span { font-size: 11.5px; color: var(--mute); }
.vids { display: flex; flex-direction: column; gap: 6px; }
.vid { display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.vid .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vid .vb { height: 6px; border-radius: 3px; background: var(--saffron); opacity: .85; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--mute); }
.timeline li.t-sent::before, .timeline li.t-followup::before { border-color: var(--indigo); }
.timeline li.t-reply::before { border-color: var(--teal); background: var(--teal); }
.timeline li.t-bounce::before, .timeline li.t-unsubscribe::before, .timeline li.t-error::before { border-color: var(--brick); }
.timeline li.t-auto_reply::before { border-color: var(--olive); }
.timeline .when { font-size: 12px; color: var(--mute); }
.quote { border-left: 3px solid var(--teal); background: var(--teal-soft); padding: 12px 14px; border-radius: 0 10px 10px 0; }
.section-title { font-family: var(--serif); font-size: 15px; font-weight: 600; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- inbox ---------- */
.convo { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: start; padding: 16px; border-bottom: 1px solid var(--line); }
.convo:last-child { border-bottom: 0; }
.convo .avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; }
.convo .msg { color: var(--ink-2); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- templates ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.preview { position: sticky; top: 20px; }
.mail-preview { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mail-preview .mh { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.mail-preview .mb { padding: 16px; white-space: pre-wrap; min-height: 140px; }
.seq { display: flex; flex-direction: column; gap: 12px; }
.seq-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.seq-item .row { margin-bottom: 8px; }
.seq-n { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 600 12px var(--mono); }
.tags-help code { cursor: pointer; }

/* Long tables scroll inside their own box, so the sideways scrollbar is always on screen. */
.table-wrap.tall { max-height: calc(100vh - 120px); overflow: auto; overscroll-behavior: contain; }
.table-wrap.tall thead th { z-index: 3; }
.table-wrap.tall th:first-child, .table-wrap.tall td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.table-wrap.tall thead th:first-child { z-index: 4; background: var(--surface-2); }
.table-wrap.tall tbody tr:hover td:first-child { background: var(--surface-2); }
.table-wrap.tall tbody tr.sel td:first-child { background: var(--saffron-soft); }
.table-wrap.tall::-webkit-scrollbar { width: 12px; height: 12px; }
.table-wrap.tall::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid var(--surface); }
.table-wrap.tall::-webkit-scrollbar-thumb:hover { background: var(--mute); }
.table-wrap.tall::-webkit-scrollbar-track { background: var(--surface); }
.table-wrap.tall::-webkit-scrollbar-corner { background: var(--surface); }

/* ---------- sequences ---------- */
.selbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); }
.selbar.active { border-color: var(--saffron); background: var(--saffron-soft); }
.selbar.active [data-sel-hint] { color: var(--saffron-ink); }
.check-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--saffron); cursor: pointer; margin: 0; flex: none; padding: 0; }
.seq-table tbody tr.picked td { background: color-mix(in srgb, var(--saffron-soft) 55%, var(--surface)); }
.seq-table td { vertical-align: top; }
.seq-table tbody tr { cursor: default; }
.cell {
  all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; width: 230px; min-height: 58px; cursor: pointer;
  padding: 8px 10px 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); position: relative;
  font-size: 12.5px; line-height: 1.4; transition: border-color .12s, transform .12s, box-shadow .12s;
}
.cell::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--line-2); }
.cell:hover, .cell:focus-visible { border-color: var(--saffron); transform: translateY(-1px); box-shadow: var(--shadow); }
.cell b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell span { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell.c-claude::before { background: var(--teal); }
.cell.c-template::before, .cell.c-generic::before { background: var(--saffron); }
.cell.c-manual::before { background: var(--indigo); }
.cell.c-sent { opacity: .62; }
.cell.c-sent::after { content: "sent"; position: absolute; right: 8px; top: 6px; font-size: 10px; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: .05em; }
.cell.c-empty { border-style: dashed; background: transparent; }

.mail-modal { border: 0; padding: 0; border-radius: 18px; width: min(720px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.mail-modal::backdrop { background: rgba(20, 15, 8, .45); backdrop-filter: blur(3px); }
.mail-modal[open] { animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.mm-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.mm-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.mm-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); }

/* ---------- reply popup ---------- */
.reply-modal { width: min(820px, calc(100vw - 32px)); }
.reply-modal .mm { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.rm-thread { overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); min-height: 120px; max-height: 42vh; }
.bubble { max-width: 86%; padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; border: 1px solid var(--line); }
.bubble small { display: block; font-size: 11px; color: var(--mute); margin-bottom: 4px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.bubble.in { align-self: flex-start; background: var(--surface); border-left: 3px solid var(--teal); }
.bubble.out { align-self: flex-end; background: var(--indigo-soft); border-right: 3px solid var(--indigo); }
.convo.unread { background: color-mix(in srgb, var(--teal-soft) 45%, var(--surface)); }
.btn.busy { opacity: .7; pointer-events: none; }
.btn.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.job-bar { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.job-bar .bar { flex: 1; }

/* ---------- import ---------- */
.drop {
  border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 36px 20px; text-align: center; background: var(--surface-2);
  transition: border-color .15s, background .15s; cursor: pointer;
}
.drop.over { border-color: var(--saffron); background: var(--saffron-soft); }
.drop svg { width: 34px; height: 34px; color: var(--saffron); }
.drop b { display: block; font-family: var(--serif); font-size: 17px; margin: 8px 0 2px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: var(--paper); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: rise .3s ease; }
.toast::before { content: ""; width: 4px; align-self: stretch; border-radius: 3px; background: var(--saffron); flex: none; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.reveal { animation: rise .45s ease both; }
.reveal:nth-child(2) { animation-delay: .05s; } .reveal:nth-child(3) { animation-delay: .1s; } .reveal:nth-child(4) { animation-delay: .15s; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .hero, .split { grid-template-columns: 1fr; } .preview { position: static; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a.on::before { display: none; }
  .side-foot { margin: 0; flex-direction: row; align-items: center; width: 100%; }
  .engine-mini { flex: 1; }
  .funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 12px; }
  .main { padding: 20px 16px 48px; }
}

/* ---------- Gmail accounts ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.acc-card { border-top: 4px solid var(--acc, var(--line)); }
.acc-card.active { box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 55%, transparent), var(--shadow, none); }
.acc-card .card-head { gap: 12px; }
.acc-card .avatar { width: 40px; height: 40px; border-radius: 11px; font-size: 16px; }
.acc-addr { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-new { border-top-style: dashed; }
.acc-new h2 { display: flex; align-items: center; gap: 8px; }
.acc-edit { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.acc-edit summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.acc-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.acc-list-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.acc-list-row select { max-width: 170px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.acc-now { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.acc-now:hover { background: var(--surface-2); }
.acc-now b { display: block; font-size: 13px; }
.acc-now small { display: block; font-size: 11.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.acc-chip { background: color-mix(in srgb, var(--acc) 16%, transparent); color: var(--ink-2); border-color: transparent; }
:root[data-side="closed"] .acc-now { display: none; }
.acc-new h2 svg { width: 20px; height: 20px; flex: none; }

/* ---------- sign in ---------- */
.auth-body { min-height: 100vh; margin: 0; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-story {
  /* the story side is always dark ink, in both themes */
  --st-bg: #1f1b16; --st-fg: #f4efe6; --st-accent: #f0a04b;
  background: var(--st-bg); color: var(--st-fg); border-right: 1px solid var(--line); padding: 40px clamp(28px, 5vw, 64px);
  display: flex; flex-direction: column; gap: 40px; position: relative; overflow: hidden;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--st-fg) 10%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
}
.auth-story::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--st-accent) 40%, transparent), transparent 70%);
}
.auth-story .brand-mark { background: var(--st-fg); color: var(--st-bg); box-shadow: inset 0 -3px 0 var(--st-accent); }
.auth-story .brand span { color: color-mix(in srgb, var(--st-fg) 60%, transparent); }
.auth-pitch { margin-top: auto; }
.auth-pitch h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.08; color: var(--st-fg); }
.auth-pitch h1 em { font-style: italic; color: var(--st-accent); }
.auth-pitch p { max-width: 360px; color: color-mix(in srgb, var(--st-fg) 70%, transparent); margin: 14px 0 0; }
.auth-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; position: relative; z-index: 1; max-width: 340px; }
.auth-flow li { display: flex; align-items: center; gap: 12px; padding: 8px 0; position: relative; }
.auth-flow li + li::before {
  content: ""; position: absolute; left: 15px; top: -8px; height: 16px; border-left: 1.5px dashed color-mix(in srgb, var(--st-fg) 30%, transparent);
}
.auth-flow b { display: block; font-size: 13px; }
.auth-flow small { color: color-mix(in srgb, var(--st-fg) 55%, transparent); font-size: 12px; }
.auth-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.auth-dot svg { width: 16px; height: 16px; }
.auth-dot.s1 { background: color-mix(in srgb, var(--st-fg) 12%, transparent); }
.auth-dot.s2 { background: color-mix(in srgb, var(--st-accent) 28%, transparent); color: var(--st-accent); }
.auth-dot.s3 { background: var(--st-accent); color: #1f1405; }
.auth-panel { display: grid; place-items: center; padding: 40px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px 28px 24px; box-shadow: var(--shadow);
}
.auth-lock {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 16px;
  background: var(--saffron-soft); color: var(--saffron-ink);
}
.auth-lock svg { width: 20px; height: 20px; }
.auth-card h2 { font-size: 26px; }
.auth-sub { color: var(--mute); margin: 4px 0 20px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-pw { position: relative; display: block; }
.auth-pw input { width: 100%; box-sizing: border-box; padding-right: 44px; font-size: 15px; }
.auth-pw .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--mute); }
.auth-caps { margin: 0; font-size: 12px; color: var(--saffron-ink); }
.auth-err { margin: 0; font-size: 13px; color: var(--brick); background: var(--brick-soft); padding: 8px 10px; border-radius: 8px; }
.auth-go { width: 100%; justify-content: center; padding: 11px 14px; font-size: 14px; margin-top: 4px; }
.auth-note { margin: 16px 0 0; font-size: 12px; color: var(--mute); text-align: center; }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-story { padding: 24px 16px 28px; gap: 22px; }
  .auth-pitch { margin-top: 0; }
  .auth-pitch p, .auth-flow { display: none; }
  .auth-panel { padding: 24px 16px 40px; align-items: start; }
}

/* sign out in the sidebar */
.signout { display: flex; }
.signout .btn { width: 100%; justify-content: flex-start; color: var(--ink-2); }
.signout .btn svg { width: 15px; height: 15px; }
.login-card h2 svg { width: 18px; height: 18px; vertical-align: -2px; margin-right: 4px; }
