/* Nubits LeadEngine
   One bold element: the signal meter next to each lead. Everything else is
   quiet: cool paper, slate ink, one indigo for actions. */

:root {
  --paper: #F2F4F1;
  --sheet: #FFFFFF;
  --ink: #1A232D;
  --ink-2: #4A5664;
  --muted: #6E7A87;
  --line: #DCE1E3;
  --line-2: #E9ECEC;
  --act: #3346C4;
  --act-ink: #FFFFFF;
  --act-soft: #E8EBFA;
  --strong: #13795B;
  --strong-soft: #E2F2EC;
  --mid: #B07514;
  --mid-soft: #FAF0DC;
  --weak: #8B95A1;
  --weak-soft: #EEF0F2;
  --out: #B03A3A;
  --out-soft: #F8E6E4;
  --r-s: 6px;
  --r-m: 10px;
  --font: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--font);
}
a { color: var(--act); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; border-radius: 3px; }
.tabs { scrollbar-width: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── top bar ───────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 5; background: var(--ink); color: #DCE3EA;
}
.bar-in {
  max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 54px;
  display: flex; align-items: center; gap: 18px;
}
.brand { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.2px; display: flex; gap: 8px; align-items: center; }
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
.ws-name { color: #9FB0C0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { color: #C9D3DC; padding: 6px 10px; border-radius: var(--r-s); font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.on { color: #fff; background: rgba(255,255,255,.12); }
.bar .grow { flex: 1; }
.bar form { margin: 0; }
.bar .linkbtn { background: none; border: 0; color: #C9D3DC; padding: 6px 4px; font: inherit; font-size: 14px; cursor: pointer; }
.bar .linkbtn:hover { color: #fff; }

/* ── page ──────────────────────────────────────────────── */
main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head .grow { flex: 1; min-width: 220px; }
h1 { font-size: 27px; line-height: 1.15; font-weight: 700; letter-spacing: -.5px; margin: 0; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 650; letter-spacing: -.2px; margin: 32px 0 10px; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 6px; }
.lede { color: var(--ink-2); font-size: 16px; margin: 6px 0 0; max-width: 68ch; }
.lede b { color: var(--ink); font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
p { max-width: 75ch; }

.flash {
  background: var(--act-soft); color: var(--ink); border-left: 3px solid var(--act);
  padding: 10px 14px; border-radius: 0 var(--r-s) var(--r-s) 0; margin: 0 0 18px;
}

/* Panels: one surface style for forms and groups. Lists don't use it. */
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 20px; margin-bottom: 14px; min-width: 0; overflow-wrap: anywhere; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.quiet { background: transparent; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px 18px; margin-bottom: 12px; }

.grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ── controls ──────────────────────────────────────────── */
button, .btn {
  font: 600 14px/1 var(--font); border: 1px solid var(--act); background: var(--act); color: var(--act-ink);
  border-radius: var(--r-s); padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button.ghost, .btn.ghost { background: var(--sheet); color: var(--act); border-color: #C8CFEF; }
button.ghost:hover, .btn.ghost:hover { background: var(--act-soft); filter: none; }
button.danger { background: var(--out); border-color: var(--out); }
button.plain { background: none; border-color: transparent; color: var(--ink-2); padding: 8px 10px; }
button.plain:hover { background: var(--line-2); filter: none; }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
input, select, textarea {
  font: 400 15px/1.4 var(--font); color: var(--ink); width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--act); outline: none; box-shadow: 0 0 0 3px var(--act-soft); }
textarea { min-height: 88px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 5px; }
label .hint { font-weight: 400; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.checks label { font-weight: 400; margin: 0; display: flex; gap: 8px; align-items: center; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--act); flex: none; }
input[type=file] { padding: 7px; }

/* ── tabs (segmented) ──────────────────────────────────── */
.tabs { display: inline-flex; background: var(--line-2); border-radius: var(--r-m); padding: 3px; gap: 2px; flex-wrap: wrap; margin: 4px 0 14px; }
.tabs a { padding: 7px 13px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 550; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(26,35,45,.12); }
.tabs .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; margin-left: 4px; }

/* ── filters ───────────────────────────────────────────── */
.filters { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 16px; }
.filters summary { display: none; }
.filters .fgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.filters label { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.filters select, .filters input { padding: 7px 9px; font-size: 14px; }
.filters .frow { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.filters .frow input { max-width: 300px; }

/* ── the signal meter (the one bold element) ───────────── */
.sig { display: flex; align-items: flex-end; gap: 10px; min-width: 76px; }
.sig .num { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; letter-spacing: -.5px; line-height: 1; width: 2.2ch; text-align: right; }
.sig .bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.sig .bars i { display: block; width: 5px; border-radius: 1.5px; background: var(--line); }
.sig .bars i:nth-child(1) { height: 6px; }  .sig .bars i:nth-child(2) { height: 10px; }
.sig .bars i:nth-child(3) { height: 14px; } .sig .bars i:nth-child(4) { height: 18px; }
.sig .bars i:nth-child(5) { height: 22px; }
.sig.s-strong .num { color: var(--strong); } .sig.s-strong .bars i.on { background: var(--strong); }
.sig.s-mid .num { color: var(--mid); }       .sig.s-mid .bars i.on { background: var(--mid); }
.sig.s-weak .num { color: var(--weak); }     .sig.s-weak .bars i.on { background: var(--weak); }
.sig.s-out .num { color: var(--out); }       .sig.s-out .bars i.on { background: var(--out); }

/* ── lead list ─────────────────────────────────────────── */
.list { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.item { display: grid; grid-template-columns: 92px minmax(0, 1fr) 170px 190px; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line-2); align-items: start; }
.item:first-child { border-top: 0; }
.item:hover { background: #FAFBFA; }
.item .title { font-weight: 650; font-size: 15.5px; color: var(--ink); line-height: 1.35; }
.item .title:hover { color: var(--act); }
.item .who { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.item .who a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.item .why { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.item .meta { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.item .meta b { color: var(--ink); font-weight: 600; }
.item .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.item .acts form { margin: 0; }
.item .acts button { padding: 7px 11px; font-size: 13px; }
.item.st-contacted { background: linear-gradient(90deg, var(--strong-soft), transparent 40%); }
.item.st-not_fit { opacity: .55; }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-2); }
.empty p { margin: 6px auto 14px; }

.tag { display: inline-block; font-size: 12.5px; line-height: 1.6; padding: 0 8px; border-radius: 999px; background: var(--weak-soft); color: var(--ink-2); white-space: nowrap; }
.tag.good { background: var(--strong-soft); color: var(--strong); }
.tag.warn { background: var(--mid-soft); color: #835509; }
.tag.bad  { background: var(--out-soft); color: var(--out); }
.tag.act  { background: var(--act-soft); color: var(--act); }
/* legacy names used by older screens */
.pill { display: inline-block; font-size: 12.5px; line-height: 1.6; padding: 0 8px; border-radius: 999px; background: var(--weak-soft); color: var(--ink-2); }
.pill.ok { background: var(--strong-soft); color: var(--strong); }
.pill.warn { background: var(--mid-soft); color: #835509; }
.pill.bad { background: var(--out-soft); color: var(--out); }

/* tier letters (company specs) share the score colours */
.tier { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; font-weight: 700;
  font-size: 13px; border-radius: 5px; color: #fff; padding: 0 6px; }
.tier.A { background: var(--strong); } .tier.B { background: var(--act); } .tier.S { background: #6D5BA8; }
.tier.C { background: var(--weak); } .tier.X { background: var(--out); }

/* ── tables (settings, runs) ───────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--sheet); }
.panel table, .card table { background: transparent; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
ul.reasons { margin: 6px 0 0; padding-left: 18px; }
ul.reasons li { margin: 3px 0; }
.stat { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
pre.draft { white-space: pre-wrap; font: inherit; background: var(--paper); border-radius: var(--r-s); padding: 10px; }
details > summary { cursor: pointer; color: var(--ink-2); }
code { font-size: 13px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }

/* workspace tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile { display: block; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px 18px; color: inherit; }
.tile:hover { border-color: #B9C1E9; text-decoration: none; }
.tile .t { font-weight: 650; font-size: 16px; }
.tile .s { color: var(--ink-2); font-size: 14px; margin-top: 4px; }

/* source rows */
.src { border-top: 1px solid var(--line-2); padding: 14px 0; }
.src:first-of-type { border-top: 0; }
.src .grid { margin-top: 8px; }

/* key/value lists on detail pages */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* detail header: score beside the title */
.head.detail { align-items: center; }
.head.detail .sig { align-self: center; }
/* settings: give cities the room */
table.markets th:nth-child(3) { width: 44%; }
table.markets th:nth-child(4) { width: 18%; }

/* login */
.login { max-width: 400px; margin: 9vh auto 0; }
.login h1 { margin-bottom: 4px; }

/* ── phones ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .filters .fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .item { grid-template-columns: 80px minmax(0, 1fr); }
  .item .meta { grid-column: 2; }
  .item .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bar-in { padding: 0 14px; gap: 10px; height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .ws-name { display: none; }
  main { padding: 18px 12px 48px; }
  h1 { font-size: 23px; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { white-space: nowrap; }
  .filters { padding: 0; }
  .filters summary { display: flex; padding: 12px 14px; font-weight: 600; color: var(--ink); list-style: none; }
  .filters summary::-webkit-details-marker { display: none; }
  .filters[open] summary { border-bottom: 1px solid var(--line-2); }
  .filters .fbody { padding: 12px 14px; }
  .filters .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item { padding: 14px; gap: 10px 12px; grid-template-columns: 64px minmax(0, 1fr); }
  .sig { flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
  .sig .num { width: auto; text-align: left; }
  .kv { grid-template-columns: 110px 1fr; }
  table.leads thead { display: none; }
  table.leads, table.leads tbody, table.leads tr, table.leads td { display: block; width: 100%; }
  table.leads tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.leads td { border: 0; padding: 3px 4px; }
  table.leads td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
}
@media (min-width: 641px) { .filters > .fbody { display: block !important; } }
