@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #eef5ff;
    --panel: #ffffff;
    --text: #0b2149;
    --muted: #6b84a8;
    --line: #e2edf9;
    --primary: #2f6bff;
    --primary-dark: #1f57e6;
    --soft: #eaf2ff;
    --green: #17b884;
    --green-soft: #e2f9ef;
    --blue: #2f6bff;
    --blue-soft: #e7f0ff;
    --amber: #f5a524;
    --amber-soft: #fef3dd;
    --red: #ef5164;
    --red-soft: #fde6ea;
    --purple: #7c5cff;
    --purple-soft: #efeaff;
    --navy: #0c1f42;
    --navy-soft: #12294f;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px -10px rgba(16, 45, 97, .12);
    --shadow-sm: 0 4px 14px rgba(16, 45, 97, .07);
}

[data-theme="dark"] {
    --bg: #0a1730;
    --panel: #101f3d;
    --text: #eef4ff;
    --muted: #91a8cc;
    --line: #22345c;
    --soft: #17294e;
    --blue-soft: #17294e;
    --green-soft: #113228;
    --amber-soft: #382a10;
    --red-soft: #3a1a21;
    --purple-soft: #241d47;
    --shadow: none;
    --shadow-sm: none;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: var(--primary); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid #a7c4ff;
    outline-offset: 3px;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(26px, 3vw, 38px); line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
small, .muted { color: var(--muted); }
.break { overflow-wrap: anywhere; }
.stack > * + * { margin-top: 16px; }

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.15em; }

/* ---------- Sidebar ---------- */

.sidebar {
    width: 250px;
    position: fixed;
    inset: 0 auto 0 0;
    background: var(--navy);
    color: #fff;
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    margin: 4px 8px 30px;
}

.brand-icon {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    color: #7cb2ff;
    background: rgba(124, 178, 255, .14);
    border-radius: 10px;
    flex-shrink: 0;
}
.brand-icon svg { width: 20px; height: 20px; }

nav button {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 4px;
    color: #a9bedd;
    background: transparent;
    text-align: left;
    font-size: 14.5px;
    font-weight: 600;
    transition: background .12s, color .12s;
}

