:root {
  --bg: #f2f4f3;
  --paper: #ffffff;
  --side: #eaeeee;
  --ink: #0e1a22;
  --muted: #465660;
  --line: #d6dcdc;
  --line-strong: #bac5c6;
  --blue: #0f4c81;
  --blue-hover: #0a3a64;
  --blue-soft: #e8f1f8;
  --green: #165e42;
  --green-soft: #ecf7f2;
  --red: #9e1b32;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-sm: none;
  --shadow-md: 0 1px 3px rgba(14, 26, 34, 0.05);
  --text-heading: 18px;
  --text-body: 14px;
  --text-sm: 13px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", ui-monospace, monospace;
  font-family: var(--font-sans);
  color: var(--ink);
  font-size: var(--text-body);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a, label, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: 0.56; }
button:disabled:hover { transform: none; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
label:focus-visible,
summary:focus-visible {
  outline: 2px solid #2854ca;
  outline-offset: 2px;
}

/* Application Shell */
.sidebar {
  width: 224px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 26px 14px 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
}
.brand > span {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.brand small {
  display: block;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.workspace-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  margin: 28px 10px 8px;
}

.sidebar nav { display: grid; gap: 3px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--text-body);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1), color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar nav a:hover { background: #dfe5e6; color: var(--ink); }
.sidebar nav a.active {
  background: var(--paper);
  color: var(--blue);
  font-weight: 600;
  box-shadow: inset 2.5px 0 0 var(--blue);
}
.nav-symbol { width: 17px; height: 17px; flex: none; }
.nav-count {
  margin-left: auto;
  background: #dce3e4;
  color: var(--ink);
  border-radius: 4px;
  min-width: 22px;
  padding: 0 6px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
.sidebar nav a.active .nav-count { background: var(--blue-soft); color: var(--blue); }

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  vertical-align: middle;
  flex: none;
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 15px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
}
.sidebar-bottom small {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: 2px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-weight: 600;
  font-size: var(--text-sm);
  flex: none;
}

.main-shell { margin-left: 224px; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--line);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  font-size: var(--text-sm);
}
.topbar-crumb { display: flex; align-items: center; min-width: 0; }
.breadcrumb { color: var(--muted); }
.divider { color: var(--line-strong); margin: 0 10px; }
#page-title { font-weight: 600; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.engine-meta {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}
.help-link {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.help-link:hover { border-color: var(--blue); color: var(--blue); }

.text-button {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--blue);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.text-button:hover { color: var(--blue-hover); text-decoration: underline; text-underline-offset: 3px; }

main {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 32px 40px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Shared Buttons, Panels, Headings */
.button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--text-body);
  font-weight: 600;
  min-height: 40px;
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1), border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.primary {
  background: var(--blue);
  color: #ffffff;
}
.primary:hover { background: var(--blue-hover); }
.secondary {
  background: var(--paper);
  border-color: var(--line-strong);
  color: var(--ink);
}
.secondary:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 20px;
}
.page-heading h1 {
  font-size: clamp(24px, 2.3vw, 30px);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.page-heading p {
  font-size: var(--text-body);
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.65;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
}
.section-heading h2 { font-size: var(--text-heading); margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.section-heading a { font-size: var(--text-sm); color: var(--blue); font-weight: 500; }
.section-heading a:hover { color: var(--blue-hover); text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); font-size: var(--text-sm); font-weight: 500; }

/* Form Fields */
.field-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 7px;
}
input:not([type=file]):not([type=checkbox]),
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 10px 12px;
  font-size: var(--text-body);
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), background-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
input:not([type=file]):not([type=checkbox]):focus,
textarea:focus {
  border-color: var(--blue);
  background: var(--paper);
  box-shadow: 0 0 0 2px #0f4c8124;
  outline: none;
}
textarea {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.75;
  resize: vertical;
  tab-size: 2;
}
#paste-path { margin-bottom: 16px; }

