/* ============================== TOKENS ==============================
   Type ramp — four sizes, each a real step from the last (~1.28x), and
   nothing below 11px:
     11  labels, metadata, table headers, timestamps
     14  body, controls, table cells
     18  card headings
     23  page titles, record titles, the figures on the tape
   Anything outside this ramp is a bug, not a decision.                */
/* Native controls — date pickers, select popups, scrollbars — read this. */
:root{
  color-scheme:light;
  --bg:#F3F6F5; --surface:#FFFFFF; --surface-2:#F8FAF9; --surface-3:#EEF2F1;
  --line:#E0E6E4; --line-strong:#C8D2CF;
  /* Borders on things you can click or type into. Held at 3:1 against
     their own surface, which --line-strong is not and does not need to be. */
  --control-line:#7E8E89;
  --ink:#111715; --ink-2:#3F504A; --ink-3:#586863;
  --accent:#0C6E63; --accent-2:#0A5B52; --accent-soft:#DFEFEC; --accent-ink:#07443D;
  --ok:#1C7A45; --ok-soft:#E1F2E7;
  --warn:#95590A; --warn-soft:#FAEEDB;
  --crit:#A62520; --crit-soft:#FBE6E4;
  --focus:#0C6E63; --on-accent:#FFFFFF;
  --select:#CFE8E3; --select-ink:#07443D;
  /* Elevation is declared once per surface: a border OR a shadow, never both. */
  --shadow-sm:0 1px 2px rgba(17,23,21,.07);
  --shadow-md:0 3px 6px rgba(17,23,21,.09), 0 10px 20px -12px rgba(17,23,21,.30);
  --shadow-lg:0 6px 12px rgba(17,23,21,.10), 0 26px 44px -22px rgba(17,23,21,.38);
  --s-new:#6C7D77; --s-attempted:#7A6A9C; --s-connected:#2F7F86; --s-contacted:#3C6A88; --s-demo:#4A7629;
  --s-proposed:#8A6A1F;
  --s-won:#1C7A45; --s-lost:#93A09B; --s-invalid:#A8452E;
  --grid:rgba(17,23,21,.07);
  --r-sm:5px; --r-md:8px; --r-lg:12px;
  --t-xs:11px; --t-sm:14px; --t-md:18px; --t-lg:23px;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --bg:#0B100F; --surface:#131A18; --surface-2:#182120; --surface-3:#1E2A27;
    --line:#222E2B; --line-strong:#33423E; --control-line:#5E736D;
    --ink:#E7EEEB; --ink-2:#A7B6B1; --ink-3:#7C8D88;
    --accent:#3BC4B0; --accent-2:#57D6C4; --accent-soft:#10312D; --accent-ink:#9AE6DA;
    --ok:#54D083; --ok-soft:#11301F;
    --warn:#E9AB43; --warn-soft:#312512;
    --crit:#F2746C; --crit-soft:#381A18;
    --focus:#57D6C4; --on-accent:#06211D;
    --select:#0F4740; --select-ink:#D9F5F0;
    --shadow-sm:0 1px 2px rgba(0,0,0,.5);
    --shadow-md:0 3px 6px rgba(0,0,0,.5), 0 10px 20px -12px rgba(0,0,0,.8);
    --shadow-lg:0 6px 12px rgba(0,0,0,.5), 0 26px 44px -22px rgba(0,0,0,.9);
    --s-new:#8A9B95; --s-attempted:#A898CC; --s-connected:#5FB9C0; --s-contacted:#6BA3C6; --s-demo:#8CC257; --s-proposed:#D9B35E;
    --s-won:#54D083; --s-lost:#6E7C77; --s-invalid:#E58A6F;
    --grid:rgba(231,238,235,.09);
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0B100F; --surface:#131A18; --surface-2:#182120; --surface-3:#1E2A27;
  --line:#222E2B; --line-strong:#33423E; --control-line:#5E736D;
  --ink:#E7EEEB; --ink-2:#A7B6B1; --ink-3:#7C8D88;
  --accent:#3BC4B0; --accent-2:#57D6C4; --accent-soft:#10312D; --accent-ink:#9AE6DA;
  --ok:#54D083; --ok-soft:#11301F;
  --warn:#E9AB43; --warn-soft:#312512;
  --crit:#F2746C; --crit-soft:#381A18;
  --focus:#57D6C4; --on-accent:#06211D;
  --select:#0F4740; --select-ink:#D9F5F0;
  --shadow-sm:0 1px 2px rgba(0,0,0,.5);
  --shadow-md:0 3px 6px rgba(0,0,0,.5), 0 10px 20px -12px rgba(0,0,0,.8);
  --shadow-lg:0 6px 12px rgba(0,0,0,.5), 0 26px 44px -22px rgba(0,0,0,.9);
  --s-new:#8A9B95; --s-attempted:#A898CC; --s-connected:#5FB9C0; --s-contacted:#6BA3C6; --s-demo:#8CC257; --s-proposed:#D9B35E;
  --s-won:#54D083; --s-lost:#6E7C77; --s-invalid:#E58A6F;
  --grid:rgba(231,238,235,.09);
}

/* ============================== BASE ============================== */
*{box-sizing:border-box}
img{max-width:100%; height:auto}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"IBM Plex Sans","Segoe UI",system-ui,-apple-system,sans-serif;
  font-size:var(--t-sm); line-height:1.5; -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{margin:0; text-wrap:balance; letter-spacing:-.015em; font-weight:600}
p{margin:0}
button,input,select,textarea{font:inherit; color:inherit}
:focus-visible{outline:2px solid var(--focus); outline-offset:2px; border-radius:3px}

/* Browser surfaces the design still owns. */
::selection{background:var(--select); color:var(--select-ink)}
input,textarea{caret-color:var(--accent)}
*{scrollbar-color:var(--line-strong) transparent; scrollbar-width:thin}
::-webkit-scrollbar{width:10px; height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--line-strong); border-radius:100px; border:3px solid transparent; background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--ink-3); background-clip:content-box}

/* Records carry names typed by other people. Never let one break the layout. */
.cell-strong,.cell-sub,.lead-card .n,.lead-card .c,.arow .t,.arow .s,
.drawer-head h2,.drawer-head .muted,.log-text{
  overflow-wrap:anywhere; word-break:break-word; min-width:0;
}

.mono{font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace; font-variant-numeric:tabular-nums}
.num{font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace; font-variant-numeric:tabular-nums; letter-spacing:-.01em}
.eyebrow{
  font-family:"IBM Plex Mono",ui-monospace,monospace; font-size:var(--t-xs); font-weight:500;
  text-transform:uppercase; letter-spacing:.1em; color:var(--ink-3);
}
.muted{color:var(--ink-3)}
.hidden{display:none !important}
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
.skip{
  position:absolute; left:8px; top:-60px; z-index:200; padding:9px 14px;
  background:var(--accent); color:var(--on-accent); border-radius:var(--r-md);
  font-size:var(--t-sm); font-weight:600; text-decoration:none;
}
.skip:focus{top:8px}
@media (max-width:820px){.skip{min-height:44px; display:inline-flex; align-items:center}}

/* ============================== SHELL ============================== */
.app{display:grid; grid-template-columns:212px 1fr; height:100vh; overflow:hidden}
.rail{
  background:var(--surface); border-right:1px solid var(--line);
  display:flex; flex-direction:column; gap:2px; padding:16px 10px; overflow-y:auto;
}
.brand{display:flex; gap:10px; align-items:center; padding:2px 8px 16px}
/* The square mark carries no dark text — just the gradient, a white face and
   dark eyes — so it reads on the light and dark rail alike, with no plate. */
.brand-logo{width:34px; height:34px; flex:none; display:block}
.brand-name{font-weight:600; font-size:var(--t-sm); line-height:1.15; letter-spacing:-.01em}
.brand-sub{font-size:var(--t-xs); letter-spacing:.1em; text-transform:uppercase; color:var(--ink-3); font-family:"IBM Plex Mono",monospace}
.nav-btn{
  display:flex; align-items:center; gap:10px; width:100%; text-align:left;
  padding:8px 9px; border:0; border-radius:var(--r-md); background:transparent;
  color:var(--ink-2); cursor:pointer; font-size:var(--t-sm); font-weight:500;
}
.nav-btn:hover{background:var(--surface-3); color:var(--ink)}
.nav-btn[aria-current="page"]{background:var(--accent-soft); color:var(--accent-ink); font-weight:600}
.nav-btn .ico{width:16px; height:16px; flex:none; opacity:.85}
.nav-btn .count{margin-left:auto; font-size:var(--t-xs); color:var(--ink-3); font-family:"IBM Plex Mono",monospace}
.nav-btn[aria-current="page"] .count{color:var(--accent-ink)}
.rail-foot{margin-top:auto; padding:14px 8px 0; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:8px}
.save-chip{display:flex; align-items:center; gap:7px; font-size:var(--t-xs); color:var(--ink-3); line-height:1.35}
.save-dot{width:7px; height:7px; border-radius:50%; background:var(--ok); flex:none}
.save-chip[data-state="saving"] .save-dot{background:var(--warn); animation:pulse 1s ease-in-out infinite}
.save-chip[data-state="local"] .save-dot{background:var(--warn)}
.save-chip[data-state="error"] .save-dot{background:var(--crit)}
@keyframes pulse{50%{opacity:.3}}
@media (prefers-reduced-motion: reduce){*{animation-duration:.001ms !important; transition-duration:.001ms !important}}

.main{display:flex; flex-direction:column; overflow:hidden; min-width:0}
.topbar{
  display:flex; align-items:center; gap:14px; padding:14px 26px;
  border-bottom:1px solid var(--line); background:var(--surface); flex:none;
}
.topbar h1{font-size:var(--t-lg)}
.topbar .title{min-width:0; overflow:hidden}
.topbar .title h1{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.topbar .sub{font-size:var(--t-xs); color:var(--ink-3); margin-top:1px}
.topbar-actions{margin-left:auto; display:flex; gap:8px; align-items:center; flex:none}
.search{position:relative}
.search input[type=text]{
  width:210px; padding:8px 10px 8px 30px; border:1px solid var(--control-line);
  border-radius:var(--r-md); background:var(--surface-2); font-size:var(--t-sm);
}
.search input[type=text]::placeholder{color:var(--ink-3)}
.search svg{position:absolute; left:9px; top:50%; transform:translateY(-50%); color:var(--ink-3); pointer-events:none}
.view-wrap{overflow-y:auto; padding:22px 26px 60px; flex:1}
.view{display:none}
.view.active{display:block}

/* ============================== CONTROLS ============================== */
.btn{
  display:inline-flex; align-items:center; gap:6px; padding:8px 13px; border-radius:var(--r-md);
  border:1px solid var(--control-line); background:var(--surface); color:var(--ink);
  font-size:var(--t-sm); font-weight:500; cursor:pointer; white-space:nowrap;
}
.btn:hover{background:var(--surface-3)}
.btn-primary{background:var(--accent); border-color:var(--accent); color:var(--on-accent)}
.btn-primary:hover{background:var(--accent-2); border-color:var(--accent-2)}
.btn-ghost{border-color:transparent; background:transparent; color:var(--ink-2)}
.btn-ghost:hover{background:var(--surface-3); color:var(--ink)}
.btn-danger{color:var(--crit); border-color:var(--control-line)}
.btn-danger:hover{background:var(--crit-soft); border-color:var(--crit)}
.btn-sm{padding:6px 10px; font-size:var(--t-sm)}
.btn:disabled{opacity:.45; cursor:not-allowed}
/* A text button that sits inline in a sentence or a list foot. */
.btn-link{
  border:0; background:transparent; padding:2px 0; color:var(--accent);
  font-size:var(--t-xs); font-weight:600; cursor:pointer; text-align:left;
}
.btn-link:hover{color:var(--accent-2); text-decoration:underline; text-underline-offset:3px}

label.field{display:flex; flex-direction:column; gap:4px; min-width:0}
label.field > span{font-size:var(--t-xs); font-weight:500; color:var(--ink-3); letter-spacing:.02em}
/* datetime-local has a wide intrinsic width; without min-width:0 it pushes a
   two-column field grid past the drawer instead of shrinking. */
input[type=text],input[type=email],input[type=date],input[type=datetime-local],
input[type=time],input[type=number],input[type=tel],select,textarea{
  width:100%; min-width:0; padding:8px 9px; border:1px solid var(--control-line);
  border-radius:var(--r-sm); background:var(--surface-2); font-size:var(--t-sm);
}
textarea{resize:vertical; min-height:70px; line-height:1.5}
select{cursor:pointer; appearance:none; background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%); background-position:calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size:5px 5px,5px 5px; background-repeat:no-repeat; padding-right:28px}
input:hover,select:hover,textarea:hover{border-color:var(--ink-3)}

/* ============================== PIECES ============================== */
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg)}
.card-head{display:flex; align-items:baseline; gap:10px; padding:14px 16px 0}
.card-head h2,.card-head h3{font-size:var(--t-md)}
.card-head .hint{margin-left:auto; font-size:var(--t-xs); color:var(--ink-3)}

/* One line of state of play, not a grid of tiles. */
.tape{
  display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 22px;
  padding:0 2px 18px; font-size:var(--t-sm); color:var(--ink-2);
}
.tape .fig{display:flex; align-items:baseline; gap:7px}
.tape .n{font-family:"IBM Plex Mono",monospace; font-variant-numeric:tabular-nums;
  font-size:var(--t-lg); font-weight:600; letter-spacing:-.03em; color:var(--ink)}
.tape .k{font-size:var(--t-xs); color:var(--ink-3)}
.tape .fig.alert .n{color:var(--crit)}

.grid-2{display:grid; grid-template-columns:1.35fr 1fr; gap:14px; align-items:start}
@media (max-width:1080px){.grid-2{grid-template-columns:1fr}}

