/* Dashboard styles, matched to the mockups. Colours/type come from /shared/tokens.css. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); }
a { color: var(--ink); } a:hover { color: var(--accent); }
.muted { color: var(--muted); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Sign in */
.signin { min-height: 100vh; display: flex; flex-wrap: wrap; }
.signin-hero { flex: 1 1 420px; background: var(--ink); color: var(--paper); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; min-height: 360px; }
.signin-hero .wordmark { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.02em; }
.signin-hero h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 48px; line-height: 1.08; letter-spacing: -0.02em; }
.signin-hero p { margin: 0; font-size: 16px; line-height: 1.6; color: #B5B0A6; max-width: 460px; }
.signin-hero .by { font-size: 13px; color: #B5B0A6; }
.signin-panel { flex: 1 1 420px; padding: 48px 24px; display: flex; align-items: center; justify-content: center; }
.signin-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 24px; }
.signin-form h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.signin-form .lead { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field label { font-size: 13px; font-weight: 500; }
.input { height: 48px; padding: 0 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--white); font: inherit; font-size: 15px; color: var(--ink); }
.btn-primary { height: 48px; border: 0; border-radius: var(--r-md); background: var(--accent); color: var(--paper); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.btn-primary[disabled] { opacity: .6; cursor: default; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-md); background: var(--bone); font-size: 14px; line-height: 1.5; }
.note svg { flex: none; margin-top: 1px; }
.error { color: var(--hot-fg); font-size: 14px; margin: 0; }
@media (max-width: 600px) { .signin-hero { padding: 32px 24px; } .signin-hero h1 { font-size: 34px; } }

/* App frame */
.frame { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar { flex: 1 1 240px; max-width: 256px; background: var(--bone); border-right: 1px solid var(--rule); padding: 24px 14px; display: flex; flex-direction: column; gap: 28px; }
.sidebar .wordmark { padding: 0 10px; font-family: var(--font-display); font-size: 18px; letter-spacing: -0.02em; }
.sidebar .hint { margin: 0; padding: 0 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.account { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-top: 1px solid var(--rule); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.account .who { display: flex; flex-direction: column; gap: 1px; font-size: 13px; flex: 1; min-width: 0; }
.account .who strong { font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; text-decoration: underline; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 56px; display: flex; flex-direction: column; gap: 24px; }
.main h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
@media (max-width: 700px) { .sidebar { max-width: none; } .main { padding: 24px 16px 48px; } }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }

.side-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.side-body { display: flex; flex-direction: column; gap: 28px; flex: 1; }
.sidebar .side-toggle { display: none; height: 36px; }
@media (max-width: 700px) {
  .sidebar { position: static; height: auto; padding: 14px 16px; gap: 0; }
  .sidebar .side-toggle { display: inline-flex; }
  .side-body { display: none; padding-top: 20px; }
  .sidebar.open .side-body { display: flex; }
}
.sidebar .wordmark { color: var(--ink); }
.switcher { display: flex; flex-direction: column; gap: 10px; }
.switcher .all { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 13px; text-decoration: none; color: var(--muted); }
.proj-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--white); }
.proj-card img, .proj-card .ph { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; background: var(--bone); }
.proj-card > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.proj-card strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: 14px; }
.nav a:hover { background: var(--bone-hover); color: var(--ink); }
.nav a.on { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; display: inline-flex; align-items: center; gap: 6px; }
.nav .count.live { color: #1F6B45; }
.nav .count .dot { background: var(--live-dot); width: 7px; height: 7px; }
.nav-group { margin: 14px 12px 4px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; color: var(--muted); }

/* ---------- page parts ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 13px; color: var(--muted); }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.row-wrap { display: flex; gap: 16px; flex-wrap: wrap; align-items: stretch; }
.card { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.card-head a { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 500; }
.kpi { flex: 1 1 210px; gap: 8px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .big { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .line { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.kpi .kpi-note { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.good { color: #1F6B45; } .bad { color: var(--hot-fg); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.split { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bone); }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-list { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 120px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.col:hover rect.bar { opacity: .82; }
.hbar { display: grid; gap: 12px; align-items: center; font-size: 13.5px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.track { border-radius: 4px; background: #F6F4EF; position: relative; overflow: hidden; display: block; }
.track > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #FFF4E8; font-size: 13.5px; line-height: 1.5; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule-soft); font-size: 14px; text-decoration: none; color: var(--ink); }
.lrow:hover { background: #FAF8F4; }
.score-ring { position: relative; width: 40px; height: 40px; flex: none; }
.score-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.seg { display: flex; padding: 3px; border-radius: 10px; background: var(--bone); font-size: 13px; }
.seg button { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font: inherit; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); font-weight: 600; }
.btn { height: 40px; padding: 0 16px; border-radius: var(--r-md); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; border: 1px solid var(--rule); background: var(--white); color: var(--ink); }
.btn.primary { border: 0; background: var(--accent); color: var(--paper); }
.btn.primary:hover { color: var(--paper); filter: brightness(1.08); }
.btn[disabled] { opacity: .6; cursor: default; }
.field { height: 40px; padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--white); font: inherit; font-size: 14px; color: var(--ink); min-width: 0; }
textarea.field { height: auto; min-height: 84px; padding: 12px; resize: vertical; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { padding: 32px; border: 1px dashed var(--dash); border-radius: var(--r-lg); color: var(--muted); line-height: 1.55; display: flex; flex-direction: column; gap: 8px; }
.empty h2 { margin: 0; font-size: 18px; color: var(--ink); font-weight: 600; }
.loading { display: flex; gap: 6px; padding: 40px 0; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--dash); animation: blink 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .3; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; z-index: 40; pointer-events: none; background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: 14px; transition: opacity .3s, transform .3s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- projects home ---------- */
.projects { display: flex; gap: 20px; flex-wrap: wrap; align-items: stretch; }
.pcard { flex: 1 1 340px; max-width: 460px; background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.pcard:hover { border-color: var(--dash); color: var(--ink); }
.pcard .img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--bone); }
.pcard .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.pcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pcard .top > span:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pcard .top strong { font-size: 17px; font-weight: 600; }
.pcard .host { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.stats { display: flex; gap: 24px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.stat strong { font-size: 18px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- leads ---------- */
.tiers { display: flex; gap: 16px; flex-wrap: wrap; }
.tier-btn { flex: 1 1 200px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--rule); background: var(--white); font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.tier-btn .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tier-btn .tx { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.tier-btn .tx b { font-size: 13px; font-weight: 600; }
.tier-btn .tx span { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tier-btn .nt { font-size: 12.5px; text-align: right; max-width: 130px; color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.table-wrap { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow-x: auto; }
table.leads { width: 100%; border-collapse: collapse; min-width: 980px; }
table.leads th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.leads td { padding: 14px; border-bottom: 1px solid var(--rule-soft); font-size: 14px; vertical-align: middle; }
table.leads tbody tr:hover td { background: #FAF8F4; }
table.leads tbody tr:last-child td { border-bottom: 0; }
.buyer { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.buyer strong { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.film { display: flex; align-items: center; gap: 8px; }
.film i { width: 7px; height: 14px; border-radius: 2px; display: inline-block; }
.film > span:first-child { display: flex; gap: 2px; }
td select.field { height: 34px; font-size: 13px; padding: 0 8px; }

/* ---------- lead ---------- */
.lead-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.big-ring { position: relative; width: 84px; height: 84px; flex: none; }
.big-ring > span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.big-ring strong { font-size: 22px; font-weight: 600; }
.talk { background: var(--bone); border-color: var(--bone); }
.talk p { margin: 0; font-size: 15px; line-height: 1.6; max-width: 78ch; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 720px; overflow: auto; }
.timeline li { display: grid; grid-template-columns: 64px 14px minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--rule-soft); font-size: 14px; }
.timeline time { font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 1px; color: var(--muted); }
.timeline .tdot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; }
.timeline .day { display: block; padding: 12px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); border-top: 0; }
.note-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; background: #FAF8F4; font-size: 14px; white-space: pre-wrap; }

/* ---------- links ---------- */
.link-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule-soft); flex-wrap: wrap; }
.link-row code { flex: 1 1 280px; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }

@media (max-width: 700px) {
  .hbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px !important; gap: 8px; }
  .lrow { flex-wrap: wrap; }
  .page-head h1 { font-size: 26px; }
}

/* ---------- alert settings ---------- */
.alert-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--rule-soft); cursor: pointer; }
.alert-row:first-child { border-top: 0; }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #D9D4CB; position: relative; cursor: pointer; flex: none; margin: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 21px; }