/* Banners */
.info-banner {
  padding: 12px 16px;
  background: var(--blue-soft);
  border: 1px solid #c3d9ea;
  border-radius: var(--radius-sm);
  color: #1c3d59;
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-bottom: 18px;
}
.info-banner button { margin-left: 10px; }
.info-banner.demo-notice {
  background: #fdf4e4;
  border-color: #e4c997;
  color: #704811;
}
.recovery-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 16px;
}
.recovery-banner[hidden] { display: none; }
.recovery-banner div { display: flex; flex-wrap: wrap; gap: 10px; }
.recovery-banner button,
.recovery-banner a.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-left: 0;
}

/* Scan View */
.scan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 20px;
  align-items: start;
}
.input-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 22px;
  margin: 18px 0;
}
.input-tabs button {
  border: 0;
  background: none;
  padding: 10px 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
.input-tabs button[aria-selected=true] { color: var(--blue); font-weight: 600; }
.input-tabs button[aria-selected=true]:after {
  content: "";
  position: absolute;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
  left: 0;
  right: 0;
  border-radius: 2px;
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  background: #f7f9f8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 216px;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 24px 18px;
  text-align: center;
  transition: border-color 150ms cubic-bezier(0.22, 1, 0.36, 1), background-color 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.dropzone:hover, .dropzone.dragging {
  background: var(--blue-soft);
  border-color: var(--blue);
}
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong { font-size: var(--text-body); font-weight: 600; color: var(--ink); }
.dropzone small { font-size: var(--text-sm); color: var(--muted); margin-top: 8px; }

.file-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
}
.file-toolbar strong { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.file-tabs { display: flex; gap: 8px; overflow: auto; padding: 4px 4px 10px; }
.file-item {
  display: inline-flex;
  flex: none;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f5f7f7;
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), background-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.file-item.active { background: var(--blue-soft); border-color: #9dc0dd; }
.file-item .file-tab, .file-item .remove-file { border: 0; background: none; color: var(--muted); }
.file-item.active .file-tab { color: var(--blue); font-weight: 600; }
.file-item .file-tab {
  max-width: min(300px, 58vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  padding: 6px 8px;
}
.file-item .remove-file { min-width: 28px; min-height: 30px; font-size: 15px; }
.file-item .remove-file:hover { color: var(--red); }

#file-editor { background: var(--paper); min-height: 240px; }
.source-panel textarea { white-space: pre; overflow-wrap: normal; overflow: auto; }

.scan-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 20px;
}
.scan-footer > span { font-size: var(--text-sm); color: var(--muted); display: inline-flex; align-items: center; }
.scan-footer .status-dot { width: 5px; height: 5px; }
#scan-progress { padding: 12px 0 0; font-size: var(--text-sm); color: var(--blue); font-weight: 600; }

.scan-aside { display: grid; gap: 16px; }
.scan-aside .panel { padding: 20px; }
.scan-aside h3 { font-size: var(--text-body); font-weight: 600; margin: 0 0 12px; }
.sample-option {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8fafa;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin-top: 8px;
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), background-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.sample-option:hover { border-color: var(--blue); background: var(--blue-soft); }
.sample-option strong {
  font-size: var(--text-body);
  color: var(--ink);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sample-option p { font-size: var(--text-sm); color: var(--muted); margin: 5px 0 0; line-height: 1.6; }

.privacy-note { padding: 2px 6px; color: var(--muted); }
.privacy-note.panel-quiet {
  padding: 16px 18px;
  background: var(--side);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.privacy-note h3 { color: var(--ink); font-size: var(--text-body); margin: 0 0 6px; }
.privacy-note p { font-size: var(--text-sm); line-height: 1.7; margin: 0; color: var(--muted); }
.privacy-note a { display: inline-block; font-size: var(--text-sm); color: var(--blue); font-weight: 600; margin-top: 8px; }

/* History & Recent */
.empty-state {
  padding: 24px 18px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--text-sm);
}
.empty-state strong { display: block; font-size: var(--text-body); color: var(--ink); margin-bottom: 6px; font-weight: 600; }
.empty-state a { display: inline-block; color: var(--blue); margin-top: 10px; font-size: var(--text-sm); font-weight: 600; }

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  margin: 0 -8px;
  border-radius: 6px;
  border-bottom: 1px solid var(--line);
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover { background: #f4f7f8; }
.report-icon {
  width: 34px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--side);
  display: grid;
  place-items: center;
  color: var(--blue);
  flex: none;
}
.recent-row strong { display: block; font-size: var(--text-body); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.recent-row small { display: block; font-size: var(--text-sm); color: var(--muted); margin-top: 3px; }
.recent-row .row-end { margin-left: auto; color: var(--blue); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }

.history-card {
  display: flex;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 10px;
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.history-card:hover { border-color: var(--line-strong); }
.history-card > div:first-of-type { min-width: 0; }
.history-card strong { font-size: var(--text-body); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.history-card p { font-size: var(--text-sm); color: var(--muted); margin: 6px 0 0; line-height: 1.6; }
.history-card .history-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.score-mini {
  font-size: 20px;
  color: var(--blue);
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-mini small { font-size: var(--text-sm); color: var(--muted); font-weight: 400; }
.icon-button {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 7px 11px;
  font-size: var(--text-sm);
  min-height: 36px;
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), color 140ms cubic-bezier(0.22, 1, 0.36, 1), background-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.icon-button:hover { background: #fdf0f2; border-color: #e4b5be; color: var(--red); }

/* Guide View */
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.guide-grid .panel { padding: 24px; }
.guide-grid h2 { font-size: 16px; margin: 14px 0 6px; font-weight: 600; }
.guide-grid p, .guide-grid li { font-size: 14px; color: var(--muted); line-height: 1.75; }
.guide-cta { display: flex; justify-content: flex-end; padding: 22px 0 8px; }

/* Severity Badge Base */
.severity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: var(--text-sm);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.severity:before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
}
.severity.critical { color: #9e1b32; background: #fdf0f2; }
.severity.high { color: #9a3d12; background: #fef4ed; }
.severity.medium { color: #74550c; background: #fbf6e6; }
.severity.low { color: #2f4f6f; background: #edf3f8; }

/* Report Layout Base */
.report-heading { margin-bottom: 20px; align-items: flex-start; }
.report-heading h1 { font-size: clamp(24px, 2.4vw, 30px); margin-bottom: 8px; }
.report-heading .report-metadata {
  color: var(--muted);
  font-size: var(--text-sm);
  display: flex;
  gap: 6px 14px;
  flex-wrap: wrap;
  align-items: center;
}
.report-actions { display: flex; gap: 9px; flex: none; }
.report-actions .button { font-size: var(--text-sm); min-height: 38px; padding: 8px 14px; }

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 284px;
  gap: 22px;
  align-items: start;
}
.report-main { min-width: 0; }
.report-aside { display: grid; gap: 16px; position: sticky; top: 20px; }
.report-aside .panel { padding: 20px; }
.report-aside h3 { font-size: var(--text-body); font-weight: 600; margin: 0 0 14px; }

.report-summary {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.score-ring {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.score-dial {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.score-dial .dial-tick { stroke: #c9d2d4; stroke-width: 1; }
.score-dial .dial-tick-major { stroke: #8d9da3; stroke-width: 1.4; }
.score-dial .dial-track { fill: none; stroke: #e6ebeb; stroke-width: 5; }
.score-dial .dial-progress { fill: none; stroke-width: 5; stroke-linecap: round; }
.score-dial-critical .dial-track { stroke: #f6dce0; }
.score-dial-critical .dial-progress { stroke: #9e1b32; }
.score-dial-high .dial-progress { stroke: #c86432; }
.score-dial-medium .dial-progress { stroke: #a87e1a; }
.score-dial-clear .dial-track { stroke: #d7ede1; }
.score-dial-clear .dial-progress { stroke: var(--green); }
.score-ring b, .score-ring small { position: relative; z-index: 1; }
.score-ring b {
  font-size: 29px;
  line-height: 1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.score-ring small { font-size: 11px; margin-top: 4px; letter-spacing: -0.02em; }
.report-summary h2 { font-size: var(--text-heading); margin: 0 0 6px; font-weight: 700; }
.report-summary p { font-size: var(--text-body); line-height: 1.65; margin: 0; }
.severity-counts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: var(--text-sm); }
.severity-counts b { font-size: var(--text-body); margin-left: 5px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.severity-spectrum {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 12px;
  border-radius: 3px;
  overflow: hidden;
}
.spectrum-track { fill: #e6ebeb; }
.spectrum-critical { fill: #9e1b32; }
.spectrum-high { fill: #c86432; }
.spectrum-medium { fill: #b0841a; }
.spectrum-low { fill: #4a6b8a; }

.report-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
  gap: 10px;
}
.report-tools h2 { font-size: var(--text-heading); margin: 0; white-space: nowrap; font-weight: 600; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filter {
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  min-height: 36px;
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1), border-color 140ms cubic-bezier(0.22, 1, 0.36, 1), color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.filter:hover { background: var(--blue-soft); }
.filter.active { background: var(--blue-soft); border-color: #9dc0dd; color: var(--blue); font-weight: 600; }

.finding {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--paper);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.finding.finding-critical { border-left-color: #9e1b32; }
.finding.finding-high { border-left-color: #9a3d12; }
.finding.finding-medium { border-left-color: #8c6a12; }
.finding.finding-low { border-left-color: #4a6b8a; }
.finding summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 17px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.finding summary::-webkit-details-marker { display: none; }
.finding summary > div { min-width: 0; overflow-wrap: anywhere; }
.finding summary .finding-name { font-size: var(--text-body); font-weight: 600; line-height: 1.45; display: block; }
.finding summary small {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.finding-chevron {
  margin-left: auto;
  font-size: 16px;
  line-height: 1.2;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}
.finding[open] .finding-chevron { transform: rotate(90deg); }
.finding-body { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.finding-body p { font-size: var(--text-body); line-height: 1.7; margin: 0 0 10px; overflow-wrap: anywhere; }
.evidence-block {
  background: #f5f7f7;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
  overflow: auto;
  font: 13px/1.68 var(--font-mono);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.finding-body h4 { font-size: var(--text-sm); margin: 14px 0 7px; font-weight: 600; }
.finding-rule { display: inline-block; margin-top: 6px; font: 12px var(--font-mono); }
.finding-locate { min-height: 36px; margin-top: 10px; padding: 7px 12px; }
.prompt-block {
  margin-top: 14px;
  border-left: 2.5px solid var(--blue);
  background: #f5f9fc;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px 12px;
}
.prompt-block h4 { margin-top: 0; }
.prompt-block pre {
  font: 13px/1.68 var(--font-mono);
  white-space: pre-wrap;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}
.copy-prompt {
  color: var(--blue);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
}
.copy-prompt:hover { background: var(--blue-soft); border-color: var(--blue); }

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  min-height: 40px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
  align-items: center;
}
.category-row:last-child { border-bottom: 0; }
.category-row b {
  font-size: 12px;
  color: #9a3d12;
  background: #fef4ed;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.category-row b.pass { color: var(--green); background: var(--green-soft); }

.unlock-panel {
  background: #f3f7fa;
  border-color: #bed3e3;
}
.unlock-panel .pack-label {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
}
.unlock-panel h3 { font-size: var(--text-heading); line-height: 1.4; color: var(--ink); margin: 10px 0 8px; }
.unlock-panel p { font-size: var(--text-sm); line-height: 1.65; margin: 0; }
.pack-price { font-size: var(--text-sm); margin: 16px 0 14px; }
.pack-price strong {
  font-size: 28px;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}
.pack-price span { font-size: var(--text-sm); }
.unlock-panel .button { width: 100%; }
.unlock-panel small { display: block; margin-top: 10px; text-align: center; font-size: var(--text-sm); }

.export-actions { display: grid; gap: 9px; margin-top: 14px; }
.export-actions .button { width: 100%; gap: 8px; }

.report-boundary {
  font-size: var(--text-sm);
  line-height: 1.75;
  margin: 22px 0 6px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.report-boundary strong { font-weight: 600; }
.report-boundary ul { padding-left: 18px; margin: 8px 0 0; }

.compare-panel {
  border: 1px solid #bcd9ca;
  background: var(--green-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 0 0 18px;
  font-size: var(--text-sm);
}
.compare-panel strong { font-size: var(--text-body); display: block; margin-bottom: 12px; font-weight: 600; }
.compare-panel p { font-size: var(--text-sm); line-height: 1.65; margin: 10px 0 0; }

.report-empty {
  background: var(--green-soft);
  border: 1px solid #bcd9ca;
  padding: 24px 20px;
  font-size: var(--text-body);
  border-radius: var(--radius);
  line-height: 1.7;
}
.report-empty strong { display: block; margin-bottom: 6px; font-size: var(--text-body); }
.empty-filter { text-align: center; padding: 28px; color: var(--muted); font-size: var(--text-sm); }

.payment-recovery {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #c3d9ea;
  background: var(--blue-soft);
  border-radius: var(--radius);
  padding: 11px 16px;
  margin: 0 0 16px;
  font-size: var(--text-sm);
}
.payment-recovery .text-button { color: var(--blue); font-size: var(--text-sm); white-space: nowrap; }

.mobile-report-actions { display: none; }

/* Dialogs */
dialog {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 28px;
  max-width: 460px;
  width: calc(100% - 28px);
  box-shadow: 0 20px 56px rgba(14, 26, 34, 0.22);
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop { background: rgba(14, 26, 34, 0.45); backdrop-filter: blur(4px); }
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.dialog-close:hover { background: var(--side); color: var(--ink); }
dialog h2 { font-size: 20px; letter-spacing: -0.02em; margin: 4px 0 10px; }
.checkout-price { font-size: 18px; color: var(--blue); margin: 16px 0; }
.checkout-price strong { font-size: 38px; font-family: var(--font-mono); font-weight: 700; }
.checkout-price span { font-size: var(--text-sm); margin-left: 8px; }
.checkout-benefits {
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  line-height: 2.05;
  margin: 0 0 16px;
}
.checkout-benefits li:before { content: "✓"; color: var(--green); margin-right: 9px; font-weight: 700; }
#checkout-actions { display: grid; gap: 10px; }
#checkout-actions .button { width: 100%; }
.checkout-footer { font-size: var(--text-sm) !important; text-align: center; line-height: 1.65; margin: 14px 0 0 !important; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: calc(50% + 112px);
  transform: translateX(-50%);
  background: #0e1a22;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: var(--text-sm);
  max-width: 85vw;
  box-shadow: 0 12px 32px rgba(14, 26, 34, 0.25);
  z-index: 100;
  line-height: 1.6;
  pointer-events: none;
}
.toast.error { background: #8c192d; }
.toast a { text-decoration: underline; }

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: var(--text-sm);
  margin-top: auto;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
footer > span:first-child { display: flex; gap: 6px; align-items: center; color: var(--ink); font-weight: 600; }
footer > .icp-filing { flex-basis: 100%; text-align: center; text-decoration: underline; }

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .sidebar { width: 196px; padding-left: 12px; padding-right: 12px; }
  .main-shell { margin-left: 196px; }
  .topbar { padding: 0 28px; }
  main { padding: 26px 28px 0; }
  .scan-layout { grid-template-columns: minmax(0, 1fr) 256px; }
  .report-layout { grid-template-columns: minmax(0, 1fr) 248px; }
  .toast { left: calc(50% + 98px); }
}

@media (max-width: 1000px) {
  .sidebar { width: 184px; padding: 22px 10px 0; }
  .brand { padding: 2px 6px; gap: 8px; }
  .brand > span { font-size: 18px; }
  .brand img { width: 28px; height: 32px; }
  .sidebar nav a { padding: 10px; font-size: 13px; gap: 8px; }
  .workspace-label { margin-left: 6px; margin-right: 6px; }
  .sidebar-bottom { gap: 8px; }
  .main-shell { margin-left: 184px; }
  .topbar { padding: 0 22px; height: 58px; }
  main { padding: 22px 22px 0; }
  .scan-layout, .report-layout { grid-template-columns: minmax(0, 1fr); }
  .scan-aside { grid-template-columns: 1fr 1fr; }
  .report-aside { position: static; grid-template-columns: 1fr 1fr; }
  .toast { left: calc(50% + 92px); }

  :root { --report-actions-space: calc(88px + env(safe-area-inset-bottom)); }
  :root:has(body[data-view=report]) { scroll-padding-block-end: var(--report-actions-space); }
  #view-report { padding-bottom: var(--report-actions-space); }
  .mobile-report-actions {
    position: fixed;
    bottom: 0;
    left: 184px;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 22px max(12px, env(safe-area-inset-bottom));
    background: #fffffffa;
    border-top: 1px solid #d9e2f1;
    box-shadow: 0 -8px 24px #111d3514;
    z-index: 15;
    color: #4a5d7c;
    font-size: 13px;
  }
  .mobile-report-actions .button { font-size: 13px; min-height: 44px; padding: 8px 14px; }
  .mobile-report-delivery .button { flex: 1; min-width: 0; justify-content: center; padding-inline: 10px; }
  body[data-view=report] .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: min(85vw, 380px);
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: sticky;
    top: 0;
    inset: auto;
    width: 100%;
    height: auto;
    padding: 10px 16px;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }
  .brand { padding: 0; gap: 7px; flex-shrink: 0; }
  .brand img { width: 24px; height: 27px; }
  .brand > span { font-size: 16px; }
  .brand small, .nav-symbol, .workspace-label, .sidebar-bottom, .nav-count { display: none; }
  .sidebar nav { display: flex; gap: 2px; margin-left: auto; }
  .sidebar nav a { padding: 8px 9px; font-size: 13px; gap: 0; }
  .sidebar nav a.active { box-shadow: inset 0 -2px 0 var(--blue); }
  .main-shell { margin-left: 0; }
  .topbar { height: 48px; padding: 0 16px; }
  .topbar-right { gap: 12px; }
  .engine-meta { display: none; }
  main { padding: 20px 16px 0; }
  .guide-grid { grid-template-columns: 1fr; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 14px; }
  .report-actions { flex-wrap: wrap; }
  .report-summary { gap: 16px; padding: 18px; grid-template-columns: 92px minmax(0, 1fr); }
  .score-ring { width: 88px; height: 88px; border-width: 5px; }
  .score-ring b { font-size: 24px; }
  .mobile-report-actions { left: 0; padding-left: 14px; padding-right: 14px; }
  .toast { left: 50%; }
  .file-item .remove-file { min-width: 42px; min-height: 42px; }
  .file-item .file-tab { min-height: 42px; }
  .finding-locate { min-height: 44px; }
  footer > span:nth-child(2) { display: none; }
}

@media (max-width: 480px) {
  .sidebar { padding: 9px 10px; gap: 6px; }
  .sidebar nav a { font-size: 12px; padding: 8px 5px; }
  .brand > span { font-size: 15px; }
  .brand img { width: 21px; height: 24px; }
  .topbar { padding: 0 12px; }
  main { padding: 16px 12px 0; }
  .panel { padding: 18px 16px; }
  .scan-aside, .report-aside { grid-template-columns: 1fr; }
  .scan-footer { align-items: stretch; flex-direction: column; gap: 12px; }
  .scan-footer > span { justify-content: center; }
  .dropzone { min-height: 188px; padding: 18px 12px; }
  .report-summary { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .score-ring { width: 82px; height: 82px; border-width: 4px; }
  .score-ring b { font-size: 23px; }
  .score-ring small { font-size: 10px; white-space: nowrap; }
  .report-tools { align-items: flex-start; flex-direction: column; gap: 10px; }
  .finding summary { padding: 14px 12px; gap: 8px; }
  .finding-body { padding: 12px 14px 16px; }
  .history-card { padding: 14px; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
  .history-card .history-meta { width: 100%; margin-left: 0; justify-content: flex-end; gap: 8px; }
  .history-card .history-meta .button { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  dialog { padding: 22px 18px; }
  .checkout-price strong { font-size: 34px; }
  .mobile-report-actions { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); gap: 8px; }
  .mobile-report-actions .button { font-size: 12px; padding: 8px 10px; }
  footer { font-size: 12px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .sidebar, .topbar, footer, .report-actions, .report-aside, .filters, .toast, .mobile-report-actions, .payment-recovery {
    display: none !important;
  }
  .main-shell { margin: 0; }
  main { padding: 0; }
  .view:not(#view-report) { display: none; }
  .report-layout { display: block; }
  .finding { break-inside: avoid; }
  details > div { display: block !important; }
  body { background: #ffffff; }
}
