/* ══════════════════════════════════════════════════════════════════════════
   LEADFORGE
   A working instrument, used in daylight for long stretches: a light ground
   with white work surfaces, one violet that means "this is the action", and
   colour otherwise reserved for state. Depth is declared once per element —
   a hairline or a shadow, never both — so the page reads as paper on a desk
   rather than as glass stacked on glass.
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.bunny.net/css?family=plus-jakarta-sans:400,500,600,700,800&display=swap');

:root{
  /* ground → surface → raised, three steps and no more */
  --ground:#F4F5F8;
  --surface:#FFFFFF;
  --sunken:#F7F8FA;
  --line:#E6E8EE;
  --line-soft:#EFF1F5;

  --ink:#14161D;
  --ink-2:#4B5162;
  --ink-3:#7A8194;
  --ink-4:#A3A9B8;

  --brand:#6D57D9;
  --brand-press:#5A45C4;
  --brand-tint:#F1EEFC;
  --brand-line:#DDD5F8;

  --good:#0E8A63;      --good-tint:#E6F5EF;
  --warn:#9A6500;      --warn-tint:#FBF1DF;
  --bad:#C2312F;       --bad-tint:#FBECEC;
  --info:#0F74C5;      --info-tint:#E8F1FB;

  /* chart steps — validated for both modes, light here */
  --c1:#6D57D9; --c2:#008966; --c3:#9A6500; --c4:#0F74C5;

  --r-card:14px;
  --r-field:10px;
  --r-pill:999px;

  --pad:20px;
  --shadow:0 1px 2px rgba(20,22,29,.05), 0 6px 16px -8px rgba(20,22,29,.12);
  --shadow-lift:0 2px 4px rgba(20,22,29,.06), 0 14px 32px -12px rgba(20,22,29,.18);
  --ring:0 0 0 3px rgba(109,87,217,.16);

  --ease:cubic-bezier(.2,.7,.2,1);
  --ease-out:cubic-bezier(.16,1,.3,1);

  --font:'Plus Jakarta Sans',system-ui,-apple-system,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,monospace;

  --rail:252px;
}

:root[data-theme="dark"]{
  --ground:#0E1016;
  --surface:#161922;
  --sunken:#12141B;
  --line:#272B37;
  --line-soft:#1F2330;

  --ink:#F2F3F7;
  --ink-2:#B4BAC9;
  --ink-3:#858C9E;
  --ink-4:#646B7C;

  --brand:#8E79FF;
  --brand-press:#7C64F5;
  --brand-tint:#221E38;
  --brand-line:#3A3160;

  --good:#3DD3A0;     --good-tint:#12271F;
  --warn:#E0A63A;     --warn-tint:#2A2113;
  --bad:#FF7B78;      --bad-tint:#2B1717;
  --info:#5AA9F0;     --info-tint:#13202E;

  --c1:#816DF1; --c2:#00A178; --c3:#B57800; --c4:#298ADE;

  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6);
  --shadow-lift:0 2px 6px rgba(0,0,0,.5), 0 18px 40px -14px rgba(0,0,0,.7);
  --ring:0 0 0 3px rgba(142,121,255,.24);
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--ground); color:var(--ink);
  font-family:var(--font); font-size:14px; line-height:1.55;
  letter-spacing:-.011em; -webkit-font-smoothing:antialiased;
  /* Off-canvas panels park outside the viewport. `clip` stops that becoming a
     horizontal scrollbar without making body a scroll container, which
     `hidden` would and which breaks position:sticky inside it. */
  overflow-x:clip;
}

/* Browser surfaces belong to the design too. */
::selection{background:var(--brand-tint); color:var(--ink)}
:root[data-theme="dark"] ::selection{background:#3A3160; color:#fff}
:where(input,textarea){caret-color:var(--brand)}
:where(a,button,input,select,textarea,[tabindex]):focus-visible{
  outline:2px solid var(--brand); outline-offset:2px; border-radius:6px;
}
*{scrollbar-width:thin; scrollbar-color:var(--line) transparent}
::-webkit-scrollbar{width:10px; height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--line); border-radius:99px;
  border:3px solid transparent; background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--ink-4); background-clip:content-box}

h1,h2,h3,h4{margin:0; font-weight:700; letter-spacing:-.025em; color:var(--ink)}
h2{font-size:24px; line-height:1.2}
h3{font-size:16px; letter-spacing:-.02em}
p{margin:0}
code{font-family:var(--mono); font-size:.92em; background:var(--sunken);
     padding:1px 5px; border-radius:5px; color:var(--ink-2)}
.muted{color:var(--ink-3)}
.small{font-size:12.5px}
.tiny{font-size:11.5px}
.mono{font-family:var(--mono); font-variant-numeric:tabular-nums}
.hidden{display:none !important}
.grow{flex:1}
.full{grid-column:1/-1}
.ok{color:var(--good)} .bad{color:var(--bad)}

/* ── icons: one drawn set, one stroke weight ────────────────────────────── */
.i{width:18px; height:18px; flex:none; stroke:currentColor; fill:none;
   stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round}
.i-sm{width:15px; height:15px}

/* ══════════════════════════════════════════════════════════════════════════
   SHELL
   ══════════════════════════════════════════════════════════════════════════ */
#app{display:grid; grid-template-columns:var(--rail) 1fr; min-height:100dvh}
/* The drawer scrim only exists below 900px. Left in the flow it becomes a grid
   item and takes the content column for itself. */
