@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f5f3fd; --surface: #ffffff; --raised: #faf9ff; --text: #16123a; --muted: #5a5580; --line: #e1dcf4;
  --accent: #5b3df0; --accent-soft: #ebe6ff; --warn: #9a5200; --warn-soft: #fff0d9; --danger: #b3225f; --danger-soft: #ffe6f0; --quiet-soft: #eceaf4;
  --primary: linear-gradient(100deg, #5b3df0, #c2307c);
  --spectrum: linear-gradient(100deg, #6b4bff 0%, #ff4f9a 55%, #ffb454 100%);
  --shadow: 0 1px 2px rgba(22, 18, 58, 0.06), 0 8px 24px -12px rgba(22, 18, 58, 0.18);
  --display: "Bricolage", "Segoe UI", system-ui, sans-serif; --body: "Geist", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0a26; --surface: #17133a; --raised: #1e1947; --text: #f3f1ff; --muted: #b8b2dc; --line: #2e2860;
  --accent: #a996ff; --accent-soft: #2a2360; --warn: #ffc77a; --warn-soft: #3d2c14; --danger: #ff9fc4; --danger-soft: #45173a; --quiet-soft: #262052;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1rem/1.55 var(--body); color: var(--text); background: var(--bg); padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--surface); padding: 0.6rem 1rem; border-radius: 8px; z-index: 30; }
.skip:focus { top: 0.75rem; }

/* Top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; padding-top: calc(0.7rem + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font: 700 1.05rem/1 var(--display); text-decoration: none; }
.brand svg { width: 1.5rem; height: 1.5rem; }
.brand span { display: none; }
.client-pick { flex: 1; min-width: 0; }
.client-pick select { width: 100%; max-width: 20rem; }
.icon { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.icon span { width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--text); box-shadow: inset -0.35rem -0.1rem 0 0 var(--surface); }
:root[data-theme="dark"] .icon span { box-shadow: none; background: var(--spectrum); }

/* Section tabs: bottom bar on phones, top strip on larger screens */
.tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; text-align: center; padding: 1rem 0.25rem; font-weight: 550; font-size: 0.92rem; text-decoration: none; color: var(--muted); min-height: 3.5rem; }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; left: 22%; right: 22%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--spectrum); }
.tabs b { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; margin-left: 0.3rem; padding: 0 0.35rem; border-radius: 999px; font-size: 0.75rem; color: #fff; background: var(--primary); vertical-align: 0.05em; }

main { max-width: 58rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
main:focus { outline: none; }
.loading { color: var(--muted); padding: 2rem 0; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.25rem; }
.head h1 { font-size: 1.9rem; }
.head p { color: var(--muted); }
h2.sec { font-size: 1.15rem; margin: 1.75rem 0 0.75rem; }
.hint { color: var(--muted); font-size: 0.95rem; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 0.75rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 18px; }
.empty strong { display: block; font: 650 1.2rem var(--display); color: var(--text); margin-bottom: 0.25rem; }

/* Buttons and fields */
.btn { font: 600 1rem/1 var(--body); min-height: 2.9rem; padding: 0 1.15rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { border: 0; background: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
label.f { display: grid; gap: 0.35rem; font-weight: 550; font-size: 0.95rem; }
label.f small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: 400 1rem/1.4 var(--body); color: var(--text); background: var(--raised); border: 1.5px solid var(--line); border-radius: 12px; padding: 0.7rem 0.85rem; min-height: 2.9rem; width: 100%; }
textarea { resize: vertical; }
.form { display: grid; gap: 1rem; }
.cols { display: grid; gap: 1rem; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: 12px; padding: 0.7rem 0.9rem; font-size: 0.95rem; }

/* Chips */
.chip { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--quiet-soft); color: var(--muted); white-space: nowrap; }
.chip.good { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Agenda items */
.item h3 { font-size: 1.1rem; }
.item .why { margin-top: 0.35rem; color: var(--muted); }
details.preview { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.7rem; }
details.preview summary { cursor: pointer; font-weight: 550; min-height: 2rem; }
.mail { margin-top: 0.6rem; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem; font-size: 0.95rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.mail b { display: block; margin-bottom: 0.4rem; }

/* Lead rows */
.rows { display: grid; gap: 0.6rem; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; align-items: center; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0.9rem 1rem; box-shadow: var(--shadow); }
.row:hover { border-color: var(--accent); }
.row .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .score { grid-row: span 2; text-align: right; font: 700 1.5rem/1 var(--display); }
.row .score small { display: block; font: 500 0.75rem var(--body); color: var(--muted); margin-top: 0.2rem; }
.row .chips { grid-column: 1 / -1; margin-top: 0.3rem; }
.filters { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.5rem; margin: 0 -1rem 0.75rem; padding-inline: 1rem; scrollbar-width: none; }
.filters button { flex: none; min-height: 2.5rem; padding: 0 0.9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font: 550 0.92rem var(--body); cursor: pointer; text-transform: capitalize; }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Lead detail */
.back { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--muted); text-decoration: none; font-weight: 550; }
.meter { height: 8px; border-radius: 8px; background: var(--quiet-soft); overflow: hidden; margin: 0.6rem 0 0.9rem; }
.meter i { display: block; height: 100%; border-radius: 8px; background: var(--spectrum); }
.w0 { width: 0; } .w10 { width: 10%; } .w20 { width: 20%; } .w30 { width: 30%; } .w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; } .w100 { width: 100%; }
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.reasons li { display: flex; justify-content: space-between; gap: 1rem; }
.reasons li.miss { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.kv { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.4rem 0.75rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.stages { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.stages button { min-height: 2.75rem; padding: 0 0.95rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: 550 0.95rem var(--body); cursor: pointer; text-transform: capitalize; }
.stages button[aria-pressed="true"] { border: 0; background: var(--primary); color: #fff; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); display: grid; gap: 0.9rem; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -1.5rem; top: 0.45rem; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.timeline time { display: block; color: var(--muted); font-size: 0.85rem; }

/* Tables that stay readable on a phone */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.list li { display: grid; gap: 0.3rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; padding-bottom: 0; }
.list .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: center; font-weight: 600; }
.copy { display: flex; gap: 0.5rem; }
.copy input { font-size: 0.9rem; }

.toast { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); top: calc(4.6rem + env(safe-area-inset-top)); max-width: calc(100% - 2rem); background: var(--text); color: var(--bg); padding: 0.75rem 1.1rem; border-radius: 999px; font-weight: 550; box-shadow: var(--shadow); }

@media (min-width: 48rem) {
  body { padding-bottom: 0; }
  .brand span { display: inline; }
  .bar { padding-inline: 1.5rem; }
  .tabs { position: sticky; top: 4.2rem; bottom: auto; display: flex; gap: 0.25rem; justify-content: center; border-top: 0; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); }
  .tabs a { padding: 0.9rem 1.2rem; min-height: 0; font-size: 1rem; }
  .tabs a[aria-current="page"]::before { top: auto; bottom: -1px; left: 1rem; right: 1rem; border-radius: 3px 3px 0 0; }
  main { padding: 2rem 1.5rem 4rem; }
  .head h1 { font-size: 2.4rem; }
  .cols { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; }
  .row .chips { grid-column: 2; grid-row: 1 / span 2; margin: 0; justify-content: flex-end; }
  .row .score { grid-column: 3; grid-row: 1 / span 2; min-width: 4rem; }
  .two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0.75rem; align-items: start; }
  .two > .card + .card { margin-top: 0; }
  .toast { top: auto; bottom: 2rem; }
}
@media (prefers-reduced-motion: no-preference) { .row, .btn { transition: border-color 0.15s ease, transform 0.15s ease; } }

.card > h2.sec:first-child { margin-top: 0; }
.kv.gap { margin-top: 1rem; }
.actions.center { justify-content: center; }
