:root {
  --bg: #111;
  --bg-surface: #191919;
  --text: #d4d4d4;
  --text-dim: #777;
  --accent: #e2e2e2;
  --blue: #5b93d3;
  --red: #c9564e;
  --amber: #c9a04e;
  --border: #282828;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */

.nav {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.nav-brand {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text-dim); }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* Main */

main {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Hero */

.hero {
  padding: 5rem 0 2rem;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.hero h1 em {
  font-style: italic;
  color: var(--red);
}
.hero-sub {
  margin-top: 1rem;
  color: var(--text-dim);
  font-size: 1.05rem;
}

/* Upload */

.upload-zone {
  border: 1px solid var(--border);
  padding: 2.5rem 2rem;
  margin: 2rem 0;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--text-dim);
}
.upload-text {
  font-size: 1rem;
  color: var(--text);
}
.upload-hint {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}
.upload-browse {
  color: var(--blue);
  cursor: pointer;
}
.upload-browse:hover {
  text-decoration: underline;
}
.upload-formats {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Progress */

.upload-progress {
  margin: 2rem 0;
}
.progress-bar {
  height: 3px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 0.8rem;
}
.progress-fill {
  height: 100%;
  background: var(--text-dim);
  width: 0%;
  transition: width 0.3s;
}
.progress-text {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* Error */

.upload-error {
  border-left: 3px solid var(--red);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  color: var(--red);
  font-size: 0.9rem;
}

/* Checks */

.checks {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
}
.checks h2 {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 2rem;
  font-weight: 400;
}

.check-list {
  display: block;
}
.check-item {
  margin-bottom: 1.8rem;
}
.check-item dt {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}
.check-item dd {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* Privacy note */

.privacy-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
}

/* Page header */

.page-header {
  padding: 4rem 0 2rem;
}
.page-header h1 {
  font-size: 1.8rem;
  font-weight: 400;
}
.page-header p {
  color: var(--text-dim);
  margin-top: 0.6rem;
}

/* Pricing */

.pricing-table {
  overflow-x: auto;
  margin: 0 -2rem;
  padding: 0 2rem;
}
.pricing-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.pricing-table th {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}
.pricing-highlight {
  color: var(--text) !important;
  font-weight: 600 !important;
}
.pricing-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.pricing-table td:first-child {
  color: var(--text);
}
.pricing-table tr:last-child td {
  border-bottom: none;
}

.pricing-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* About */

.about-methods {
  padding-bottom: 2rem;
}
.method {
  margin-bottom: 2.5rem;
}
.method h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.method p {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.about-privacy {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}
.about-privacy h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.about-privacy p {
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* Footer */

.footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.footer-privacy {
  font-size: 0.7rem;
  margin-top: 0.3rem;
  opacity: 0.6;
}

/* Report */

.report {
  padding-top: 1rem;
}
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.report-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-all;
}
.report-reset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.report-reset:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

/* Score */

.report-score-row {
  margin-bottom: 1.5rem;
}
.score-gauge {
  margin-bottom: 0.5rem;
}
.score-number {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}
.score-label {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-dim);
}
.score-good .score-number { color: #6a9f6a; }
.score-warn .score-number { color: var(--amber); }
.score-bad .score-number { color: var(--red); }

.score-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.meta-sep { margin: 0 0.4rem; }

/* Score breakdown */

.score-breakdown {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.breakdown-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.breakdown-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
}
.breakdown-value.score-good { color: #6a9f6a; }
.breakdown-value.score-warn { color: var(--amber); }
.breakdown-value.score-bad { color: var(--red); }
.breakdown-value.na { color: var(--text-dim); font-size: 0.9rem; font-weight: 400; }

/* Sheet tabs */

.sheet-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.sheet-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
}
.sheet-tab:hover { color: var(--text); }
.sheet-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.sheet-panel { display: none; }
.sheet-panel.active { display: block; }

/* Severity */

.severity-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  margin-left: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.severity-tag.red_flag { color: var(--red); border: 1px solid var(--red); }
.severity-tag.investigate { color: var(--amber); border: 1px solid var(--amber); }
.severity-tag.info { color: var(--text-dim); border: 1px solid var(--border); }
.severity-tag.close, .severity-tag.acceptable { color: #6a9f6a; border: 1px solid #6a9f6a; }
.severity-tag.marginal { color: var(--amber); border: 1px solid var(--amber); }
.severity-tag.nonconforming { color: var(--red); border: 1px solid var(--red); }

.severity-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.5rem;
  flex-shrink: 0;
  margin-top: 0.45rem;
}
.severity-dot.red_flag { background: var(--red); }
.severity-dot.investigate { background: var(--amber); }
.severity-dot.info { background: var(--text-dim); }

/* AI Narrative */

.narrative-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.narrative-summary {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.2rem;
}
.narrative-summary p {
  margin-bottom: 0.6rem;
}
.narrative-findings {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 1.2rem;
}
.narrative-findings p {
  margin-bottom: 0.5rem;
}
.narrative-steps {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.7;
}
.narrative-steps ul {
  list-style: none;
  padding: 0;
}
.narrative-steps li {
  padding: 0.2rem 0;
  padding-left: 1rem;
  position: relative;
}
.narrative-steps li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-dim);
}

/* Convergent signals */

.convergent-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.convergent-note {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}
.convergent-item {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--red);
  padding: 0.3rem 0;
}

/* Section labels */

.section-label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}

/* Charts */

.chart-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.chart-block {
  margin-bottom: 1.5rem;
}
.chart-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.chart-wrap {
  position: relative;
  height: 180px;
}

/* Findings */

.findings-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.finding-item {
  margin-bottom: 0.3rem;
}
.finding-header {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  padding: 0.4rem 0;
}
.finding-header:hover .finding-message {
  color: var(--text);
}
.finding-message {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  transition: color 0.1s;
}
.finding-detail {
  display: none;
  padding: 0.5rem 0 0.8rem 1.2rem;
}
.finding-item.open .finding-detail {
  display: block;
}

/* Detail tables */

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.detail-table th {
  text-align: left;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-table td {
  padding: 0.25rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.detail-table tr:last-child td { border-bottom: none; }
.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.detail-stats {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* Report actions */

.report-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  display: flex;
  gap: 0.6rem;
}
.export-pdf, .export-json {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 1rem;
  cursor: pointer;
}
.export-pdf:hover, .export-json:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

/* Popup */

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.popup {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}
.popup-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0.3rem;
}
.popup-close:hover { color: var(--text); }
.popup-body {
  padding: 1rem;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}
.popup-body pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
}

/* Responsive */

@media (max-width: 600px) {
  .hero { padding: 3rem 0 1.5rem; }
  .hero h1 { font-size: 1.8rem; }
  main { padding: 1.5rem; }
  .pricing-table { font-size: 0.82rem; }
}