.pill{
  display:inline-flex; align-items:center; gap:5px; padding:2px 8px; border-radius:100px;
  font-size:var(--t-xs); font-weight:500; line-height:1.6; white-space:nowrap;
  background:var(--surface-3); color:var(--ink-2); border:1px solid transparent;
}
.pill .dot{width:6px; height:6px; border-radius:50%; background:currentColor; flex:none}
.pill.ok{background:var(--ok-soft); color:var(--ok)}
.pill.warn{background:var(--warn-soft); color:var(--warn)}
.pill.crit{background:var(--crit-soft); color:var(--crit)}
.pill.info{background:var(--accent-soft); color:var(--accent-ink)}
.pill.stage{color:#fff}
.stage-swatch{width:8px; height:8px; border-radius:2px; flex:none; display:inline-block}

table{width:100%; border-collapse:collapse; font-size:var(--t-sm)}
.table-wrap{overflow-x:auto; border-radius:var(--r-lg)}
/* Below the point where the columns would start squeezing words apart, the
   table scrolls under a pinned identity column instead of compressing. */
@media (max-width:900px){.table-wrap table{min-width:760px}}
thead th{
  text-align:left; font-size:var(--t-xs); text-transform:uppercase; letter-spacing:.08em;
  color:var(--ink-3); font-weight:500; font-family:"IBM Plex Mono",monospace;
  padding:9px 12px; border-bottom:1px solid var(--line); background:var(--surface-2);
  position:sticky; top:0; z-index:1; white-space:nowrap;
}
tbody td{padding:10px 12px; border-bottom:1px solid var(--line); vertical-align:middle}
tbody tr{cursor:pointer}
tbody tr:hover{background:var(--surface-2)}
tbody tr:focus-within{background:var(--surface-2)}
tbody tr:last-child td{border-bottom:0}
td.r,th.r{text-align:right}
.cell-strong{font-weight:500}
.cell-sub{font-size:var(--t-xs); color:var(--ink-3)}
/* A 1px rule, and always beside a word that says the same thing. */
.risk-stripe{box-shadow:inset 1px 0 0 var(--crit)}
.risk-stripe-w{box-shadow:inset 1px 0 0 var(--warn)}
/* The whole identity cell is the control, so the row is reachable by keyboard. */
.rowbtn{
  display:block; width:100%; text-align:left; border:0; background:transparent;
  padding:0; font:inherit; color:inherit; cursor:pointer;
}

.empty{padding:44px 20px; text-align:center; color:var(--ink-3)}
.empty h4{font-size:var(--t-md); color:var(--ink-2); margin-bottom:5px}
.empty .btn{margin-top:14px}

/* ============================== BOARD ============================== */
.board{display:flex; gap:12px; overflow-x:auto; overscroll-behavior-x:contain;
  padding-bottom:14px; align-items:flex-start; scroll-snap-type:x proximity}
.col{scroll-snap-align:start}
/* Eight columns do not fit a laptop, so the board scrolls sideways and snaps
   to a column. They share the width when there is room, and stop shrinking at
   188px — narrower and a company name no longer fits on a card. */
.col{
  flex:1 1 188px; min-width:188px; max-width:400px;
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--r-lg); display:flex; flex-direction:column; max-height:calc(100vh - 210px);
}
.col.drop{border-color:var(--accent); background:var(--accent-soft)}
/* Name on the first line, count and value on the second, in every column —
   so the stage name never breaks mid-word ("Prospec / ts") and the headers
   line up across the board instead of some wrapping and some not. */
.col-head{padding:10px 12px 9px; border-bottom:1px solid var(--line); display:flex; align-items:center;
  flex-wrap:wrap; gap:2px 7px}
.col-head .name{font-size:var(--t-sm); font-weight:600; white-space:nowrap}
.col-head .n{white-space:nowrap; flex:1 0 100%; padding-left:15px}
.col-head .n{font-size:var(--t-xs); color:var(--ink-3); font-family:"IBM Plex Mono",monospace}
.col-body{padding:9px; display:flex; flex-direction:column; gap:8px; overflow-y:auto}
.col-foot{padding:0 9px 9px}
/* The stage colour tints the whole border rather than hanging a tab off one
   edge — same information, without the accent-stripe tell. */
.lead-card{
  display:block; width:100%; text-align:left; font:inherit; color:inherit;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md);
  padding:10px 11px; cursor:pointer; box-shadow:var(--shadow-sm);
}
.lead-card:hover{border-color:var(--control-line)}
/* Picking mode: the card becomes a checkbox, and says so with a real box
   rather than only a colour, so the selection reads the same to everyone. */
.lead-card.picked{background:var(--accent-soft); border-color:var(--accent)}
.lead-card.pick-locked{opacity:.55; cursor:not-allowed}
.tickbox{
  display:inline-block; width:15px; height:15px; margin-bottom:7px;
  border:1.5px solid var(--control-line); border-radius:4px; vertical-align:-2px;
}
.tickbox.on{
  background:var(--accent); border-color:var(--accent);
  box-shadow:inset 0 0 0 2px var(--surface);
}
.lead-card.dragging{opacity:.4}
.lead-card .n{font-weight:600; font-size:var(--t-sm); letter-spacing:-.01em}
.lead-card .c{font-size:var(--t-xs); color:var(--ink-3); margin-top:1px}
.lead-card .row{display:flex; align-items:center; gap:6px; margin-top:8px; flex-wrap:wrap}
/* A vertical like "Health, Wellness, and Personal Care" has to wrap inside the
   card rather than run out of it. */
.lead-card .pill{white-space:normal; text-align:left}
.lead-card .val{font-size:var(--t-sm); font-weight:600; font-family:"IBM Plex Mono",monospace}

/* ============================== CHARTS ============================== */
.funnel{display:flex; flex-direction:column; gap:7px; padding:14px 16px 16px}
.fn-row{display:grid; grid-template-columns:88px 1fr auto; gap:10px; align-items:center; font-size:var(--t-sm)}
.fn-bar{height:16px; background:var(--surface-3); border-radius:3px; overflow:hidden; position:relative}
.fn-fill{height:100%; width:100%; border-radius:3px 4px 4px 3px; transform-origin:left center;
  transition:transform .25s ease}
.fn-n{font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-2); min-width:56px; text-align:right}
.chart{padding:6px 16px 14px; position:relative}
.chart svg{display:block; width:100%; height:auto; overflow:visible}
.tip{
  position:fixed; z-index:80; pointer-events:none; opacity:0; transition:opacity .1s;
  background:var(--surface); border-radius:var(--r-md);
  box-shadow:var(--shadow-md); padding:7px 10px; font-size:var(--t-sm); max-width:220px;
}
.tip.on{opacity:1}
.tip .t{font-weight:600; margin-bottom:2px}
.legend-note{padding:0 16px 14px; font-size:var(--t-xs); color:var(--ink-3)}

/* ============================== ALERTS ============================== */
.agroup{border-top:1px solid var(--line)}
.agroup:first-of-type{border-top:0}
.agroup-head{
  display:flex; align-items:baseline; gap:9px; padding:11px 16px 3px;
}
.agroup-head h3{font-size:var(--t-xs); font-family:"IBM Plex Mono",monospace;
  text-transform:uppercase; letter-spacing:.1em; font-weight:500; color:var(--ink-3)}
.agroup-head.crit h3{color:var(--crit)}
.agroup-head .n{margin-left:auto; font-size:var(--t-xs); color:var(--ink-3); font-family:"IBM Plex Mono",monospace}
.agroup-more{padding:0 16px 11px}
.alist{display:flex; flex-direction:column}
.arow{
  display:flex; gap:11px; align-items:flex-start; width:100%; text-align:left;
  padding:9px 16px; border:0; border-top:1px solid var(--line); background:transparent;
  font:inherit; color:inherit; cursor:pointer;
}
.alist .arow:first-child{border-top:0}
.arow:hover{background:var(--surface-2)}
.arow .t{font-size:var(--t-sm); font-weight:500}
.arow .s{font-size:var(--t-xs); color:var(--ink-3); margin-top:1px}
.arow .when{margin-left:auto; text-align:right; font-size:var(--t-xs); color:var(--ink-3); white-space:nowrap; font-family:"IBM Plex Mono",monospace; flex:none}
.arow.crit .when{color:var(--crit)}

/* ============================== DRAWER ============================== */
.scrim{position:fixed; inset:0; background:rgba(10,16,14,.42); opacity:0; pointer-events:none; transition:opacity .18s; z-index:60}
.scrim.on{opacity:1; pointer-events:auto}
.drawer{
  position:fixed; top:0; right:0; bottom:0; width:min(470px,94vw); background:var(--surface);
  box-shadow:var(--shadow-lg); z-index:70;
  transform:translateX(102%); transition:transform .2s ease; display:flex; flex-direction:column;
}
.drawer.on{transform:none}
.drawer[aria-hidden="true"]{visibility:hidden}
.drawer-head{padding:16px 18px 13px; border-bottom:1px solid var(--line); display:flex; gap:10px; align-items:flex-start}
.drawer-head h2{font-size:var(--t-lg); letter-spacing:-.02em}
.drawer-body{overflow-y:auto; padding:16px 18px 30px; display:flex; flex-direction:column; gap:16px}
.drawer-foot{padding:11px 18px; border-top:1px solid var(--line); display:flex; gap:8px; flex-wrap:wrap; background:var(--surface-2)}
.fgrid{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.fgrid.one{grid-template-columns:1fr}
.sect{display:flex; flex-direction:column; gap:9px}
.sect > .eyebrow{padding-bottom:2px; border-bottom:1px solid var(--line)}
/* The note composer is the most-used control in the drawer, so it opens first. */
.sect.compose{
  background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-md);
  padding:12px 13px 13px; gap:7px;
}
/* ---------------------------- data quality ---------------------------- */
/* The two records, as a pair of choosable cards. Big targets, because picking
   the wrong survivor is not something you can take back. */
