/* Leakproof dashboard demo. Same tokens as the site (see BRAND.md). */
:root {
  --ink: #1C1A17; --text: #2B2824; --muted: #625D56; --paper: #F6F4EF; --paper-2: #ECE8E0;
  --card: #FDFCFA; --rule: #DCD6CB; --track: #EEEAE2; --water: #1E6A80; --water-dk: #17566A;
  --drop: #3F95AC; --loss: #B04A33; --good: #2E6B4F;
  --hatch: repeating-linear-gradient(135deg, var(--water) 0 3px, #2D7F95 3px 6px);
  --sans: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 15px/1.5 var(--sans); overflow-x: hidden; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--water); }
small { font-size: 12px; }
.dim { color: var(--muted); }
.bad { color: var(--loss); font-weight: 500; }
:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; }

/* Top bar */
.bar { background: var(--ink); color: var(--paper); }
.bar-in, .tabs-in, .main, .demo-note, .foot { max-width: 1200px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.bar-in { display: flex; align-items: center; gap: 22px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.bar-logo img { height: 28px; width: auto; display: block; }
.bar-shop { display: flex; flex-direction: column; line-height: 1.25; padding-left: 22px; border-left: 1px solid #3A3733; margin-right: auto; }
.bar-shop b { font-weight: 700; }
.bar-shop span { font-size: 13px; color: #B9B2A7; }
.viewas { display: inline-flex; background: #2B2824; border-radius: 6px; padding: 3px; }
.viewas button { font: 500 14px var(--sans); color: #CFC9BF; background: none; border: 0; border-radius: 4px; padding: 0 14px; min-height: 38px; cursor: pointer; }
.viewas button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

.demo-note { font-size: 13px; color: var(--muted); padding-top: 10px; padding-bottom: 0; }

/* Tabs */
.tabs { border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper); z-index: 20; }
.tabs-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs-in::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 14px 12px 12px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
body.owner .team-only, body.owner .teamnote { display: none !important; }

/* Views */
.main { padding-top: 26px; padding-bottom: 56px; }
.vhead { margin-bottom: 20px; }
.vhead h1 { font-size: clamp(1.6rem, 3vw, 2rem); margin-bottom: 4px; }
.vhead p { color: var(--muted); max-width: 46em; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 20px; margin-top: 16px; }
.panel h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.ph { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.no { display: inline-grid; place-items: center; width: 22px; height: 22px; font-size: 12px; background: var(--ink); color: var(--paper); border-radius: 3px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .k { width: 12px; height: 10px; background: var(--drop); border-radius: 2px; }
.legend .k.paid { background: var(--hatch); }
.legend .k.miss { background: var(--loss); }
.two { display: grid; gap: 0 16px; }

/* KPIs: one ruled strip, not a row of cards */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.kpi { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--rule); }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi b { display: block; font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.kpi.warn small { color: var(--loss); }

/* Equation */
.eq-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 10px; }
.term { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; color: var(--ink); background: #fff; min-width: 88px; }
a.term:hover { border-color: var(--water); }
.term b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.term small { color: var(--muted); }
.term.total { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.term.total small { color: #CFC9BF; }
.op { font-size: 18px; color: var(--muted); font-weight: 500; }
.eq-note { color: var(--muted); font-size: 14px; }

/* Leads per day chart */
.chart { display: grid; grid-template-columns: 22px 1fr; gap: 8px; height: 150px; }
.axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); text-align: right; }
.cols { display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--ink); background: linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; cursor: default; padding-top: 0; }
.col i { display: block; border-radius: 2px 2px 0 0; }
.col .a { background: var(--drop); }
.col .m { background: var(--loss); }
.col:hover .a, .col:focus .a { background: var(--water); }
.chart-x { display: flex; justify-content: space-between; margin: 6px 0 0 30px; font-size: 11px; color: var(--muted); }

/* Since we started */
.prog { gap: 28px 32px !important; margin-top: 4px; }
.prog > div, .two > section { min-width: 0; }
.legend { flex-wrap: wrap; }
.ch { font-size: 15px; margin-bottom: 6px; }
.pchart { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
.pchart .grid { stroke: var(--rule); stroke-width: 1; }
.pchart .base { stroke: var(--ink); stroke-width: 1; }
.pchart .ax { font: 400 15px var(--sans); fill: var(--muted); }
.pchart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pchart .ln.leak { stroke: var(--loss); }
.pchart .ln.miss { stroke: var(--ink); stroke-dasharray: 5 4; }
.pchart .pt { stroke: var(--card); stroke-width: 2; cursor: default; }
.pchart .pt.leak { fill: var(--loss); }
.pchart .pt.miss { fill: var(--ink); }
.pchart .mark line { stroke: var(--water); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pchart .mark rect { fill: var(--water); }
.pchart .mark text { font: 700 14px var(--sans); fill: #fff; }
.legend .k.ln-leak { background: var(--loss); height: 3px; }
.legend .k.ln-miss { background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 7px); height: 3px; }
.legend .k.k-off { background: none; border: 1.5px dashed var(--loss); }
.marks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.marks b { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 5px; background: var(--water); color: #fff; border-radius: 3px; font-size: 11px; }
.chart.wk { height: 170px; margin-top: 12px; }
.chart.wk .col { gap: 1px; }
.chart.wk .col i { border-radius: 0; }

/* Sources table */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
td small { display: block; color: var(--muted); }
.srct td b { color: var(--ink); font-weight: 500; }
.pres { display: none; }
body.presenter .pres { display: table-cell; }
.teamnote { display: none; }
body.presenter .teamnote { display: block; }
td.wrap { white-space: normal; min-width: 220px; color: var(--muted); font-size: 14px; }
.bcell { width: 34%; min-width: 160px; }
.bwrap { display: flex; align-items: center; gap: 10px; }
.hb { flex: 1; display: flex; height: 12px; background: var(--track); border-radius: 2px; overflow: hidden; }
.hb i { display: block; height: 100%; background: var(--drop); }
.hb i.paid { background: var(--hatch); }
.hb.big { height: 16px; }
.num { min-width: 22px; text-align: right; font-weight: 700 !important; }
.gap td { color: var(--loss); }
.gapbox { display: inline-block; border: 1.5px dashed var(--loss); border-radius: 3px; padding: 2px 8px; font-size: 12px; font-weight: 500; }
.insight { margin-top: 12px; font-size: 14px; color: var(--text); max-width: 60em; }

/* Funnel */
.funnel { list-style: none; margin: 12px 0 0; padding: 0; }
.fs { margin: 0; }
.fbar { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; background: var(--ink); color: var(--paper); border-radius: 3px; font-size: 14px; white-space: nowrap; }
.fbar b { font-weight: 700; }
.fs.last .fbar { background: var(--water); }
.fl { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 6px 0 6px 14px; color: var(--loss); font-size: 14px; }
.fl i { width: 7px; height: 10px; background: var(--loss); clip-path: polygon(30% 0, 70% 0, 70% 20%, 100% 20%, 100% 80%, 70% 80%, 70% 100%, 30% 100%, 30% 80%, 0 80%, 0 20%, 30% 20%); }
.fl em { font-style: normal; font-size: 13px; color: var(--muted); text-align: right; }

/* Come back */
.ret { margin: 14px 0 6px; display: grid; gap: 8px; }
.ret p { font-size: 14px; }
.ret b { font-size: 18px; color: var(--ink); }
.facts { margin: 10px 0 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--rule); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; color: var(--ink); text-align: right; }

/* Reviews */
.more { font-size: 14px; font-weight: 500; }
.rv-sum { display: grid; gap: 8px 32px; align-items: center; }
.rv-note { font-size: 14px; color: var(--muted); margin-top: 10px; max-width: 46em; }
.rv-note b { color: var(--ink); }
.chain { list-style: none; margin: 12px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--drop); }
.chain li { position: relative; padding: 5px 0; }
.chain li::before { content: ""; position: absolute; left: -24px; top: 12px; width: 10px; height: 10px; background: var(--drop); border-radius: 2px; }
.chain li:last-child::before { background: var(--water); }
.chain b { font-size: 18px; color: var(--ink); margin-right: 4px; }
.tagbars { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.tagbars li { display: grid; grid-template-columns: 150px 1fr 32px; gap: 10px; align-items: center; font-size: 14px; }
.tagbars b { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.rvlist { list-style: none; margin: 12px 0 0; padding: 0; }
.rvlist li { padding: 14px 0; border-top: 1px solid var(--rule); }
.rv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.rv-head b { color: var(--ink); }
.rv-head small { color: var(--muted); }
.stars { color: #C98A1A; letter-spacing: 1px; font-size: 14px; }
.stars i { font-style: normal; color: #D9D3C8; }
.rvlist p { max-width: 52em; }
.rv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag-dim { background: transparent; border: 1px dashed #B6AFA4; color: var(--muted); }
.rv-named { display: grid; grid-template-columns: minmax(80px, 200px) auto; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.howmeasure { margin-top: 12px; font-size: 13px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--rule); }
.howmeasure b { color: var(--ink); }

/* Leads */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters .grow { flex: 1; min-width: 180px; }
.filters select, .filters input { font: 400 15px var(--sans); color: var(--ink); background: #fff; border: 1.5px solid #CFC8BC; border-radius: 6px; min-height: 44px; padding: 0 10px; }
.count { margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.leadt tbody tr { cursor: pointer; }
.leadt tbody tr:hover td { background: #F1EEE7; }
.leadt td small { display: block; }
.r { text-align: right; padding-right: 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 3px; background: #E3EEF0; color: var(--water-dk); vertical-align: 1px; }
.badge.ad { background: #EDE7F3; color: #5B4C70; }
.st { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 3px; }
.st-miss { background: #F4E1DB; color: var(--loss); }
.st-quiet { background: #EFE9DE; color: #7A5B22; }
.st-lost { background: #F1E6E0; color: #8A4A35; }
.st-paid { background: #DDECEF; color: var(--water-dk); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* Recommendations */
.recs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rec { display: grid; grid-template-columns: 1fr; gap: 10px 24px; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px; scroll-margin-top: 80px; }
.rec.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--drop); } 100% { box-shadow: 0 0 0 3px transparent; } }
.rec-top { display: flex; gap: 10px; align-items: center; }
.chip { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 3px; background: var(--paper-2); color: var(--ink); }
.c-live, .c-done { background: #DDECEF; color: var(--water-dk); }
.c-in-progress { background: #EFE9DE; color: #7A5B22; }
.c-keep { background: #E2EDE6; color: var(--good); }
.lever { font-size: 12px; color: var(--muted); }
.rec h2 { font-size: 18px; margin-bottom: 6px; }
.rec p { max-width: 52em; }
.math, .teamnote { margin-top: 10px; font-size: 13px; color: var(--muted); }
.math span, .teamnote span { display: block; font-size: 11px; font-weight: 500; color: var(--ink); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.teamnote { border-left: 3px solid var(--rule); padding-left: 10px; }
.worth b { display: block; font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.worth b.sm { font-size: 15px; font-weight: 500; color: var(--muted); }
.worth small { color: var(--muted); }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.feed li { display: grid; grid-template-columns: 1fr; gap: 4px 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.feed .when { font-size: 13px; color: var(--muted); }
.feed h2 { font-size: 17px; margin: 4px 0; }
.feed p { color: var(--muted); max-width: 50em; }
.tag { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 3px; background: var(--paper-2); color: var(--ink); }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(28,26,23,.35); z-index: 50; opacity: 0; transition: opacity .2s; }
.drawer.open { opacity: 1; }
.drawer-in { position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 100%); background: var(--card); padding: 22px 22px 40px; overflow-y: auto; transform: translateX(30px); transition: transform .2s; outline: none; }
.drawer.open .drawer-in { transform: none; }
.drawer-x { position: absolute; right: 12px; top: 10px; width: 44px; height: 44px; font-size: 26px; background: none; border: 0; cursor: pointer; color: var(--ink); }
.d-kicker { font-size: 12px; color: var(--muted); }
.drawer h2 { font-size: 22px; margin: 2px 0 8px; }
.drawer h3 { font-size: 15px; margin: 22px 0 8px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--rule); }
.tl li { position: relative; padding: 0 0 14px 4px; }
.tl li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; background: var(--ink); border-radius: 2px; }
.tl li.bad { color: var(--loss); } .tl li.bad::before { background: var(--loss); }
.tl li.good::before { background: var(--water); }
.tl span { display: block; font-size: 12px; color: var(--muted); }

/* Tooltip */
.tip { position: fixed; z-index: 60; background: var(--ink); color: var(--paper); font-size: 13px; padding: 6px 9px; border-radius: 4px; pointer-events: none; max-width: 240px; }

.foot { padding-top: 10px; padding-bottom: 40px; color: var(--muted); }

@media (max-width: 640px) {
  .tagbars li { grid-template-columns: 120px 1fr 28px; }
  .bar-shop { padding-left: 0; border-left: 0; order: 3; width: 100%; flex-direction: row; gap: 8px; align-items: baseline; }
  .viewas { margin-left: auto; }
  .viewas button { padding: 0 10px; font-size: 13px; }
  .leadt thead { display: none; }
  .leadt, .leadt tbody, .leadt tr, .leadt td { display: block; width: 100%; }
  .leadt tr { border-bottom: 1px solid var(--rule); padding: 10px 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  .leadt td { border: 0; padding: 0; white-space: normal; }
  .leadt td[data-l="Name"] { grid-column: 1; grid-row: 1; }
  .leadt td[data-l="Value"] { grid-column: 2; grid-row: 1; font-weight: 500; }
  .leadt td[data-l="When"] { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
  .leadt td[data-l="When"] small { display: inline; margin-left: 4px; }
  .leadt td[data-l="Source"], .leadt td[data-l="How"], .leadt td[data-l="Job"] { display: inline; font-size: 14px; }
  .leadt td[data-l="Source"] { grid-column: 1 / -1; }
  .leadt td[data-l="How"], .leadt td[data-l="Job"] { grid-column: 1 / -1; color: var(--muted); }
  .leadt td[data-l="First reply"] { grid-column: 2; grid-row: 2; font-size: 13px; text-align: right; }
  .leadt td[data-l="Status"] { grid-column: 1; grid-row: 2; }
  .tscroll { overflow: visible; }
  .srct-wrap { overflow-x: auto; }
}
@media (min-width: 641px) { .kpis { grid-template-columns: repeat(5, 1fr); } .kpi { border-bottom: 0; } }
@media (min-width: 900px) {
  .rv-sum { grid-template-columns: 1.2fr 1fr; }
  .two { grid-template-columns: 1fr 1fr; }
  .rec { grid-template-columns: 1fr 170px; }
  .rec-top { grid-column: 1 / -1; }
  .worth { text-align: right; }
  .feed li { grid-template-columns: 140px 1fr; }
}
@media (prefers-reduced-motion: reduce) { .rec.flash { animation: none; } .drawer, .drawer-in { transition: none; } }
