/* Prospekt — design system.
   Ported from the approved wireframes. One purple, one typeface, colour only
   where it carries meaning. */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&display=swap');

:root{
  --purple:#602EBD; --purple-deep:#2C1557; --purple-wash:#EFEAFB;
  --ink:#1A1526; --ink-2:#4A4557; --ink-3:#807C8E;
  --line:#E5E2EE; --line-soft:#F0EEF6;
  --surface:#fff; --page:#F6F5FA;
  --warn-line:#EFB9A4; --warn-bg:#FDF6F3; --warn-ink:#993C1D;
  --ok-bg:#DDF1E9; --ok-ink:#0E6B52;
  --shell:min(520px, 100%);
  --safe-top:env(safe-area-inset-top, 0px);
  --safe-bottom:env(safe-area-inset-bottom, 0px);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;background:var(--page);color:var(--ink);
  font-family:'Archivo',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:15px;line-height:1.6;-webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
}
h1,h2,h3,h4,p,dl,dd{margin:0}
button{font:inherit;color:inherit;background:none;border:none;padding:0;cursor:pointer}
input,textarea,select{font:inherit;color:inherit}
a{color:var(--purple);text-decoration:none}
svg{display:block;flex:none}
:focus-visible{outline:2px solid var(--purple);outline-offset:2px;border-radius:6px}

/* ---------------------------------------------------------------- shell */

#shell{
  width:var(--shell);margin:0 auto;min-height:100%;
  background:var(--surface);display:flex;flex-direction:column;
  position:relative;
}
@media(min-width:560px){
  #shell{min-height:100vh;border-left:1px solid var(--line);border-right:1px solid var(--line)}
}
#view{flex:1;display:flex;flex-direction:column;padding-top:var(--safe-top)}
.scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}

.appbar{flex:none;padding:14px 18px 10px;display:flex;align-items:center;gap:11px}
.appbar.divide{border-bottom:1px solid var(--line-soft);padding-bottom:12px}
.appbar h1{font-size:18px;font-weight:600;letter-spacing:-0.025em;flex:1;min-width:0}
.appbar h1.small{font-size:16px}
.appbar .sub{font-size:11px;color:var(--ink-3);font-weight:400;display:block;line-height:1.3}