.rail-scrim{display:none}

.rail{
  position:sticky; top:0; height:100dvh; display:flex; flex-direction:column;
  background:var(--surface); border-right:1px solid var(--line);
  padding:18px 12px 12px;
}
.rail-brand{
  display:flex; align-items:center; gap:10px; padding:4px 8px 18px;
  font-weight:800; font-size:16.5px; letter-spacing:-.03em; color:var(--ink);
}
.rail-mark{
  width:30px; height:30px; border-radius:9px; flex:none;
  background:var(--brand); color:#fff; display:grid; place-items:center;
}
.rail-nav{flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:2px;
          margin:0 -4px; padding:0 4px}
.rail-group{
  font-size:10.5px; font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  color:var(--ink-4); padding:16px 10px 6px;
}
.rail-group:first-child{padding-top:2px}
.navlink{
  display:flex; align-items:center; gap:11px; width:100%;
  appearance:none; border:0; background:none; cursor:pointer;
  font:inherit; font-size:13.5px; font-weight:500; color:var(--ink-2);
  padding:9px 10px; border-radius:9px; text-align:left;
  transition:background .18s var(--ease), color .18s var(--ease);
}
.navlink:hover{background:var(--sunken); color:var(--ink)}
.navlink.active{background:var(--brand-tint); color:var(--brand); font-weight:600}
:root[data-theme="dark"] .navlink.active{color:#C7BCFF}
.navlink .i{opacity:.85}
.navlink.active .i{opacity:1}
.navcount{
  margin-left:auto; font-size:11px; font-weight:600; padding:1px 7px;
  border-radius:var(--r-pill); background:var(--bad-tint); color:var(--bad);
}

.rail-foot{border-top:1px solid var(--line-soft); padding-top:10px; margin-top:8px}
.rail-user{
  display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px;
  width:100%; appearance:none; border:0; background:none; cursor:pointer;
  font:inherit; text-align:left; color:var(--ink);
  transition:background .18s var(--ease);
}
.rail-user:hover{background:var(--sunken)}
.avatar{
  width:30px; height:30px; border-radius:50%; flex:none; display:grid;
  place-items:center; background:var(--brand-tint); color:var(--brand);
  font-weight:700; font-size:12.5px;
}
.rail-user-main{flex:1; min-width:0}
.rail-user-name{font-size:13px; font-weight:600; overflow:hidden;
                text-overflow:ellipsis; white-space:nowrap}
.rail-user-sub{font-size:11px; color:var(--ink-3)}

/* ── workspace ──────────────────────────────────────────────────────────── */
.work{min-width:0; display:flex; flex-direction:column}
.topbar{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; gap:14px;
  padding:14px 28px; background:var(--ground);
  border-bottom:1px solid var(--line);
}
.topbar h1{font-size:17px; font-weight:700; letter-spacing:-.022em}
.searchbox{position:relative; flex:1; max-width:420px}
.searchbox .i{position:absolute; left:12px; top:50%; transform:translateY(-50%);
              color:var(--ink-4); pointer-events:none}
.searchbox input{padding-left:37px}
main{padding:24px 28px 56px; max-width:1560px; width:100%}

/* ── the "acting as someone else" banner ────────────────────────────────── */
.asbar{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:10px 28px; background:var(--warn-tint); color:var(--warn);
  border-bottom:1px solid var(--line); font-size:13px; font-weight:600;
}
.asbar .btn{margin-left:auto}

/* ══════════════════════════════════════════════════════════════════════════
   SURFACES
   ══════════════════════════════════════════════════════════════════════════ */
.panel,.card,.stat,.tablewrap,.table-wrap,.chart,.auth-card,.drawer-inner{
  background:var(--surface);
  border:1px solid var(--line);       /* elevation declared once: hairline only */
  border-radius:var(--r-card);
}
.panel{padding:var(--pad); margin-bottom:18px}
.panel.soft{background:var(--sunken); border-color:var(--line-soft)}
.card{padding:16px 18px}
.chart,.tablewrap,.table-wrap{overflow:hidden}
.tablewrap,.table-wrap{padding:0}

h2+.muted,h2+p{margin-top:6px}
.section-title{
  font-size:12.5px; font-weight:700; color:var(--ink-2);
  margin:26px 0 10px; letter-spacing:-.01em;
}
.section-title:first-child{margin-top:0}

/* ── stat tiles: an icon well, the figure, its label, one delta ─────────── */
.stat-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
           gap:14px; margin:0 0 20px}
.stat{padding:16px 18px 15px; display:flex; flex-direction:column; gap:2px}
.stat .stat-top{display:flex; align-items:center; justify-content:space-between;
                margin-bottom:10px}
.statwell{
  width:32px; height:32px; border-radius:9px; display:grid; place-items:center;
  background:var(--brand-tint); color:var(--brand);
}
.delta{
  display:inline-flex; align-items:center; gap:3px; font-size:11.5px; font-weight:700;
  padding:2px 8px; border-radius:var(--r-pill);
  background:var(--good-tint); color:var(--good);
}
.delta.down{background:var(--bad-tint); color:var(--bad)}
.stat .v,.stat .num,.stat-n{
  font-size:27px; font-weight:700; letter-spacing:-.035em; line-height:1.15;
  color:var(--ink); font-variant-numeric:tabular-nums;
}
.stat .k,.stat .lbl,.stat-l{font-size:12.5px; color:var(--ink-3); font-weight:500}
.stat .sub{font-size:11.5px; color:var(--ink-4); margin-top:3px}
.stat-grid.mini{grid-template-columns:repeat(auto-fit,minmax(128px,1fr)); gap:10px}
.stat-grid.mini .v{font-size:21px}