.keep-card{
  display:flex; flex-direction:column; gap:6px; text-align:left; width:100%;
  font:inherit; color:inherit; cursor:pointer;
  border:1px solid var(--line); border-left:3px solid var(--line);
  border-radius:var(--r-md); background:var(--surface-2); padding:12px 13px;
}
.keep-card:hover{border-color:var(--control-line)}
.keep-card.on{border-color:var(--accent); border-left-color:var(--accent); background:var(--accent-soft)}
.keep-card.on .cell-sub{color:var(--accent-ink)}
.keep-head{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
/* The field-by-field comparison. A grid, not a table, so it can STACK on a
   phone rather than pushing the second record off the side — a comparison that
   shows one of the two values is worse than no comparison, because you pick
   what you can see. */
.cmp{display:flex; flex-direction:column; gap:1px; background:var(--line);
  border:1px solid var(--line); border-radius:var(--r-md); overflow:hidden}
.cmp-head,.cmp-row{display:grid; grid-template-columns:150px 1fr 1fr; gap:10px;
  align-items:center; background:var(--surface); padding:8px 11px}
.cmp-head{background:var(--surface-2); font-size:var(--t-xs); letter-spacing:.04em;
  text-transform:uppercase; color:var(--ink-3)}
.cmp-head span{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.cmp-label{font-size:var(--t-sm); color:var(--ink-2)}
/* A row the two records agree on: one value, spanning, and quiet. */
.cmp-row.same{grid-template-columns:150px 1fr}
.cmp-agreed{font-size:var(--t-sm); color:var(--ink-3)}
@media (max-width: 760px){
  .cmp-head{display:none}
  .cmp-row,.cmp-row.same{grid-template-columns:1fr; gap:5px; padding:10px 11px}
  .cmp-label{font-size:var(--t-xs); text-transform:uppercase; letter-spacing:.04em; color:var(--ink-3)}
}
/* One value from one record. A button rather than a radio because the value
   itself is the label — a radio beside it would be a second thing to read. */
.pickval{
  font:inherit; color:inherit; cursor:pointer; text-align:left; width:100%;
  border:1px solid var(--line); border-radius:var(--r-sm);
  background:var(--surface); padding:6px 9px; font-size:var(--t-sm);
  overflow:hidden; text-overflow:ellipsis;
}
.pickval:hover{border-color:var(--control-line)}
.pickval.on{border-color:var(--accent); background:var(--accent-soft); color:var(--accent-ink); font-weight:600}
.pickval.empty{color:var(--ink-3); font-style:italic}
.pickval.on.empty{color:var(--accent-ink)}

/* A person at a business. Boxed, because the fields inside belong to THEM and
   not to the record above — and because a business can have six of these and
   a flat run of eighteen inputs is unreadable. The main contact carries a left
   edge in the brand colour so the one you ring is findable at a glance without
   reading a single label. */
/* A source that did nothing this period. Dimmed rather than hidden: a source
   producing nothing is the row you are looking at this table to find. */
.perf-quiet td{opacity:.55}
.person{
  display:flex; flex-direction:column; gap:10px;
  border:1px solid var(--line); border-left:3px solid var(--line);
  border-radius:var(--r-md); background:var(--surface-2); padding:11px 12px 12px;
}
.person.primary{border-left-color:var(--accent)}
.person-head{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
/* flex-basis, not flex:1, so the buttons wrap onto their own line rather than
   squeezing the name down to "Marcus H…". A person's name is the one thing on
   this card that must always be readable — it is how you know whose consent
   you are about to change. */
.person-name{font-weight:600; font-size:var(--t-sm); flex:0 1 auto; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
/* Gives way before the name does — it is the detail, not the identity. */
.person-title{font-size:var(--t-xs); color:var(--ink-3); flex:1 1 40px; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.person-head .btn{flex:none}
.person-head .btn.danger{color:var(--crit)}
.person-head .btn.danger:hover{background:var(--crit-soft)}
/* The consent block inside a person sits flush — it is part of the card, not a
   section of the drawer, so it loses the rule above it. */
.person > .sect > .eyebrow{border-bottom:0; padding-bottom:0}
.linked{display:flex; flex-direction:column; gap:6px}
.linked-item{display:flex; gap:9px; align-items:center; width:100%; text-align:left; font:inherit; color:inherit;
  padding:8px 10px; border:1px solid var(--line); border-radius:var(--r-md); cursor:pointer; background:var(--surface-2)}
.linked-item:hover{border-color:var(--control-line)}
.log{display:flex; flex-direction:column; gap:0}
.log-item{display:flex; gap:10px; padding:8px 0; border-bottom:1px dashed var(--line)}
.log-item:last-child{border-bottom:0}
.log-when{font-size:var(--t-xs); color:var(--ink-3); font-family:"IBM Plex Mono",monospace; width:82px; flex:none; padding-top:2px}
.log-text{font-size:var(--t-sm); line-height:1.45}
.log-who{font-size:var(--t-xs); color:var(--ink-3)}
.note-add{display:flex; gap:7px; align-items:flex-end}

/* ============================== MODAL ============================== */
.modal-wrap{position:fixed; inset:0; z-index:90; display:none; place-items:center; padding:24px}
.modal-wrap.on{display:grid}
.modal{
  position:relative; background:var(--surface); border-radius:var(--r-lg);
  box-shadow:var(--shadow-lg); width:min(680px,100%); max-height:88vh; display:flex; flex-direction:column;
}
.modal-head{padding:16px 18px 12px; border-bottom:1px solid var(--line); display:flex; align-items:flex-start; gap:10px}
.modal-head h2{font-size:var(--t-lg)}
.modal-body{padding:16px 18px; overflow-y:auto; display:flex; flex-direction:column; gap:13px}
.modal-foot{padding:12px 18px; border-top:1px solid var(--line); display:flex; gap:8px; justify-content:flex-end; background:var(--surface-2); border-radius:0 0 var(--r-lg) var(--r-lg)}

/* ============================== TOASTS ============================== */
.toasts{position:fixed; left:50%; bottom:22px; transform:translateX(-50%); z-index:100; display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none}
.toast{
  background:var(--ink); color:var(--bg); padding:9px 14px; border-radius:100px; font-size:var(--t-sm);
  box-shadow:var(--shadow-md); animation:rise .2s ease;
}
.toast.err{background:var(--crit); color:#fff}
@keyframes rise{from{opacity:0; transform:translateY(8px)}}

/* ============================== DATA VIEW ============================== */
.stack{display:flex; flex-direction:column; gap:14px}
.rowset{display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.mapper{display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; max-height:230px; overflow-y:auto; padding:2px}
.chip{padding:6px 11px; border-radius:100px; border:1px solid var(--control-line); background:var(--surface); font-size:var(--t-sm); cursor:pointer}
.chip[aria-pressed="true"]{background:var(--accent-soft); border-color:var(--accent); color:var(--accent-ink); font-weight:500}
code.k{font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); background:var(--surface-3); padding:1px 5px; border-radius:4px}
.cadence-row{display:grid; grid-template-columns:118px 1fr 86px; gap:8px; align-items:center}
.field.outcome-row{display:grid; grid-template-columns:118px minmax(0,260px); gap:8px; align-items:center}
.field.outcome-row > span{font-size:var(--t-sm); text-align:left; color:var(--ink); margin:0}
.plan-row{display:grid; grid-template-columns:1fr 92px 128px 96px auto; gap:8px; align-items:center}
/* A plan is now a price AND a set of channels, so it needs two rows and a
   boundary of its own — four plans of loose fields in a column read as one
   undifferentiated form. */
.plan-card{
  border:1px solid var(--line); border-radius:var(--r-md);
  padding:10px 11px; background:var(--surface-2); display:flex;
  flex-direction:column; gap:9px;
}
.plan-chans{display:flex; flex-direction:column; gap:6px}

/* Channels: a checkbox that reads as one at a glance, ticked or not. The tick
   is the signal and the tint only reinforces it — colour alone never carries
   state here. */
.chanset{display:flex; flex-wrap:wrap; gap:6px}
.chan{
  display:inline-flex; align-items:center; gap:7px; cursor:pointer;
  padding:5px 10px 5px 8px; border-radius:100px;
  border:1px solid var(--control-line); background:var(--surface);
  font-size:var(--t-sm); line-height:1.4; user-select:none;
}
.chan:hover{border-color:var(--ink-3)}
.chan input{width:14px; height:14px; margin:0; flex:none; accent-color:var(--accent)}
.chan.on{background:var(--accent-soft); border-color:var(--accent); color:var(--accent-ink); font-weight:500}
.chan:focus-within{outline:2px solid var(--focus); outline-offset:2px}
@media (max-width:820px){
  .plan-row{grid-template-columns:1fr 1fr; gap:6px}
  .plan-row .btn{grid-column:1 / -1}
  .chan{min-height:44px; padding-left:11px; padding-right:13px}
}

/* ============================== PHONE ==============================
   The digest email lands on a phone at 09:30, so this is a first-class
   layout, not a fallback. Targets are 44px, type in fields is 16px so
   iOS does not zoom on focus, and the row identity stays on screen
   while the rest of a wide table scrolls under it.                    */
@media (max-width:820px){
  .app{grid-template-columns:1fr}
  .rail{position:fixed; z-index:50; width:212px; height:100%; transform:translateX(-100%); transition:transform .2s}
  .rail.on{transform:none}
  .view-wrap{padding:16px}
  .topbar{padding:10px 12px; gap:8px}
  .topbar h1{font-size:var(--t-md)}
  .topbar .sub{display:none}
  .topbar-actions{gap:6px; min-width:0}
  .search input[type=text]{width:120px}

  .btn,.btn-sm,.nav-btn,.chip{min-height:44px}
  /* The identity cell is the row's control, so it carries the row's tap target. */
  .rowbtn{min-height:44px; display:flex; flex-direction:column; justify-content:center}
  .btn,.btn-sm{padding-top:10px; padding-bottom:10px}
  .nav-btn{padding-top:11px; padding-bottom:11px}
  input[type=text],input[type=email],input[type=date],input[type=datetime-local],
  input[type=time],input[type=number],input[type=tel],select,textarea{
    font-size:16px; min-height:44px;
  }
  /* Two datetime fields will not fit side by side on a phone. */
  .fgrid.when{grid-template-columns:1fr}
  .search input[type=text]{min-height:40px}
  .btn-link{min-height:44px; display:inline-flex; align-items:center}

  /* The primary action shrinks to its mark rather than being clipped. */
  .topbar .icon-only{width:44px; padding-left:0; padding-right:0; justify-content:center}
  .topbar .icon-only .label{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0)}

  .tape{gap:4px 16px; padding-bottom:14px}
  .tape .n{font-size:var(--t-md)}

  tbody td:first-child,thead th:first-child{
    position:sticky; left:0; z-index:2; background:var(--surface);
    box-shadow:1px 0 0 var(--line); min-width:148px;
  }
  thead th:first-child{background:var(--surface-2); z-index:3}
  tbody tr:hover td:first-child{background:var(--surface-2)}
  .cadence-row{grid-template-columns:1fr; gap:6px}
  .field.outcome-row{grid-template-columns:1fr; gap:6px}
  .plan-row{grid-template-columns:1fr 1fr; gap:6px}
  .toasts{bottom:auto; top:14px; width:calc(100% - 28px)}
  .toast{width:100%; text-align:center; border-radius:var(--r-md)}
}
.railtoggle{display:none}
@media (max-width:820px){.railtoggle{display:inline-flex}}

/* ============================== SIGN IN ============================== */
.gate{
  position:fixed; inset:0; z-index:120; display:grid; place-items:center;
  padding:24px; background:var(--bg);
}
.gate.hidden{display:none !important}
.gate-card{
  width:min(352px,100%); background:var(--surface);
  border-radius:var(--r-lg); box-shadow:var(--shadow-md); padding:24px 24px 22px;
  display:flex; flex-direction:column; gap:13px;
}
.gate-brand{display:flex; flex-direction:column; align-items:center; gap:11px; padding-bottom:8px}
/* The plate is white in both themes: invisible against the white card in light
   mode, and a white panel in dark mode so the logo keeps its own colours. */
.gate-logo{
  display:block; width:186px; height:auto; background:#FFFFFF;
  padding:13px 17px; border-radius:11px;
}
.gate-sub{
  font-family:"IBM Plex Mono",ui-monospace,monospace; font-size:var(--t-xs); font-weight:500;
  text-transform:uppercase; letter-spacing:.15em; color:var(--ink-3);
}
.gate-card .btn{width:100%}
.gate-error{min-height:16px; font-size:var(--t-sm); color:var(--crit)}
.gate-error:empty{min-height:0}

/* ============================== FILTER BAR ============================== */
.filterbar{
  display:flex; align-items:flex-end; gap:9px; flex-wrap:wrap; padding:0 0 14px;
}
.filterbar label.field{width:auto}
.filterbar select{width:auto; min-width:190px}
.pill.nostep{background:var(--warn-soft); color:var(--warn)}
.note-line{font-size:var(--t-sm); color:var(--ink-2); line-height:1.6}
.note-line strong{color:var(--ink); font-weight:600}
.note-line a{color:var(--accent); font-weight:600; text-underline-offset:3px}
.note-line a:hover{color:var(--accent-2)}

/* ============================== SUPPORT ==============================
   Priority is a stripe rather than another pill: the row already carries a
   status pill, and two pills side by side make you read both to learn either.
   The stripe is decorative — every word of it is repeated in the subtitle, so
   nothing depends on telling four colours apart. */
.tick-pri{
  width:3px; align-self:stretch; min-height:30px; border-radius:2px; flex:none;
  background:var(--line);
}
.tick-pri.urgent{background:var(--crit)}
.tick-pri.high{background:var(--warn)}
.tick-pri.normal{background:var(--accent)}
.tick-pri.low{background:var(--ink-3); opacity:.4}
.tick-end{
  margin-left:auto; display:flex; align-items:center; gap:9px; flex:none;
  padding-top:1px;
}
.tick-end .when{margin-left:0}
/* A resolved ticket stays legible but stops competing with the live queue. */
.arow.is-off{opacity:.62}
.arow.is-off:hover{opacity:1}
/* The reply clock in the drawer: one sentence, stated plainly, in the colour
   of whether we met it. */
.tick-clock{
  display:flex; flex-direction:column; gap:1px; margin-bottom:14px;
  padding:9px 11px; border:1px solid var(--line); border-radius:var(--r-sm);
  background:var(--surface-2); font-size:var(--t-sm); color:var(--ink-2); line-height:1.5;
}
.tick-clock strong{font-size:var(--t-md); letter-spacing:-.015em}
.tick-clock strong{color:var(--ink); font-weight:600}
.tick-clock.crit{background:var(--crit-soft); border-color:var(--crit)}
.tick-clock.crit strong{color:var(--crit)}
.tick-clock.warn{background:var(--warn-soft); border-color:var(--warn)}
.tick-clock.warn strong{color:var(--warn)}
.tick-clock.ok strong{color:var(--ok)}
/* At phone width the status and the clock stop competing with the summary for
   the same line and drop underneath it, where they still read left to right. */
@media (max-width:820px){
  #view-support .arow{flex-wrap:wrap}
  #view-support .tick-end{margin-left:19px; width:100%; padding-top:3px}
  #view-support .tick-pri{min-height:34px}
}

/* A credential shown once. Loud on purpose: this is the only moment it exists
   in readable form, and somebody skimming past it has to make another. */
.issued{
  margin-top:10px; padding:13px 15px; border-radius:var(--r-md);
  background:var(--warn-soft); border:1px solid var(--warn);
  display:flex; flex-direction:column; gap:8px; align-items:flex-start;
}
.issued .eyebrow{color:var(--warn)}
.issued-token{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-sm); user-select:all;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-sm);
  padding:9px 11px; width:100%; overflow-wrap:anywhere; line-height:1.5;
}

/* ============================== PAYMENTS ==============================
   A ledger is read down the amount column, so the amount leads the row and is
   tabular — figures that do not line up cannot be scanned or added up by eye. */
.pay-amt{
  font-family:"IBM Plex Mono",monospace; font-variant-numeric:tabular-nums;
  font-size:var(--t-sm); font-weight:600; min-width:84px; flex:none;
  text-align:right; padding-top:1px;
}
.linked-item.as-row{cursor:default; align-items:center; gap:11px}
.linked-item.as-row:hover{background:transparent}
/* A refund is money going the other way, so it reads the other way: the minus
   sign does the work and the muted tone stops it competing with income. */
.arow.is-refund .pay-amt,.linked-item .pay-amt.neg{color:var(--ink-3)}

/* The three-way total under the filters. This is a VAT return line when you
   narrow to a quarter, so the figures line up and net is the emphasised one. */
.paysum{
  display:flex; align-items:baseline; gap:9px 22px; flex-wrap:wrap;
  padding:0 0 14px; margin-top:-4px;
}
.paysum-fig{display:flex; align-items:baseline; gap:7px}
.paysum-fig .k{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-3);
  text-transform:uppercase; letter-spacing:.08em;
}
.paysum-fig .num{font-size:var(--t-sm); color:var(--ink-2)}
.paysum-fig.strong .num{font-weight:600; color:var(--ink)}

/* Two stacked bars per month, not one: a build fee and a subscription are not
   the same kind of money, and a good month made of each means something very
   different about the business. */
.paypeak{
  display:flex; align-items:center; gap:9px; margin-bottom:5px;
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-3);
}
.paypeak::after{content:""; flex:1; height:1px; background:var(--line)}
.paychart{display:flex; align-items:flex-end; gap:6px; min-height:150px}
.paycol{flex:1; display:flex; flex-direction:column; align-items:center; gap:7px; min-width:0}
.paybars{
  display:flex; flex-direction:column-reverse; justify-content:flex-start;
  width:100%; max-width:46px; height:128px; gap:2px;
}
.paybar{width:100%; border-radius:3px 3px 0 0}
.paybar.rec{background:var(--accent)}
.paybar.setup{background:var(--s-demo); border-radius:3px}
/* A month with nothing collected has to look like a nought rather than be
   missing, or the chart quietly draws a business that never had a quiet one. */
.paybar.nil{height:2px; background:var(--line-strong); border-radius:2px}
.paylab{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-3);
  white-space:nowrap;
}
.swatch{
  display:inline-block; width:9px; height:9px; border-radius:2px; vertical-align:-1px;
  margin-right:3px;
}
.swatch.rec{background:var(--accent)}
.swatch.setup{background:var(--s-demo)}
@media (max-width:820px){
  .paychart{gap:3px; min-height:130px}
  .paybars{height:104px}
  .paylab{font-size:9.5px}
  .pay-amt{min-width:70px; font-size:var(--t-xs)}
}

