:root {
  --blue: #465496; --blue-d: #36427a; --blue-l: #eef0f8; --blue-m: #c9cfe6;
  --pink: #B1377F; --pink-d: #8f2b66; --pink-l: #f8ecf3;
  --ink: #1b1b22; --muted: #6b6b76; --line: #e3e3ea; --bg: #f6f6f9; --white: #fff;
  --ok: #2f7d4f; --warn: #a86a00; --tbd: #fff3c4;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Poppins', system-ui, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

header.top { position: sticky; top: 0; z-index: 50; background: var(--white); border-bottom: 3px solid var(--blue); display: flex; align-items: center; gap: 22px; padding: 0 24px; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand b { font-weight: 700; font-size: 20px; color: var(--blue); letter-spacing: .3px; }
.brand span { font-size: 13px; color: var(--pink); font-weight: 600; }
nav.main { display: flex; gap: 4px; }
nav.main a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 6px; font-weight: 500; }
nav.main a.on, nav.main a:hover { color: var(--blue); background: var(--blue-l); }
.who { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.who button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; color: var(--muted); }

main { max-width: 1280px; margin: 0 auto; padding: 22px 24px 80px; }
h1 { font-size: 22px; margin: 0 0 4px; color: var(--blue-d); font-weight: 600; }
h2 { font-size: 17px; margin: 22px 0 8px; color: var(--blue-d); font-weight: 600; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--pink); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.intro { color: var(--muted); margin: 0 0 16px; max-width: 760px; }

.btn { background: var(--pink); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.btn:hover { background: var(--pink-d); }
.btn.alt { background: var(--white); color: var(--blue); border: 1px solid var(--blue-m); }
.btn.alt:hover { background: var(--blue-l); }
.btn.sm { padding: 5px 10px; font-size: 12px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* Client list */
table.list { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; padding: 10px 12px; background: #fafafc; border-bottom: 1px solid var(--line); }
table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--blue-l); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--blue-l); color: var(--blue); white-space: nowrap; }
.pill.test { background: var(--tbd); color: #7a5a00; border: 1px dashed #c9a400; }
.pill.pink { background: var(--pink-l); color: var(--pink); }
.pill.ok { background: #e6f3ec; color: var(--ok); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; width: 120px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.bar i { display: block; height: 100%; background: var(--blue); }

/* Client workspace */
.ws { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
.side { position: sticky; top: 82px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.side a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--ink); font-size: 13px; }
.side a:hover { background: var(--blue-l); }
.side a.on { background: var(--blue); color: #fff; }
.side a .n { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--tbd); color: #7a5a00; border-radius: 99px; padding: 1px 7px; }
.side a.on .n { background: rgba(255,255,255,.25); color: #fff; }
.side a .ok { margin-left: auto; color: var(--ok); font-size: 12px; }
.side a.on .ok { color: #fff; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.wshead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.testbanner { background: var(--tbd); border: 1px dashed #c9a400; color: #6a4e00; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; }

/* Forms */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f.wide { grid-column: 1 / -1; }
.f label { font-size: 12px; font-weight: 600; color: #3a3a46; }
.f label .key { color: var(--pink); margin-left: 3px; }
.f .help { font-size: 11px; color: var(--muted); }
[hidden] { display: none !important; }
.f input[type=text], .f input[type=password], .f input[type=email], .f input[type=url], .f input[type=date], .f input[type=number], .f select, .f textarea, td input, td select {
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--white); width: 100%; }
.f textarea { min-height: 78px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus, td input:focus, td select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-l); }
.f.gap input, .f.gap select, .f.gap textarea { background: #fffdf2; border-color: #e8d98a; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; font-weight: 400; font-size: 13px; cursor: pointer; background: var(--white); }
.chips label.on { border-color: var(--blue); background: var(--blue-l); color: var(--blue-d); font-weight: 500; }
.chips input { margin: 0; accent-color: var(--blue); }
.yn { display: flex; gap: 6px; }
.yn button { border: 1px solid var(--line); background: var(--white); border-radius: 7px; padding: 6px 16px; }
.yn button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
table.rows { width: 100%; border-collapse: collapse; }
table.rows th { font-size: 11px; color: var(--muted); text-align: left; font-weight: 600; padding: 4px 6px; }
table.rows td { padding: 3px 4px; }
table.rows td.x { width: 30px; text-align: center; }
.x button, button.x { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 2px 6px; }
.x button:hover, button.x:hover { color: var(--pink); }
.savebar { position: sticky; bottom: 0; background: rgba(246,246,249,.95); border-top: 1px solid var(--line); padding: 10px 0; margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.saved { font-size: 12px; color: var(--muted); }
.saved.dirty { color: var(--pink); font-weight: 600; }

/* Choice cards */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.choice { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--white); cursor: pointer; }
.choice.on { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-l); }
.choice .t { font-weight: 600; color: var(--blue-d); display: flex; gap: 8px; align-items: center; }
.choice .t input { accent-color: var(--blue); }
.choice ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.choice ul.pro li::marker { content: '+  '; color: var(--ok); font-weight: 700; }
.choice ul.con li::marker { content: '–  '; color: var(--pink); font-weight: 700; }

/* Apps picker */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.app { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); }
.app.on { border-color: var(--blue); background: #f8f9fd; }
.app .t { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.app .t input { accent-color: var(--blue); }
.app .s { font-size: 12px; color: var(--muted); margin: 4px 0 0 24px; }
.app .opts { display: flex; gap: 6px; margin: 8px 0 0 24px; }
.app .opts select, .app .opts input { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.app .opts input { flex: 1; }
.grp { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--pink); font-weight: 600; margin: 14px 0 6px; }

/* Intake designer */
.stage { border: 1px solid var(--line); border-radius: 10px; background: var(--white); margin-bottom: 10px; }
.stage.off { opacity: .55; }
.stage .hd { display: grid; grid-template-columns: 26px 26px 1.2fr 1fr 1.6fr 30px; gap: 8px; align-items: center; padding: 10px 12px; }
.stage .hd .num { font-weight: 700; color: var(--blue); text-align: center; }
.stage .hd input[type=text] { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; }
.stage .bd { border-top: 1px dashed var(--line); padding: 8px 12px 12px 72px; }
.stage .fld { display: grid; grid-template-columns: 22px 1fr 110px 90px 30px; gap: 6px; align-items: center; padding: 2px 0; font-size: 13px; }
.stage .fld.off .lbl { text-decoration: line-through; color: var(--muted); }
.stage .fld input[type=text], .stage .fld select { border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; background: transparent; width: 100%; }
.stage .fld input[type=text]:hover, .stage .fld select:hover, .stage .fld input[type=text]:focus { border-color: var(--line); background: var(--white); }
.tag { font-size: 10px; border-radius: 4px; padding: 1px 5px; background: #f1ece2; color: #7a6040; }
.arrow { text-align: center; color: var(--blue-m); font-size: 18px; line-height: 1; margin: -4px 0 6px; }

/* Runbook */
.phase { margin-bottom: 20px; }
.phase h2 { display: flex; align-items: center; gap: 10px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 6px 10px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.step.done { background: #f7fbf8; border-color: #cfe6d7; }
.step.done .st { color: var(--ok); text-decoration: line-through; text-decoration-color: rgba(47,125,79,.4); }
.step.info { background: var(--blue-l); border-color: var(--blue-m); grid-template-columns: 1fr; }
.step input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ok); margin-top: 2px; cursor: pointer; }
.step .st { font-weight: 600; }
.step .who { font-size: 11px; margin-left: 8px; }
.step .body p { margin: 5px 0; font-size: 13px; color: #33333d; }
.step .meta { font-size: 11px; color: var(--muted); margin-top: 6px; }
.step .note { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; margin-top: 6px; min-height: 32px; resize: vertical; }
.cmd { position: relative; margin: 8px 0 2px; }
.cmd .lab { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.cmd pre { margin: 0; background: #1f2236; color: #e8eaf6; border-radius: 8px; padding: 10px 12px; font-size: 12px; overflow-x: auto; font-family: 'IBM Plex Mono', ui-monospace, monospace; line-height: 1.5; }
.cmd .copy { position: absolute; top: 18px; right: 6px; background: var(--white); border: 0; border-radius: 5px; font-size: 11px; padding: 3px 8px; color: var(--blue); opacity: .9; }
.tbd { background: var(--tbd); color: #6a4e00; border-radius: 4px; padding: 0 4px; font-weight: 600; }
pre .tbd { background: #6a5a10; color: #fff3c4; }

/* Outputs */
.outs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.out h3 { margin-top: 0; }
pre.preview { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 12px; white-space: pre-wrap; max-height: 560px; overflow: auto; font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.miss li { margin: 3px 0; }

/* Login */
.login { max-width: 380px; margin: 9vh auto; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 12px; padding: 28px; }
.login h1 { margin-bottom: 2px; }
.login .f { margin-top: 12px; }
.err { color: var(--pink-d); font-size: 13px; margin-top: 10px; min-height: 18px; }

.modal-bg { position: fixed; inset: 0; background: rgba(27,27,34,.35); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 100; }
.modal { background: var(--white); border-radius: 12px; padding: 22px 24px; width: 440px; max-width: 92vw; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 860px) { .ws { grid-template-columns: 1fr; } .side { position: static; } .fields { grid-template-columns: 1fr; } }

/* Playbook + inline code */
code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .92em; background: var(--blue-l); color: var(--blue-d); padding: 1px 5px; border-radius: 4px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.toc a { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--white); border: 1px solid var(--line); color: var(--blue); text-decoration: none; }
.toc a:hover { border-color: var(--blue); }
.card.playbook { scroll-margin-top: 70px; }
.card.playbook h2 { margin-top: 0; }
.card.playbook p, .card.playbook li { font-size: 13.5px; line-height: 1.55; color: #33333d; }
.card.playbook ul { padding-left: 20px; margin: 6px 0; }
.card.playbook li { margin: 4px 0; }
.tip { background: var(--pink-l); border-left: 3px solid var(--pink); border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 10px 0 4px; }

/* Google sign-in + account */
.btn.google { display: inline-flex; align-items: center; gap: 10px; background: var(--white); color: #3c4043; border: 1px solid #dadce0; font-weight: 500; margin-top: 18px; text-decoration: none; }
.btn.google:hover { background: #f8f9fb; border-color: #c4c7cc; }
.btn.google .g { display: inline-flex; }
#whoName { cursor: pointer; }
#whoName:hover { text-decoration: underline; }
.card.ok { background: #e6f3ec; border-color: #cfe6d7; color: var(--ok); }
ul.plain { padding-left: 18px; margin: 6px 0 12px; font-size: 13px; }
a.btn { text-decoration: none; }
/* Tall modals: scroll inside, buttons stay visible */
.modal-bg { padding: 4vh 12px; overflow-y: auto; }
.modal { max-height: 92vh; overflow-y: auto; }
.modal .actions { position: sticky; bottom: -22px; background: var(--white); padding: 12px 0 4px; margin-bottom: -4px; border-top: 1px solid var(--line); }

/* Owner documents editor */
.docedit { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.mdedit { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12.5px/1.55 'IBM Plex Mono', ui-monospace, monospace; resize: vertical; }
.docprev { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.btn.disabled { opacity: .45; pointer-events: none; }
@media (max-width: 1100px) { .docedit { grid-template-columns: 1fr; } }
/* Intake designer: dropdown choices row under select / multi fields */
.stage .fld .opts { grid-column: 2 / -1; border: 1px solid var(--line) !important; background: var(--white) !important; font-size: 12px; }
.stage .fld .opts.need { border-color: #e8d98a !important; background: #fffdf2 !important; }

/* ── Prospects ── */
.two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.planws { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .two, .planws { grid-template-columns: 1fr; } }
.docprev.tall { height: 72vh; }
.fit { color: var(--pink); letter-spacing: 1px; font-size: 11px; } .fit i { color: var(--line); font-style: normal; }
.tier { display: inline-block; min-width: 20px; text-align: center; border-radius: 5px; padding: 0 5px; font-size: 12px; color: #fff; background: var(--muted); }
.tier.tA { background: var(--pink); } .tier.tB { background: var(--blue); } .tier.tC { background: #8a8a96; }
.tag { display: inline-block; font-size: 11px; background: var(--blue-l); color: var(--blue-d); border-radius: 4px; padding: 0 6px; margin: 2px 4px 0 0; }
.bulk { position: sticky; top: 64px; z-index: 5; background: var(--blue-l); border-color: var(--blue-m); }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px 12px 3px 0; vertical-align: top; white-space: nowrap; font-size: 12px; }
table.kv td { padding: 3px 0; vertical-align: top; }
.feed .note { border-top: 1px solid var(--line); padding: 8px 0; }
.feed .note.system .nb, .feed .note.import .nb { color: var(--muted); font-size: 12px; }
.feed .nb, .msg .mb { white-space: pre-wrap; overflow-wrap: anywhere; }
.pchat { position: sticky; top: 70px; }
.pchat .msgs { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.msg { border-radius: 10px; padding: 8px 11px; max-width: 94%; }
.msg.user { background: var(--blue-l); align-self: flex-end; }
.msg.assistant { background: var(--bg); border: 1px solid var(--line); align-self: flex-start; }
.msg.error { border-color: var(--pink); background: var(--pink-l); }
.chip { background: var(--white); border: 1px solid var(--blue-m); color: var(--blue); border-radius: 14px; padding: 3px 10px; font-size: 12px; }
.chip:hover { background: var(--blue-l); } .chip:disabled { opacity: .5; }
.star { background: none; border: 0; font-size: 18px; color: var(--muted); padding: 0 4px; } .star.on { color: #d49b00; }
details.sources { margin-top: 8px; font-size: 12px; } details.sources ol { margin: 6px 0; padding-left: 20px; }
table.mapt select { min-width: 220px; }
.pchat textarea, .feed textarea, .card > div > textarea { width: 100%; }
.msg .mb code { font-size: 12px; background: var(--blue-l); padding: 0 3px; border-radius: 3px; }

/* ── Phones and small tablets ── */
.choices { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.apps { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.outs { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
img, iframe { max-width: 100%; }
/* Grid columns must not grow to fit wide content (tables, code) */
.ws > *, .two > *, .planws > *, .docedit > *, .fields > *, .step > * { min-width: 0; }
@media (max-width: 860px) {
  header.top { flex-wrap: wrap; height: auto; gap: 4px 12px; padding: 8px 14px 0; }
  nav.main { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 10px 6px; width: calc(100% + 28px); }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main a { white-space: nowrap; }
  .brand span { display: none; }
  .who #whoName { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding: 14px 14px 70px; }
  h1 { font-size: 19px; overflow-wrap: anywhere; }
  .card { padding: 14px; }
  /* iOS zooms into inputs smaller than 16px */
  input, select, textarea { font-size: 16px !important; }
  /* Wide tables scroll sideways inside their box instead of stretching the page */
  table.list, table.rows, .card > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.list td, table.list th { padding: 9px 10px; }
  table.list td input, table.list td select, table.list td textarea, table.rows td input, table.rows td select { min-width: 120px; }
  table.kv th { white-space: normal; }
  /* Workspace tabs become a swipeable strip above the page */
  .side { position: relative; top: auto; display: flex; overflow-x: auto; gap: 2px; padding: 6px; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side a { white-space: nowrap; flex: none; }
  .side a .n, .side a .ok { margin-left: 4px; }
  .side hr { border: 0; border-left: 1px solid var(--line); margin: 4px 2px; }
  .ws { gap: 12px; grid-template-columns: minmax(0, 1fr); }
  .two, .planws, .docedit, .fields { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: 26px minmax(0, 1fr); }
  .step .body p, .intro, .sub, .card { overflow-wrap: anywhere; }
  select, input, textarea { max-width: 100%; }
  .wshead { gap: 8px; }
  .wshead > .grow { flex-basis: 100%; }
  .bulk, .pchat { position: static; }
  .pchat .msgs { max-height: 60vh; }
  .msg { max-width: 100%; }
  .savebar { padding: 8px 0; flex-wrap: wrap; }
  .mdedit, .docprev { height: 60vh; }
  .docprev.tall { height: 70vh; }
  .modal { padding: 18px 16px; }
  .modal-bg { padding: 3vh 8px; }
  .app .opts { flex-wrap: wrap; margin-left: 0; }
  .app .s { margin-left: 0; }
  .step { padding: 10px 12px; }
  .login { margin: 5vh 14px; padding: 22px 18px; }
  /* Intake designer: stage header and field rows wrap */
  .stage .hd { grid-template-columns: 26px 22px 1fr 30px; }
  .stage .hd input[type=text]:nth-of-type(1) { grid-column: 3; }
  .stage .hd input[type=text]:nth-of-type(2), .stage .hd input[type=text]:nth-of-type(3) { grid-column: 1 / -1; }
  .stage .hd .x { grid-column: 4; grid-row: 1; }
  .stage .bd { padding: 8px 10px 12px; }
  .stage .fld { grid-template-columns: 22px 1fr 30px; border-bottom: 1px dashed var(--line); padding: 6px 0; }
  .stage .fld > .lbl { grid-column: 2; }
  .stage .fld > .x { grid-column: 3; grid-row: 1; }
  .stage .fld > select { grid-column: 2; }
  .stage .fld > label { grid-column: 2; }
}

/* Raw leads */
@keyframes pulse { 50% { opacity: .35; } }
.chip.on:hover { background: var(--blue-d); }

/* Progress indicator: spinner + time so far + time left */
.eta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.spin { width: 12px; height: 12px; border: 2px solid var(--blue-m); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* First-year rank: one blue ramp, light → dark (validated: monotone, visible steps, light end ≥ 2:1) */
.rk { display: inline-block; min-width: 24px; text-align: center; border-radius: 5px; padding: 1px 6px; font-size: 12px; font-weight: 700; }
.rk.big { font-size: 18px; padding: 2px 9px; } .rk small { font-size: 11px; font-weight: 500; opacity: .8; }
.rk1, .seg.b1 { background: #a7b0dc; color: var(--ink); } .rk2, .seg.b2 { background: #7c88c4; color: var(--ink); }
.rk3, .seg.b3 { background: #4f5ca3; color: #fff; } .rk4, .seg.b4 { background: #283268; color: #fff; } .seg.b0 { background: #d9d9e0; }
.hist { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 150px; margin: 8px 0 4px; border-bottom: 1px solid var(--line); padding-top: 18px; }
.hcol { flex: 1; min-width: 24px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; background: none; border: 0; padding: 0; position: relative; }
.hcol:hover .hbar, .hcol:focus-visible .hbar { filter: brightness(1.2); }
.hcol.dim .hbar { opacity: .35; } .hcol.on .hbar { outline: 2px solid var(--pink); outline-offset: 1px; }
.hbar { width: min(24px, 80%); background: #465496; border-radius: 4px 4px 0 0; display: block; }
.hbar.none { background: #b9b9c4; }
.hval { font-size: 11px; color: var(--ink); min-height: 15px; }
.hx { position: absolute; bottom: -18px; font-size: 11px; color: var(--muted); }
.hist + .sub { margin-top: 22px; }
.tip-pop { position: absolute; top: -6px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 5; }
.mini { display: flex; gap: 2px; height: 10px; }
.mini .seg { display: block; min-width: 3px; } .mini .seg:first-child { border-radius: 4px 0 0 4px; } .mini .seg:last-child { border-radius: 0 4px 4px 0; } .mini .seg:only-child { border-radius: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.legend i.seg { display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
table.rankgrp td, table.rankgrp th { padding: 6px 8px; } table.rankgrp th { white-space: nowrap; }

/* Our fields (Raw leads): new-field inputs in the import mapping and the field manager */
.newf { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.newf input, .fieldmgr input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font: inherit; }
textarea.fval { width: 100%; min-height: 30px; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; font: inherit; resize: vertical; background: transparent; }
textarea.fval:hover, textarea.fval:focus { border-color: var(--line); background: #fff; }
table.list.tech td { vertical-align: top; font-size: 13px; }
table.list.tech td:last-child { min-width: 220px; }

/* ── Portal shell: shared nav with group drop-downs ── */
.brand { flex: none; }
.brand span:empty { display: none; }
nav.main { align-items: center; }
nav.main a, nav.main .ddb { display: inline-flex; align-items: center; gap: 6px; }
nav.main .ic { font-size: 14px; }
.dd { position: relative; }
.ddb { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 6px; font-weight: 500; }
.dd.on > .ddb, .ddb:hover, .dd.open > .ddb { color: var(--blue); background: var(--blue-l); }
.ddm { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(27,27,34,.12); padding: 6px; z-index: 60; flex-direction: column; }
.dd.open .ddm { display: flex; }
.ddm a { padding: 8px 10px !important; color: var(--ink) !important; }
.ddm a.on { background: var(--blue) !important; color: #fff !important; }
.who a#whoName { color: var(--muted); text-decoration: none; }
.who a#whoName:hover { color: var(--blue); }
.login .logo { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.login .logo b { font-size: 30px; font-weight: 700; color: var(--blue); letter-spacing: .3px; }
.login .logo span { font-size: 15px; font-weight: 600; color: var(--pink); }

/* ── Portal home ── */
.phead { margin: 6px 0 18px; }
.phead h1 { font-size: 26px; }
.pgroup { margin-bottom: 22px; }
.pgroup > h3 { margin: 0 0 10px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.pcard { display: flex; gap: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.pcard:hover { border-color: var(--blue-m); box-shadow: 0 6px 22px rgba(70,84,150,.12); transform: translateY(-1px); }
.pic { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--blue-l); display: grid; place-items: center; font-size: 24px; }
.pname { font-weight: 600; font-size: 16px; color: var(--blue-d); }
.pdesc { color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.pcounts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
span.chip { display: inline-block; cursor: default; white-space: nowrap; font-size: 11px; padding: 2px 9px; }
span.chip:hover { background: var(--white); }
.chip.alert { border-color: #e7b9d3; background: var(--pink-l); color: var(--pink); }
.chip.ok { border-color: #cfe6d7; background: #e6f3ec; color: var(--ok); }
.chip.warn { border-color: #ecd9a6; background: #fff8e1; color: var(--warn); }
a.chip.link { text-decoration: none; display: inline-block; margin: 0 6px 6px 0; }
.chipset { display: flex; flex-wrap: wrap; }

/* ── App Catalog ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--blue); border-bottom-color: var(--pink); }
.pipe { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.pstep { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-align: left; display: flex; flex-direction: column; gap: 2px; position: relative; }
.pstep b { font-size: 20px; color: var(--blue-d); }
.pstep span { font-size: 12px; color: var(--muted); }
.pstep.on { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); }
.pstep::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; }
.pstep.s-idea::before { background: #c9c9d4; } .pstep.s-building::before { background: #e0a93b; } .pstep.s-lab::before { background: var(--blue); }
.pstep.s-client-ready::before { background: var(--ok); } .pstep.s-retired::before { background: #8b8b96; }
.ctools { gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.csearch { flex: 1 1 260px; max-width: 420px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--white); }
.ctools select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--white); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--white); border: 0; padding: 6px 11px; color: var(--muted); }
.seg button.on { background: var(--blue); color: #fff; }
.cgroup { margin-bottom: 20px; }
.cgroup > h3 { margin: 0 0 8px; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.ccard { display: flex; flex-direction: column; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.ccard:hover { border-color: var(--blue-m); box-shadow: 0 6px 20px rgba(70,84,150,.10); }
.ccard.dim { opacity: .6; }
.ctop { display: flex; gap: 10px; align-items: flex-start; }
.cic { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--blue-l); display: inline-grid; place-items: center; font-size: 18px; }
.cic.big { width: 52px; height: 52px; border-radius: 12px; font-size: 26px; }
.cname { font-weight: 600; color: var(--blue-d); margin-bottom: 3px; }
.ctag { font-size: 12.5px; color: #44444e; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cfoot { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.cstat { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.cstat.s-idea { background: #f0f0f4; color: #5b5b66; } .cstat.s-building { background: #fff3dc; color: #8a5a00; } .cstat.s-lab { background: var(--blue-l); color: var(--blue); }
.cstat.s-client-ready { background: #e6f3ec; color: var(--ok); } .cstat.s-retired { background: #ececef; color: #77777f; }
.meter { display: inline-flex; gap: 3px; flex: none; padding-top: 4px; }
.meter i { width: 7px; height: 14px; border-radius: 2px; background: #e3e3ea; }
.meter i.on { background: var(--ok); }
.cpane { min-width: 0; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.bcol { background: #eeeef3; border-radius: 10px; padding: 8px; min-height: 80px; }
.bhead { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 4px 6px 8px; }
.bcard { background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--blue-m); border-radius: 8px; padding: 9px 10px; margin-bottom: 7px; cursor: pointer; font-size: 13px; }
.bcard:hover { border-color: var(--blue-m); }
.bcard.t-bug { border-left-color: var(--pink); } .bcard.t-feature { border-left-color: var(--blue); } .bcard.t-generalize { border-left-color: var(--ok); } .bcard.t-data { border-left-color: #e0a93b; }
details.card .bcard { margin-top: 7px; }
.thread .note { border-left: 2px solid var(--blue-m); padding: 4px 10px; margin: 6px 0; }
.thread .nb { white-space: pre-wrap; font-size: 13px; }
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(140px, .6fr) 28px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 10px; }
.fcol { display: flex; flex-direction: column; gap: 6px; }
.fcol.mid { align-items: stretch; }
.flab { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.fbox { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fafafc; font-size: 12.5px; text-decoration: none; color: var(--ink); }
.fbox.opt { border-style: dashed; }
.fbox.app { background: var(--blue-l); border-color: var(--blue-m); color: var(--blue-d); }
.fbox.me { background: var(--blue); color: #fff; border-color: var(--blue); display: flex; align-items: center; gap: 8px; padding: 12px; }
.fbox.me .cic { background: rgba(255,255,255,.18); }
.farrow { color: var(--blue-m); font-size: 22px; text-align: center; }
table.list.edit td { vertical-align: top; padding: 6px 8px; }
table.list.edit textarea, table.list.edit select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 12.5px; resize: vertical; }
.cgridx { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cgridx textarea { width: 100%; }
.savebar { justify-content: flex-end; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 6px; }
.stats { display: flex; gap: 10px; margin: 6px 0 10px; }
.stat { flex: 1; background: var(--blue-l); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat b { font-size: 20px; color: var(--blue-d); }
.stat span { font-size: 11px; color: var(--muted); }
.aigrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.aibox { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; }
.aibox p { flex: 1; margin: 4px 0 10px; }
.aibox .btn { align-self: flex-start; }
.pickrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
table.list.review td { vertical-align: top; font-size: 12.5px; }
.md { font-size: 13.5px; line-height: 1.55; color: #2b2b33; overflow-wrap: anywhere; }
.md h2 { font-size: 16px; margin: 14px 0 6px; } .md h3 { margin: 14px 0 6px; } .md h4, .md h5 { margin: 12px 0 4px; font-size: 13px; color: var(--blue-d); }
.md ul, .md ol { padding-left: 20px; margin: 4px 0 8px; } .md p { margin: 4px 0 8px; }
.md.small { font-size: 12px; max-height: 260px; overflow-y: auto; }
.mdt { overflow-x: auto; margin: 6px 0; }
.connout { min-height: 120px; }
.store { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.shero { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.stitle { font-size: 19px; font-weight: 600; color: var(--blue-d); }
.stag { color: var(--muted); font-size: 13px; }
.store h4 { color: var(--pink); text-transform: uppercase; font-size: 12px; letter-spacing: .7px; margin: 16px 0 4px; }
.sben { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.sben li { background: var(--blue-l); border-radius: 8px; padding: 8px 10px 8px 28px; position: relative; font-size: 13px; }
.sben li::before { content: '✓'; position: absolute; left: 10px; color: var(--ok); font-weight: 700; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.scard { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-align: left; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.scard:hover { border-color: var(--blue-m); box-shadow: 0 6px 20px rgba(70,84,150,.10); }
@media (max-width: 860px) {
  .dd .ddb { display: none; }
  .dd .ddm, .dd.open .ddm { display: flex; flex-direction: row; position: static; box-shadow: none; border: 0; padding: 0; min-width: 0; background: none; }
  .ddm a { padding: 8px 12px !important; color: var(--muted) !important; }
  .pipe { grid-template-columns: repeat(5, minmax(110px, 1fr)); overflow-x: auto; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .farrow { transform: rotate(90deg); }
  .stats { flex-wrap: wrap; }
}
.phome { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; align-items: start; }
.pcol { display: flex; flex-direction: column; gap: 12px; }
.fbox .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fcol { max-height: 420px; overflow-y: auto; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* ── Targeting: filters box, technology column, upload chooser ── */
.card.filters { padding: 12px 16px; }
.flabel { font-weight: 600; color: var(--blue-d); margin-bottom: 8px; }
.frow { display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; }
.frow .fl { flex: none; width: 84px; padding-top: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.frow > div { flex: 1; flex-wrap: wrap; }
.frow select { flex: none; width: auto; border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--white); max-width: 100%; }
.techcell { min-width: 190px; max-width: 280px; font-size: 12.5px; }
.tflags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.tag.bad { background: var(--pink-l); color: var(--pink); }
.tag.good { background: #e6f3ec; color: var(--ok); }
.uptiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.uptile { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); background: var(--white); }
.uptile:hover { border-color: var(--blue-m); }
.uptile.on { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); background: var(--pink-l); }
.upic { font-size: 26px; flex: none; }
@media (max-width: 860px) { .frow { flex-direction: column; gap: 4px; } .frow .fl { width: auto; padding-top: 0; } }
.tagedit { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.utag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; background: #fdf1e3; color: #8a5300; border: 1px solid #f1d6ae; border-radius: 99px; padding: 1px 8px; margin: 2px 4px 0 0; }
.utag button { border: 0; background: none; color: inherit; padding: 0 0 0 2px; font-size: 13px; line-height: 1; opacity: .7; }
.utag button:hover { opacity: 1; }
.utag.add { background: var(--white); color: var(--blue); border: 1px dashed var(--blue-m); cursor: pointer; }
.utag.sm { font-size: 10.5px; padding: 0 7px; }
.tagin { border: 1px solid var(--blue-m); border-radius: 99px; padding: 2px 10px; font-size: 12px; min-width: 240px; }
.frow select { max-width: 230px; text-overflow: ellipsis; }
.rowtags { margin-top: 3px; }
.rowtags .utag { font-size: 10.5px; padding: 0 7px; }
.rowtags .utag.add { opacity: .55; }
tr:hover .rowtags .utag.add { opacity: 1; }
.rowtags .tagin { min-width: 200px; font-size: 12px; }
/* Compact lists: narrow columns shrink to their content; Company / Technology take the rest. */
table.list.compact th, table.list.compact td { width: 1%; white-space: nowrap; padding: 8px 10px; vertical-align: top; }
table.list.compact th.grow { width: auto; }
table.list.compact td.grow { width: auto; white-space: normal; }
table.list.compact td.wrap { white-space: normal; min-width: 140px; max-width: 220px; }
table.list.compact td.co { min-width: 280px; }
table.list.compact td.techcell { min-width: 220px; max-width: none; width: 36%; }
table.list.compact td.co { width: 46%; }
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.list.compact td.done { font-size: 12px; letter-spacing: -1px; }
table.list.compact td.done span { margin-right: 1px; }
table.list.compact th { font-size: 10.5px; letter-spacing: .4px; }
table.list.compact .pill { padding: 1px 7px; font-size: 10.5px; }
table.list.compact .btn.sm { padding: 4px 8px; }
/* Catalog: drag a card to another group */
.ccard[draggable] { cursor: grab; }
.cgroup.drop { border-radius: 12px; padding: 4px; margin-left: -4px; margin-right: -4px; transition: background .12s, box-shadow .12s; }
.dragging .cgroup.drop { box-shadow: inset 0 0 0 1px var(--blue-m); }
.cgroup.drop.over { background: var(--blue-l); box-shadow: inset 0 0 0 2px var(--blue); }
.newgrp { display: none; border: 2px dashed var(--blue-m); border-radius: 12px; padding: 18px; text-align: center; color: var(--blue); font-weight: 500; margin-top: 8px; }
.dragging .newgrp { display: block; }
.newgrp.over { background: var(--blue-l); border-color: var(--blue); }
.draghint { margin: -4px 0 8px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