.cards{display:grid; grid-template-columns:repeat(auto-fill,minmax(268px,1fr));
       gap:14px; margin:16px 0}
.card{cursor:pointer; transition:border-color .2s var(--ease), box-shadow .2s var(--ease)}
.card:hover{border-color:var(--brand-line); box-shadow:var(--shadow)}
.card-head{display:flex; align-items:center; justify-content:space-between; gap:10px}
.card>*+*{margin-top:6px}
.card .row.gap{margin-top:14px !important}

.two-col{display:grid; grid-template-columns:1.25fr 1fr; gap:16px; align-items:start}
.grid2{display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
       gap:14px; margin-bottom:16px}
.row{display:flex; align-items:flex-start}
.row.center{align-items:center} .row.between{justify-content:space-between}
.row.wrap{flex-wrap:wrap} .row.gap{gap:10px}
.actions{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
.empty{padding:40px 20px; text-align:center; color:var(--ink-3); font-size:13px}

/* ══════════════════════════════════════════════════════════════════════════
   CONTROLS
   ══════════════════════════════════════════════════════════════════════════ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  appearance:none; cursor:pointer; font:inherit; font-size:13px; font-weight:600;
  padding:9px 15px; border-radius:var(--r-field);
  background:var(--surface); color:var(--ink); border:1px solid var(--line);
  transition:background .16s var(--ease), border-color .16s var(--ease),
             color .16s var(--ease), transform .1s var(--ease);
  white-space:nowrap;
}
.btn:hover{background:var(--sunken); border-color:var(--ink-4)}
.btn:active{transform:translateY(1px)}
.btn.small{padding:7px 12px; font-size:12.5px}
.btn.primary{background:var(--brand); border-color:var(--brand); color:#fff}
.btn.primary:hover{background:var(--brand-press); border-color:var(--brand-press)}
.btn.accent{background:var(--good-tint); border-color:transparent; color:var(--good)}
.btn.accent:hover{background:var(--good-tint); border-color:var(--good)}
.btn.ghost{background:transparent; border-color:var(--line)}
.btn.ghost:hover{background:var(--sunken)}
.btn.danger,.btn.ghost.danger{background:var(--bad-tint); border-color:transparent; color:var(--bad)}
.btn.danger:hover{border-color:var(--bad)}
.btn[disabled]{opacity:.45; pointer-events:none}
.btn .i{opacity:.9}

/* The assistant is the one place a gradient earns its keep: it marks the only
   control on the page that reaches outside LeadForge. */
.btn.ai{
  background:linear-gradient(120deg,var(--brand),#8E79FF 60%,#4CA8FF);
  border-color:transparent; color:#fff; font-weight:600;
  box-shadow:0 1px 2px rgba(109,87,217,.3), 0 8px 20px -8px rgba(109,87,217,.5);
}
.btn.ai:hover{filter:brightness(1.06)}

.icon-btn{
  width:34px; height:34px; border-radius:9px; display:grid; place-items:center;
  appearance:none; cursor:pointer; background:transparent; color:var(--ink-2);
  border:1px solid transparent;
  transition:background .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover{background:var(--sunken); color:var(--ink)}
.close{width:32px; height:32px; border-radius:9px; display:grid; place-items:center;
       appearance:none; border:1px solid var(--line); background:var(--surface);
       color:var(--ink-2); cursor:pointer; flex:none; font-size:16px; line-height:1}
.close:hover{background:var(--sunken); color:var(--ink)}

label{display:flex; flex-direction:column; gap:6px; font-size:12.5px;
      font-weight:600; color:var(--ink-2)}
label.btn,label.file-btn{flex-direction:row; gap:7px; font-size:13px; color:var(--ink)}
input,select,textarea{
  font:inherit; font-size:13.5px; color:var(--ink);
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-field); padding:9px 12px; width:100%;
  transition:border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input::placeholder,textarea::placeholder{color:var(--ink-4)}
input:focus,select:focus,textarea:focus{outline:0; border-color:var(--brand); box-shadow:var(--ring)}
textarea{resize:vertical; min-height:110px; line-height:1.6}
select{appearance:none; padding-right:32px; cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A8194' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center}
input[type=checkbox]{
  width:17px; height:17px; flex:0 0 17px; appearance:none; padding:0; cursor:pointer;
  border:1.5px solid var(--ink-4); border-radius:5px; background:var(--surface);
  transition:background .16s var(--ease), border-color .16s var(--ease);
}
input[type=checkbox]:checked{
  background:var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='9' fill='none'%3E%3Cpath d='M1 4.5L4 7.5L10 1.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat;
  border-color:var(--brand);
}
label.check{flex-direction:row; align-items:center; gap:9px; font-weight:500;
            font-size:13px; color:var(--ink)}
.grid2 label.check,.formgrid label.check{grid-column:1/-1}
label.check.tiny{font-size:11.5px}

.filters{display:flex; flex-wrap:wrap; gap:9px; align-items:center; margin-bottom:16px}
.filters>input,.filters>select,.filters label{flex:0 1 168px; width:auto; min-width:0}
.filters>input.grow,.filters .grow{flex:1 1 230px}
.filters>.btn,.filters button{flex:none}

.tabs{display:inline-flex; gap:2px; padding:3px; background:var(--sunken);
      border:1px solid var(--line); border-radius:var(--r-field)}
.tab{appearance:none; border:0; background:transparent; color:var(--ink-3);
     font:inherit; font-size:12.5px; font-weight:600; padding:7px 13px;
     border-radius:7px; cursor:pointer; white-space:nowrap;
     transition:background .16s var(--ease), color .16s var(--ease)}
.tab:hover{color:var(--ink)}
.tab.active{background:var(--surface); color:var(--ink); box-shadow:var(--shadow)}
.tabs.mini{padding:2px}
.tabs.mini .tab{font-size:11.5px; padding:6px 10px}

.pill{
  display:inline-flex; align-items:center; gap:5px; padding:2px 9px;
  border-radius:var(--r-pill); font-size:11.5px; font-weight:600;
  background:var(--sunken); color:var(--ink-2); border:1px solid var(--line);
}
.pill.ok{background:var(--good-tint); color:var(--good); border-color:transparent}
.pill.bad{background:var(--bad-tint); color:var(--bad); border-color:transparent}
.pill.muted{opacity:.7}
.chip{
  display:inline-flex; align-items:center; gap:6px; padding:4px 10px;
  border-radius:var(--r-pill); font-size:11.5px; font-weight:500;
  background:var(--sunken); color:var(--ink-2); border:1px solid var(--line);
  transition:border-color .16s var(--ease), color .16s var(--ease);
}
.chip:hover{border-color:var(--brand-line); color:var(--ink)}
.chip.picked,.chip.accent{background:var(--brand-tint); color:var(--brand);
                          border-color:var(--brand-line); font-weight:600}
.chips{display:flex; flex-wrap:wrap; gap:6px}
.chip[data-role],.chip[data-lt],.chip[data-ltall],.chip[data-mf]{cursor:pointer}

.msg{font-size:12.5px; padding:10px 13px; border-radius:var(--r-field);
     margin-top:12px; background:var(--sunken); color:var(--ink-2);
     border:1px solid var(--line)}
.msg.ok,.msg.good{background:var(--good-tint); color:var(--good); border-color:transparent}
.msg.error,.msg.bad{background:var(--bad-tint); color:var(--bad); border-color:transparent}

.toast{
  position:fixed; left:50%; bottom:26px; transform:translateX(-50%);
  z-index:90; padding:11px 18px; border-radius:var(--r-field);
  background:var(--ink); color:var(--surface); font-size:13px; font-weight:600;
  box-shadow:var(--shadow-lift);
}

/* ══════════════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════════════ */
.table{width:100%; border-collapse:collapse; font-size:13.5px}
.table th{
  text-align:left; font-size:11.5px; font-weight:600; color:var(--ink-3);
  padding:11px 16px; background:var(--sunken);
  border-bottom:1px solid var(--line); white-space:nowrap;
}
.table td{padding:12px 16px; border-bottom:1px solid var(--line-soft); vertical-align:middle}
.table tbody tr{transition:background .14s var(--ease)}
.table tbody tr:hover{background:var(--sunken)}
.table tbody tr.picked{background:var(--brand-tint)}
.table tbody tr:last-child td{border-bottom:0}
.table td.tick,.table th.tick{width:44px; padding-right:0}
.table .mono{font-size:12.5px; color:var(--ink-2); word-break:break-all}
.biz{font-weight:600; color:var(--ink)}
.sub-line{font-size:11.5px; color:var(--ink-3); margin-top:2px}
.kv{display:grid; grid-template-columns:minmax(96px,auto) 1fr; margin:0}
.kv dt{font-size:11.5px; color:var(--ink-3); font-weight:600; padding:10px 16px 10px 0;
       border-top:1px solid var(--line-soft)}
.kv dd{margin:0; padding:10px 0; font-size:13.5px; word-break:break-word;
       border-top:1px solid var(--line-soft)}
.kv dt:first-of-type,.kv dd:first-of-type{border-top:0; padding-top:0}
.pager{display:flex; align-items:center; justify-content:center; gap:10px;
       padding:14px 0 2px; font-size:12.5px; color:var(--ink-3)}
.statline{display:flex; gap:12px; flex-wrap:wrap; font-size:12px; color:var(--ink-3)}
.dot{display:inline-block; width:7px; height:7px; border-radius:50%; flex:none;
     background:var(--ink-4); margin-right:7px; vertical-align:middle}
.dot.yes,.dot.ok,.dot.good{background:var(--good)}
.dot.no,.dot.bad{background:var(--bad)}

.selbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:10px 14px; margin:0 0 14px; border-radius:var(--r-field);
  background:var(--brand-tint); border:1px solid var(--brand-line);
}
.selcount{font-size:12.5px; font-weight:600; color:var(--brand)}
:root[data-theme="dark"] .selcount{color:#C7BCFF}

/* ── jobs, saved rows, advice ───────────────────────────────────────────── */
.job,.saved,.advice-row,.excamp{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-field); padding:14px 16px; margin-bottom:9px;
  transition:border-color .18s var(--ease);
}
.job:hover,.saved:hover,.excamp:hover{border-color:var(--brand-line)}
.excamp.picked{background:var(--brand-tint); border-color:var(--brand-line)}
.job-head{display:flex; align-items:center; justify-content:space-between; gap:12px}
.job-title{font-weight:600; display:flex; align-items:center; gap:8px}
.saved,.advice-row,.excamp{display:flex; align-items:center; gap:11px}
.saved{justify-content:space-between}
.advice-row{align-items:flex-start; font-size:12.5px; color:var(--ink-2)}
.excamp{cursor:pointer; font-weight:400; font-size:13px; color:var(--ink)}
.excamp input{width:17px; flex:0 0 17px}
.excamp-main{flex:1; display:flex; flex-direction:column; gap:2px; min-width:0}
.saved-wrap,.advice{display:flex; flex-direction:column; gap:0; margin-top:8px}
.progress{height:5px; border-radius:99px; background:var(--sunken); overflow:hidden; margin-top:12px}
.progress>div{height:100%; width:100%; border-radius:99px; background:var(--brand);
              transform-origin:left center; transition:transform .8s var(--ease-out)}
.spinner{width:12px; height:12px; flex:none; border-radius:50%;
         border:1.5px solid var(--line); border-top-color:var(--brand);
         animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.status{
  display:inline-flex; align-items:center; gap:6px; flex:none;
  padding:3px 10px 3px 8px; border-radius:var(--r-pill);
  font-size:11.5px; font-weight:600; background:var(--sunken);
  color:var(--ink-2); border:1px solid var(--line);
}
.status::before{content:''; width:6px; height:6px; border-radius:50%; background:currentColor}
.status.running{background:var(--brand-tint); color:var(--brand); border-color:transparent}
.status.running::before{animation:pulse 1.5s var(--ease) infinite}
.status.completed{background:var(--good-tint); color:var(--good); border-color:transparent}
.status.failed{background:var(--bad-tint); color:var(--bad); border-color:transparent}
@keyframes pulse{0%,100%{opacity:1} 50%{opacity:.35}}

.key{font-family:var(--mono); font-size:12.5px; padding:9px 13px;
     border-radius:var(--r-field); background:var(--sunken);
     border:1px solid var(--line); word-break:break-all}
.keyrow{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:8px}

/* ══════════════════════════════════════════════════════════════════════════
   CHARTS
   ══════════════════════════════════════════════════════════════════════════ */
.chart{padding:16px 18px}
.chart-fig{margin:12px 0 0}
.chartbox{position:relative; width:100%}
.chartbox svg{display:block; overflow:visible}
.charttip{
  position:absolute; top:6px; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:3px; padding:9px 12px;
  border-radius:var(--r-field); pointer-events:none; z-index:5;
  background:var(--surface); border:1px solid var(--line);
  box-shadow:var(--shadow-lift); font-size:11.5px; white-space:nowrap;
}
.charttip strong{font-size:11px; color:var(--ink-3); font-weight:600}
.charttip span{display:flex; align-items:center; gap:7px; color:var(--ink-2)}
.charttip b{color:var(--ink); font-variant-numeric:tabular-nums}
.charttip i,.legend i{width:9px; height:9px; border-radius:3px; flex:none; display:inline-block}
.legend{display:flex; gap:14px; flex-wrap:wrap}
.legend .lg{display:flex; align-items:center; gap:7px; font-size:11.5px; color:var(--ink-3)}

.barchart{display:flex; flex-direction:column; gap:9px; margin-top:14px}
.barrow{display:grid; grid-template-columns:minmax(88px,180px) 1fr auto;
        align-items:center; gap:12px}
.barlabel{font-size:12.5px; color:var(--ink-2); overflow:hidden;
          text-overflow:ellipsis; white-space:nowrap}
.bartrack{height:8px; border-radius:99px; background:var(--sunken); overflow:hidden}
.barfill{height:100%; width:100%; transform-origin:left center;
         transition:transform .8s var(--ease-out)}
.barval{font-size:13px; font-weight:600; font-variant-numeric:tabular-nums;
        text-align:right; display:flex; flex-direction:column; align-items:flex-end;
        min-width:56px}
.barsub{font-size:10.5px; font-weight:500; color:var(--ink-4)}
.bar-row{display:grid; grid-template-columns:minmax(84px,150px) 1fr auto;
         align-items:center; gap:13px; padding:8px 0}
.bar-row+.bar-row{border-top:1px solid var(--line-soft)}
.bar-label{font-size:12.5px; color:var(--ink-2); overflow:hidden;
           text-overflow:ellipsis; white-space:nowrap}
.bar-track{height:7px; border-radius:99px; background:var(--sunken); overflow:hidden}
.bar-fill{height:100%; width:100%; border-radius:99px; background:var(--c1);
          transform-origin:left center; transition:transform 1s var(--ease-out)}
.bar-fill.good{background:var(--c2)} .bar-fill.warn{background:var(--c3)}
.bar-fill.bad{background:var(--bad)}
.bar-val{font-size:13px; font-weight:600; font-variant-numeric:tabular-nums;
         min-width:42px; text-align:right}

/* ══════════════════════════════════════════════════════════════════════════
   ATTENTION — what needs doing, decided by rules
   ══════════════════════════════════════════════════════════════════════════ */
.attention{display:flex; flex-direction:column; gap:2px}
.att{
  display:flex; align-items:flex-start; gap:11px; padding:12px 2px;
  border-bottom:1px solid var(--line-soft); cursor:pointer;
  transition:background .16s var(--ease);
}
.att:last-child{border-bottom:0}
.att:hover{background:var(--sunken)}
.attdot{width:8px; height:8px; border-radius:50%; margin-top:6px; flex:none}
.att.bad .attdot{background:var(--bad)}
.att.warn .attdot{background:var(--warn)}
.att.info .attdot{background:var(--info)}
.att-main{flex:1; min-width:0}
.att-title{font-size:13px; font-weight:600; color:var(--ink)}
.att-detail{font-size:12px; color:var(--ink-3); margin-top:2px}
.att-do{font-size:12px; font-weight:600; color:var(--brand); white-space:nowrap;
        display:flex; align-items:center; gap:4px; margin-top:5px}

/* ══════════════════════════════════════════════════════════════════════════
   ASSISTANT
   ══════════════════════════════════════════════════════════════════════════ */
.ai-panel{
  position:fixed; top:0; right:0; bottom:0; width:min(440px,100%); z-index:85;
  display:flex; flex-direction:column; background:var(--surface);
  border-left:1px solid var(--line); box-shadow:var(--shadow-lift);
  transform:translateX(100%); visibility:hidden;
  transition:transform .42s var(--ease-out), visibility .42s var(--ease-out);
}
body.ai-open .ai-panel{transform:none; visibility:visible}
.ai-head{display:flex; align-items:center; gap:11px; padding:16px 18px;
         border-bottom:1px solid var(--line)}
.ai-mark{width:30px; height:30px; border-radius:9px; display:grid; place-items:center;
         background:linear-gradient(120deg,var(--brand),#4CA8FF); color:#fff}
.ai-body{flex:1; overflow-y:auto; padding:18px; display:flex;
         flex-direction:column; gap:14px}
.ai-msg{display:flex; flex-direction:column; gap:5px; max-width:92%}
.ai-msg.me{align-self:flex-end; align-items:flex-end}
.ai-bubble{
  padding:11px 14px; border-radius:14px; font-size:13.5px; line-height:1.6;
  background:var(--sunken); border:1px solid var(--line); color:var(--ink);
}
.ai-msg.me .ai-bubble{background:var(--brand); border-color:var(--brand); color:#fff}
.ai-bubble p{margin:0 0 8px} .ai-bubble p:last-child{margin:0}
.ai-meta{font-size:10.5px; color:var(--ink-4)}
.ai-foot{padding:14px 18px; border-top:1px solid var(--line); display:flex;
         flex-direction:column; gap:9px}
.ai-suggest{display:flex; flex-wrap:wrap; gap:6px}
.ai-input{display:flex; gap:8px; align-items:flex-end}
.ai-input textarea{min-height:44px; max-height:140px; resize:none; padding:11px 12px}
.ai-scrim{position:fixed; inset:0; z-index:84; background:rgba(20,22,29,.34);
          opacity:0; visibility:hidden; transition:opacity .3s var(--ease)}
body.ai-open .ai-scrim{opacity:1; visibility:visible}
body.ai-open{overflow:hidden}

/* ══════════════════════════════════════════════════════════════════════════
   EDITOR
   ══════════════════════════════════════════════════════════════════════════ */
.editor{position:relative; border:1px solid var(--line); border-radius:var(--r-field);
        background:var(--surface); overflow:visible}
.editor:focus-within{border-color:var(--brand); box-shadow:var(--ring)}
.etoolbar{display:flex; align-items:center; gap:2px; flex-wrap:wrap; padding:7px 9px;
          border-bottom:1px solid var(--line); background:var(--sunken);
          border-radius:var(--r-field) var(--r-field) 0 0; position:sticky; top:0; z-index:3}
.esep{width:1px; height:16px; background:var(--line); margin:0 5px}
.etool{appearance:none; border:1px solid transparent; background:transparent;
       color:var(--ink-3); font:inherit; font-size:12.5px; font-weight:600;
       min-width:28px; height:28px; padding:0 8px; border-radius:7px; cursor:pointer;
       display:inline-flex; align-items:center; justify-content:center;
       transition:background .16s var(--ease), color .16s var(--ease)}
.etool:hover{background:var(--surface); color:var(--ink)}
.etool.on{background:var(--brand-tint); color:var(--brand); border-color:var(--brand-line)}
.etool[disabled]{opacity:.35; pointer-events:none}
.etool.link{color:var(--good)}
.etool.src{font-size:10.5px; letter-spacing:.06em}
.ebody{padding:15px 17px; min-height:190px; max-height:min(58vh,440px);
       overflow-y:auto; outline:0; font-size:14px; line-height:1.68}
.ebody.empty::before{content:attr(data-placeholder); color:var(--ink-4)}
.ebody p{margin:0 0 11px} .ebody p:last-child{margin-bottom:0}
.ebody h2{font-size:19px; margin:0 0 9px}
.ebody ul,.ebody ol{margin:0 0 11px; padding-left:22px}
.ebody li{margin-bottom:4px}
.ebody blockquote{margin:0 0 11px; padding-left:14px; border-left:2px solid var(--line);
                  color:var(--ink-3)}
.ebody a{color:var(--brand); text-decoration:underline; text-underline-offset:2px}
.editor .stepBody{border:0; background:transparent; border-radius:0; min-height:220px;
                  max-height:min(58vh,440px); font-family:var(--mono); font-size:12.5px}
.editor .stepBody:focus{box-shadow:none}

.bubble{position:absolute; z-index:70; display:flex; align-items:center; gap:2px;
        padding:4px 5px; border-radius:11px; background:var(--surface);
        border:1px solid var(--line); box-shadow:var(--shadow-lift);
        animation:pop .2s var(--ease-out) both}
@keyframes pop{from{opacity:0; transform:translateY(4px) scale(.97)} to{opacity:1; transform:none}}
.bubble button{appearance:none; border:0; background:transparent; color:var(--ink-3);
               font:inherit; font-size:12.5px; font-weight:600; cursor:pointer;
               min-width:27px; height:27px; padding:0 8px; border-radius:7px;
               display:inline-flex; align-items:center; justify-content:center}
.bubble button:hover{background:var(--sunken); color:var(--ink)}
.bubble button.on{background:var(--brand-tint); color:var(--brand)}
.bubble button.bl{color:var(--good)}
.bubble .bsep{width:1px; height:15px; background:var(--line); margin:0 3px}

.linkpop{position:absolute; z-index:45; width:min(320px,calc(100% - 16px));
         padding:14px; border-radius:var(--r-card); background:var(--surface);
         border:1px solid var(--line); box-shadow:var(--shadow-lift)}
.linkpop input{margin-top:5px}

/* ══════════════════════════════════════════════════════════════════════════
   MODAL, DRAWER, RANGE, WARM-UP
   ══════════════════════════════════════════════════════════════════════════ */
.modal{position:fixed; inset:0; z-index:80; display:grid; place-items:center;
       padding:24px; background:rgba(20,22,29,.4)}
body.modal-open{overflow:hidden}
.modal-card{width:min(880px,100%); max-height:86vh; display:flex; flex-direction:column;
            padding:22px 24px 18px; border-radius:var(--r-card); background:var(--surface);
            border:1px solid var(--line); box-shadow:var(--shadow-lift);
            animation:rise .3s var(--ease-out) both}
@keyframes rise{from{opacity:0; transform:translateY(12px)} to{opacity:1; transform:none}}
.modal-card>#excludeManual,.modal-card>#excludeSent{flex:1; min-height:0;
  display:flex; flex-direction:column; overflow:hidden}
.exscroll{flex:1; min-height:170px; max-height:44vh; overflow-y:auto}
.modal-foot{display:flex; align-items:center; justify-content:space-between; gap:14px;
            flex-wrap:wrap; margin-top:14px; padding-top:14px; border-top:1px solid var(--line)}

.drawer{position:fixed; top:0; right:0; bottom:0; width:min(520px,100%); z-index:75;
        background:var(--surface); border-left:1px solid var(--line);
        box-shadow:var(--shadow-lift); overflow-y:auto}
.drawer-inner{border:0; border-radius:0; padding:20px}

.rangebox,.longtail,.seeds{padding:14px 16px; border-radius:var(--r-field);
  background:var(--sunken); border:1px solid var(--line-soft)}
.rangewrap{margin-bottom:4px}
.rangehead{display:flex; align-items:center; justify-content:space-between; gap:12px}
.rangetext,.reachline{font-size:13px; color:var(--ink-2); text-transform:none;
  letter-spacing:-.005em; line-height:1.55; font-weight:500}
.rangetext b,.reachline b{color:var(--ink); font-variant-numeric:tabular-nums}
.rangetext.partial{color:var(--brand)} .rangetext.partial b{color:var(--brand)}
.reachline{margin-top:8px}
.reachline.danger{color:var(--bad)} .reachline.danger b{color:var(--bad)}
.dualrange{position:relative; height:32px; margin:12px 0 4px}
.rangetrack{position:absolute; top:14px; left:0; right:0; height:5px;
            border-radius:99px; background:var(--line)}
.rangefill{position:absolute; top:0; height:100%; border-radius:99px; background:var(--brand)}
.dualrange input[type=range]{position:absolute; top:0; left:0; width:100%; height:32px;
  margin:0; padding:0; appearance:none; background:none; pointer-events:none; border:0}
.dualrange input[type=range]:focus{box-shadow:none}
.dualrange input[type=range]::-webkit-slider-thumb{
  appearance:none; pointer-events:auto; width:18px; height:18px; border-radius:50%;
  background:var(--surface); border:2px solid var(--brand); cursor:grab;
  box-shadow:var(--shadow); transition:transform .18s var(--ease)}
.dualrange input[type=range]::-webkit-slider-thumb:hover{transform:scale(1.12)}
.dualrange input[type=range]::-moz-range-thumb{pointer-events:auto; width:18px; height:18px;
  border-radius:50%; background:var(--surface); border:2px solid var(--brand); cursor:grab}
.rangenums{flex-wrap:wrap; margin-top:6px}
.rangenums label{flex-direction:row; align-items:center; gap:7px; font-size:11.5px}
.rangenums input{width:84px; padding:7px 10px; font-size:12.5px}

.ramp{display:flex; align-items:flex-end; gap:4px; height:92px; padding:13px 13px 7px;
      border-radius:var(--r-field); background:var(--sunken); border:1px solid var(--line-soft)}
.rampday{flex:1; display:flex; flex-direction:column; align-items:center;
         justify-content:flex-end; height:100%; gap:5px; min-width:0}
.rampbar{width:100%; height:100%; max-width:20px; border-radius:4px 4px 2px 2px;
         background:var(--brand); opacity:.55; transform-origin:bottom center;
         transition:transform .8s var(--ease-out)}
.rampday.today .rampbar{opacity:1; background:var(--good)}
.rampnum{font-size:9.5px; color:var(--ink-4); font-variant-numeric:tabular-nums}
.rampday.today .rampnum{color:var(--good); font-weight:700}
.seeds summary{cursor:pointer; font-size:12.5px; font-weight:600; color:var(--ink)}
.detectwrap{justify-content:flex-end}
.detectwrap .btn{width:100%}

/* ══════════════════════════════════════════════════════════════════════════
   AUTH
   ══════════════════════════════════════════════════════════════════════════ */
.auth-wrap{min-height:100dvh; display:grid; place-items:center; padding:24px;
           background:var(--ground)}
.auth-card{width:min(400px,100%); padding:30px; box-shadow:var(--shadow-lift)}
.small-brand{display:flex; align-items:center; gap:10px; font-weight:800;
             font-size:17px; letter-spacing:-.03em; margin-bottom:4px}
.authform{display:flex; flex-direction:column; gap:13px; margin-top:20px}
.authform .btn{margin-top:4px; padding:11px}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
.burger{display:none; width:36px; height:36px; border-radius:9px; appearance:none;
        border:1px solid var(--line); background:var(--surface); color:var(--ink-2);
        cursor:pointer; place-items:center; flex:none}
@media (max-width:1080px){
  .two-col{grid-template-columns:1fr}
}
@media (max-width:900px){
  #app{grid-template-columns:1fr}
  .rail{position:fixed; left:0; top:0; z-index:88; width:var(--rail);
        transform:translateX(-100%); transition:transform .34s var(--ease-out);
        box-shadow:var(--shadow-lift)}
  body.rail-open .rail{transform:none}
  body.rail-open{overflow:hidden}
  .rail-scrim{display:block; position:fixed; inset:0; z-index:87;
              background:rgba(20,22,29,.4); opacity:0; visibility:hidden;
              transition:opacity .3s var(--ease)}
  body.rail-open .rail-scrim{opacity:1; visibility:visible}
  .burger{display:grid}
  .searchbox{order:5; flex:1 1 100%; max-width:none}
  .topbar{padding:12px 16px; gap:10px}
  /* The rail already carries identity and sign-out; repeating them here only
     crowds the row until it overflows. */
  .topbar #logout{display:none}
  .btn.ai span,.btn.ai{font-size:0}
  .btn.ai .i{margin:0}
  .btn.ai{padding:9px 11px}
  main{padding:18px 16px 48px}
  .asbar{padding:10px 16px}
  .searchbox{max-width:none}
}
@media (max-width:640px){
  .stat-grid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
  .table th:nth-child(4),.table td:nth-child(4){display:none}
  .topbar h1{font-size:15px}
  .ai-panel{width:100%}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important; transition-duration:.01ms !important}
}

/* ── remaining pieces the markup relies on ──────────────────────────────── */
.view{animation:enter .3s var(--ease-out) both}
@keyframes enter{from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:none}}
.brand{display:flex; align-items:center; gap:10px; font-weight:800;
       letter-spacing:-.03em; color:var(--ink)}
.step{margin-bottom:14px}
.stepSubject,.stepDelay{margin-bottom:0}
.mergemenu .chips{gap:5px}
.mergemenu .chip{font-family:var(--mono); font-size:11px}
.linkurl{margin-top:5px}
.mini-select{width:auto; min-width:146px; padding:7px 30px 7px 11px; font-size:12.5px}
.audiencetoggle{gap:6px}
.srcmode .ebody{display:none}
.tbl{width:100%; border-collapse:collapse}
.bar-outer{height:7px; border-radius:99px; background:var(--sunken); overflow:hidden}
.bar-inner{height:100%; border-radius:99px; background:var(--brand)}
.eheading{margin-bottom:7px}

/* A multi-select is a list box, not a dropdown: it must not inherit the
   chevron, the single-line padding, or the collapsed height. */
select[multiple]{
  background-image:none; padding:6px; height:auto; min-height:168px;
  overflow-y:auto; cursor:default;
}
select[multiple] option{
  padding:7px 9px; border-radius:7px; font-size:13px; line-height:1.4;
}
select[multiple] option:checked{
  background:var(--brand-tint) linear-gradient(0deg,var(--brand-tint),var(--brand-tint));
  color:var(--brand); font-weight:600;
}
#insShare .grid2{grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px}

/* ── checkbox pickers ───────────────────────────────────────────────────── */
.fieldlabel{font-size:12.5px; font-weight:600; color:var(--ink-2)}
.linkbtn{appearance:none; border:0; background:none; cursor:pointer; font:inherit;
         font-size:12px; font-weight:600; color:var(--brand); padding:0}
.linkbtn:hover{text-decoration:underline}
.picklist{max-height:196px; overflow-y:auto; border:1px solid var(--line);
          border-radius:var(--r-field); background:var(--surface); padding:4px}
.pick{display:flex; align-items:center; gap:10px; padding:8px 9px; border-radius:8px;
      cursor:pointer; font-weight:400; flex-direction:row;
      transition:background .14s var(--ease)}
.pick:hover{background:var(--sunken)}
.pick:has(input:checked){background:var(--brand-tint)}
.pick-main{display:flex; flex-direction:column; gap:1px; min-width:0}
.pick-name{font-size:13px; color:var(--ink); overflow:hidden;
           text-overflow:ellipsis; white-space:nowrap}
.pick-sub{font-size:11px; color:var(--ink-3)}
.picklist .empty{padding:18px 10px; font-size:12.5px}