/* ============================== DIRECT DEBIT ==========================
   A state panel, not a form. Nothing in it is editable — it reports what
   GoCardless has told us — so it is given a sunk surface rather than the
   field styling, which would invite someone to try typing in it. */
.gc-state{
  background:var(--surface-2); border:1px solid var(--line);
  border-left:3px solid var(--line-strong); border-radius:var(--r-sm);
  padding:11px 13px; display:flex; flex-direction:column; gap:7px;
}
.gc-state.ok{border-left-color:var(--ok)}
.gc-state.warn{border-left-color:var(--warn)}
.gc-state.info{border-left-color:var(--accent)}
.gc-state.crit{border-left-color:var(--crit); background:var(--crit-soft)}
.gc-head{display:flex; align-items:center; gap:9px; flex-wrap:wrap}
/* Sandbox has to be unmissable: the whole risk of this feature is somebody
   believing a test payment was real, or the reverse. */
.gc-env{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); font-weight:500;
  letter-spacing:.08em; text-transform:uppercase; color:var(--warn);
  background:var(--warn-soft); border:1px solid var(--warn);
  padding:1px 7px; border-radius:100px;
}
.gc-hint{font-size:var(--t-sm); color:var(--ink-2); line-height:1.5}
.gc-err{font-size:var(--t-sm); color:var(--crit); line-height:1.5}
.gc-facts{margin:1px 0 0; display:flex; flex-direction:column; gap:4px}
.gc-facts > div{display:flex; gap:10px; align-items:baseline; flex-wrap:wrap}
.gc-facts dt{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-3);
  min-width:78px; flex:none;
}
.gc-facts dd{
  margin:0; font-size:var(--t-xs); color:var(--ink-2);
  font-family:"IBM Plex Mono",monospace; overflow-wrap:anywhere; min-width:0;
}

/* ============================== CALENDAR ==============================
   A month grid of two different things: booked appointments, which have a
   time, and next actions, which only have a day. The dot carries the kind's
   colour, but colour is never the only signal — appointments lead with a
   time, next actions do not, and the dot itself is filled for an
   appointment and hollow for an action.                                */
.cal-bar{
  display:flex; align-items:center; gap:9px; flex-wrap:wrap; padding:0 0 13px;
}
.cal-title{
  font-size:var(--t-md); font-weight:600; letter-spacing:-.01em; margin:0;
  min-width:170px;                       /* so the arrows hold still month to month */
}
.cal-nav{display:flex; align-items:center; gap:6px; flex:none}
.cal-bar .btn-sm{flex:none}
.cal-legend{display:flex; align-items:center; gap:13px; flex-wrap:wrap; margin-left:auto}
.cal-key{display:inline-flex; align-items:center; gap:6px; font-size:var(--t-xs); color:var(--ink-2)}
.cal-action{background:transparent; box-shadow:inset 0 0 0 1.5px var(--ink-3)}

.cal{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); overflow:hidden;
}
.cal-head{
  display:grid; grid-template-columns:repeat(7,minmax(0,1fr));
  background:var(--surface-2); border-bottom:1px solid var(--line);
}
.cal-head > div{
  padding:8px 9px; font-size:var(--t-xs); font-weight:600;
  text-transform:uppercase; letter-spacing:.09em; color:var(--ink-3);
}
.cal-grid{display:grid; grid-template-columns:repeat(7,minmax(0,1fr))}
.cal-cell{
  position:relative; min-height:112px; padding:5px 5px 7px;
  display:flex; flex-direction:column; gap:2px; min-width:0;
  border-right:1px solid var(--line); border-bottom:1px solid var(--line);
}
.cal-cell:nth-child(7n){border-right:0}
.cal-grid > :nth-last-child(-n+7){border-bottom:0}
.cal-cell.wknd{background:var(--surface-2)}
.cal-cell.out{background:var(--surface-3)}
.cal-cell.today{background:var(--accent-soft)}
.cal-cell.picked{box-shadow:inset 0 0 0 2px var(--accent); z-index:1}

.cal-n{
  display:flex; align-items:center; justify-content:space-between; gap:6px;
  width:100%; padding:2px 3px 3px; border:0; background:transparent;
  font:inherit; font-size:var(--t-sm); font-weight:600; color:var(--ink);
  font-variant-numeric:tabular-nums; cursor:pointer; border-radius:var(--r-sm);
  text-align:left;
}
.cal-n:hover{background:var(--surface-3)}
/* Recessive by tint and weight, not by dropping the text under contrast —
   --ink-3 on the out-of-month tint misses AA in the dark theme. */
.cal-cell.out .cal-n{color:var(--ink-2); font-weight:500}
.cal-today{
  font-size:var(--t-xs); font-weight:600; text-transform:uppercase;
  letter-spacing:.09em; color:var(--accent-ink);
}

.cal-item{
  display:flex; align-items:center; gap:6px; width:100%; min-width:0;
  padding:3px 5px; border:0; border-radius:var(--r-sm);
  background:transparent; font:inherit; font-size:var(--t-xs); color:var(--ink);
  text-align:left; cursor:pointer;
}
.cal-item::before{
  content:""; flex:none; width:7px; height:7px; border-radius:2px;
  background:var(--dot,var(--ink-3));
}
/* Hollow dot = a next action, not a booking. */
.cal-item.is-action::before{background:transparent; box-shadow:inset 0 0 0 1.5px var(--dot,var(--ink-3))}
.cal-item:hover{background:var(--surface); box-shadow:inset 0 0 0 1px var(--line-strong)}
.cal-cell.today .cal-item:hover{background:var(--surface)}
.cal-time{flex:none; font-weight:600; color:var(--ink-2); font-variant-numeric:tabular-nums}
.cal-label{flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.cal-item.is-off .cal-label,.cal-item.is-off .cal-time{text-decoration:line-through; color:var(--ink-3)}
.cal-item.is-off::before{opacity:.45}
.linked-item.is-off .t{text-decoration:line-through; color:var(--ink-3)}

.cal-more{
  align-self:flex-start; padding:2px 5px; border:0; border-radius:var(--r-sm);
  background:transparent; font:inherit; font-size:var(--t-xs); font-weight:600;
  color:var(--accent); cursor:pointer;
}
.cal-more:hover{text-decoration:underline}

/* Phone: seven columns of a month grid cannot hold text, so the cells become
   markers — the day number plus one dot per item — and the day panel below
   is where the detail is actually read. */
@media (max-width:820px){
  .cal-legend{margin-left:0; width:100%; gap:11px}
  .cal-title{min-width:0; flex:1 1 auto}
  .cal-bar .cell-sub{order:3; width:100%}
  .cal-bar .btn-sm{min-width:44px; justify-content:center}
  .cal-head > div{padding:7px 4px; text-align:center; letter-spacing:.04em}
  .cal-cell{min-height:68px; padding:3px 2px 5px; gap:3px; align-items:center}
  .cal-n{justify-content:center; min-height:44px; padding:2px}
  .cal-today{display:none}
  /* The number, not the "today" chip — the chip stays hidden at this width. */
  .cal-cell.today .cal-n > span:first-child{
    background:var(--accent); color:var(--on-accent); border-radius:100px;
    min-width:26px; height:26px; display:inline-grid; place-items:center;
  }
  /* Each item is a 6px marker here, rendered as a span rather than a button:
     nothing that small should claim to be a tap target. The cell selects the
     day, and the panel underneath lists the same items at full size. */
  .cal-item{
    width:auto; padding:0; gap:0; min-height:0; border-radius:0;
    display:inline-flex;
  }
  .cal-item:hover{background:transparent; box-shadow:none}
  .cal-time,.cal-label{display:none}
  .cal-item::before{width:6px; height:6px}
  /* The dots sit on one line under the number rather than stacking. */
  .cal-cell{flex-flow:row wrap; justify-content:center; align-content:flex-start}
  .cal-n{flex:1 0 100%}
}

/* ============================ CALL LOGGING ============================
   The five buttons sit at the top of a lead, above the details, because for
   a rep working a list that is the only reason the record is open. They are
   deliberately large and evenly weighted: at seventy dials a day the target
   is a thumb on a phone, and no outcome should be easier to press than the
   honest one.                                                            */
.call-sect{background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-lg); padding:14px}
.call-row{display:grid; grid-template-columns:repeat(auto-fit,minmax(112px,1fr)); gap:7px; margin-bottom:10px}
.call-btn{
  padding:11px 9px; border-radius:var(--r-md); border:1px solid var(--control-line);
  background:var(--surface); color:var(--ink); font-size:var(--t-sm); font-weight:500;
  cursor:pointer; text-align:center; min-height:44px;
}
.call-btn:hover:not(:disabled){background:var(--surface-3)}
.call-btn:disabled{opacity:.5; cursor:default}
/* Colour carries the same meaning it does on a pill elsewhere: teal is
   progress, green is the win, red is a real answer that happens to be no. */
.call-btn.info{border-color:var(--accent); color:var(--accent-ink); background:var(--accent-soft)}
.call-btn.ok{border-color:var(--ok); color:var(--ok); background:var(--ok-soft)}
.call-btn.crit{border-color:var(--crit); color:var(--crit); background:var(--crit-soft)}
.call-btn.warn{border-color:var(--warn); color:var(--warn); background:var(--warn-soft)}
/* Chosen, not yet logged: a solid ring and a tick, so it reads as selected in
   every tone and in both themes. */
