:root {
  --ink: #1E1B4B;
  --ink-2: #4A4775;
  --muted: #6B6890;
  --page: #F6F6FA;
  --surface: #FFFFFF;
  --line: #E4E3EF;
  --amber: #F59E0B;
  --amber-ink: #8A5300;
  --amber-soft: #FEF3DC;
  --good: #15803D;
  --ok: #B45309;
  --poor: #B91C1C;
  --radius-s: 6px;
  --radius-m: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 15px/1.55 "Plus Jakarta Sans", system-ui, sans-serif; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 22px 18px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 17px; font-weight: 500; }
.logo svg { width: 34px; height: 34px; }
.logo svg rect { fill: #2E2A72; }
.logo b { font-weight: 800; color: var(--amber); }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { color: #CFCDEB; text-decoration: none; padding: 9px 12px; border-radius: var(--radius-s); font-weight: 600; }
.side nav a.on, .side nav a:hover { background: #2E2A72; color: #fff; }
.side .out { margin-top: auto; color: #A9A6CC; font-size: 13px; text-decoration: none; }
.main { padding: 34px clamp(18px, 4vw, 56px) 64px; max-width: 1080px; width: 100%; min-width: 0; }

/* ---------- headings ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h1 { font-size: 30px; line-height: 1.15; margin: 2px 0 0; font-weight: 800; letter-spacing: -0.02em; }
.h2 { font-size: 19px; margin: 38px 0 14px; font-weight: 700; }
.sub { color: var(--muted); margin: 4px 0 0; }
.sub a { color: var(--ink-2); }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.back::before { content: "‹ "; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.head-actions form { margin: 0; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border-radius: var(--radius-s); border: 1.5px solid var(--ink); background: var(--ink); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: #2E2A72; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #ECEBF6; }
.btn.danger { background: transparent; border-color: var(--poor); color: var(--poor); margin-left: auto; }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px; display: grid; gap: 16px; max-width: 720px; }
.form label, .login-box label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, textarea { font: inherit; color: var(--ink); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: #fff; }
input:focus, textarea:focus { border-color: var(--ink); outline: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.err { color: var(--poor); font-weight: 600; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 30px; display: grid; gap: 16px; }
.login-box h1 { font-size: 24px; }

/* ---------- client list ---------- */
.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.list th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FBFBFD; }
.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #FAFAFE; }
.list.compact td { padding: 10px 16px; }
.list .n { text-align: right; }
.strong { font-weight: 700; text-decoration: none; }
.list .sub { display: block; font-size: 13px; }
.muted { color: var(--muted); }
.num { font-weight: 800; font-variant-numeric: tabular-nums; }
.num.g-good, .g-good .score-value { color: var(--good); }
.num.g-ok, .g-ok .score-value { color: var(--ok); }
.num.g-poor, .g-poor .score-value { color: var(--poor); }
.num.g-none { color: var(--muted); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-m); padding: 28px; color: var(--muted); }
.err-cell { color: var(--poor); font-size: 13px; }

/* ---------- diagnosis ---------- */
.checked { color: var(--muted); font-size: 14px; margin: -8px 0 16px; }
.strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.score { padding: 18px 20px; display: grid; gap: 2px; align-content: start; }
.score + .score { border-left: 1px solid var(--line); }
.score-label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.score-value { font-size: 44px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.g-none .score-value { color: var(--muted); }
.score-hint { font-size: 12.5px; color: var(--muted); }
.score-delta { font-size: 13px; font-weight: 700; color: var(--muted); }
.score-delta.up { color: var(--good); }
.score-delta.down { color: var(--poor); }
.vitals { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 2px 0; }
.vitals div { display: flex; gap: 6px; align-items: baseline; }
.vitals dt { color: var(--muted); font-size: 13.5px; }
.vitals dd { margin: 0; font-weight: 700; font-size: 14px; }
.note { color: var(--ok); font-size: 14px; }

/* ---------- the fix list: the one memorable element ---------- */
.fixes { list-style: none; counter-reset: fix; margin: 0; padding: 0; display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.fix { counter-increment: fix; position: relative; padding: 18px 20px 18px 74px; border-bottom: 1px solid var(--line); }
.fix:last-child { border-bottom: 0; }
.fix::before { content: counter(fix); position: absolute; left: 20px; top: 16px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--amber-soft); color: var(--amber-ink); }
.fix.s-fail::before { background: var(--amber); color: var(--ink); }
.fix-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.fix-title { font-weight: 700; font-size: 16.5px; }
.pill { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.p-fail { background: #FDE8E8; color: var(--poor); }
.p-warn { background: var(--amber-soft); color: var(--amber-ink); }
.fix-detail { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.fix-do { margin: 6px 0 0; max-width: 70ch; }
.allgood { background: #E9F7EE; color: var(--good); padding: 16px 20px; border-radius: var(--radius-m); font-weight: 600; }
.passed { margin-top: 14px; }
.passed summary { cursor: pointer; font-weight: 600; color: var(--good); padding: 6px 0; }
.passed ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); }
.passed li span { color: var(--muted); font-size: 13.5px; }

/* ---------- running ---------- */
.running { display: flex; gap: 12px; align-items: center; background: var(--amber-soft); color: var(--amber-ink); padding: 14px 18px; border-radius: var(--radius-m); font-weight: 600; margin-bottom: 18px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); flex: none; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; }
  .side nav { flex-direction: row; }
  .side .out { margin: 0 0 0 auto; }
  .strip { grid-template-columns: 1fr 1fr; }
  .score:nth-child(3) { border-left: 0; }
  .score:nth-child(n+3) { border-top: 1px solid var(--line); }
  .list th:nth-child(2), .list td:nth-child(2) { display: none; }
  .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .score-value { font-size: 34px; }
  .fix { padding-left: 62px; }
  .fix::before { left: 14px; }
  .list th:nth-child(6), .list td:nth-child(6) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
@media print {
  .side, .btn, .head-actions, .back { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .passed { display: none; }
}

/* ---------- client tabs & studio ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin: -6px 0 24px; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 700; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; }
.tabs a.on, .tabs a:hover { color: var(--ink); border-color: var(--amber); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tools a { padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); background: var(--surface); }
.tools a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tool-intro { margin: 0; color: var(--ink-2); }
.studio-form { max-width: none; }
select { font: inherit; color: var(--ink); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: #fff; }
.small { font-size: 13px; }
.actions .muted { align-self: center; }
.paste { margin-top: 18px; }
.paste textarea { width: 100%; margin: 8px 0; font-size: 13.5px; }
.batch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 6px 20px 16px; margin-bottom: 16px; }
.batch-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.batch-head form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--poor); font: inherit; font-size: 13px; cursor: pointer; }
.piece { padding: 14px 0; border-bottom: 1px solid var(--line); }
.piece:last-child { border-bottom: 0; }
.piece-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.piece-text { white-space: pre-wrap; margin: 8px 0 10px; max-width: 75ch; }
.tag { font-size: 12.5px; color: var(--amber-ink); background: var(--amber-soft); padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.review { margin: 14px 0 4px; padding: 10px 14px; border-left: 3px solid var(--line); color: var(--ink-2); font-style: italic; }
.seo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.seo-grid h3 { font-size: 14px; margin: 0 0 6px; }
.seo-grid ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 860px) { .seo-grid { grid-template-columns: 1fr; } }
@media print { .tabs, .tools, .studio, .batch-head form, .piece .btn { display: none !important; } }

/* ---------- Google Business tracker ---------- */
.strip-6 { grid-template-columns: repeat(6, 1fr); }
.score-value.sm { font-size: 32px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.charts figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 10px; }
.charts figcaption { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.chart { width: 100%; height: auto; display: block; font-family: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.gbp-form { max-width: none; }
.gbp-form .month { max-width: 220px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.row-actions { white-space: nowrap; display: flex; gap: 10px; align-items: center; }
.row-actions form { margin: 0; }
.list tbody tr:has(.row-actions) { cursor: default; }
@media (max-width: 1100px) { .strip-6 { grid-template-columns: repeat(3, 1fr); } .strip-6 .score:nth-child(4) { border-left: 0; } .strip-6 .score:nth-child(n+4) { border-top: 1px solid var(--line); } }
@media (max-width: 860px) { .charts, .grid3 { grid-template-columns: 1fr; } .strip-6 { grid-template-columns: 1fr 1fr; } .strip-6 .score { border-left: 0 !important; border-top: 1px solid var(--line); } .strip-6 .score:nth-child(-n+2) { border-top: 0; } .strip-6 .score:nth-child(even) { border-left: 1px solid var(--line) !important; } }
@media print { .gbp-form, #add, .row-actions { display: none !important; } .charts { grid-template-columns: 1fr 1fr; } }

/* ---------- monthly report ---------- */
.report-bar { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.report-bar .actions form { margin: 0; }
.month-pick label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 36px clamp(18px, 4vw, 48px); max-width: 900px; }
.rep-head { display: flex; gap: 18px; align-items: center; padding-bottom: 20px; border-bottom: 3px solid var(--ink); }
.rep-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; padding-right: 18px; border-right: 1px solid var(--line); }
.rep-title { font-size: 28px; margin: 0; }
.rep-sub { margin: 2px 0 0; color: var(--muted); font-weight: 600; }
.rep-sec { padding: 22px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.rep-sec.rep-flow { break-inside: auto; }
.rep-table tr, .rep-charts figure, .rep-sec h2 { break-inside: avoid; }
.rep-sec h2 { break-after: avoid; }
.rep-sec h2 { font-size: 18px; margin: 0 0 12px; }
.rep-sec h3 { font-size: 14px; margin: 0 0 6px; color: var(--ink-2); }
.rep-headline { font-size: 21px; font-weight: 700; line-height: 1.35; margin: 0 0 14px; max-width: 60ch; padding-left: 14px; border-left: 4px solid var(--amber); }
.rep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rep-cols ul, .rep-list { margin: 0; padding-left: 20px; }
.rep-cols li, .rep-list li, .rep-steps li { margin-bottom: 4px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.rep-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rep-table td { padding: 7px 8px; border-bottom: 1px solid #F0EFF6; }
.rep-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.rep-table .up, .rs-change.up { color: var(--good); font-weight: 700; }
.rep-table .down, .rs-change.down { color: var(--poor); font-weight: 700; }
.rep-charts { margin-top: 16px; }
.rep-charts figure { border: 0; padding: 0; }
.rep-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.rep-scores div { display: grid; }
.rs-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.rs-value { font-size: 34px; font-weight: 800; line-height: 1.1; }
.rs-value.g-good { color: var(--good); } .rs-value.g-ok { color: var(--ok); } .rs-value.g-poor { color: var(--poor); }
.rs-change { font-size: 12.5px; color: var(--muted); }
.rep-steps { margin: 0; padding-left: 22px; }
.rep-foot { padding-top: 18px; color: var(--muted); font-size: 13px; }
@media (max-width: 700px) { .rep-cols { grid-template-columns: 1fr; } .rep-scores { grid-template-columns: 1fr 1fr; } .rep-head { flex-direction: column; align-items: flex-start; } .rep-brand { border: 0; } }
@media print {
  @page { size: A4; margin: 14mm; }
  .noprint, .tabs { display: none !important; }
  .report { border: 0; padding: 0; max-width: none; }
  .charts.rep-charts { grid-template-columns: 1fr 1fr; }
  body { background: #fff; }
}

/* ---------- website results ---------- */
.setup-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px; max-width: 760px; }
.setup-card p { color: var(--ink-2); max-width: 62ch; }
.range-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: -6px 0 16px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg a { padding: 6px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.seg a.on { background: var(--ink); color: #fff; }
.month-pick-inline label { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.month-pick-inline input { padding: 6px 10px; }
.score.hl { background: var(--amber-soft); }
.score.hl .score-value { color: var(--amber-ink); }
.charts.one { grid-template-columns: 1fr; }
.legend-inline { font-weight: 500; font-size: 12.5px; color: var(--muted); margin-left: 10px; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; margin: 0 4px 0 10px; vertical-align: -1px; }
.legend-inline .sq { background: var(--ink); border-radius: 2px; }
.legend-inline .dt { background: var(--amber); border-radius: 50%; }
.lists { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 16px; }
.barlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; }
.barlist h3 { font-size: 15px; margin: 0 0 10px; }
.barlist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.barlist li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 36px; gap: 10px; align-items: center; font-size: 14px; }
.bl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-bar { height: 8px; background: #F0EFF7; border-radius: 4px; overflow: hidden; }
.bl-bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.barlist li b { text-align: right; font-variant-numeric: tabular-nums; }
.snippet { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 18px; }
.snippet summary { cursor: pointer; font-weight: 700; }
.snippet pre { background: #1E1B4B; color: #F4F3FF; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.snippet p { color: var(--ink-2); font-size: 14.5px; }
@media (max-width: 860px) { .lists { grid-template-columns: 1fr; } }
