:root {
  --brand: #2563eb;
  --ink: #0f172a;
  --ink-2: #475569;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --good: #16a34a;
  --ok: #d97706;
  --bad: #dc2626;
  --good-bg: #dcfce7;
  --ok-bg: #fef3c7;
  --bad-bg: #fee2e2;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 460px; padding-top: 48px; padding-bottom: 48px; }
.muted { color: var(--ink-2); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
code, pre { background: #f1f5f9; border-radius: 6px; padding: 2px 6px; font-size: .9em; overflow-x: auto; }
pre { padding: 12px; }

/* top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo img { height: 34px; display: block; }
.topbar-product { color: var(--ink-2); font-size: .9rem; }

/* hero + form */
.hero { background: linear-gradient(180deg, #fff 0%, var(--bg) 100%); padding: 56px 0 72px; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; letter-spacing: -.02em; }
.lead { font-size: 1.15rem; color: var(--ink-2); }
.ticks { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.ticks li { padding-left: 30px; position: relative; font-weight: 500; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--good-bg); color: var(--good); font-size: .75rem; display: grid; place-items: center; font-weight: 800; }
.audit-form { display: grid; gap: 14px; }
.audit-form h2 { font-size: 1.3rem; }
.audit-form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.audit-form input { font: inherit; padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; width: 100%; }
.audit-form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -9999px; }
.fine { font-size: .82rem; color: var(--ink-2); margin: 0; text-align: center; }
.alert { background: var(--bad-bg); color: #991b1b; padding: 10px 14px; border-radius: 10px; font-size: .92rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 13px 20px; cursor: pointer; text-decoration: none; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 600; padding: 10px 16px; }

/* loading overlay */
.loading { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.loading[hidden] { display: none; }
.loading-box { background: #fff; border-radius: var(--radius); padding: 32px; width: 100%; max-width: 400px; text-align: center; }
.spinner { width: 44px; height: 44px; margin: 0 auto 16px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { text-align: left; padding-left: 0; list-style: none; margin: 16px 0 0; display: grid; gap: 8px; }
.steps li { color: #94a3b8; padding-left: 26px; position: relative; }
.steps li::before { content: "○"; position: absolute; left: 4px; }
.steps li.on { color: var(--ink); font-weight: 600; }
.steps li.on::before { content: "●"; color: var(--brand); }
.steps li.done { color: var(--good); }
.steps li.done::before { content: "✓"; }

/* report */
.report-head { background: #fff; border-bottom: 1px solid var(--line); padding: 40px 0; margin-bottom: 28px; }
.report-head-inner { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; }
.report-head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; word-break: break-word; }
.report-head .muted a { color: inherit; word-break: break-all; }
.verdict { font-size: 1.1rem; }
.tech { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f1f5f9; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 500; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.ring { position: relative; width: 170px; height: 170px; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke-linecap: round; transition: stroke-dashoffset 1s; }
.ring.good .bar { stroke: var(--good); } .ring.ok .bar { stroke: var(--ok); } .ring.bad .bar { stroke: var(--bad); }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; font-size: 2.8rem; font-weight: 800; }
.ring-num small { font-size: .9rem; color: var(--ink-2); font-weight: 600; margin-top: -6px; }

.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.cat { display: grid; gap: 6px; text-decoration: none; color: var(--ink); padding: 18px; }
a.cat:hover { border-color: var(--brand); }
.cat-label { font-weight: 600; color: var(--ink-2); font-size: .9rem; }
.cat-score { font-size: 2rem; font-weight: 800; }
.cat-score.small { font-size: .95rem; padding: 2px 10px; border-radius: 999px; vertical-align: middle; }
.cat-score.good { color: var(--good); } .cat-score.ok { color: var(--ok); } .cat-score.bad { color: var(--bad); }
.cat-score.small.good { background: var(--good-bg); } .cat-score.small.ok { background: var(--ok-bg); } .cat-score.small.bad { background: var(--bad-bg); }
.meter { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; }
.meter .good { background: var(--good); } .meter .ok { background: var(--ok); } .meter .bad { background: var(--bad); }
.cat-counts { font-size: .8rem; color: var(--ink-2); }

.report .card + .card, .report section.card { margin-bottom: 20px; }
.priorities ol, .checks { list-style: none; padding: 0; margin: 0; }
.priorities li, .checks li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.priorities li:first-child, .checks li:first-child { border-top: 0; }
.priorities p, .checks p { margin: 4px 0 0; }
.found { color: var(--ink-2); word-break: break-word; }
.fix { background: #f1f5f9; border-left: 3px solid var(--brand); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: .93rem; }
.badge { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.badge.pass { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--ok-bg); color: var(--ok); }
.badge.fail { background: var(--bad-bg); color: var(--bad); }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--ink); color: #fff; border: 0; }
.cta p { color: #cbd5e1; margin: 0; }
.lh { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.lh div { display: grid; }
.small-print { font-size: .82rem; margin: 8px 0 40px; }

/* admin */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 32px 0 20px; }
.admin-head .actions { margin: 0; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); background: #f8fafc; }

.foot { border-top: 1px solid var(--line); padding: 24px 0; color: var(--ink-2); font-size: .85rem; margin-top: 40px; }

@media (max-width: 820px) {
  .hero { padding: 32px 0 48px; }
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .report-head-inner { grid-template-columns: 1fr; }
  .ring { width: 140px; height: 140px; order: -1; }
  .cta { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}
@media print {
  .no-print, .topbar, .foot { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .report-head { border: 0; padding-top: 0; }
}

/* ---- portal ---- */
.subnav { background: #fff; border-bottom: 1px solid var(--line); }
.subnav-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 48px; }
.subnav-links { display: flex; gap: 4px; overflow-x: auto; }
.subnav-links a { padding: 13px 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .92rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav-links a.on { color: var(--ink); border-bottom-color: var(--brand); }
.subnav-user { display: flex; gap: 12px; font-size: .85rem; align-items: center; }
.alert.success { background: var(--good-bg); color: #166534; margin-bottom: 16px; }
main > .alert { margin: 0 0 16px; }
.pipeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.pipeline .cat { padding: 14px; }
.pipeline .cat-score { font-size: 1.5rem; }
.pipeline .sel { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.st-new { color: var(--brand); } .st-contacted { color: #7c3aed; } .st-proposal { color: var(--ok); } .st-won { color: var(--good); } .st-lost { color: #64748b; }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; white-space: nowrap; }
.pill.st-new { background: #dbeafe; } .pill.st-contacted { background: #ede9fe; } .pill.st-proposal { background: var(--ok-bg); } .pill.st-won { background: var(--good-bg); } .pill.st-lost { background: #f1f5f9; }
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 200px; font: inherit; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 10px; }
.chip a { text-decoration: none; margin-left: 4px; }
tr.rowlink { cursor: pointer; } tr.rowlink:hover td { background: #f8fafc; }
tr.inactive td { opacity: .55; }
.share { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.share p { margin: 2px 0 0; }
.copy-row { display: flex; gap: 8px; flex: 1; max-width: 480px; min-width: 240px; }
.copy-row input { flex: 1; font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; min-width: 0; }
.crumb { margin: 20px 0 12px; } .crumb a { text-decoration: none; font-weight: 600; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.lead-grid > div > .card, .lead-grid aside > .card { margin-bottom: 20px; }
.lead-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.lead-top h1 { font-size: 1.6rem; margin: 0; }
.facts { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 20px 0; }
.facts dt { color: var(--ink-2); font-size: .9rem; } .facts dd { margin: 0; word-break: break-word; }
.mini-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.mini-cats div { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border-radius: 8px; padding: 8px 10px; font-size: .9rem; }
.talk { padding-left: 18px; } .talk li { margin-bottom: 6px; }
h3 { font-size: 1rem; }
.stack { display: grid; gap: 10px; }
select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; width: 100%; background: #fff; }
.notes { list-style: none; padding: 0; margin: 16px 0 0; }
.notes li { border-top: 1px solid var(--line); padding: 10px 0; font-size: .9rem; }
.notes p { margin: 0 0 4px; white-space: normal; word-break: break-word; }
.notes .muted { font-size: .8rem; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; font-size: .88rem; }
.linkbtn.danger { color: var(--bad); }
.row-actions { white-space: nowrap; } .row-actions form { display: inline; margin-left: 10px; }
.creds { margin-bottom: 20px; border-color: var(--good); }
.creds pre { white-space: pre-wrap; background: #f8fafc; }
@media (max-width: 900px) { .lead-grid { grid-template-columns: 1fr; } .pipeline { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; gap: 2px; } .facts dd { margin-bottom: 8px; } .pipeline { grid-template-columns: repeat(2, 1fr); } }