.call-btn.is-selected{box-shadow:inset 0 0 0 2px currentColor; font-weight:600}
.call-btn.is-selected::before{content:"\2713\00a0"}
.call-btn:not(.info):not(.ok):not(.crit):not(.warn).is-selected{border-color:var(--ink); color:var(--ink)}
.log-form{display:flex; flex-direction:column; gap:8px; margin:2px 0 12px}
.log-foot{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.log-hint{flex:1 1 160px; font-size:var(--t-sm)}
.log-foot .btn{min-width:120px; justify-content:center}
.call-note{flex:1 1 100%; font-size:var(--t-sm); color:var(--ink); padding-left:2px}
.call-btn.is-logging{opacity:1; box-shadow:inset 0 0 0 2px var(--focus)}
.call-log{display:flex; flex-direction:column; gap:5px; margin-bottom:8px}
.call-item{display:flex; align-items:center; gap:9px; flex-wrap:wrap}
.call-when{font-size:var(--t-xs); color:var(--ink-2); font-family:"IBM Plex Mono",monospace}
.call-who{font-size:var(--t-xs)}

/* ============================ PERFORMANCE ============================ */
.perf-bar{display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px}
.perf-bar.is-loading{opacity:.6}
.perf-when{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.perf-label{font-size:var(--t-sm); font-weight:500; min-width:150px}
.perf-updated{white-space:nowrap}
.perf-note{font-size:var(--t-xs); margin:-6px 0 12px}
.perf-bar .field.inline{margin-left:auto; min-width:170px}
/* One control, four states — a segmented switch rather than four buttons,
   so it reads as "which period" and not as four separate things to press. */
.seg{display:inline-flex; border:1px solid var(--control-line); border-radius:var(--r-md); overflow:hidden}
.seg-btn{
  padding:8px 14px; border:0; background:var(--surface); color:var(--ink-2);
  font-size:var(--t-sm); font-weight:500; cursor:pointer; min-height:38px;
}
.seg-btn + .seg-btn{border-left:1px solid var(--line)}
.seg-btn:hover{background:var(--surface-3)}
.seg-btn.on{background:var(--accent); color:var(--on-accent)}

.kpi-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:14px}
/* The card is a flex column with the meter pushed to the bottom, so three
   cards line their meters up even when one title wraps onto two lines. */
.kpi{display:flex; flex-direction:column}
.kpi-body{padding:0 16px 14px; display:flex; flex-direction:column; flex:1}
.kpi-n{
  font-family:"IBM Plex Mono",monospace; font-variant-numeric:tabular-nums;
  font-size:var(--t-lg); font-weight:600; line-height:1.1; margin-bottom:9px;
}
/* The band is the point of the meter. A single target line tells you whether
   a number was cleared; a band shows the difference between hitting the
   target and hammering a bad list to beat it. */
.kpi-track{position:relative; height:9px; background:var(--surface-3); border-radius:100px; overflow:hidden; margin-top:auto}
.kpi-band{position:absolute; top:0; bottom:0; background:var(--grid); border-left:1px solid var(--line-strong); border-right:1px solid var(--line-strong)}
.kpi-fill{position:absolute; top:0; bottom:0; left:0; background:var(--ink-3); border-radius:100px}
.kpi-fill.ok{background:var(--ok)}
.kpi-fill.warn{background:var(--warn)}
.kpi-fill.crit{background:var(--crit)}
.kpi-foot{display:flex; justify-content:space-between; gap:10px; margin-top:7px; font-size:var(--t-xs)}
.kpi-foot .crit{color:var(--crit)}
/* A 1px rule, and always beside a word that says the same thing — the state
   is written out in the footer, so the colour is reinforcement, not the
   only signal. */
.kpi.crit{box-shadow:inset 2px 0 0 var(--crit)}
.kpi.warn{box-shadow:inset 2px 0 0 var(--warn)}

.tr-call{fill:var(--s-contacted)}
.tr-conv{fill:var(--accent)}
.tr-axis{stroke:var(--line-strong); stroke-width:1}
.tr-tick{fill:var(--ink-3); font-size:11px; font-family:"IBM Plex Mono",monospace}
.key{display:inline-block; width:9px; height:9px; border-radius:2px; margin:0 5px 0 0; vertical-align:baseline}
.key + .key{margin-left:12px}
.key-call{background:var(--s-contacted)}
.key-conv{background:var(--accent)}

@media (max-width:1000px){
  .kpi-grid{grid-template-columns:1fr}
  .perf-bar .field.inline{margin-left:0; width:100%}
  .perf-label{min-width:0}
}

/* ============================== AUDIENCES ==============================
   Two columns on purpose: the criteria on the left, and who they actually
   caught on the right, side by side and updating together. A rule you
   cannot see the effect of is a rule you get wrong once and never trust
   again.                                                               */
.aud-top{display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; margin-bottom:14px}
.aud-top-actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
/* The result sticks while the criteria column scrolls past it. The whole point
   of the layout is seeing the effect of a rule as you change it, and the
   criteria list is longer than a screen — without this, half the changes are
   made with the count out of sight. */
.aud-grid{align-items:start}
@media (min-width:1001px){
  .aud-grid > .card:last-child{position:sticky; top:0; max-height:calc(100vh - 150px); overflow:auto}
}
.rules{padding:4px 16px 16px; display:flex; flex-direction:column; gap:16px}
.rule + .rule{border-top:1px solid var(--line); padding-top:15px}
.rule-head{display:flex; align-items:baseline; gap:9px; flex-wrap:wrap; margin-bottom:8px}
.rule-label{font-size:var(--t-sm); font-weight:600}
.rule-hint{font-size:var(--t-xs)}
.rule-clear{font-size:var(--t-xs); margin-left:auto}
.rule-warn{font-size:var(--t-xs); color:var(--warn); margin-top:7px}
.rule .fgrid{margin-top:2px}

.aud-body{padding:0 16px 14px}
.aud-n{
  font-family:"IBM Plex Mono",monospace; font-variant-numeric:tabular-nums;
  font-size:var(--t-lg); font-weight:600; line-height:1.1;
}
.aud-k{font-size:var(--t-xs); margin-bottom:10px}
/* Spelled out rather than summed: no email is a data problem to go and fix,
   unsubscribed is the system working, and a pile of duplicates means the
   same people are on the board twice. Different jobs, different lines. */
.aud-cut{list-style:none; display:flex; flex-direction:column; gap:4px; font-size:var(--t-sm)}
.aud-cut .num{font-weight:600; min-width:2.2em; display:inline-block}
.aud-actions{
  display:flex; gap:8px; align-items:center; flex-wrap:wrap;
  padding:12px 16px 16px; border-top:1px solid var(--line);
}
/* The consent radios read like the pills they echo, so a record's state is
   the same colour here as it is anywhere else in the app. */
.chan.mk.on.ok{background:var(--ok-soft); border-color:var(--ok); color:var(--ok)}
.chan.mk.on.warn{background:var(--warn-soft); border-color:var(--warn); color:var(--warn)}
.chan.mk.on.crit{background:var(--crit-soft); border-color:var(--crit); color:var(--crit)}
.chan input[type="radio"]{width:14px; height:14px; margin:0; flex:none; accent-color:currentColor}
.linked-item.on{background:var(--accent-soft); border-color:var(--accent)}

@media (max-width:1000px){
  .aud-grid{grid-template-columns:1fr}
  .aud-top .field{flex:1 1 100% !important}
}

/* A basis problem is not a suppression: it is a question for whoever is about
   to press send, and it is worded and coloured as one. Left rule rather than a
   filled panel, so it reads as a margin note on the count above it and never
   as "this list has been blocked". */
.mk-risk{
  font-size:var(--t-xs); color:var(--ink-2); line-height:1.45;
  border-left:2px solid var(--warn); padding:2px 0 2px 10px; margin-top:8px;
}
.mk-risk.crit{border-left-color:var(--crit)}
.mk-risk strong{font-family:"IBM Plex Mono",monospace; color:var(--ink)}
.aud-flags{margin-top:2px}
.ok-line{color:var(--ok)}

/* ===================== LEGAL FORM AND SCREENING =====================
   The Companies House block on a record, and the review queue behind it.

   Everything here is built around one risk: a person reading "no match" as
   "sole trader". So the states are never conveyed by colour alone, the
   explanatory note sits in the same block as the fact it qualifies rather than
   in a tooltip, and the unmatched state gets the most words rather than the
   fewest. */
.reg-line{font-size:var(--t-sm); color:var(--ink-2); line-height:1.6; margin:0 0 6px}
.reg-line strong{color:var(--ink); font-weight:600}
/* The qualifier. Left rule rather than a filled panel, the same treatment
   .mk-risk gets, so it reads as a margin note on the fact above it. */
.reg-note{
  font-size:var(--t-xs); color:var(--ink-2); line-height:1.5;
  border-left:2px solid var(--line-strong); padding:2px 0 2px 10px; margin:6px 0 0;
}
.reg-note strong{color:var(--ink); font-weight:600}

.reg-co{
  border:1px solid var(--line); border-radius:var(--r-md);
  background:var(--surface-2); padding:10px 12px; margin-bottom:8px;
}
/* A proposal is not an answer, and the dashed edge says so before the words
   underneath it do. */
.reg-co.prop{border-style:dashed; border-color:var(--warn)}
.reg-co-name{font-weight:600; color:var(--ink); display:flex; gap:8px; align-items:baseline; flex-wrap:wrap}
.reg-no{font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-3)}
.reg-form{font-size:var(--t-sm); color:var(--ink-2); margin-top:3px; line-height:1.5}
.reg-implies{color:var(--ink-3)}
.reg-implies.warn{color:var(--warn)}
.reg-status{
  font-size:var(--t-xs); color:var(--ink-3); text-transform:capitalize; margin-top:3px;
}
.reg-status.bad{color:var(--crit); font-weight:600}
.reg-addr{font-size:var(--t-xs); line-height:1.5; margin-top:3px}
.reg-sic{display:flex; gap:6px; flex-wrap:wrap; align-items:baseline; margin-top:6px; font-size:var(--t-xs)}
.sic{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs);
  background:var(--surface-3); border:1px solid var(--line); border-radius:var(--r-sm);
  padding:1px 6px; color:var(--ink-2);
}
/* The principal activity — the first code — is the one that decides the
   vertical, so it is the one that looks different. */
.sic.lead{background:var(--accent-soft); border-color:var(--accent); color:var(--accent-ink); font-weight:600}
.reg-acts{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px}

.reg-screen{
  font-size:var(--t-sm); line-height:1.55; border-radius:var(--r-md);
  padding:8px 12px; margin-top:10px; border:1px solid var(--line);
  background:var(--surface-2); color:var(--ink-2);
}
.reg-screen strong{color:var(--ink)}
.reg-screen.good{border-color:var(--ok); background:var(--ok-soft)}
.reg-screen.good strong{color:var(--ok)}
.reg-screen.warn{border-color:var(--warn); background:var(--warn-soft)}
.reg-screen.warn strong{color:var(--warn)}
.reg-screen.bad{border-color:var(--crit); background:var(--crit-soft)}
.reg-screen.bad strong{color:var(--crit)}

/* Above the call buttons, not beside them: somebody about to press one has to
   pass their eyes over it. */
.call-warn{
  font-size:var(--t-sm); line-height:1.5; border-radius:var(--r-md);
  padding:8px 12px; margin-bottom:8px; border:1px solid var(--line); color:var(--ink-2);
}
.call-warn strong{font-weight:600}
/* The Lost offer after a Not interested — beneath the buttons, because it is
   about the call just made rather than the next one. */
.call-offer{display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:var(--t-sm);
  border:1px solid var(--line); border-radius:var(--r-md); padding:8px 12px; margin-bottom:10px;
  background:var(--surface)}
.call-offer > span{flex:1 1 100%; color:var(--ink-2)}
.call-warn.warn{border-color:var(--warn); background:var(--warn-soft)}
.call-warn.warn strong{color:var(--warn)}
.call-warn.bad{border-color:var(--crit); background:var(--crit-soft)}
.call-warn.bad strong{color:var(--crit)}

/* The counts at the top of each half of the Data quality screen. */
.qstat{display:flex; gap:10px; flex-wrap:wrap; margin-top:12px}
.qstat-item{
  flex:1 1 140px; min-width:0;
  border:1px solid var(--line); border-radius:var(--r-md);
  background:var(--surface-2); padding:10px 12px;
}
.qstat-n{font-size:var(--t-lg); font-weight:600; letter-spacing:-.02em; color:var(--ink)}
.qstat-l{font-size:var(--t-sm); color:var(--ink-2); margin-top:1px}
.qstat-s{font-size:var(--t-xs); line-height:1.4; margin-top:3px}

.dupe-list{display:flex; flex-direction:column}
.dupe-row{padding:14px 16px; border-bottom:1px solid var(--line)}
.dupe-row:last-child{border-bottom:0}
.dupe-top{display:flex; gap:10px; align-items:baseline; flex-wrap:wrap}
.dupe-names{flex:1 1 260px; min-width:0; font-size:var(--t-sm); color:var(--ink-2); line-height:1.5}
.dupe-why{margin-top:8px}
.score{
  font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); font-weight:600;
  border-radius:var(--r-sm); padding:2px 7px; border:1px solid var(--line-strong);
  color:var(--ink-2); background:var(--surface-3);
}
/* Strong and weak look different, and neither looks like a verdict — the
   number is how confident the matcher is, not whether it is right. */
.score.strong{border-color:var(--accent); color:var(--accent-ink); background:var(--accent-soft)}
.why{margin:6px 0 0; padding-left:18px; font-size:var(--t-xs); color:var(--ink-2); line-height:1.6}
.why li{margin:1px 0}

.reg-confirm{
  margin-top:10px; padding-top:10px; border-top:1px dashed var(--line);
  display:flex; flex-direction:column; gap:8px;
}
/* The tick says what will be written, in the words that end up on the record.
   "Also set subscriber type" is a label somebody ticks without reading. */
.tick{
  display:flex; gap:8px; align-items:flex-start;
  font-size:var(--t-sm); color:var(--ink-2); line-height:1.5; cursor:pointer;
}
.tick input{margin-top:3px; flex:none}
.tick strong{color:var(--ink); font-weight:600}

@media (max-width:760px){
  .qstat-item{flex:1 1 100%}
  .dupe-top{gap:6px}
}

/* Vertical conflicts: the two answers side by side, with which SIC code said
   the second. Wraps to two lines on a phone rather than truncating either. */
.vert-cmp{
  display:flex; flex-wrap:wrap; gap:6px 10px; align-items:baseline;
  font-size:var(--t-sm); color:var(--ink-2); margin-top:6px;
}
.vert-cmp strong{color:var(--ink); font-weight:600}

/* ============================== INSTANTLY ============================== */
.ist-figs{display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:8px}
.ist-fig{border:1px solid var(--line); border-radius:var(--r-md); padding:8px 10px; background:var(--surface)}
.ist-fig .n{display:block; font-family:"IBM Plex Mono",monospace; font-size:var(--t-lg); font-weight:600}
.ist-fig .l{display:block; font-size:var(--t-xs); color:var(--ink-3)}
.ist-person{display:flex; justify-content:space-between; gap:10px; align-items:flex-start;
  padding:8px 0; border-bottom:1px solid var(--line)}
.ist-pills{display:flex; flex-wrap:wrap; gap:4px; justify-content:flex-end; flex:none}
.ist-mails{display:flex; flex-direction:column; gap:8px; margin-top:10px}
.ist-mail{border:1px solid var(--line); border-radius:var(--r-md); padding:8px 10px; background:var(--surface)}
.ist-mail.in{border-color:color-mix(in srgb, var(--accent) 40%, var(--line))}
.ist-mail-head{display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:4px}
.ist-mail-body{font-size:var(--t-sm); color:var(--ink-2); white-space:pre-wrap; overflow-wrap:anywhere; margin-top:2px}
/* A LinkedIn conversation from Gojiberry, folded under its person. */
.gj-convo{padding:6px 0 10px; border-bottom:1px solid var(--line)}
.gj-convo summary{cursor:pointer; font-size:var(--t-sm); color:var(--ink-2); padding:2px 0}
.gj-convo[open] summary{margin-bottom:8px}
.gj-msg{border:1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius:var(--r-md);
  padding:8px 10px; background:var(--surface); margin:0 24px 8px 0}
.gj-msg.self{border-color:var(--line); margin:0 0 8px 24px}
.gj-meta{font-size:var(--t-xs); color:var(--ink-3); margin-bottom:3px}
.gj-text{font-size:var(--t-sm); color:var(--ink-2); white-space:pre-wrap; overflow-wrap:anywhere}
/* Log an email — sits under Log a call and borrows its look. */
.email-sect{margin-top:12px}
.email-to{max-width:440px; margin-bottom:8px}

/* ============================== BOARD PAGING ============================== */
/* The column shows its first fifty cards; the rest are one tap away. */
.col-more{justify-content:center; width:100%; flex:none}
.col-more .muted{font-weight:400; margin-left:4px}
/* The stage tabs are the phone's way through the board. On a wider screen the
   columns themselves do that job. */
