:root {
  color-scheme: light;
  --bg-page: #f8fafc;
  --paper: #ffffff;
  --paper-elevated: #ffffff;
  --paper-subtle: #f1f5f9;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-glow: rgba(79, 70, 229, 0.15);

  --teal: #0d9488;
  --teal-soft: #f0fdf4;
  --teal-border: #bbf7d0;

  --error: #e11d48;
  --error-soft: #fff1f2;
  --error-border: #fecdd3;

  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-receipt: 0 18px 45px -10px rgba(15, 23, 42, 0.09), 0 0 0 1px rgba(226, 232, 240, 0.9);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, Menlo, Monaco, monospace;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", Bahnschrift, "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #090d16;
  --paper: #0f172a;
  --paper-elevated: #1e293b;
  --paper-subtle: #162032;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --subtle: #64748b;
  --line: #1e293b;
  --line-strong: #334155;

  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(129, 140, 248, 0.25);

  --teal: #2dd4bf;
  --teal-soft: rgba(20, 184, 166, 0.14);
  --teal-border: rgba(45, 212, 191, 0.3);

  --error: #fb7185;
  --error-soft: rgba(244, 63, 94, 0.14);
  --error-border: rgba(251, 113, 133, 0.3);

  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --warning-border: rgba(251, 191, 36, 0.3);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 14px 30px -4px rgba(0, 0, 0, 0.6);
  --shadow-receipt: 0 20px 45px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-page: #090d16;
    --paper: #0f172a;
    --paper-elevated: #1e293b;
    --paper-subtle: #162032;
    --ink: #f8fafc;
    --ink-secondary: #cbd5e1;
    --muted: #94a3b8;
    --subtle: #64748b;
    --line: #1e293b;
    --line-strong: #334155;

    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(99, 102, 241, 0.15);
    --accent-glow: rgba(129, 140, 248, 0.25);

    --teal: #2dd4bf;
    --teal-soft: rgba(20, 184, 166, 0.14);
    --teal-border: rgba(45, 212, 191, 0.3);

    --error: #fb7185;
    --error-soft: rgba(244, 63, 94, 0.14);
    --error-border: rgba(251, 113, 133, 0.3);

    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --warning-border: rgba(251, 191, 36, 0.3);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 30px -4px rgba(0, 0, 0, 0.6);
    --shadow-receipt: 0 20px 45px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg-page);
  color: var(--ink);
  font: 14.5px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button, a, input, select {
  touch-action: manipulation;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
svg [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4, p, ul, ol, dl, dd {
  margin: 0;
}

h1, h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Header & Brand
   ========================================================================== */
.site-header {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 78px;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-page);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 700 20px/1.2 var(--display);
  letter-spacing: -0.03em;
  color: var(--ink);
  transition: transform 0.15s ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #312e81 100%);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-badge svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.brand span {
  display: flex;
  flex-direction: column;
}

.brand small {
  display: block;
  font: 500 11px/1.4 var(--body);
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.local-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--paper);
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--teal);
  box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.7);
  animation: pulse-glow 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(13, 148, 136, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0);
  }
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-icon.sun {
  display: none;
}
.theme-icon.moon {
  display: block;
}

[data-theme="dark"] .theme-icon.sun {
  display: block;
}
[data-theme="dark"] .theme-icon.moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon.sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-icon.moon {
    display: none;
  }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 40px 48px;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  font: 700 11px/1 var(--mono);
  color: var(--accent);
  letter-spacing: 0.12em;
  padding: 5px 9px;
  border-radius: 9999px;
  background: var(--accent-soft);
  margin-bottom: 12px;
}