nav button span { width: 20px; display: grid; place-items: center; flex-shrink: 0; }
nav button span svg { width: 19px; height: 19px; }
nav button.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px -6px rgba(47, 107, 255, .6);
}
nav button:not(.active):hover { background: rgba(255, 255, 255, .06); color: #fff; }

.sidebar-footer { margin-top: auto; display: flex; gap: 6px; padding: 10px 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer button { color: #7f95b8; border: 0; background: none; font-size: 12.5px; padding: 6px 8px; border-radius: 7px; }
.sidebar-footer button:hover { color: #fff; background: rgba(255,255,255,.06); }

/* ---------- Layout / topbar ---------- */

.main { margin-left: 250px; padding: 22px 30px 44px; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
#today { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); }
.avatar-button, .icon-button {
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    font-size: 20px;
    flex-shrink: 0;
}
.avatar-button svg, .icon-button svg { width: 20px; height: 20px; }
.avatar-button { padding: 0; overflow: hidden; }
.avatar-button img, .profile-picture { width: 100%; height: 100%; object-fit: cover; }
.mobile-only { display: none; }

/* ---------- Hero ---------- */

.hero { max-width: 980px; margin: 50px auto; text-align: center; }
.hero h1 { font-size: clamp(32px, 4.5vw, 56px); margin-bottom: 16px; }
.hero p { max-width: 680px; margin: 0 auto 32px; color: var(--muted); font-size: 18px; }
.hero-art {
    width: 168px;
    height: 150px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle, var(--soft), transparent 72%);
    border-radius: 50%;
    color: var(--primary);
    position: relative;
}
.hero-art .icon { width: 96px; height: 96px; }
.hero-art::before, .hero-art::after {
    content: "";
    position: absolute;
    width: 16px; height: 3px;
    border-radius: 3px;
    background: var(--primary);
    opacity: .55;
}
.hero-art::before { top: 18px; left: 6px; transform: rotate(35deg); }
.hero-art::after { top: 18px; right: 6px; transform: rotate(-35deg); }

.url-form { display: flex; gap: 12px; margin-top: 34px; }
input, select {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--text);
    padding: 11px 13px;
    min-width: 0;
    max-width: 100%;
}
input:not([type=checkbox]):not([type=file]), select { width: 100%; }
.url-form input { padding: 19px 22px; font-size: 16px; flex: 1; box-shadow: var(--shadow-sm); border-radius: 14px; }
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 11px 18px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: background .12s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn.outline { background: var(--panel); color: var(--primary); border-color: var(--line); }
.btn.outline:hover { background: var(--soft); }
.btn.soft { background: var(--soft); color: var(--primary); }
.btn.soft:hover { background: var(--blue-soft); }
.btn.danger { background: var(--red-soft); color: #b82138; }
.btn.small { padding: 7px 11px; font-size: 12px; border-radius: 8px; }
.url-form .btn { padding-inline: 30px; font-size: 16px; border-radius: 14px; }
.google { min-width: min(100%, 380px); font-size: 16px; padding: 16px 24px; border-radius: 14px; }
.google b { color: #4285f4; font-size: 22px; }

/* ---------- Panels / cards ---------- */

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat-icon {
    color: var(--primary);
    width: 46px; height: 46px; border-radius: 13px;
    background: var(--soft); display: grid; place-items: center; flex-shrink: 0;
}
.stat-icon svg { width: 21px; height: 21px; }
.stat strong { display: block; font-size: 24px; margin: 3px 0; font-weight: 800; }
.stat small { display: block; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(230px, 1fr); gap: 18px; }
.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.page-heading { margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.page-heading h1 { margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.page-heading .icon { width: .82em; height: .82em; color: var(--primary); }
.page-heading p { color: var(--muted); margin: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar h2 { margin: 0; }
.toolbar input { max-width: 240px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 14px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; text-transform: none; background: transparent; white-space: nowrap; }
td.url-cell { min-width: 155px; max-width: 250px; }
td.url-cell small { display: block; overflow-wrap: anywhere; color: var(--muted); }
.actions { display: flex; gap: 6px; align-items: center; }
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: 30px; padding: 5px 11px;
    font-size: 12px; font-weight: 700;
    background: var(--soft); color: var(--primary);
    white-space: nowrap;
}
.badge.good { background: var(--green-soft); color: #0a8f61; }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.warn { background: var(--amber-soft); color: #a3690a; }
.badge.bad { background: var(--red-soft); color: #c62138; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.pager-buttons { display: flex; gap: 5px; }
.filter label { display: block; margin: 12px 0; font-size: 13px; font-weight: 600; }
.filter .btn { width: 100%; margin-top: 12px; }
.distribution { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.donut { width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.donut > div {
    width: 82px; height: 82px; border-radius: 50%;
    background: var(--panel); display: grid; place-content: center; text-align: center;
}
.donut strong { font-size: 20px; font-weight: 800; }
.legend { font-size: 12.5px; flex: 1; min-width: 110px; }
.legend div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; margin-right: 6px; }
.activity { border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 13px; }
.activity:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- Report ---------- */

.report-summary { display: flex; align-items: center; gap: 25px; margin-bottom: 18px; }
.report-summary .description { flex: 1; }
.report-summary .description h2 { font-size: 22px; margin-bottom: 6px; }
.report-meta { border-left: 1px solid var(--line); padding-left: 24px; max-width: 300px; }
.report-meta strong { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.report-meta p { margin: 2px 0 12px; font-weight: 600; }

.score-card { text-align: left; color: var(--text); width: 100%; transition: border-color .12s, transform .12s; }
.score-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.score-card .card-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 4px; }
.score-card .card-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center; flex-shrink: 0;
}
.score-card .card-icon svg { width: 20px; height: 20px; }
.score-card .card-icon.load { background: var(--blue-soft); color: var(--blue); }
.score-card .card-icon.mobile { background: var(--purple-soft); color: var(--purple); }
.score-card .card-icon.seo { background: #ffe9d6; color: #e8791a; }
[data-theme="dark"] .score-card .card-icon.seo { background: #3a260f; }
.score-card h2 { margin-bottom: 2px; font-size: 17px; }
.score-card p { font-size: 12.5px; color: var(--muted); }
.score-card .card-footer { margin-top: 12px; font-size: 12.5px; color: var(--primary); font-weight: 700; }

.ring {
    width: 132px; height: 132px; border-radius: 50%;
    display: grid; place-items: center; margin: 16px auto;
    background: conic-gradient(var(--ring) calc(var(--score) * 1%), var(--line) 0);
    flex-shrink: 0;
}
.ring > div {
    width: 104px; height: 104px; border-radius: 50%;
    background: var(--panel); display: grid; place-content: center; text-align: center;
}
.ring strong { font-size: 28px; line-height: 1.1; font-weight: 800; }
.ring small { font-size: 11.5px; font-weight: 600; }
.metric { display: flex; justify-content: space-between; gap: 15px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.metric:last-child { border-bottom: 0; }
.metric span:first-child { color: var(--muted); }
.metric strong { font-weight: 700; }
.notice { background: var(--soft); padding: 14px; border-radius: var(--radius-sm); font-size: 13px; }
.audit { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin: 14px 0; }
.audit h3 { margin-bottom: 8px; }
.audit p { overflow-wrap: anywhere; }
.audit pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 12px; max-height: 330px; overflow: auto; font-size: 12px; border-radius: 8px; }
.audit summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.audit-heading { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }

/* ---------- Settings ---------- */

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.setting-row select { width: 170px; }
.toggle {
    appearance: none; width: 44px; height: 25px; padding: 3px;
    background: #cbd8ec; border: 0; border-radius: 25px; cursor: pointer; flex-shrink: 0;
}
[data-theme="dark"] .toggle { background: #33456c; }
.toggle::before { content: ""; display: block; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle:checked { background: var(--green); }
.toggle:checked::before { transform: translateX(19px); }
.profile-block { display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.picture { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--soft); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.picture svg { width: 34px; height: 34px; }
.profile-fields { display: grid; gap: 14px; }
.profile-fields label { font-size: 13px; font-weight: 600; }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.theme-option { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px 10px; cursor: pointer; text-align: center; font-size: 13px; font-weight: 600; }
.theme-option .icon { width: 22px; height: 22px; color: var(--primary); }
.theme-option:has(input:checked) { border-color: var(--primary); background: var(--soft); }
.theme-option input { margin-right: 5px; accent-color: var(--primary); }

/* ---------- Loader ---------- */

.loader { display: flex; justify-content: center; gap: 40px; margin-top: 40px; }
.loader-item { color: var(--muted); font-size: 13.5px; text-align: center; font-weight: 600; }
.loader-circle { width: 64px; height: 64px; margin: 0 auto 13px; border: 5px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.loader-item:nth-child(2) .loader-circle { animation-delay: .2s; }
.loader-item:nth-child(3) .loader-circle { animation-delay: .4s; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 24px; width: min(950px, calc(100% - 24px)); max-height: 88vh; }
dialog::backdrop { background: rgba(6, 20, 45, .55); backdrop-filter: blur(2px); }
.modal-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; position: sticky; top: -24px; background: var(--panel); padding: 12px 0; }
.modal-top h2 { margin: 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; background: var(--navy); color: white; padding: 13px 22px; border-radius: 12px; max-width: 90vw; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 600; font-size: 13.5px; }
.empty { padding: 35px 15px; text-align: center; color: var(--muted); }
.shade { display: none; }

@media (max-width: 1250px) {
    .sidebar { width: 220px; }
    .brand { font-size: 17px; }
    .main { margin-left: 220px; padding-inline: 20px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
    .split > .stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
    .split > .stack > * { margin-top: 0; }
    .report-summary { flex-wrap: wrap; }
    .report-meta { max-width: none; }
}

@media (max-width: 850px) {
    .columns-3 { grid-template-columns: 1fr; }
    .columns-2 { grid-template-columns: 1fr; }
    .score-card .ring { width: 120px; height: 120px; }
    .score-card .ring > div { width: 94px; height: 94px; }
}

@media (max-width: 700px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; width: 250px; }
    body.nav-open .sidebar { transform: translateX(0); }
    .shade { position: fixed; inset: 0; background: #0006; border: 0; z-index: 25; }
    body.nav-open .shade { display: block; }
    .main { margin-left: 0; padding: 15px; }
    .mobile-only { display: inline-grid; }
    .hero { margin-top: 35px; }
    .hero p { font-size: 16px; }
    .hero-art { width: 130px; height: 118px; }
    .hero-art .icon { width: 72px; height: 72px; }
    .url-form { flex-direction: column; }
    .url-form .btn { width: 100%; }
    .stats { gap: 10px; }
    .stat { padding: 13px; gap: 9px; }
    .stat-icon { display: none; }
    .stat strong { font-size: 21px; }
    .stat small { font-size: 11px; }
    .split > .stack { grid-template-columns: 1fr; }
    .report-summary { display: block; }
    .report-summary .ring { margin-inline: auto; }
    .report-meta { border-left: 0; border-top: 1px solid var(--line); padding: 15px 0 0; margin-top: 18px; }
    .loader { gap: 15px; }
    .loader-item { font-size: 11px; flex: 1; }
    .loader-circle { width: 48px; height: 48px; }
    .setting-row { gap: 10px; }
    .setting-row select { width: 130px; }
    .profile-block { align-items: flex-start; flex-wrap: wrap; }
    .theme-options { gap: 7px; }
    .theme-option { padding: 12px 7px; font-size: 12px; }
    .audit-heading { display: block; }
    .toolbar input { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
    :root, [data-theme="dark"] {
        --panel: white; --bg: white; --text: black; --muted: #444; --line: #ddd;
    }
    .sidebar, .topbar, .no-print, dialog, .toast, .shade { display: none !important; }
    .main { margin: 0; padding: 0; }
    body { background: white; color: black; font-size: 11px; }
    .panel { box-shadow: none; break-inside: avoid; }
    .columns-3 { grid-template-columns: repeat(3, 1fr); }
    .report-summary { display: flex; }
    .audit { break-inside: avoid; }
    .audit pre { max-height: none; overflow: visible; }
}