.stage-tabs{display:none}
/* iOS counts the space behind its own toolbars in 100vh, which pushed the foot
   of each column under Safari's bottom bar. dvh is the height actually shown. */
@supports (height:100dvh){ .col{max-height:calc(100dvh - 210px)} }

/* ============================== PHONE: PIPELINE ============================== */
@media (max-width:760px){
  /* Header: title and menu on the first line, search full width on the second,
     and New lead as a floating button so it can never be pushed off screen. */
  .topbar{flex-wrap:wrap; row-gap:8px}
  .topbar-actions{flex:1 1 100%; order:3; margin-left:0}
  .topbar-actions .search{flex:1; min-width:0}
  .search input[type=text]{width:100%}
  #primaryAction:not(.hidden){
    position:fixed; right:16px; bottom:calc(18px + env(safe-area-inset-bottom, 0px)); z-index:40;
    width:56px; height:56px; min-height:56px; border-radius:50%;
    box-shadow:0 6px 18px rgba(0,0,0,.22);
  }
  #primaryAction svg{width:20px; height:20px}
  .view-wrap{padding-bottom:calc(96px + env(safe-area-inset-bottom, 0px))}

  /* Filters: one row that swipes sideways, rather than three rows of buttons
     before the first lead. */
  .filterbar{flex-wrap:nowrap; overflow-x:auto; margin:0 -16px; padding:0 16px 12px;
    scrollbar-width:none; -webkit-overflow-scrolling:touch}
  .filterbar::-webkit-scrollbar{display:none}
  .filterbar > *{flex:none}
  .filterbar select{min-width:150px}

  /* One stage at a time, picked from a row of tabs that swipes sideways. */
  .stage-tabs{display:flex; gap:6px; overflow-x:auto; margin:0 -16px 12px; padding:0 16px 2px;
    scrollbar-width:none; -webkit-overflow-scrolling:touch; scroll-snap-type:x proximity}
  .stage-tabs::-webkit-scrollbar{display:none}
  .stage-tab{flex:none; display:inline-flex; align-items:center; gap:7px; min-height:40px;
    padding:0 13px; border:1px solid var(--line); border-radius:999px; background:var(--surface);
    font:inherit; font-size:var(--t-sm); font-weight:600; color:var(--ink-2); cursor:pointer;
    scroll-snap-align:start}
  .stage-tab .n{font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); font-weight:500; color:var(--ink-3)}
  .stage-tab.on{background:var(--ink); border-color:var(--ink); color:var(--surface)}
  .stage-tab.on .n{color:var(--surface); opacity:.8}

  .board{display:block; overflow:visible; padding-bottom:0}
  .col{display:none; max-width:none; min-width:0; max-height:none}
  .col.is-current{display:flex}
  /* Belt and braces: if no column has been marked as the current one — a
     script that has not caught up with this stylesheet — show the first
     rather than an empty board. */
  .board:not(:has(.col.is-current)) .col:first-child{display:flex}
  .col-body{overflow:visible}
  .col-foot{display:none}

  /* Compact cards: two or three to a screen became six or seven. Long names
     and addresses end in an ellipsis instead of breaking mid-word. */
  .lead-card{padding:9px 11px}
  .lead-card .n,.lead-card .c{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; word-break:normal}
  .lead-card .row{margin-top:6px}
  /* The tags under the value — vertical, next step, owner — share one line
     that wraps, instead of taking a line each. */
  .lead-card .pill{font-size:11px; min-height:0; padding:2px 8px; line-height:1.5}
  .lead-card .row{gap:6px}
  .col-head{padding:9px 12px}
}

/* ============================== BULK ACTIONS ============================== */
.bulkbar{background:var(--accent-soft); border-radius:var(--r-md); padding:10px 12px;
  margin-bottom:12px; display:flex; flex-direction:column; gap:10px}
.bulk-row{display:flex; flex-wrap:wrap; align-items:flex-end; gap:9px}
.bulk-row:first-child{align-items:center}
.bulk-row .field{width:auto}
.bulk-row select{min-width:190px}
.bulk-row input[type=text]{min-width:220px}
.bulk-row input[type=number]{width:110px}
.bulk-chk{display:inline-flex; align-items:center; gap:7px; font-size:var(--t-sm); min-height:36px}
.bulk-note{flex-basis:100%}
@media (max-width:760px){
  .bulk-row .field,.bulk-row select,.bulk-row input[type=text]{width:100%; min-width:0}
  .bulk-row .field{flex:1 1 100%}
  #bulkApply{width:100%; justify-content:center}
  .is-picking #primaryAction{display:none}
}

/* Cards, every screen size: the tags under the value — vertical, next step,
   owner — share a line that wraps, instead of stacking one per line, and a long
   vertical ends in an ellipsis inside its pill rather than breaking it in two. */
.lead-card .c[style*="margin-top:6px"]{display:inline-flex !important; margin:6px 6px 0 0 !important;
  max-width:100%; vertical-align:middle}
.lead-card .c .pill{white-space:nowrap; max-width:100%; overflow:hidden; text-overflow:ellipsis; display:inline-block}

/* ---------------- Performance click-through ---------------- */
/* Every figure that has rows behind it is a button. They keep the look of the
   figure they are, with a hint of a link on hover and a clear focus ring. */
.drill-link,.drill-row,.drill-fig,.drill-cell{font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; text-align:inherit}
.drill-link{display:block}
.drill-link:hover,.drill-fig:hover .n,.drill-cell:hover{text-decoration:underline; text-underline-offset:3px; text-decoration-thickness:1px}
.drill-row{width:100%; border-radius:var(--r-sm); padding:3px 4px; margin:0 -4px}
.drill-row:hover{background:var(--surface-2)}
.drill-cell{font-variant-numeric:tabular-nums}
.drill-cell.sub{font-size:var(--t-xs); color:var(--ink-3)}
.drill-link:focus-visible,.drill-row:focus-visible,.drill-fig:focus-visible,.drill-cell:focus-visible,.drill-bar:focus-visible{outline:2px solid var(--focus); outline-offset:2px}
.drill-bar{cursor:pointer}
.drill-bar:hover rect{filter:brightness(1.12)}
.card.drill{margin-bottom:14px; border-color:var(--accent)}
.drill-tools{display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:0 16px 10px}
.drill-tools .field.inline{min-width:150px}
.drill-table td{vertical-align:top}
.drill-note{max-width:420px; white-space:normal}
.linkish{font:inherit; background:none; border:0; padding:0; color:var(--accent-ink); cursor:pointer; text-align:left; text-decoration:underline; text-underline-offset:2px}
.report-banner{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:0 0 12px; padding:10px 12px;
  border:1px solid var(--accent); background:var(--accent-soft); border-radius:var(--r-md); font-size:var(--t-sm)}
.report-banner > span{flex:1 1 240px}
.kpi-n.drill-link{font-family:"IBM Plex Mono",monospace; font-size:var(--t-lg); font-weight:600; line-height:1.1; text-align:left; align-self:flex-start}

/* ---------------- Data quality → People to tidy ---------------- */
.pq-bar{display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:12px 16px 4px}
.pq-bar .field.inline{min-width:200px}
.pq-bar [data-pq-kept]{margin-left:auto}
.pq-actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:8px 16px 12px; position:sticky; top:0; background:var(--surface); z-index:2; border-bottom:1px solid var(--line)}
.pq-table td{vertical-align:top}
.pq-table tr.picked td{background:var(--accent-soft)}
.pq-why{margin:6px 0 0; padding-left:16px; font-size:var(--t-xs); color:var(--ink-2)}
.pq-why li{margin:1px 0}

/* ---- Reporting tabs ---- */
.rep-tabs{display:flex; gap:4px; overflow-x:auto; margin:0 0 14px; padding-bottom:2px; border-bottom:1px solid var(--line); scrollbar-width:thin}
.rep-tab{font:inherit; font-size:var(--t-sm); background:none; border:0; border-bottom:2px solid transparent; padding:8px 12px; color:var(--ink-2); cursor:pointer; white-space:nowrap; margin-bottom:-1px}
.rep-tab:hover{color:var(--ink)}
.rep-tab.on{color:var(--accent-ink); border-bottom-color:var(--accent); font-weight:600}
.rep-note{font-size:var(--t-xs); margin:-6px 0 12px}
.hl-up{color:var(--crit); font-variant-numeric:tabular-nums}
.hl-down{color:var(--ok); font-variant-numeric:tabular-nums}
.fc-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px}
.bb-days{display:flex; flex-wrap:wrap; gap:6px 14px}

/* ---- The tray: records parked along the bottom ---- */
.drawer-head-btns{margin-left:auto; display:flex; gap:4px; flex:none}
.tray{position:fixed; left:calc(212px + 16px); right:16px; bottom:calc(12px + env(safe-area-inset-bottom, 0px)); z-index:75;
  display:flex; align-items:center; gap:8px; overflow-x:auto; padding:2px; scrollbar-width:thin; pointer-events:none}
.tray[hidden]{display:none}
.tray > *{pointer-events:auto}
body.drawer-open .tray{right:calc(min(470px,94vw) + 16px)}
.tray-label{font-size:var(--t-xs); letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); font-weight:600; flex:none;
  background:var(--surface); border:1px solid var(--line); border-radius:999px; padding:3px 9px}
.tray-chip{display:flex; align-items:stretch; flex:none; max-width:260px; background:var(--surface); border:1px solid var(--line);
  border-radius:10px; box-shadow:var(--shadow-lg); overflow:hidden}
.tray-chip.on{border-color:var(--accent); box-shadow:0 0 0 1px var(--accent), var(--shadow-lg)}
.tray-open{font:inherit; color:inherit; background:none; border:0; cursor:pointer; display:flex; align-items:center; gap:8px;
  padding:7px 4px 7px 11px; min-width:0; text-align:left}
.tray-open:hover .tray-name{text-decoration:underline; text-underline-offset:2px}
.tray-text{display:flex; flex-direction:column; min-width:0}
.tray-name{font-weight:600; font-size:var(--t-sm); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:190px}
.tray-sub{font-size:var(--t-xs); color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:190px}
.tray-dot{width:8px; height:8px; border-radius:50%; flex:none; border:1.5px solid var(--line-strong, var(--line))}
.tray-dot.on{background:var(--warn); border-color:var(--warn)}
.tray-x{font:inherit; font-size:16px; line-height:1; color:var(--ink-3); background:none; border:0; border-left:1px solid var(--line);
  padding:0 10px; cursor:pointer; min-width:36px}
.tray-x:hover{color:var(--ink); background:var(--surface-2)}
.tray-open:focus-visible,.tray-x:focus-visible{outline:2px solid var(--accent); outline-offset:-2px}
body.has-tray .view-wrap{padding-bottom:96px}
@media (max-width:820px){ .tray{left:12px} }
@media (max-width:760px){
  .tray{left:12px; right:84px}
  body.drawer-open .tray{display:none}
  body.has-tray .view-wrap{padding-bottom:calc(150px + env(safe-area-inset-bottom, 0px))}
  .tray-label{display:none}
}

/* LinkedIn link on a person card (from Gojiberry). */
.person-li{font-size:var(--t-xs); color:var(--accent, inherit); text-decoration:underline; flex:none}

/* Activity screen: filters, count line, Show more. */
.act-filters input[type=date]{width:auto; min-width:150px}
.act-count{margin:-6px 0 8px; min-height:1.2em}
.act-more{display:flex; justify-content:center; padding:12px; border-top:1px solid var(--line)}

/* Data quality → Missing contact details. */
.gap-table table{min-width:0}
.gap-table tbody tr{cursor:default}
.gap-table tr.tot td{background:var(--surface-2)}
.btn-link.gap-num{font-size:var(--t-sm); font-family:"IBM Plex Mono",monospace}
.gap-pills{display:flex; gap:4px; flex:none; margin-left:auto; align-items:flex-start}
@media (max-width:700px){ .gap-sect .seg{display:flex; overflow-x:auto; max-width:calc(100vw - 64px)} .gap-sect .seg-btn{flex:none} }

/* "What happened?" boxes: start two lines tall, grow as you type (autoGrow),
   and can be dragged taller. Line breaks typed in them are kept when shown. */
textarea.grow{min-height:0; resize:vertical; overflow-y:auto; line-height:1.45}
.note-add .btn{flex:none}
.log-text,.call-note,.arow .t,.ist-mail-body{white-space:pre-line}

/* Hidden on touch screens, where there is no Shift key. */
@media (hover:none){ .pick-tip{display:none} }

/* Missing contact details: rows say they open for editing. */
.gap-edit{font-size:var(--t-xs); font-weight:600; color:var(--accent); margin-left:6px; align-self:center}
.gap-row:hover .gap-edit{text-decoration:underline; text-underline-offset:3px}
/* A field or person the drawer was opened to fix. */
@keyframes flashFix{from{box-shadow:0 0 0 3px var(--accent-soft, rgba(15,118,110,.25))} to{box-shadow:0 0 0 0 transparent}}
.flash{animation:flashFix 1.6s ease-out}