.intro h1 {
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.22;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.intro > div > p:last-child {
  color: var(--muted);
  font-size: 15px;
  margin-top: 10px;
  max-width: 580px;
}

.mobile-break {
  display: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--paper-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button:active {
  transform: translateY(0);
}

.sample-button {
  background: linear-gradient(135deg, var(--accent) 0%, #4338ca 100%);
  color: #ffffff;
  border: 1px solid transparent;
  padding: 11px 22px;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.sample-button:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-hover) 0%, #3730a3 100%);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.sample-button span {
  font-size: 15px;
  line-height: 1;
}

.small {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.text-button {
  background: transparent;
  border: none;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.text-button:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Workbench & Upload Panel
   ========================================================================== */
.workbench {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.input-panel {
  padding: 24px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 24px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-heading h2 {
  font: 700 16px/1.2 var(--body);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.input-help {
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0 20px;
  line-height: 1.6;
}

.input-help code {
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  padding: 2px 5px;
  border-radius: 4px;
}

.drop-zone {
  display: flex;
  position: relative;
  min-height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--line-strong);
  background: var(--paper-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.drop-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-glow);
  transform: scale(1.02);
}

.drop-zone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.drop-zone svg {
  width: 34px;
  height: 34px;
  stroke: var(--accent);
  stroke-width: 1.6;
  fill: none;
  margin: 14px 0 8px;
  transition: transform 0.2s ease;
}

.drop-zone:hover svg {
  transform: translateY(-2px);
}

.slot-label {
  align-self: stretch;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.slot-label > span {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.secondary .slot-label > span {
  background: var(--paper-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
}

.drop-zone strong {
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
  max-width: 100%;
  color: var(--ink);
}

.drop-detail {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
  text-align: center;
  overflow-wrap: anywhere;
}

.secondary {
  background: transparent;
  border-color: var(--line);
  min-height: 160px;
}

.secondary svg {
  stroke: var(--muted);
  width: 28px;
  height: 28px;
  margin-top: 10px;
}

.secondary:hover {
  border-color: var(--muted);
  background: var(--paper-subtle);
}

.comparison-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 12px 0;
}

.comparison-connector span {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.status-message {
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
  overflow-wrap: anywhere;
  min-height: 38px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  line-height: 1.5;
  transition: all 0.2s ease;
}

.status-message.error {
  color: var(--error);
  background: var(--error-soft);
  border-color: var(--error-border);
  font-weight: 500;
}

.scope-note {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.scope-note h3 {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scope-note p + p {
  margin-top: 8px;
}

/* ==========================================================================
   Receipt Main Report Card
   ========================================================================== */
.receipt {
  min-height: 700px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-receipt);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.2s ease;
}

.receipt:before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 24px;
  border-left: 1px dashed var(--line-strong);
  pointer-events: none;
  z-index: 2;
}

.receipt-header {
  padding: 32px 36px 24px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.receipt-kicker {
  font: 700 11px/1.4 var(--mono);
  letter-spacing: 0.14em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-tag {
  font: 600 10.5px/1 var(--body);
  letter-spacing: 0;
  padding: 4px 8px;
  border-radius: 9999px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
}

.receipt-header h2 {
  font: 700 clamp(22px, 2.4vw, 32px)/1.3 var(--mono);
  letter-spacing: -0.04em;
  margin-top: 8px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.receipt-header p {
  font: 500 12.5px/1.6 var(--mono);
  color: var(--muted);
  margin-top: 6px;
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.copy-button {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.copy-button:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ==========================================================================
   Receipt Summary Alert
   ========================================================================== */
.receipt-summary {
  margin: 24px 36px 0 48px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--error-border);
  border-left: 5px solid var(--error);
  background: var(--error-soft);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}

.receipt-summary strong {
  font-weight: 700;
  color: var(--error);
}

.receipt-summary .summary-secondary {
  color: var(--muted);
  font-size: 11.5px;
  display: block;
  margin-top: 4px;
}

.receipt-summary.review {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  border-left-color: var(--warning);
}

.receipt-summary.review strong {
  color: var(--warning);
}

.receipt-summary.clear {
  background: var(--teal-soft);
  border-color: var(--teal-border);
  border-left-color: var(--teal);
}

.receipt-summary.clear strong {
  color: var(--teal);
}

/* ==========================================================================
   Stats Strip
   ========================================================================== */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 36px 0 48px;
  padding: 0;
  gap: 14px;
}

.stats-strip > div {
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--paper-subtle);
  border-radius: var(--radius-md);
  min-width: 0;
  transition: all 0.2s ease;
}

.stats-strip > div:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stats-strip dt {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.stats-strip dd {
  font: 700 22px/1.2 var(--mono);
  margin: 0;
  white-space: nowrap;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.stats-strip dd small {
  display: block;
  font: 400 11px/1.5 var(--body);
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 6px;
}

/* ==========================================================================
   Report Tabs
   ========================================================================== */
.report-tabs {
  display: flex;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-left: 48px;
  gap: 32px;
  margin-top: 26px;
  background: var(--paper);
}

.report-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 16px 4px 14px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.report-tab:hover {
  color: var(--ink);
}

.report-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.report-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9999px;
  font: 600 10px var(--mono);
  background: var(--paper-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.report-tab.active span {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* ==========================================================================
   Tab Panel & Findings
   ========================================================================== */
.tab-panel {
  padding: 26px 36px 16px 48px;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-label h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.section-label > span {
  font: 500 11px var(--mono);
  color: var(--muted);
}

.filter-label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.filter-label select {
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

.filter-label select:focus {
  border-color: var(--accent);
}

.finding {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.finding:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.finding:first-child {
  padding-top: 18px;
}

.finding-icon {
  font: 700 12px/26px var(--mono);
  width: 26px;
  height: 26px;
  text-align: center;
  border-radius: 8px;
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.finding.warning .finding-icon {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: var(--warning-border);
}

.finding.info .finding-icon {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--line);
}

.finding-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.severity-word {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid var(--error-border);
  white-space: nowrap;
}

.warning .severity-word {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: var(--warning-border);
}

.info .severity-word {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--line);
}

.finding-path {
  display: inline-block;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
  font: 500 11.5px/1.6 var(--mono);
  overflow-wrap: anywhere;
  margin-top: 8px;
}

.finding-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.finding details {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}

.finding summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
  font-weight: 600;
}

.finding summary:hover {
  text-decoration: underline;
}

.finding ul {
  padding-left: 20px;
  margin: 8px 0;
}

.finding li {
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.quiet-empty {
  padding: 32px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ==========================================================================
   Treemap & Growth Section
   ========================================================================== */
.size-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}

.treemap-container {
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--paper-subtle);
  border: 1px solid var(--line);
}

.treemap-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.treemap-container text {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--ink);
  pointer-events: none;
}

.treemap-container rect {
  stroke: var(--paper);
  stroke-width: 2;
  transition: opacity 0.15s ease;
}

.treemap-container [role="button"] {
  cursor: pointer;
}

.treemap-container [role="button"]:hover rect {
  opacity: 0.85;
}

.treemap-container .map-size {
  font-size: 10px;
  font-weight: 400;
  fill: var(--muted);
}

.growth-list {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.growth-item {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 8px 12px;
  font: 11px/1.6 var(--mono);
  color: var(--ink);
  background: var(--paper-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.growth-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.growth-item span:last-child {
  white-space: nowrap;
  font-weight: 700;
  color: var(--warning);
}

/* ==========================================================================
   Files Panel & Controls
   ========================================================================== */
.file-controls {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 16px;
}

.search-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.search-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kbd-hint {
  font: 600 10px var(--mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

.search-input-wrap input {
  font-size: 12.5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: all 0.15s ease;
}

.search-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.small-text {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.table-scroll {
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.file-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper-subtle);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  white-space: nowrap;
  user-select: none;
}

.file-table th.sortable {
  cursor: pointer;
  transition: color 0.15s ease;
}

.file-table th.sortable:hover {
  color: var(--accent);
}

.sort-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
}

.file-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  vertical-align: middle;
}

.file-table tbody tr {
  transition: background-color 0.15s ease;
}

.file-table tbody tr:hover {
  background-color: var(--paper-subtle);
}

.file-table th:first-child,
.file-table td:first-child {
  padding-left: 16px;
}

.file-table th:nth-child(n+3),
.file-table td:nth-child(n+3) {
  text-align: right;
  white-space: nowrap;
}

.file-link {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: var(--ink);
  font: inherit;
  overflow-wrap: anywhere;
  min-width: 90px;
  transition: color 0.15s ease;
}

.file-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.diff-kind {
  font: 600 10.5px/1.6 var(--body);
  border-radius: 9999px;
  background: var(--paper-subtle);
  color: var(--muted);
  padding: 2px 8px;
  white-space: nowrap;
  display: inline-block;
}

.diff-kind.added {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid var(--teal-border);
}

.diff-kind.changed {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line);
}

.diff-kind.removed {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.delta-positive {
  color: var(--warning);
  font-weight: 700;
}

.delta-negative {
  color: var(--teal);
  font-weight: 700;
}

.load-more {
  display: block;
  margin: 20px auto 10px;
  font-size: 12px;
}

/* ==========================================================================
   Scripts Panel
   ========================================================================== */
.section-intro {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 20px;
}

.script-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  padding: 16px 18px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.script-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 700 13px var(--mono);
  margin-bottom: 12px;
  color: var(--ink);
}

.script-item pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11.5px/1.8 var(--mono);
  margin: 6px 0 12px;
  padding: 10px 14px;
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
}

.script-caption {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* ==========================================================================
   Receipt Footer & Page Footer
   ========================================================================== */
.receipt-footer {
  margin: 24px 36px 0 48px;
  border-top: 1px dashed var(--line);
  padding: 20px 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
}

.receipt-footer > span {
  font: 700 10px/1.4 var(--mono);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.receipt-footer p {
  font-size: 11px;
  max-width: 460px;
  line-height: 1.6;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
  min-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 60px 40px;
  text-align: center;
}

.empty-state svg {
  width: 72px;
  height: 86px;
  stroke: var(--accent);
  stroke-width: 1.5;
  fill: var(--accent-soft);
  margin-bottom: 24px;
}

.empty-state h2 {
  font: 700 24px/1.4 var(--display);
  margin-bottom: 12px;
  color: var(--ink);
}

.empty-state p {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--muted);
}

/* ==========================================================================
   File Inspector Modal Dialog
   ========================================================================== */
dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  width: min(1140px, calc(100% - 40px));
  max-height: 85vh;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 12px;
}

.dialog-heading .eyebrow {
  margin-bottom: 4px;
}

.dialog-heading h2 {
  font: 700 18px/1.5 var(--mono);
  overflow-wrap: anywhere;
  color: var(--ink);
}

.file-preview-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.file-preview-columns > section {
  min-width: 0;
}

.file-preview-columns h3 {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink-secondary);
}

.file-preview-columns pre {
  background: var(--paper-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 55vh;
  overflow: auto;
  font: 11.5px/1.8 var(--mono);
  margin: 0;
  min-height: 160px;
  color: var(--ink);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (min-width: 1500px) {
  .site-header, main {
    max-width: 1480px;
  }
  .workbench {
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 32px;
  }
  .receipt-header {
    padding-top: 36px;
  }
  .tab-panel {
    padding-top: 28px;
  }
  .treemap-container {
    height: 220px;
  }
}

@media (max-width: 1050px) {
  .site-header {
    padding: 16px 24px;
  }
  main {
    padding: 20px 24px 32px;
  }
  .workbench {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
  }
  .input-panel {
    padding: 18px 16px;
  }
  .receipt-header {
    padding: 26px 24px 20px 34px;
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
  .export-actions {
    justify-content: flex-start;
  }
  .receipt:before {
    left: 16px;
  }
  .receipt-summary,
  .stats-strip,
  .receipt-footer {
    margin-left: 34px;
    margin-right: 24px;
  }
  .stats-strip > div {
    padding: 12px 14px;
  }
  .stats-strip dd {
    font-size: 19px;
  }
  .report-tabs {
    padding-left: 34px;
    gap: 20px;
  }
  .tab-panel {
    padding-left: 34px;
    padding-right: 24px;
  }
  .intro h1 {
    font-size: 34px;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 14px 18px;
    min-height: 68px;
  }
  .brand {
    font-size: 18px;
  }
  .brand-badge {
    width: 34px;
    height: 34px;
  }
  .brand-badge svg {
    width: 20px;
    height: 20px;
  }
  .local-note {
    font-size: 11px;
    padding: 4px 8px;
  }
  main {
    padding: 14px 16px 28px;
  }
  .intro {
    margin-bottom: 24px;
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
  .intro h1 {
    font-size: 30px;
    letter-spacing: -0.03em;
  }
  .intro .mobile-break {
    display: block;
  }
  .workbench {
    display: block;
  }
  .input-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 14px;
    row-gap: 0;
    padding: 16px;
    margin-bottom: 22px;
    position: static;
  }
  .panel-heading, .input-help, .status-message {
    grid-column: 1 / -1;
  }
  .input-help {
    margin: 8px 0 14px;
  }
  .drop-zone, .secondary {
    min-height: 150px;
    padding: 12px 10px;
  }
  .comparison-connector, .scope-note {
    display: none;
  }
  .receipt-header {
    padding-left: 28px;
    padding-right: 20px;
  }
  .receipt:before {
    left: 12px;
  }
  .receipt-summary,
  .stats-strip,
  .receipt-footer {
    margin-left: 28px;
    margin-right: 20px;
  }
  .stats-strip {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .stats-strip dd {
    font-size: 18px;
  }
  .report-tabs {
    padding-left: 28px;
    gap: 18px;
  }
  .tab-panel {
    padding: 20px 20px 10px 28px;
  }
  .file-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .empty-state {
    min-height: 480px;
    padding: 40px 20px;
  }
  .empty-state h2 {
    font-size: 20px;
  }
  .file-preview-columns {
    grid-template-columns: 1fr;
  }
  .file-preview-columns pre {
    max-height: 32vh;
  }
  dialog {
    padding: 22px 18px;
  }
  .receipt {
    min-height: 480px;
  }
}

@media (max-width: 380px) {
  .intro h1 {
    font-size: 26px;
  }
  .report-tabs {
    gap: 12px;
  }
  .export-actions {
    gap: 6px;
  }
}

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