.iconbtn{
  width:32px;height:32px;border-radius:9px;border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;color:var(--ink-2);
  position:relative;flex:none;
}
.iconbtn.bare{border:none}
.iconbtn .nd{position:absolute;top:5px;right:6px;width:6px;height:6px;border-radius:50%;
  background:var(--purple);border:1.5px solid #fff}

.pad{padding:14px 18px}
.stack{display:flex;flex-direction:column;gap:11px}
.stack.tight{gap:8px}
.grow{flex:1}
.center{text-align:center}

/* ---------------------------------------------------------------- type */

.eyebrow{font-size:11px;font-weight:600;color:var(--ink-3)}
.txt{font-size:13px;color:var(--ink-2);line-height:1.55}
.txt-sm{font-size:12px;color:var(--ink-3);line-height:1.5}
.h-lg{font-size:21px;font-weight:600;letter-spacing:-0.025em;line-height:1.25}
.h-md{font-size:16px;font-weight:600;letter-spacing:-0.015em}
.mono{font-variant-numeric:tabular-nums}

/* ---------------------------------------------------------------- cards */

.card{border:1px solid var(--line);border-radius:13px;padding:13px;background:var(--surface)}
.card.flat{border-color:var(--line-soft)}
.card.accent{border-color:var(--purple);background:#FBFAFE}
.card.warn{border-color:var(--warn-line);background:var(--warn-bg)}

.hero{border:1px solid var(--purple);background:#FBFAFE;border-radius:15px;padding:15px;width:100%;text-align:left}
.hero .n{font-size:34px;font-weight:600;letter-spacing:-0.035em;line-height:1.1;font-variant-numeric:tabular-nums}
.hero .sub{font-size:13px;color:var(--ink-2);margin-top:3px}
.hero .cta{display:flex;align-items:center;gap:6px;margin-top:11px;color:var(--purple);font-size:13px;font-weight:600}

.arow{border:1px solid var(--line);border-radius:12px;padding:11px 13px;display:flex;
  align-items:center;gap:11px;width:100%;text-align:left;background:var(--surface)}
.arow .ic{width:28px;height:28px;border-radius:9px;background:var(--purple-wash);
  color:var(--purple-deep);display:flex;align-items:center;justify-content:center;flex:none}
.arow .am{flex:1;min-width:0}
.arow .at{font-size:13.5px;font-weight:600;letter-spacing:-0.01em;line-height:1.35}
.arow .as{font-size:11.5px;color:var(--ink-3);line-height:1.35}
.arow .ch{color:var(--ink-3);flex:none}
.arow.warn{border-color:var(--warn-line);background:var(--warn-bg)}
.arow.warn .ic{background:#F8E2D9;color:var(--warn-ink)}

.stat{border:1px solid var(--line);border-radius:12px;padding:11px 12px}
.stat .n{font-size:20px;font-weight:600;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;line-height:1.2}
.stat .l{font-size:11px;color:var(--ink-3);margin-top:1px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}

.kv{display:flex;justify-content:space-between;gap:14px;padding:9px 0;
  border-bottom:1px solid var(--line-soft);font-size:13px}
.kv:last-child{border-bottom:none}
.kv dt{color:var(--ink-3);flex:none}
.kv dd{text-align:right;font-weight:500}

.quiet{display:flex;align-items:center;gap:9px;padding:11px 13px;width:100%;
  border:1px dashed var(--line);border-radius:12px;color:var(--ink-3);font-size:12.5px}
.quiet .qa{color:var(--purple);font-weight:600;margin-left:auto;display:flex;align-items:center;gap:5px}

/* ---------------------------------------------------------------- controls */

.field{border:1px solid var(--line);border-radius:11px;padding:11px 13px;
  /* 16px is not a style choice: iOS Safari zooms the page when a focused
     input is smaller, and the zoom never comes back cleanly. */
  font-size:16px;background:var(--surface);width:100%;display:block}
.field::placeholder{color:var(--ink-3)}
.field:focus{border-color:var(--purple);box-shadow:0 0 0 3px var(--purple-wash);outline:none}
textarea.field{min-height:78px;resize:vertical;line-height:1.5}
.label{font-size:12px;font-weight:600;color:var(--ink-2);margin-bottom:6px;display:block}

.btn{border-radius:11px;padding:13px;text-align:center;font-size:14px;font-weight:600;
  letter-spacing:-0.01em;width:100%;display:block}
.btn.primary{background:var(--purple);color:#fff}
.btn.ghost{border:1px solid var(--line);color:var(--ink-2)}
.btn[disabled]{background:var(--line-soft);color:#B6B2C4;cursor:default}
.btn.busy{opacity:.6;pointer-events:none}

.opt{border:1px solid var(--line);border-radius:11px;padding:11px 13px;display:flex;
  align-items:center;gap:11px;font-size:14px;width:100%;text-align:left;background:var(--surface)}
.opt.on{border-color:var(--purple);background:#FBFAFE}
.opt .tickbox{width:19px;height:19px;border-radius:6px;border:1.5px solid var(--line);flex:none;
  display:flex;align-items:center;justify-content:center;color:#fff}
.opt .tickbox.round{border-radius:50%}
.opt.on .tickbox{background:var(--purple);border-color:var(--purple)}
.opt .opt-main{flex:1;min-width:0}
.opt .opt-sub{font-size:11px;color:var(--ink-3);line-height:1.35;display:block;font-variant-numeric:normal}

.otp{display:flex;gap:8px}
.otp input{flex:1;width:100%;height:50px;border:1px solid var(--line);border-radius:11px;
  text-align:center;font-size:19px;font-weight:600;font-variant-numeric:tabular-nums;background:var(--surface)}
.otp input:focus{border-color:var(--purple);box-shadow:0 0 0 3px var(--purple-wash);outline:none}

.progress{display:flex;gap:5px;padding:0 18px 12px}
.progress i{flex:1;height:3px;border-radius:2px;background:var(--line-soft)}
.progress i.on{background:var(--purple)}

/* ---------------------------------------------------------------- lists */

.chips{display:flex;gap:7px;overflow-x:auto;padding:0 18px 12px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;font-size:12px;font-weight:500;border-radius:999px;border:1px solid var(--line);
  padding:6px 12px;color:var(--ink-2);white-space:nowrap}
.chip.on{background:var(--ink);color:#fff;border-color:var(--ink)}
.chip .n{opacity:.55;margin-left:3px;font-variant-numeric:tabular-nums}

.leadrow{padding:12px 18px;border-bottom:1px solid var(--line-soft);display:flex;gap:11px;
  align-items:flex-start;width:100%;text-align:left;background:var(--surface)}
.leadrow .dot{width:6px;height:6px;border-radius:50%;background:var(--purple);margin-top:6px;flex:none}
.leadrow .dot.off{background:transparent}
.leadrow .dot.late{background:#D85A30}
.leadrow .lm{flex:1;min-width:0}
.leadrow .ln{font-size:13.5px;font-weight:600;letter-spacing:-0.01em}
.leadrow .lx{font-size:12px;color:var(--ink-3);margin-top:1px;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}
.leadrow .ltags{display:flex;gap:6px;margin-top:7px;flex-wrap:wrap}
.leadrow .lt{font-size:11px;color:var(--ink-3);font-variant-numeric:tabular-nums;flex:none}

.srow{padding:13px 18px;border-bottom:1px solid var(--line-soft);display:flex;
  align-items:center;gap:12px;width:100%;text-align:left;background:var(--surface)}
.srow .ic{width:32px;height:32px;border-radius:10px;background:var(--line-soft);
  color:var(--ink-2);display:flex;align-items:center;justify-content:center;flex:none}
.srow.active .ic{background:var(--purple-wash);color:var(--purple-deep)}
.srow .sm{flex:1;min-width:0}
.srow .sn{font-size:13.5px;font-weight:600;letter-spacing:-0.01em}
.srow .ss{font-size:11.5px;color:var(--ink-3);line-height:1.35}

.pill{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:600;
  border-radius:999px;padding:3px 9px;line-height:1.5}
.p-new{background:#EDE8FB;color:#4B22A0}
.p-contacted{background:#E3EDF9;color:#1C5288}
.p-interested{background:#FBF0DA;color:#8A5A0B}
.p-site_visit{background:#DDF1E9;color:#0E6B52}
.p-closed{background:#E6F2DD;color:#3C6B14}
.p-dropped,.p-junk{background:#F0EEF3;color:#66636F}
.p-source{background:var(--line-soft);color:var(--ink-2)}
.p-live{background:var(--ok-bg);color:var(--ok-ink)}
.p-soon{background:#FBF0DA;color:#8A5A0B}

.timeline{display:flex;flex-direction:column}
.tl-item{display:flex;gap:11px;padding-bottom:14px}
.tl-item:last-child{padding-bottom:0}
.tl-rail{display:flex;flex-direction:column;align-items:center;gap:3px;flex:none}
.tl-rail .d{width:15px;height:15px;border-radius:50%;border:1.5px solid var(--line);
  display:flex;align-items:center;justify-content:center;color:#fff}
.tl-rail .d.done{background:var(--purple);border-color:var(--purple)}
.tl-rail .d.now{border-color:var(--purple);border-width:4px}
.tl-rail .l{flex:1;width:1.5px;background:var(--line-soft)}
.tl-item:last-child .tl-rail .l{display:none}
.tl-body .a{font-size:13px;font-weight:600;line-height:1.4;letter-spacing:-0.01em}
.tl-body .b{font-size:11.5px;color:var(--ink-3);line-height:1.4}
.tl-body.dim .a{font-weight:500;color:var(--ink-3)}

.bars{display:flex;flex-direction:column;gap:9px}
.bar-row{display:flex;align-items:center;gap:10px;font-size:12px}
.bar-row .bl{width:70px;flex:none;color:var(--ink-2)}
.bar-row .bt{flex:1;height:7px;border-radius:4px;background:var(--line-soft);overflow:hidden}
.bar-row .bf{height:100%;border-radius:4px;background:var(--purple)}
.bar-row .bn{width:26px;text-align:right;flex:none;font-variant-numeric:tabular-nums;
  color:var(--ink-2);font-weight:500}

.actions2{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.act{border:1px solid var(--line);border-radius:11px;padding:11px;display:flex;
  align-items:center;justify-content:center;gap:7px;font-size:13px;font-weight:600}
.act.fill{background:var(--purple);color:#fff;border-color:var(--purple)}

/* ---------------------------------------------------------------- tabbar */

.tabbar{flex:none;border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(4,1fr);
  padding:9px 6px calc(10px + var(--safe-bottom));background:var(--surface);
  position:sticky;bottom:0}
.tab{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:10px;
  font-weight:500;color:var(--ink-3);width:100%}
.tab.on{color:var(--purple)}
.tabwrap{position:relative;display:flex;justify-content:center}
.badge{position:absolute;transform:translate(12px,-4px);background:var(--purple);color:#fff;
  font-size:9px;font-weight:600;border-radius:999px;padding:0 4px;min-width:14px;
  text-align:center;line-height:14px;pointer-events:none}

/* ---------------------------------------------------------------- sheet */

.sheetdim{position:fixed;inset:0;background:rgba(26,21,38,.42);z-index:40;
  animation:fade .18s ease}
.sheet{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:var(--shell);
  background:var(--surface);border-radius:20px 20px 0 0;z-index:41;
  padding:8px 18px calc(22px + var(--safe-bottom));max-height:86vh;overflow-y:auto;
  animation:rise .22s cubic-bezier(.2,.8,.3,1)}
.sheet .grab{width:34px;height:4px;border-radius:2px;background:var(--line);margin:0 auto 14px}
@keyframes fade{from{opacity:0}}
@keyframes rise{from{transform:translate(-50%,18px);opacity:.4}}
@media(prefers-reduced-motion:reduce){.sheetdim,.sheet{animation:none}}

.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(78px + var(--safe-bottom));
  background:var(--ink);color:#fff;border-radius:12px;padding:11px 16px;font-size:13px;
  z-index:60;max-width:calc(var(--shell) - 36px);animation:rise .2s ease}

.banner{background:var(--ink);color:#fff;font-size:12px;padding:7px 14px;display:flex;
  align-items:center;gap:10px}
.banner button{color:#fff;font-weight:600;margin-left:auto;text-decoration:underline}

/* ---------------------------------------------------------------- states */

.empty{padding:48px 24px;text-align:center;color:var(--ink-3)}
.empty .h{font-size:15px;font-weight:600;color:var(--ink);margin-bottom:4px}
.skeleton{background:var(--line-soft);border-radius:8px;animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{50%{opacity:.45}}

/* The mark is 888×1024, taller than wide. In a flex column an auto-width img
   gets stretched to the container and the SVG letterboxes itself inside it,
   which reads as a tiny centred logo. align-self stops the stretch. */
.brandmark{height:32px;width:auto;align-self:flex-start;flex:none}
.brandmark.lg{height:52px}
.splash{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px}
.splash .brandmark{align-self:center}

.errline{font-size:12px;color:#A32D2D;line-height:1.5;margin-top:6px}
.errline:empty{display:none}


/* Titles and subtitles inside list rows live in <span>s, because they sit
   inside <button>s. Spans are inline, so without this they run together on
   one line — "Google adsSearch, and microsites". */
.srow .sm, .srow .sn, .srow .ss,
.arow .am, .arow .at, .arow .as,
.leadrow .lm, .leadrow .ln, .leadrow .lx,
.opt .opt-main, .opt .opt-sub,
.hero .n, .hero .sub, .hero .cta{display:block}
.leadrow .ltags{display:flex}
.hero .cta{display:flex}
.arow .at{margin-bottom:1px}
.srow .sn{margin-bottom:1px}

/* Sparkline for leads-per-day. Bars, not a chart library — one metric, one
   glance, no axis needed. */
.spark{display:flex;align-items:flex-end;gap:2px;height:56px}
.spark .sp{flex:1;min-width:2px;background:var(--purple);border-radius:2px 2px 0 0;opacity:.85}
.chips .chip.on{background:var(--ink);color:#fff;border-color:var(--ink)}


/* Buttons that hold an icon next to a label. Without this the svg (display:block)
   drops onto its own line and the button grows to two rows. */
.btn.row{display:flex;align-items:center;justify-content:center;gap:7px}

/* Lift the sheet above the software keyboard, and get the tab bar out of the
   way while typing. --kb is published by watchKeyboard(). */
.sheet{bottom:var(--kb, 0px);transition:bottom .18s ease}
body.kb-open .tabbar{display:none}
body.kb-open .toast{bottom:calc(16px + var(--kb, 0px))}

/* ---------------------------------------------------------------- calendar */

.cal{border:1px solid var(--line);border-radius:13px;padding:11px 11px 9px}
.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}
.cal-title{font-size:14px;font-weight:600;letter-spacing:-0.01em}
.cal-nav{width:30px;height:30px;border-radius:9px;display:flex;align-items:center;
  justify-content:center;color:var(--ink-2)}
.cal-nav:disabled{color:var(--line);cursor:default}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.cal-grid.dow{margin-bottom:3px}
.cal-dow{text-align:center;font-size:11px;font-weight:600;color:var(--ink-3);padding:3px 0}
.cal-cell{height:36px;border-radius:9px;font-size:13px;font-variant-numeric:tabular-nums;
  display:flex;align-items:center;justify-content:center;color:var(--ink)}
.cal-cell.empty{pointer-events:none}
.cal-cell:disabled{color:var(--line-soft);cursor:default}
.cal-cell.mid{background:var(--purple-wash);border-radius:0}
.cal-cell.sel{background:var(--purple);color:#fff;font-weight:600}
.cal-foot{display:flex;align-items:center;justify-content:space-between;
  margin-top:9px;padding-top:9px;border-top:1px solid var(--line-soft);min-height:30px}
.cal-clear{font-size:12.5px;font-weight:600;color:var(--purple)}

/* The filter sheet needs room to breathe on a small screen */
.filter-sec{margin-top:16px}
.filter-sec:first-of-type{margin-top:0}