/* The flag: look at this lead again. */
.flag-ico{width:14px; height:14px; flex:none; display:inline-block; vertical-align:-2px}
.flag-quiet{display:flex; justify-content:flex-end; margin:-4px 0 2px}
.flag-btn{display:inline-flex; gap:6px; align-items:center; color:var(--ink-2)}
.flag-box{display:flex; gap:10px; align-items:flex-start; padding:12px 14px; border-radius:var(--r-md); margin-bottom:12px}
.flag-box.on{background:var(--warn-soft); border:1px solid color-mix(in srgb, var(--warn) 45%, transparent); color:var(--ink)}
.flag-box.on > .flag-ico{color:var(--warn); width:18px; height:18px; margin-top:2px}
.flag-box.editing{align-items:flex-end; background:var(--surface-2); border:1px solid var(--line)}
.flag-note{font-size:var(--t-sm); margin:2px 0; white-space:pre-line; overflow-wrap:anywhere}
.flag-acts{display:flex; gap:6px; flex:none; flex-wrap:wrap}
.lead-card.flagged{box-shadow:inset 3px 0 0 var(--warn)}
.card-flag{display:flex; gap:5px; align-items:center; font-size:var(--t-xs); font-weight:600; color:var(--warn); margin-bottom:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%}
.flag-filter{display:inline-flex; gap:6px; align-items:center}
.flag-filter .flag-ico{color:var(--warn)}
.flag-filter.on{background:var(--warn-soft); border-color:var(--warn)}
@media (max-width:700px){ .flag-box{flex-wrap:wrap} .flag-box.editing .field{flex-basis:100%} }

/* The Flagged filter, when set, takes the flag colour. */
select#flagFilter.flag-on{border-color:var(--warn); background-color:var(--warn-soft)}

/* ============================== AGENTS ============================== */
.ag-agents{display:flex; flex-direction:column; gap:12px; margin-bottom:16px}
.ag-card{padding:14px 16px}
.ag-head{display:flex; justify-content:space-between; gap:12px; align-items:flex-start; flex-wrap:wrap}
.ag-settings{display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-top:12px; padding-top:12px; border-top:1px solid var(--line)}
.ag-settings .field{flex:1 1 200px; min-width:0}
.ag-top{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:12px}
.ag-top .ag-tabs{margin-bottom:0}
.ag-tabs{margin-bottom:12px}
.ag-list{padding:0}
.ag-item{display:flex; gap:12px; justify-content:space-between; align-items:flex-start; flex-wrap:wrap;
  padding:12px 16px; border-bottom:1px solid var(--line)}
