:root {
  --ink: #1b2430;
  --ink-2: #4a5566;
  --ink-3: #5f6b7b;
  --paper: #f3f5f7;
  --black: #000000;
  --warm-text: #1f7a55;
  --acq-text: #7d6100;
  --surface: #ffffff;
  --line: #dde2e8;
  --line-2: #eceff3;
  --sea: #1f5f8b;
  --sea-2: #e6eef5;
  --close: #0e7c66;
  --warm: #4aa57e;
  --acq: #c39a22;
  --dormant: #8a94a3;
  --cold: #c7cdd4;
  --bad: #b23b3b;
  --radius: 6px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; }
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--black) 208px, transparent 208px); }
.nav { background: var(--black); color: #d8dee6; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 17px; }
.brand svg { flex: none; }
.nav a { display: flex; justify-content: space-between; align-items: center; color: #c9d1db; padding: 7px 10px;
  border-radius: var(--radius); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav .count { font-size: 12px; color: #8f9aa8; }
.nav .spacer { flex: 1; }
.nav .who { font-size: 12.5px; color: #8f9aa8; padding: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; gap: 10px; align-items: center; padding: 12px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.ask { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0 10px; max-width: 640px; }
.ask input { flex: 1; border: 0; background: transparent; padding: 8px 0; outline: none; }
.ask:focus-within { border-color: var(--sea); background: #fff; }
.page { padding: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: var(--radius);
  cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--sea); border-color: var(--sea); color: #fff; }
.btn.primary:hover { background: #184d72; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--sea); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px; background: #fff; width: 100%; }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 3px; font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 11px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--sea-2); color: var(--sea); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--sea); color: var(--sea); }
.chip.on { background: var(--sea); border-color: var(--sea); color: #fff; }
.tag { display: inline-block; background: var(--line-2); border-radius: 4px; padding: 1px 7px; font-size: 12px; color: var(--ink-2); margin: 1px 3px 1px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stack > * + * { margin-top: 14px; }

/* ---------- explore ---------- */
.explore { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.explore > *, .mapwrap > * { min-width: 0; }
.tablewrap { overflow-x: auto; border-radius: 8px; }
.show-sm { display: none; }
.filters { position: sticky; top: 74px; max-height: calc(100vh - 92px); overflow: auto; padding-right: 4px; }
.fgroup { border-bottom: 1px solid var(--line); padding: 10px 0; }
.fgroup summary { cursor: pointer; font-weight: 600; display: flex; justify-content: space-between; list-style: none; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary .n { color: var(--sea); font-weight: 500; font-size: 12.5px; }
.fopts { margin-top: 6px; max-height: 220px; overflow: auto; }
.fopt { display: flex; align-items: center; gap: 7px; padding: 2px 0; cursor: pointer; font-size: 13px; }
.fopt .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fopt .c { color: var(--ink-3); font-size: 12px; }
.fsearch { margin: 6px 0 2px; padding: 5px 8px !important; font-size: 13px; }
.toggles label { display: flex; gap: 7px; align-items: center; padding: 3px 0; cursor: pointer; }
.presets { margin-bottom: 14px; }
.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.active-filters .chip { background: var(--sea-2); border-color: transparent; color: var(--sea); }

table.people { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.people th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 9px 10px; border-bottom: 1px solid var(--line);
  background: #fafbfc; white-space: nowrap; }
.people th.sortable { cursor: pointer; }
.people th.sorted { color: var(--sea); }
.people td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.people tr:last-child td { border-bottom: 0; }
.people tbody tr { cursor: pointer; }
.people tbody tr:hover { background: #f8fafc; }
.people tbody tr.sel { background: var(--sea-2); }
.people .name { font-weight: 600; }
.people .sub { color: var(--ink-3); font-size: 12.5px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people td.cb, .people th.cb { width: 34px; }
.flag { font-size: 11.5px; color: var(--sea); background: var(--sea-2); border-radius: 4px; padding: 0 5px; margin-left: 4px; font-weight: 500; }
.flag.net { color: var(--ink-2); background: var(--line-2); }
.flag.change { color: #8a5a00; background: #fbf1d9; }

/* warmth meter: the one memorable element */
.warmth { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.meter { position: relative; width: 64px; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.tier { font-size: 12.5px; font-weight: 600; }
.t-Close { color: var(--close); } .bg-Close { background: var(--close); }
.t-Warm { color: var(--warm-text); } .bg-Warm { background: var(--warm); }
.t-Acquainted { color: var(--acq-text); } .bg-Acquainted { background: var(--acq); }
.t-Dormant { color: var(--ink-2); } .bg-Dormant { background: var(--dormant); }
.t-Cold { color: var(--ink-3); } .bg-Cold { background: var(--cold); }
.t-Shared { color: var(--ink-3); } .bg-Shared { background: var(--cold); }
.loc-src { font-size: 11.5px; color: var(--ink-3); }

.bulkbar { position: sticky; bottom: 12px; margin-top: 12px; background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; box-shadow: 0 6px 24px rgba(27,36,48,.25); z-index: 10; }
.bulkbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.bulkbar .btn.primary { background: #fff; color: var(--ink); border-color: #fff; }
.bulkbar select, .bulkbar input { width: auto; padding: 5px 8px; }

/* ---------- group by ---------- */
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar { display: grid; grid-template-columns: 230px 1fr 230px; gap: 12px; align-items: center; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; }
.bar:hover { background: #fff; }
.bar .k { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 18px; position: relative; }
.bar .track i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; }
.bar .track .all { background: #c9d6e3; }
.bar .track .w { background: var(--warm); }
.bar .nums { font-size: 12.5px; color: var(--ink-2); }
.bar .nums b { color: var(--ink); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- map ---------- */
.mapwrap { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
#map { height: calc(100vh - 170px); min-height: 420px; border-radius: 8px; border: 1px solid var(--line); }
.citylist { max-height: calc(100vh - 170px); overflow: auto; }
.cityrow { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: var(--radius); cursor: pointer; }
.cityrow:hover, .cityrow.on { background: #fff; }

/* ---------- drawer ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(27,36,48,.12); transform: translateX(100%); transition: transform .18s ease; z-index: 50; overflow: auto; }
.drawer.open { transform: none; }
.drawer .dh { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.drawer .db { padding: 16px 20px 40px; }
.drawer .close { position: absolute; right: 14px; top: 14px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }

/* ---------- outreach ---------- */
.drafts { display: flex; flex-direction: column; gap: 12px; }
.draft { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.draft.sent { opacity: .6; }
.draft .meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; align-items: baseline; flex-wrap: wrap; }
.draft textarea.body { min-height: 170px; }
.status { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.status.sent, .status.intro.made { background: #dff1ea; color: var(--close); }
.status.failed { background: #f6e1e1; color: var(--bad); }
.status.queued { background: var(--sea-2); color: var(--sea); }

/* ---------- auth / onboarding ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: var(--black); color: #dce3ea; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.auth .art h1 { color: #fff; font-size: 40px; line-height: 1.08; margin-bottom: 16px; max-width: 12ch; letter-spacing: -0.02em; font-weight: 700; }
.auth .art p { max-width: 46ch; color: #b8c2ce; font-size: 15px; }
.auth .form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth .form .card { width: 100%; max-width: 380px; padding: 26px; }
.steps { counter-reset: s; padding: 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding-left: 30px; margin-bottom: 10px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--sea-2); color: var(--sea); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.drop { border: 1.5px dashed var(--line); border-radius: 8px; padding: 26px; text-align: center; background: #fafbfc; cursor: pointer; }
.drop.over { border-color: var(--sea); background: var(--sea-2); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .18s; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 22px; font-weight: 700; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: #eef1f4; border-radius: 8px; padding: 10px; min-height: 120px; }
.lane h3 { display: flex; justify-content: space-between; }
.lane .item { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-top: 6px; cursor: pointer; font-size: 13px; }
.cov td { vertical-align: top; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--sea); border-radius: 50%;
  animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .nav { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; }
  .nav .brand, .nav .who, .nav .spacer { display: none; }
  .nav a { flex: none; }
  .explore, .mapwrap, .auth { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.open { display: block; }
  .show-sm { display: inline-block; }
  .topbar { padding: 10px; }
  .topbar select { max-width: 120px; }
  .page { padding: 12px; }
  #map { height: 60vh; }
  .auth .art { display: none; }
  .bar { grid-template-columns: 1fr; }
  .people .hide-sm { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}

.tree ul { list-style: none; padding-left: 18px; margin: 4px 0; border-left: 1px solid var(--line); }
.tree > ul { border-left: 0; padding-left: 0; }
.tree li { padding: 3px 0; }

.upload-wrap { max-width: 980px; }
.upload-wrap.first { margin: 48px auto; padding: 0 20px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.upload-grid .card { display: flex; flex-direction: column; height: 100%; }
.upload-grid .steps { flex: 1; }
.upload-grid .u-st:empty { display: none; }
@media (max-width: 760px) { .upload-grid { grid-template-columns: 1fr; } }

.pbar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 4px 0 6px; }
.pbar > span { display: block; height: 100%; background: var(--sea); border-radius: 3px; transition: width .4s ease; }
.pbar-label { color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .pbar > span { transition: none; } }
.pbar.warn > span { background: #c98a00; }
.pbar.bad > span { background: var(--bad); }

/* Logo watermark: the mark sits large and faint behind the open space */
#logofield { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
#app { position: relative; z-index: 1; }
.auth .art { background: var(--black) url("/static/watermark-light.svg") no-repeat right -22% bottom -26% / 78%; }
.auth .art > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 16px; color: #fff; font-weight: 700; font-size: 34px; letter-spacing: -0.02em; }
.auth-brand svg { flex: none; }
.splash { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.splash img { width: 72px; height: 72px; animation: breathe 1.6s ease-in-out infinite; }
.splash p { color: var(--ink-3); margin-top: 14px; min-height: 1.4em; }
@keyframes breathe { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .splash img { animation: none; } }
form.busy .ask, .ask:has(input:disabled) { position: relative; }
form.busy::after { content: "Searching…"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; }
form.busy { position: relative; }

.nav .soon { margin-left: auto; font-size: 10.5px; font-weight: 600; color: #0b1520; background: #e8edf2; border-radius: 999px; padding: 1px 7px; }
.soon.big { font-size: 12px; vertical-align: middle; margin-left: 8px; color: var(--sea); background: var(--sea-2); border-radius: 999px; padding: 2px 9px; font-weight: 600; }
.notice { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--sea); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }
.mrow { display: grid; grid-template-columns: 1fr 1fr 220px; gap: 16px; align-items: start; }
.mside b { display: block; margin: 2px 0; }
.mact { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 900px) { .mrow { grid-template-columns: 1fr; } }
.premium { max-width: 920px; }
.premium .lead { font-size: 16px; max-width: 62ch; color: var(--ink-2, #3a4654); }
.premium .card.accent { border-color: var(--sea); box-shadow: inset 0 3px 0 var(--sea); }
.ticks { padding: 0; margin: 0; list-style: none; }
.ticks li { padding: 6px 0 6px 22px; position: relative; border-top: 1px solid var(--line); }
.ticks li:first-child { border-top: 0; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 9px; height: 5px; border-left: 2px solid var(--sea); border-bottom: 2px solid var(--sea); transform: rotate(-45deg); }
.costs { width: 100%; border-collapse: collapse; margin-top: 10px; }
.costs th, .costs td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); }
.costs th { font-weight: 600; color: var(--ink-3); font-size: 12.5px; border-top: 0; }
.costs td:nth-child(n+2), .costs th:nth-child(n+2) { white-space: nowrap; }
.explore .filters { background: var(--paper); box-shadow: 0 0 0 10px var(--paper); border-radius: 2px; }
.auth .form { flex-direction: column; }
.trust { max-width: 380px; margin: 14px auto 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); background: var(--paper); padding: 2px 0; }
.trust b { color: var(--ink-2); font-weight: 600; }
