:root {
  --ink: #13221c;
  --muted: #65726b;
  --canvas: #f3f5f0;
  --panel: #ffffff;
  --line: #dfe5de;
  --green: #176b4d;
  --green-dark: #0f513a;
  --green-soft: #e8f4ed;
  --lime: #b7db6d;
  --critical: #b33831;
  --critical-soft: #f9e9e7;
  --high: #da6845;
  --high-soft: #fff0e8;
  --medium: #d19a29;
  --medium-soft: #fff6dd;
  --low: #47768d;
  --low-soft: #e9f2f6;
  --shadow: 0 12px 32px rgba(24, 48, 36, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 22px 24px;
  display: flex;
  flex-direction: column;
  background: #10271e;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-size: 25px; font-weight: 760; letter-spacing: -0.04em; }
.brand-mark { position: relative; width: 33px; height: 38px; display: grid; place-items: center; background: var(--lime); clip-path: polygon(50% 0, 92% 17%, 84% 73%, 50% 100%, 16% 73%, 8% 17%); }
.brand-mark::before { content: ""; width: 16px; height: 21px; background: #10271e; clip-path: polygon(50% 0, 90% 20%, 82% 72%, 50% 100%, 18% 72%, 10% 20%); }
.brand-mark i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }
nav { margin-top: 54px; display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 13px; border-radius: 10px; color: #aebdb5; text-decoration: none; font-size: 14px; font-weight: 650; }
.nav-item svg { width: 19px; fill: currentColor; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: #fff; }
.sidebar-note { margin-top: auto; padding: 15px; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; color: #e9f1ed; font-size: 12px; font-weight: 700; }
.sidebar-note small { display: block; margin: 7px 0 0 17px; color: #91a69b; line-height: 1.45; font-weight: 500; }
.pulse-dot, .live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(183,219,109,.12); }
.version { margin: 18px 0 0; color: #6f897c; font-size: 11px; }

main { min-width: 0; padding: 37px clamp(24px, 4vw, 64px) 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; max-width: 1240px; margin: 0 auto 30px; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.topbar-actions form { margin: 0; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3vw, 35px); letter-spacing: -.045em; }
h2 { letter-spacing: -.035em; }
.button { min-height: 43px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 750; transition: transform .16s, background .16s; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--green); color: #fff; box-shadow: 0 5px 12px rgba(23,107,77,.17); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: var(--panel); border: 1px solid var(--line); }
.button.ghost { background: transparent; color: var(--muted); }

.welcome-card, .loading-card, .error-card, #dashboard { max-width: 1240px; margin: 0 auto; }
.welcome-card { min-height: 430px; padding: clamp(35px, 6vw, 76px); display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.welcome-copy { position: relative; z-index: 2; max-width: 610px; }
.status-label { display: inline-block; margin-bottom: 20px; padding: 6px 10px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.welcome-copy h2 { margin-bottom: 18px; font-size: clamp(35px, 5vw, 57px); line-height: 1.02; }
.welcome-copy p { max-width: 570px; margin-bottom: 29px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.welcome-visual { position: relative; min-height: 320px; display: grid; place-items: center; }
.shield-visual { width: 135px; height: 155px; display: grid; place-items: center; background: var(--green); color: #fff; clip-path: polygon(50% 0, 93% 17%, 84% 73%, 50% 100%, 16% 73%, 7% 17%); filter: drop-shadow(0 18px 24px rgba(23,107,77,.25)); }
.shield-visual span { display: grid; place-items: center; width: 54px; height: 54px; border: 2px solid var(--lime); border-radius: 50%; color: var(--lime); font-size: 28px; }
.orbit { position: absolute; border: 1px solid #cbdace; border-radius: 50%; }
.orbit-one { width: 250px; height: 250px; }
.orbit-two { width: 340px; height: 180px; transform: rotate(-30deg); }

.loading-card { min-height: 340px; padding: 55px; display: flex; align-items: center; justify-content: center; gap: 45px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.scanner-animation { width: 145px; height: 165px; display: grid; place-items: center; overflow: hidden; background: var(--green-soft); clip-path: polygon(50% 0, 93% 17%, 84% 73%, 50% 100%, 16% 73%, 7% 17%); }
.scanner-animation::before { content: ""; width: 50px; height: 60px; background: var(--green); clip-path: inherit; }
.scanner-animation span { position: absolute; width: 130px; height: 2px; background: var(--lime); box-shadow: 0 0 15px var(--lime); animation: scanning 2s ease-in-out infinite; }
@keyframes scanning { 0%, 100% { transform: translateY(-55px); } 50% { transform: translateY(55px); } }
.loading-copy { width: min(480px, 60vw); }
.loading-copy h2 { margin-bottom: 9px; font-size: 27px; }
.loading-copy > p:not(.eyebrow) { color: var(--muted); }
.progress-track { width: 100%; height: 8px; margin: 24px 0 8px; overflow: hidden; border-radius: 99px; background: #e8ece7; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .35s ease; }
.loading-copy small { color: var(--muted); }
.error-card { padding: 28px; display: flex; align-items: center; gap: 18px; border: 1px solid #eccdca; border-radius: 14px; background: var(--critical-soft); }
.error-card h2 { margin-bottom: 5px; font-size: 18px; }
.error-card p { margin: 0; color: #765752; }
.error-card .button { margin-left: auto; }
.error-icon { flex: 0 0 auto; width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: var(--critical); color: #fff; font-weight: 850; }

.snapshot-card, .panel { border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: 0 6px 20px rgba(24,48,36,.035); }
.snapshot-card { padding: clamp(24px, 3.5vw, 42px); }
.snapshot-heading { display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.target-line { margin-bottom: 12px; color: var(--green); font-size: 13px; font-weight: 750; }
.snapshot-heading h2 { margin-bottom: 7px; font-size: clamp(24px, 3vw, 34px); }
.snapshot-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.score-ring { --score: 0; flex: 0 0 auto; width: 112px; height: 112px; padding: 9px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--score) * 1%), #e8ece7 0); }
.score-ring > div { width: 94px; height: 94px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: #fff; }
.score-ring strong { display: block; font-size: 31px; line-height: 1; letter-spacing: -.05em; }
.score-ring span { color: var(--muted); font-size: 11px; }
.severity-grid { margin-top: 34px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 11px; }
.severity-stat { padding: 17px 20px; border-right: 1px solid var(--line); }
.severity-stat:last-child { border: 0; }
.severity-stat strong { display: block; margin-bottom: 3px; font-size: 23px; }
.severity-stat span { color: var(--muted); font-size: 12px; }
.severity-stat i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; }
.severity-stat.critical { color: var(--critical); }.severity-stat.high { color: var(--high); }.severity-stat.medium { color: var(--medium); }.severity-stat.low { color: var(--low); }
.score-context { margin: 18px 0 0; color: var(--muted); font-size: 11px; }
.content-grid { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.panel { padding: 26px; }
.panel-heading { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 20px; }
.count-badge { padding: 6px 9px; border-radius: 99px; background: #f0f3ef; color: var(--muted); font-size: 11px; font-weight: 700; }
.findings-list { display: grid; gap: 9px; }
.finding { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; }
.finding-summary { width: 100%; padding: 15px; display: grid; grid-template-columns: 31px minmax(0, 1fr) auto 20px; align-items: center; gap: 11px; border: 0; background: #fff; text-align: left; cursor: pointer; }
.severity-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; font-size: 14px; font-weight: 900; }
.finding-title-wrap { min-width: 0; }
.finding-title-wrap strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.finding-title-wrap small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.severity-pill { padding: 5px 8px; border-radius: 99px; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.finding[data-severity="critical"] .severity-icon, .finding[data-severity="critical"] .severity-pill { background: var(--critical-soft); color: var(--critical); }
.finding[data-severity="high"] .severity-icon, .finding[data-severity="high"] .severity-pill { background: var(--high-soft); color: var(--high); }
.finding[data-severity="medium"] .severity-icon, .finding[data-severity="medium"] .severity-pill { background: var(--medium-soft); color: #946900; }
.finding[data-severity="low"] .severity-icon, .finding[data-severity="low"] .severity-pill { background: var(--low-soft); color: var(--low); }
.finding[data-severity="info"] .severity-icon, .finding[data-severity="info"] .severity-pill { background: #eff1ef; color: var(--muted); }
.chevron { color: var(--muted); transition: transform .2s; }
.finding-summary[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.finding-detail { padding: 4px 57px 19px; border-top: 1px solid var(--line); background: #fbfcfa; }
.finding-detail > div { margin-top: 15px; }
.finding-detail span, .finding-detail summary { color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.finding-detail p { margin: 5px 0 0; color: #506058; font-size: 12px; line-height: 1.6; }
.finding-detail details { margin-top: 15px; }
.finding-detail summary { cursor: pointer; }
.finding-detail code { display: block; margin-top: 8px; overflow-wrap: anywhere; color: #55635c; font-size: 11px; }
.empty-findings { padding: 28px; border-radius: 11px; background: var(--green-soft); color: var(--green-dark); text-align: center; font-size: 13px; }
.right-column { display: grid; gap: 20px; }
.checks-list { display: grid; }
.check-row { display: grid; grid-template-columns: 21px minmax(0,1fr); gap: 9px; padding: 10px 0; border-bottom: 1px solid #edf0ec; font-size: 12px; }
.check-row:last-child { border: 0; }
.check-status { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 850; }
.check-row.pass .check-status { background: var(--green-soft); color: var(--green); }
.check-row.fail .check-status { background: var(--medium-soft); color: #946900; }
.check-row.checked .check-status, .check-row.not-applicable .check-status { background: #eff1ef; color: var(--muted); }
.check-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.history-list { display: grid; }
.history-item { width: 100%; padding: 11px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid #edf0ec; background: transparent; cursor: pointer; text-align: left; }
.history-item:last-child { border: 0; }
.history-item strong { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.history-item small { color: var(--muted); font-size: 10px; }
.history-score { flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--green); }
footer { max-width: 1240px; margin: 25px auto 0; color: var(--muted); font-size: 10px; text-align: center; }

dialog { width: min(560px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 17px; background: #fff; box-shadow: 0 24px 80px rgba(8,31,21,.24); }
dialog::backdrop { background: rgba(8,25,18,.58); backdrop-filter: blur(3px); }
dialog form { padding: 29px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 27px; }
.dialog-heading h2 { margin: 0; font-size: 24px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f0f3ef; color: var(--muted); cursor: pointer; font-size: 22px; }
.field-label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
.url-field { height: 49px; display: flex; align-items: center; border: 1px solid #cfd8d1; border-radius: 9px; background: #fbfcfa; overflow: hidden; }
.url-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,77,.1); }
.url-field span { padding-left: 14px; color: var(--muted); font-size: 13px; }
.url-field input { width: 100%; height: 100%; padding: 0 14px 0 2px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.field-help { margin: 7px 0 20px; color: var(--muted); font-size: 10px; }
.mode-card { padding: 15px; display: flex; gap: 12px; border: 1px solid #bbd7c8; border-radius: 10px; background: var(--green-soft); }
.mode-icon { flex: 0 0 auto; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 12px; }
.mode-card strong { font-size: 12px; }
.mode-card p { margin: 4px 0 0; color: #567166; font-size: 10px; line-height: 1.5; }
.consent-row { margin: 19px 0; display: flex; align-items: start; gap: 10px; color: #46564e; font-size: 11px; line-height: 1.5; cursor: pointer; }
.consent-row input { margin-top: 2px; accent-color: var(--green); }
.form-error { padding: 10px 12px; border-radius: 8px; background: var(--critical-soft); color: var(--critical); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }

.setup-page { min-height: 100vh; display: grid; place-items: center; padding: 35px 18px; background: #10271e; }
.setup-shell { width: min(520px, 100%); padding: 0; }
.setup-brand { margin-bottom: 22px; display: flex; justify-content: center; align-items: center; gap: 11px; color: #fff; font-size: 24px; letter-spacing: -.04em; }
.setup-brand .brand-mark { width: 29px; height: 34px; }
.setup-card { padding: clamp(27px, 6vw, 42px); border-radius: 18px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.2); }
.setup-card h1 { margin-bottom: 12px; font-size: 34px; }
.setup-intro { margin-bottom: 23px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.storage-note { margin: 18px 0; padding: 13px; display: flex; align-items: start; gap: 10px; border: 1px solid #bbd7c8; border-radius: 9px; background: var(--green-soft); }
.storage-note > span { flex: 0 0 auto; width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 10px; font-weight: 800; }
.storage-note strong { display: block; color: var(--green-dark); font-size: 11px; }
.storage-note p { margin: 3px 0 0; color: #567166; font-size: 10px; line-height: 1.5; }
.requirements { margin: 20px 0 25px; display: grid; gap: 7px; }
.requirement { padding: 9px 11px; display: flex; gap: 9px; align-items: center; border-radius: 8px; background: #f2f5f1; font-size: 11px; }
.requirement span { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; }
.requirement.passed span { background: var(--green-soft); color: var(--green); }
.requirement.failed { background: var(--critical-soft); color: var(--critical); }
.requirement.failed span { background: var(--critical); color: #fff; }
.setup-form { display: grid; gap: 8px; }
.setup-form label { margin-top: 7px; font-size: 11px; font-weight: 750; }
.setup-form label small { color: var(--muted); font-weight: 500; }
.setup-form input { width: 100%; height: 45px; padding: 0 12px; border: 1px solid #cfd8d1; border-radius: 8px; outline: none; }
.setup-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,77,.1); }
.setup-form .button { margin-top: 14px; }
.setup-fieldset { margin: 10px 0 4px; padding: 15px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 10px; }
.setup-fieldset legend { padding: 0 7px; color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.setup-fieldset label { display: grid; gap: 6px; }
.setup-split { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.setup-warning, .success-message { padding: 11px 13px; border-radius: 8px; font-size: 11px; line-height: 1.5; }
.setup-warning { background: var(--critical-soft); color: var(--critical); }
.success-message { background: var(--green-soft); color: var(--green-dark); }
.login-card { max-width: 440px; margin: auto; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { padding: 28px 13px; align-items: center; }
  .brand > span:last-child, .nav-item:not(.active), .nav-item.active { font-size: 0; }
  .nav-item { padding: 0 14px; }
  .nav-item svg { width: 20px; }
  .sidebar-note, .version { display: none; }
  nav { margin-top: 46px; }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: 65px; padding: 0 17px; flex-direction: row; justify-content: space-between; }
  .brand > span:last-child { display: inline; font-size: 22px; }
  nav { margin: 0; display: flex; }
  .nav-item { min-height: 40px; }
  .nav-item.active { font-size: 0; }
  main { padding: 24px 15px; }
  .topbar { align-items: end; }
  .topbar .eyebrow { display: none; }
  .topbar .button { padding: 0 12px; }
  .welcome-card { min-height: auto; grid-template-columns: 1fr; padding: 30px 25px; }
  .welcome-visual { display: none; }
  .loading-card { padding: 38px 22px; flex-direction: column; gap: 25px; }
  .loading-copy { width: 100%; text-align: center; }
  .scanner-animation { width: 95px; height: 110px; }
  .snapshot-heading { align-items: start; }
  .score-ring { width: 84px; height: 84px; padding: 7px; }
  .score-ring > div { width: 70px; height: 70px; }
  .score-ring strong { font-size: 24px; }
  .severity-grid { grid-template-columns: repeat(2, 1fr); }
  .severity-stat:nth-child(2) { border-right: 0; }
  .severity-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .finding-summary { grid-template-columns: 31px minmax(0,1fr) 18px; }
  .severity-pill { display: none; }
  .finding-detail { padding-left: 20px; }
  .error-card { align-items: start; flex-wrap: wrap; }
}
