:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --panel: #ffffff;
  --panel-2: #faf9f8;
  --text: #323130;
  --muted: #605e5c;
  --line: #edebe9;
  --brand: #0078d4;
  --brand-dark: #005a9e;
  --brand-soft: #deecf9;
  --critical: #b42318;
  --high: #d85b12;
  --medium: #ad7600;
  --low: #4e677a;
  --shadow: 0 8px 32px rgba(50, 49, 48, .07);
}

:root.dark {
  color-scheme: dark;
  --bg: #323130;
  --panel: #252423;
  --panel-2: #323130;
  --text: #f5f5f5;
  --muted: #c8c6c4;
  --line: #484644;
  --brand: #6cb8f6;
  --brand-dark: #9ccff8;
  --brand-soft: #17354d;
  --shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; display: flex; flex-direction: column; gap: 20px; padding: 24px 16px; background: var(--panel); color: var(--text); border-right: 1px solid var(--line); z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--brand-soft); color: var(--brand); border-radius: 10px; font-size: 18px; font-weight: 900; }
.brand span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.brand b { font-size: 17px; }
.brand small { color: var(--muted); margin-top: 3px; }
.project-card { padding: 13px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; }
.project-card small { color: var(--muted); font-size: 10px; letter-spacing: .09em; }
.project-card strong { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card span { color: var(--muted); font-size: 12px; margin-top: 2px; }
nav { display: grid; gap: 5px; }
nav button, .ghost { border: 0; background: transparent; color: var(--text); text-align: left; border-radius: 9px; padding: 10px 12px; cursor: pointer; }
nav button span { display: inline-block; width: 24px; color: var(--brand); }
nav button:hover, nav button.active, .ghost:hover { background: var(--brand-soft); color: var(--brand); }
.sidebar-footer { margin-top: auto; display: grid; gap: 7px; }
.sidebar-footer a { color: var(--text); padding: 9px 12px; text-decoration: none; border-radius: 9px; }
.sidebar-footer a:hover { background: var(--brand-soft); }
.sidebar-footer small { color: var(--muted); padding: 5px 12px; }

main { margin-left: 248px; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 28px; background: #3376cd; border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.url-form { display: flex; flex: 1; max-width: 720px; }
input, select { background: var(--panel); color: var(--text); border: 1px solid var(--line); min-height: 42px; padding: 9px 12px; outline: 0; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.url-form input { flex: 1; border-radius: 9px 0 0 9px; }
.url-form select { border-left: 0; }
.url-form button { border-radius: 0 9px 9px 0; }
button { border: 1px solid var(--line); background: var(--panel); padding: 9px 13px; border-radius: 9px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--brand); }
button:disabled { opacity: .45; cursor: not-allowed; }
[hidden] { display: none !important; }
.primary { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 700; }
.primary:hover:not(:disabled) { background: var(--brand-dark); }
.actions { display: flex; gap: 8px; }
.user-button { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-menu { display: none; }
.content { max-width: 1500px; margin: 0 auto; padding: 30px 32px 60px; }
.notice { margin: 18px 32px 0; padding: 12px 14px; border: 1px solid #efc785; background: #fff7e5; color: #704a00; border-radius: 10px; }
.notice.error { background: #fff0ee; color: #8e1a10; border-color: #f0b7b0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.035em; line-height: 1.08; }
h2 { font-size: 20px; letter-spacing: -.015em; }
h3 { font-size: 15px; }
.eyebrow { color: var(--brand); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .12em; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.score-card { min-height: 158px; display: flex; flex-direction: column; }
.score { margin: auto 0 2px; font-size: 42px; line-height: 1; font-weight: 850; letter-spacing: -.05em; color: var(--brand-dark); }
.score small { color: var(--muted); font-size: 16px; letter-spacing: 0; }
.score-card p { color: var(--muted); margin: 5px 0 0; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.section-head h2, .section-head p { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; background: var(--panel-2); font-size: 12px; }
.chip.good { color: var(--brand-dark); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 28%, var(--line)); }
.severity { width: 9px; height: 9px; border-radius: 50%; background: var(--low); }
.severity.critical { background: var(--critical); }
.severity.high { background: var(--high); }
.severity.medium { background: var(--medium); }

.issue-list { display: grid; gap: 9px; }
.issue { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.issue strong { display: block; }
.issue p { margin: 2px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.count { min-width: 34px; text-align: center; border-radius: 999px; padding: 3px 8px; background: var(--panel); border: 1px solid var(--line); }
.empty { padding: 50px 24px; text-align: center; border: 1px dashed var(--line); border-radius: 15px; background: var(--panel); }
.empty-icon { display: grid; place-items: center; margin: 0 auto 14px; width: 58px; height: 58px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); font-size: 26px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.url { max-width: 320px; overflow-wrap: anywhere; }
.status { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 12px; }
.status.warn { color: #845900; background: #fff1c9; }
.status.bad { color: #9d2419; background: #ffe0dc; }
.toolbar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 12px; }
.toolbar input { min-width: 240px; border-radius: 9px; }

.connector { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; }
.connector-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 850; }
.connector h3, .connector p { margin: 0; }
.connector p { color: var(--muted); font-size: 12px; }
.connector-state { color: var(--muted); font-size: 12px; }
.connector-state.on { color: #107c10; font-weight: 700; }
:root.dark .connector-state.on { color: #6ccb5f; }
.connector-details { margin-top: 8px; }
.connector-details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.connector-details p, .connector-details button { margin-top: 6px; }
.competitor-form { display: flex; gap: 8px; }
.competitor-form input { flex: 1; border-radius: 9px; }
.bar-chart { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; }
.bar-track { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, var(--brand), #6cb8f6); border-radius: inherit; }

.loader { display: grid; place-items: center; min-height: 420px; 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 .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
dialog { width: min(480px, calc(100% - 28px)); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(50,49,48,.55); backdrop-filter: blur(4px); }
dialog form { display: grid; gap: 14px; }
dialog label { display: grid; gap: 6px; }
dialog input { border-radius: 9px; }
.dialog-close { position: absolute; right: 12px; top: 12px; border: 0; font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.auth-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #deecf9, transparent 35%), #f5f5f5; }
.auth-card { width: min(430px, 100%); padding: 34px; border: 1px solid #edebe9; border-radius: 22px; background: #fff; color: #323130; box-shadow: 0 30px 100px rgba(50, 49, 48, .16); }
.auth-card .brand-mark { margin-bottom: 20px; }
.auth-card h1 { margin-top: 6px; font-size: 30px; }
.google-button { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 22px; }
.google-button b { color: #4285f4; font-size: 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #605e5c; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: #edebe9; }
.email-login { display: grid; gap: 8px; }
.email-login input { border-radius: 9px; }
.auth-message { min-height: 21px; margin: 14px 0 0; color: #0078d4; }

@media (max-width: 1100px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; }
  .url-form { min-width: calc(100% - 55px); }
  .actions { margin-left: 55px; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 15px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  main { margin-left: 0; }
  .mobile-menu { display: inline-block; }
  .topbar { padding: 10px 14px; }
  .url-form { order: 2; min-width: 100%; }
  .url-form select { display: none; }
  .actions { margin-left: auto; }
  .actions button { font-size: 0; }
  .actions button::first-letter { font-size: 14px; }
  .content { padding: 24px 14px 50px; }
  .notice { margin-inline: 14px; }
  .grid.four, .grid.two { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
}

.brand-mark { flex-shrink: 0; object-fit: contain; background: transparent; border-radius: 10px; }
.auth-card > .brand-mark { width: 64px; height: 64px; }
.auth-card > .language-select { float: right; min-height: 36px; border-radius: 8px; }
.language-select { border-radius: 8px; min-width: 64px; }

/* Report controls share the analytics palette. */
.project-card select { margin-top: 8px; width: 100%; border-radius: 8px; }
.sidebar { overflow-y: auto; gap: 12px; }
.score-ring { width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, var(--panel) 61%, transparent 63%), conic-gradient(var(--brand) calc(var(--score) * 1%), var(--line) 0); display: grid; place-content: center; font-size: 28px; margin-block: 14px; }
.score-ring small { font-size: 12px; text-align: center; }
.issue-detail { padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.issue-detail summary { cursor: pointer; }
.issue-detail .severity { display: inline-block; }
.issue-detail ul, .url { overflow-wrap: anywhere; }
.content-pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.content-page { padding: 16px; box-shadow: none; }
.content-page input[type=checkbox] { min-height: 0; }
.content-page details { margin-top: 12px; }
.content-page summary { cursor: pointer; color: var(--brand); }
label { display: block; margin-block: 12px; }
label input:not([type=checkbox]) { display: block; max-width: 100%; border-radius: 8px; }
.toolbar { align-items: center; }
.toolbar select { border-radius: 8px; }
.section-shortcuts a { color: var(--brand); padding: 6px 10px; }
dl { display: grid; grid-template-columns: minmax(120px, 1fr) 3fr; gap: 8px; }
dt { font-weight: 700; } dd { margin: 0; overflow-wrap: anywhere; }
.crawl-progress { text-align: center; } .cancel-audit { display: block; margin: 0 auto; }
.sidebar-collapsed .sidebar { width: 70px; padding-inline: 8px; }
.sidebar-collapsed main { margin-left: 70px; }
.sidebar-collapsed .brand span, .sidebar-collapsed .project-card, .sidebar-collapsed #add-project, .sidebar-collapsed .sidebar-footer a, .sidebar-collapsed .sidebar-footer small { display: none; }
.sidebar-collapsed nav button { font-size: 0; padding: 10px; }
.sidebar-collapsed nav button span { font-size: 16px; }
.sidebar-collapsed #theme-button { font-size: 0; }
.sidebar-collapsed #theme-button::first-letter { font-size: 16px; }
@media (max-width:760px) { .sidebar-collapsed main { margin-left:0; } dl { grid-template-columns:1fr; } }

.radar-chart { width: 100%; max-width: 340px; display: block; margin: auto; }
.search-timeline { width: 100%; max-height: 230px; }
