:root {
  --bg: #0b0b10;
  --card: #14141c;
  --card2: #1b1b26;
  --line: #26262e;
  --gold: #d4af37;
  --gold-dim: #a9882a;
  --purple: #7c3aed;
  --text: #f2f0ea;
  --muted: #a3a3b0;
  --green: #34c77b;
  --red: #e5484d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.55; }
a { color: var(--gold); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); margin: .4rem 0; }
.fine { color: var(--muted); font-size: .85rem; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--line); background: #0e0e14; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .04em; }
.monogram { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, var(--gold), var(--purple)); color: #0b0b10; font-weight: 800; }
.brand-name em { font-style: normal; color: var(--gold); font-weight: 500; margin-left: 6px; }
.user-email { color: var(--muted); font-size: .9rem; margin-right: 8px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
h1 { font-size: 1.7rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; color: var(--gold); }
.lede { color: var(--muted); max-width: 60ch; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab { background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px; cursor: pointer; }
.tab.active { border-color: var(--gold); color: var(--gold); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: .92rem; color: var(--muted); }
.form input { background: #0f0f16; border: 1px solid var(--line); border-radius: 9px; color: var(--text); padding: 11px 12px; font-size: 1rem; }
.form input:focus { outline: none; border-color: var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .scan-actions, .grid2 .error { grid-column: 1 / -1; }
.btn { border: none; border-radius: 9px; padding: 11px 18px; font-size: 1rem; cursor: pointer; font-weight: 600; }
.btn-gold { background: linear-gradient(135deg, var(--gold), #e8c85a); color: #14100a; }
.btn-gold:disabled { opacity: .55; cursor: wait; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.progress { color: var(--gold); margin-left: 10px; }
.scan-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.dash-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.latest { background: var(--card2); border: 1px solid var(--gold-dim); border-radius: 12px; padding: 12px 16px; min-width: 220px; }
.latest .big { font-size: 1.6rem; font-weight: 800; color: var(--gold); }
.scan-list { display: flex; flex-direction: column; gap: 10px; }
.scan-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.score-badge { font-weight: 800; color: var(--gold); font-size: 1.2rem; white-space: nowrap; }
.scan-row button { margin-left: 6px; }

.report-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.report-kicker { color: var(--gold); letter-spacing: .12em; font-size: .8rem; font-weight: 700; margin: 0; }
.gauge-wrap { text-align: center; }
.gauge-num { fill: var(--text); font-size: 26px; font-weight: 800; }
.gauge-den { fill: var(--muted); font-size: 11px; }
.grade { color: var(--gold); font-weight: 700; margin: .4rem 0 0; }
.summary { background: var(--card2); border-left: 3px solid var(--purple); padding: 12px 14px; border-radius: 0 10px 10px 0; }
.fixes { padding-left: 20px; }
.fixes li { margin-bottom: 12px; }
.fixes strong { color: var(--gold); }
.checks { list-style: none; padding: 0; }
.checks li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks .pass { color: var(--green); font-weight: 700; }
.checks .fail { color: var(--red); font-weight: 700; }
.checks .detail { color: var(--muted); font-size: .9rem; display: block; }
.gbp, .ai { background: var(--card2); border-radius: 10px; padding: 14px; }
.ai ul, .gbp ul { margin: .4rem 0; padding-left: 20px; }
.report-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 18px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .brand-name em { display: none; }
  .wrap { padding: 20px 14px 48px; }
}
@media print {
  body { background: #fff; color: #111; }
  .topbar, .foot, #backBtn, .report-actions { display: none !important; }
  .card, .report { border: 1px solid #ccc; background: #fff; }
  .summary { background: #f5f5f5; }
}