.ag-item:last-child{border-bottom:0}
.ag-item-main{flex:1 1 320px; min-width:0; display:flex; flex-direction:column; gap:4px}
.ag-item-top{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.ins-where{font-size:12px; font-weight:600; padding:1px 8px; border-radius:6px; background:var(--surface-3); border:1px solid var(--line); color:var(--ink-2); white-space:nowrap}
.ag-why{font-size:var(--t-sm); color:var(--ink-2); overflow-wrap:anywhere}
.ag-actions{display:flex; gap:6px; flex-wrap:wrap; flex:0 1 auto}
.ag-holds{margin-top:16px; padding:14px 16px}
.ag-hold{display:flex; justify-content:space-between; gap:10px; align-items:center; padding:6px 0; border-bottom:1px solid var(--line)}
.ag-hold:last-child{border-bottom:0}

/* ============================== SOCIAL ============================== */
.so-head,.so-settings{padding:14px 16px; margin-bottom:12px}
.so-chips{display:flex; gap:6px; flex-wrap:wrap}
.so-settings summary{cursor:pointer; font-weight:600; font-size:var(--t-sm)}
.so-settings[open] summary{margin-bottom:12px}
.so-settings .field,.so-fields .field{margin-bottom:10px}
.so-row{display:flex; gap:12px; flex-wrap:wrap}
.so-row .field{flex:1 1 220px; min-width:0}
.so-checks{display:flex; gap:12px; flex-wrap:wrap; padding-top:4px}
.so-check{display:inline-flex; gap:6px; align-items:center; font-size:var(--t-sm)}
.so-tabs{margin-bottom:12px}
.so-post{display:flex; gap:20px; padding:16px; margin-bottom:12px; flex-wrap:wrap; align-items:flex-start}
.so-preview{flex:0 0 300px; max-width:100%}
.so-preview canvas,.so-preview img{width:100%; height:auto; aspect-ratio:1; border-radius:var(--r-md); border:1px solid var(--line); display:block; margin-bottom:8px}
.so-fields{flex:1 1 360px; min-width:0}
.so-fields textarea{width:100%; resize:vertical}
.so-count{float:right; font-family:"IBM Plex Mono",monospace; font-size:var(--t-xs); color:var(--ink-3)}
.so-count.over{color:var(--crit); font-weight:600}
.so-actions{display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:6px}
.so-hint{flex:1 1 180px; min-width:0; font:inherit; font-size:var(--t-sm); padding:6px 10px; border:1px solid var(--control-line); border-radius:var(--r-md); background:var(--surface); color:var(--ink)}
.so-text{font-size:var(--t-sm); color:var(--ink-2); white-space:pre-wrap; overflow-wrap:anywhere; margin-top:8px}
.so-net{margin-top:8px; font-size:var(--t-sm)}
@media (max-width:640px){ .so-preview{flex-basis:100%} }
.so-insights{display:flex; gap:24px; flex-wrap:wrap; margin-top:12px}
.so-insight{flex:1 1 260px; min-width:0}
.so-insight-row{display:flex; gap:10px; justify-content:space-between; align-items:baseline; padding:5px 0; border-bottom:1px solid var(--line); font-size:var(--t-sm)}
.so-insight-row span:first-child{flex:1; min-width:0}
.so-lib{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px}
.so-asset{padding:12px}
.so-asset img,.so-asset-words{width:100%; aspect-ratio:1; object-fit:cover; border-radius:var(--r-md); border:1px solid var(--line); display:block}
.so-asset-words{display:flex; align-items:center; padding:14px; font-weight:600; background:var(--surface-2); overflow:hidden}
.so-preview canvas.tall,.so-preview img.tall{aspect-ratio:9/16; max-width:220px}
.so-preview video,.so-asset video{width:100%; border-radius:var(--r-md); border:1px solid var(--line); display:block; margin-bottom:8px; background:#000; max-height:420px}
.so-slides{display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-bottom:8px}
.so-slides canvas,.so-slides img{margin:0; border-radius:6px}
.ag-compare{border-collapse:collapse; font-size:var(--t-sm); margin-top:6px; max-width:100%}
.ag-compare th,.ag-compare td{text-align:left; padding:4px 10px 4px 0; border-bottom:1px solid var(--line); vertical-align:top; overflow-wrap:anywhere}
.ag-compare th{font-weight:500; color:var(--ink-3); white-space:nowrap}
.ag-compare td.keep{font-weight:600}
.ag-kept{font-size:var(--t-xs); color:var(--accent-ink); background:var(--accent-soft); border-radius:4px; padding:0 5px; font-weight:500}
.ag-evlist{margin:6px 0 0 18px; font-size:var(--t-sm); color:var(--ink-2)}
.pill.score{font-family:"IBM Plex Mono",monospace; font-weight:600}
.ag-points{margin:6px 0 0; padding-left:18px; font-size:var(--t-sm); line-height:1.5}
.ins-form{display:grid; grid-template-columns:1fr 1fr 2fr auto; gap:10px; align-items:end}
@media (max-width:900px){ .ins-form{grid-template-columns:1fr} }
.ins-bar{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin:12px 2px}
.ins-comp{margin-bottom:12px} .ins-comp.is-off{opacity:.65}
.ins-caps{display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:8px}
.ins-caps .eyebrow{flex:0 0 96px}
.ins-cap{padding:3px 9px; border-radius:100px; background:var(--surface-3); font-size:var(--t-sm)}
.ins-cap.is-new{background:var(--accent-soft); border:1px solid var(--accent); color:var(--accent-ink); font-weight:500}
.ins-cap.is-new::after{content:" new"; font-size:var(--t-xs); text-transform:uppercase; letter-spacing:.04em}
.ins-log{display:flex; gap:10px; align-items:baseline; padding:7px 0; border-top:1px solid var(--line); font-size:var(--t-sm); flex-wrap:wrap}
.ins-ev{margin:4px 0 0; padding-left:18px; font-size:var(--t-sm); color:var(--ink-2)}
.ins-score{display:flex; gap:18px; align-items:center; flex-wrap:wrap; margin-bottom:12px}
.ins-n{font-size:48px; line-height:1; font-weight:700; font-variant-numeric:tabular-nums}
.ins-n.ok{color:var(--ok, var(--accent))} .ins-n.mid{color:var(--warn)} .ins-n.low{color:var(--crit)}
.ins-act,.ins-find{display:flex; gap:10px; align-items:flex-start; padding:9px 0; border-top:1px solid var(--line)}
.ins-act .pill,.ins-find .pill{flex:none}
.ins-act > div,.ins-find > div{min-width:0; flex:1}
.hot-strip{background:var(--surface); border:1px solid var(--line); border-left:5px solid var(--crit); border-radius:var(--r-lg); padding:14px 16px; margin-bottom:14px}
.hot-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap}
.hot-head h2{font-size:var(--t-lg); margin:0}
.hot-n{display:inline-block; min-width:26px; padding:1px 8px; border-radius:100px; background:var(--crit); color:#fff; font-size:var(--t-sm); text-align:center; vertical-align:middle; font-variant-numeric:tabular-nums}
.hot-rows{margin-top:10px; border-top:1px solid var(--line)}
.hot-row{display:flex; align-items:center; gap:12px; padding:8px 0; border-bottom:1px solid var(--line)}
.hot-row .rowbtn{flex:1; min-width:0; text-align:left}
.hot-row .rowbtn span{display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.hot-tel{font-family:"IBM Plex Mono",monospace; font-size:var(--t-sm); white-space:nowrap}
.hot-who{white-space:nowrap} .hot-who.none{color:var(--warn)}
@media (max-width:640px){ .hot-row{flex-wrap:wrap} .hot-row .rowbtn{flex-basis:100%} }
.score-parts{display:flex; gap:14px; flex-wrap:wrap; margin-top:8px; font-size:var(--t-sm); color:var(--ink-2)}
.score-parts b{font-weight:600; color:var(--ink)}
.score-moved{margin:8px 0 0; font-size:var(--t-sm); padding:6px 9px; border-radius:var(--r-md); background:var(--surface-2)}
.score-moved.up{border-left:3px solid var(--ok, var(--accent))} .score-moved.down{border-left:3px solid var(--crit)}
.call-tips{margin:8px 0 0; padding:8px 10px; border-radius:var(--r-md); background:var(--accent-soft); color:var(--ink); font-size:var(--t-sm); display:grid; gap:3px}
.call-tips b{font-weight:600; margin-right:4px}
.score-why{list-style:none; margin:8px 0 0; padding:0; font-size:var(--t-sm); color:var(--ink-2)}
.score-why li{padding:3px 0; display:flex; gap:8px}
.score-why .mono{flex:0 0 34px; text-align:right; font-weight:600}
.score-why .up{color:var(--ok, var(--accent-ink))} .score-why .down{color:var(--crit)}
.ag-settings-fold{margin-top:12px; padding-top:12px; border-top:1px solid var(--line)}
.ag-settings-fold summary{cursor:pointer; font-size:var(--t-sm); font-weight:600; margin-bottom:10px}
.ag-weights{display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:8px 12px; margin-bottom:10px}
.ag-quote{margin:6px 0 0; padding:8px 12px; border-left:3px solid var(--line); background:var(--surface-2); font-size:var(--t-sm); white-space:pre-wrap; overflow-wrap:anywhere}
.ag-quote span{display:block; margin-bottom:2px}
.ag-check{list-style:none; margin:6px 0 0; padding:0; font-size:var(--t-sm)}
.ag-check li.done{color:var(--ink-3)}
.ag-section{margin-top:8px}
.ag-link{display:block; font-size:var(--t-sm); padding:2px 0}
.ag-draft{margin-top:8px}
.ag-draft textarea{width:100%; font:inherit; font-size:var(--t-sm)}
.so-colour{display:inline-flex; gap:6px; align-items:center; font-size:var(--t-sm)}
.so-colour input{width:40px; height:30px; padding:0; border:1px solid var(--control-line); border-radius:6px; background:none}
.so-warn{font-size:var(--t-sm); color:var(--crit); border:1px solid color-mix(in srgb, var(--crit) 40%, var(--line)); border-radius:var(--r-md); padding:8px 10px; margin:0 0 10px}
.so-cal{padding:4px 16px}
.so-day{padding:10px 0; border-bottom:1px solid var(--line)}
.so-day:last-child{border-bottom:0}
.so-day.today .so-day-name{color:var(--accent-ink)}
.so-day-name{font-weight:600; font-size:var(--t-sm); margin-bottom:6px}
.so-cal-item{display:flex; gap:8px; align-items:center; flex-wrap:wrap; padding:3px 0; font-size:var(--t-sm)}
.so-cal-text{flex:1 1 200px; min-width:0; overflow-wrap:anywhere}
.so-score{border:1px solid var(--line); border-radius:var(--r-md); padding:8px 10px; margin:0 0 10px}
.so-score summary{display:flex; gap:10px; align-items:center; cursor:pointer; list-style:none; flex-wrap:wrap}
.so-score summary::-webkit-details-marker{display:none}
.so-score-n{min-width:38px; text-align:center; font-weight:700; border-radius:999px; padding:4px 8px; font-variant-numeric:tabular-nums}
.so-score-n.ok{background:var(--ok-soft); color:var(--ok)}
.so-score-n.info{background:var(--accent-soft); color:var(--accent-ink)}
.so-score-n.warn{background:var(--warn-soft); color:var(--warn)}
.so-score-parts{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:12px; margin-top:10px}
.so-score-head{display:flex; justify-content:space-between; font-size:var(--t-sm); font-weight:600}
.so-score-bar{height:4px; border-radius:2px; background:var(--line); margin:4px 0 6px; overflow:hidden}
.so-score-bar i{display:block; height:100%; background:var(--accent)}
.so-score-part ul{margin:0; padding:0; list-style:none; font-size:var(--t-sm)}
.so-score-part li{padding:2px 0 2px 18px; position:relative; overflow-wrap:anywhere}
.so-score-part li::before{position:absolute; left:0}
.so-score-part li.yes::before{content:"✓"; color:var(--ok)}
.so-score-part li.no::before{content:"!"; color:var(--warn); font-weight:700; left:4px}
.so-score-part li.yes{color:var(--muted, inherit)}
.so-player{display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-bottom:8px}
.so-player input[type=range]{flex:1 1 90px; min-width:80px; accent-color:var(--accent)}
.so-time{font-size:var(--t-xs); color:var(--ink-3); white-space:nowrap}
.so-cal-bar{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.so-cal-title{min-width:150px; text-align:center}
.so-legend{display:flex; gap:6px 14px; flex-wrap:wrap; margin-top:10px}
.so-legend .so-chip{background:none; padding:0}
.so-grid-card{padding:10px}
.so-grid{display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px}
.so-grid-head{margin-bottom:4px; font-size:var(--t-xs); color:var(--ink-3); font-weight:600; text-align:center}
.so-cell{display:flex; flex-direction:column; gap:3px; align-items:stretch; min-height:96px; padding:6px; text-align:left; background:var(--surface, #fff); border:1px solid var(--line); border-radius:var(--r-md); cursor:pointer; font:inherit; color:inherit; min-width:0}
.so-cell.out{opacity:.45}
.so-cell.today{border-color:var(--accent)}
.so-cell.today .so-cell-n{color:var(--accent-ink); font-weight:700}
.so-cell.on{box-shadow:0 0 0 2px var(--accent)}
.so-cell-n{font-size:var(--t-xs); color:var(--ink-3)}
.so-chip{display:flex; gap:5px; align-items:center; min-width:0; font-size:11px; line-height:1.3; padding:2px 5px; border-radius:5px; background:color-mix(in srgb, var(--chip, var(--ink-3)) 12%, transparent)}
.so-chip i{flex:none; width:7px; height:7px; border-radius:50%; background:var(--chip, var(--ink-3))}
.so-chip b{flex:none; font-weight:600; font-variant-numeric:tabular-nums}
.so-chip em{font-style:normal; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0}
.so-chip.k-posted,.so-chip.k-partial{--chip:var(--ok)}
.so-chip.k-approved,.so-chip.k-publishing{--chip:var(--accent)}
.so-chip.k-draft{--chip:var(--warn)}
.so-chip.k-failed{--chip:var(--crit)}
.so-chip.k-empty{--chip:var(--crit); background:none; outline:1px dashed color-mix(in srgb, var(--crit) 55%, transparent); outline-offset:-1px}
.so-chip.k-empty i{background:none; border:1.5px solid var(--crit)}
.so-chip.k-rejected{--chip:var(--ink-3)}
.so-chip.k-rejected em{text-decoration:line-through}
.so-chip.k-page{--chip:#3F66B5}
.so-more{font-size:11px; color:var(--ink-3)}
@media (max-width:760px){ .so-cell{min-height:64px; padding:4px} .so-chip{padding:2px 3px} .so-chip em,.so-chip b{display:none} .so-chip{justify-content:center} .so-legend .so-chip{justify-content:flex-start} }
.so-cell.plan{background:color-mix(in srgb, var(--accent) 7%, var(--surface, #fff))}
.so-cell.drop{box-shadow:0 0 0 2px var(--accent); background:color-mix(in srgb, var(--accent) 16%, var(--surface, #fff))}
.so-chip[draggable=true]{cursor:grab}
.so-chip[draggable=true]:active{cursor:grabbing}
.so-move{font:inherit; font-size:var(--t-sm); padding:4px 6px; border:1px solid var(--control-line); border-radius:6px; background:var(--surface, #fff); color:inherit; max-width:100%}
.so-preview{flex-basis:340px}
.so-preview canvas.tall,.so-preview img.tall{max-width:260px}
.so-preview [data-so-zoom],.so-preview [data-so-shot],.so-slides canvas{cursor:zoom-in}
.so-slides canvas.on{outline:2px solid var(--accent); outline-offset:1px}
.so-pager .so-time{min-width:44px; text-align:center}
.so-zoom{position:fixed; inset:0; z-index:90; background:rgba(12,16,20,.82); display:flex; align-items:center; justify-content:center; gap:12px; padding:16px}
.so-zoom-pic{display:flex; max-width:min(92vw,1080px); max-height:92vh}
.so-zoom-pic canvas,.so-zoom-pic img{max-width:100%; max-height:92vh; width:auto; height:auto; border-radius:10px; background:#fff; object-fit:contain}
.so-zoom-x{position:absolute; top:14px; right:14px}
.so-zoom-nav{font-size:22px; line-height:1; padding:10px 14px; flex:none}
.so-zoom-n{position:absolute; bottom:14px; left:50%; transform:translateX(-50%); color:#fff; font-size:var(--t-sm); font-variant-numeric:tabular-nums}
@media (max-width:640px){ .so-zoom{padding:8px; gap:4px} .so-zoom-nav{padding:8px 10px} }
.so-post [hidden]{display:none !important}
.so-ref{border:1px solid var(--line); border-radius:var(--r-md); padding:12px; margin:0 0 12px}
.so-drop{border:1.5px dashed var(--control-line); border-radius:var(--r-md); padding:12px; font-size:var(--t-sm); line-height:1.5}
.so-drop.over{border-color:var(--accent); background:color-mix(in srgb, var(--accent) 8%, transparent)}
.so-pick{color:var(--accent-ink); text-decoration:underline; cursor:pointer}
.so-ref-on{display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:10px; padding-top:10px; border-top:1px solid var(--line)}
.so-ref-on img{width:64px; height:64px; object-fit:cover; border-radius:6px; border:1px solid var(--line)}
.so-ref-on span{flex:1 1 160px; min-width:0; overflow-wrap:anywhere}
.nav-btn .count.count-alert{background:var(--crit); color:#fff; font-weight:700}
.ag-filter{display:flex; gap:6px; flex-wrap:wrap; margin-top:10px}
.cust-show{display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px}
.ag-filter .chip{font:inherit; font-size:var(--t-sm); padding:4px 10px; border-radius:999px; border:1px solid var(--control-line); background:var(--surface, #fff); color:inherit; cursor:pointer}
.ag-filter .chip.on{background:var(--accent); border-color:var(--accent); color:#fff}
.ag-nudge{display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap; border-color:var(--crit)}
.dec-flash{position:fixed; inset:0; z-index:95; background:rgba(10,16,14,.5); display:grid; place-items:center; padding:20px; animation:decIn .18s ease-out}
.dec-flash-card{background:var(--surface, #fff); color:var(--ink, inherit); border-radius:14px; padding:22px 24px; width:min(560px, 100%); max-height:88vh; overflow:auto; box-shadow:0 24px 60px rgba(0,0,0,.3); border-top:5px solid var(--crit)}
.dec-flash-n{font-size:56px; line-height:1; font-weight:700; color:var(--crit); font-variant-numeric:tabular-nums}
.dec-flash-card h2{font-size:var(--t-lg); margin:4px 0 6px}
.dec-flash-list{border-top:1px solid var(--line)}
.dec-flash-item{display:flex; gap:10px; align-items:flex-start; padding:9px 0; border-bottom:1px solid var(--line); font-size:var(--t-sm)}
.dec-flash-item .pill{flex:none}
@keyframes decIn{from{opacity:0} to{opacity:1}}
@media (prefers-reduced-motion:reduce){ .dec-flash{animation:none} }
/* The Pipeline Nurse's reminder borrows the Decisions alert, in a calmer colour: it is a nudge, not an alarm. */
.nurse-card{border-top-color:var(--warn, #b7791f)}
.nurse-card .dec-flash-n{color:var(--warn, #b7791f); margin-top:4px}
.nurse-sec{border-top:1px solid var(--line); padding:9px 0}
.nurse-links{display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:4px; font-size:var(--t-sm)}
.ag-how{border:1px solid var(--line); border-left:3px solid var(--accent); border-radius:var(--r-md); padding:10px 12px; margin:10px 0}
.ag-how ol{margin:6px 0 10px; padding-left:20px; font-size:var(--t-sm); line-height:1.55}
.nav-btn .count.count-alert{padding:1px 7px; border-radius:999px; min-width:0}
.ag-how a.btn{text-decoration:none}
.merge-modal{position:fixed; inset:0; z-index:80; background:rgba(10,16,14,.5); display:flex; justify-content:center; align-items:flex-start; padding:24px 16px; overflow:hidden}
.merge-modal-body{width:min(1040px,100%); max-height:calc(100vh - 48px); overflow-y:auto; background:var(--bg, #f3f5f4); border-radius:14px; padding:16px; box-shadow:0 24px 60px rgba(0,0,0,.3)}
body.merge-open{overflow:hidden}
@media (max-width:640px){ .merge-modal{padding:8px} .merge-modal-body{max-height:calc(100vh - 16px); padding:10px} }
.mm-keep{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:10px}
.mm-row{display:grid; grid-template-columns:150px 1fr; gap:10px; align-items:start; padding:8px 0; border-top:1px solid var(--line)}
.mm-row:first-child{border-top:0}
.mm-values{display:flex; flex-wrap:wrap; gap:6px}
.mm-values .pickval{flex:1 1 220px; text-align:left; display:flex; justify-content:space-between; gap:10px; align-items:baseline; overflow-wrap:anywhere}
.mm-from{flex:none; font-size:var(--t-xs); color:var(--ink-3)}
.mm-danger{border-color:var(--crit)}
@media (max-width:640px){ .mm-row{grid-template-columns:1fr; gap:4px} }
#manyMerge .card{padding:14px 16px}
#view-insights .card{margin-bottom:12px}

.person-edit{display:flex; flex-direction:column; gap:10px; padding:12px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface-2)}
.person-email{display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; border-top:1px solid var(--line); padding-top:12px}
.ins-profile summary{cursor:pointer}
.ins-profile[open] summary{margin-bottom:4px}
.pill.mail-agent{background:var(--accent-soft); color:var(--accent-ink); border:1px solid var(--accent)}
.mail-full summary{cursor:pointer; color:var(--accent-ink); font-size:var(--t-sm); margin-top:4px}
.mail-full[open] summary{margin-bottom:6px}
.ist-mail:has(.mail-full[open]) .mail-preview{display:none}
.mail-text{white-space:pre-wrap; overflow-wrap:anywhere; max-height:none}
.ist-mail.is-auto{opacity:.8}
.ins-find-d{border-top:1px solid var(--line)}
.ins-find-d > summary{list-style:none; cursor:pointer; border-top:0}
.ins-find-d > summary::-webkit-details-marker{display:none}
.ins-more{flex:none; font-size:var(--t-sm); color:var(--accent-ink); align-self:center}
.ins-find-d[open] .ins-more{visibility:hidden}
.ins-find-body{padding:4px 0 12px 12px; margin-left:4px; border-left:3px solid var(--line); font-size:var(--t-sm)}
.ins-ev-row{padding:4px 0; overflow-wrap:anywhere}
.ins-pages td,.ins-pages th{font-size:var(--t-sm); vertical-align:top}

/* ---- Before you call: the brief at the top of a lead, and the call sheet ---- */
.brief{display:grid; gap:10px; font-size:var(--t-sm)}
.brief-who{display:grid; gap:3px; padding:9px 11px; border-radius:var(--r-md); background:var(--accent-soft); color:var(--ink)}
.brief-who b, .brief-open b, .brief-obj b{font-weight:600; margin-right:4px}
.brief-warn{color:var(--crit); font-weight:600}
.brief-sec{display:grid; gap:4px}
.brief-h{font-size:var(--t-xs, 11px); text-transform:uppercase; letter-spacing:.06em; color:var(--ink-3); font-weight:600}
.brief ul{margin:0; padding-left:18px; display:grid; gap:2px}
.brief-avoid li{color:var(--crit)}
.brief-told{padding:6px 9px; border-left:3px solid var(--accent); background:var(--surface-2); border-radius:var(--r-sm, 6px)}
.brief-open{display:grid; gap:5px}
.brief-say{font-size:15px; line-height:1.45; color:var(--ink)}
.brief-obj{padding:6px 9px; background:var(--surface-2); border-radius:var(--r-sm, 6px)}
.brief.compact{padding:0 16px 14px}
.sheet-top{display:flex; align-items:center; gap:12px; padding:14px 16px 10px; flex-wrap:wrap}
.sheet-n{width:26px; height:26px; border-radius:50%; display:grid; place-items:center; background:var(--surface-3); font-weight:600; font-size:var(--t-sm)}
.quick-facts{margin:8px 0 4px; border:1px solid var(--line); border-radius:var(--r-md); padding:6px 10px}
.quick-facts summary{cursor:pointer; font-size:var(--t-sm); font-weight:600; padding:4px 0}
.quick-facts .fgrid{margin-top:8px}
.quick-facts .field.wide{grid-column:1 / -1}
.quick-facts .field.check{display:flex; align-items:center; gap:6px; flex-direction:row}
.ops-where{display:flex; flex-wrap:wrap; max-width:100%}
.ag-emails{display:grid; gap:8px; margin-top:8px}
.ag-email{border:1px solid var(--line); border-radius:var(--r-md); padding:8px 12px; background:var(--surface)}
.ag-email summary{cursor:pointer; font-size:var(--t-sm)}
.ag-email-body{margin-top:8px; font-size:var(--t-sm); line-height:1.55; padding:10px 12px; background:var(--surface-2); border-radius:var(--r-sm)}
.ag-email-body p{margin:0 0 10px}
.pb-head{display:flex; gap:12px; align-items:flex-start; justify-content:space-between}
.pb-sections{display:grid; gap:10px; margin-top:12px}
.pb-sections textarea{width:100%; font-size:var(--t-sm); line-height:1.5}
.rm-row{display:flex; gap:8px; align-items:flex-start; padding:8px 0; border-top:1px solid var(--line)}
