/* ── EconFaithAI · shared platform styles ───────────────────────────────── */

:root {
  --bg: #faf9f6;
  --paper: #ffffff;
  --ink: #1a1a1a;
  --muted: #595959;
  --soft: #7a7a7a;
  --line: #e5e3dd;
  --line-soft: #f0eee9;
  --accent: #1e3a5f;
  --accent-light: #eaf0f6;

  --serif: "Charter", "Iowan Old Style", "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;

  /* Domain colors */
  --col-relationships: #3d7a6b;
  --col-children:      #5a8a3c;
  --col-morality:      #7a5a9a;
  --col-workforce:     #8a6a2a;
  --col-civic:         #3a5a8a;

  /* Stakeholder colors */
  --col-policy:    #1e3a5f;
  --col-innovators:#2e6b3f;
  --col-investors: #7a4a1a;
  --col-parents:   #4a2a6b;
  --col-church:    #a14a3c;

  /* Severity */
  --sev-critical: #c0392b;
  --sev-high:     #d35400;
  --sev-medium:   #b8860b;
  --sev-emerging: #2e6b3f;

  /* Score colors */
  --score-9:  #2e6b3f;   /* 9-10 green */
  --score-7:  #6a9a4a;   /* 7-8 lime */
  --score-5:  #c8a84a;   /* 5-6 amber */
  --score-3:  #c87a3a;   /* 3-4 orange */
  --score-1:  #b04040;   /* 1-2 red */

  /* Status badges */
  --status-active:  #1e3a5f;
  --status-nascent: #b8860b;
  --status-stalled: #7a7a7a;
  --status-unknown: #a14a7c;
  --status-solved:  #2e6b3f;

  /* Roadmap status */
  --rm-draft:    #7a7a7a;
  --rm-active:   #1e3a5f;
  --rm-paused:   #b8860b;
  --rm-complete: #2e6b3f;
  --rm-killed:   #b04040;

  --topbar-h: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: var(--topbar-h);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left { display: flex; align-items: baseline; gap: 14px; }
.topbar-brand {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.topbar-brand:hover { text-decoration: none; color: var(--accent); }
.topbar-sep { color: var(--line); font-size: 14px; }
.topbar-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}
.topbar-nav {
  display: flex;
  gap: 22px;
  align-items: center;
}
.topbar-nav a {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.topbar-nav a:hover { color: var(--ink); text-decoration: none; }
.topbar-nav a.active {
  color: var(--accent);
  font-weight: 700;
}

/* ── Page shell ─────────────────────────────────────────────────────────── */
.page {
  flex: 1;
  padding: 0;
}
.page-header {
  padding: 22px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.page-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.page-subtitle {
  font-size: 12px;
  color: var(--soft);
  margin-top: 4px;
  font-style: italic;
}
.page-body {
  padding: 24px 32px;
}

/* ── Common: severity dots + scope ──────────────────────────────────────── */
.sev-dots { display: inline-flex; gap: 3px; align-items: center; }
.sev-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}
.sev-dots .dot.on { background: var(--sev-high); }
.sev-dots.crit  .dot.on { background: var(--sev-critical); }
.sev-dots.high  .dot.on { background: var(--sev-high); }
.sev-dots.med   .dot.on { background: var(--sev-medium); }
.sev-dots.emerg .dot.on { background: var(--sev-emerging); }

.sev-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-left: 5px;
}
.sev-label.crit  { color: var(--sev-critical); }
.sev-label.high  { color: var(--sev-high); }
.sev-label.med   { color: var(--sev-medium); }
.sev-label.emerg { color: var(--sev-emerging); }

.scope-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft);
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: white;
  white-space: nowrap;
}
.status-badge.active  { background: var(--status-active); }
.status-badge.nascent { background: var(--status-nascent); }
.status-badge.stalled { background: var(--status-stalled); }
.status-badge.unknown { background: var(--status-unknown); }
.status-badge.solved  { background: var(--status-solved); }

.status-badge-outline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid;
}
.status-badge-outline.active  { color: var(--status-active);  border-color: var(--status-active); }
.status-badge-outline.nascent { color: var(--status-nascent); border-color: var(--status-nascent); }
.status-badge-outline.stalled { color: var(--status-stalled); border-color: var(--status-stalled); }
.status-badge-outline.unknown { color: var(--status-unknown); border-color: var(--status-unknown); }

/* ── Roadmap badges ─────────────────────────────────────────────────────── */
.rm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: white;
}
.rm-badge.draft    { background: var(--rm-draft); }
.rm-badge.active   { background: var(--rm-active); }
.rm-badge.paused   { background: var(--rm-paused); }
.rm-badge.complete { background: var(--rm-complete); }
.rm-badge.killed   { background: var(--rm-killed); }

/* ── Stakeholder pill ───────────────────────────────────────────────────── */
.sh-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.sh-dot.policy    { background: var(--col-policy); }
.sh-dot.innovators{ background: var(--col-innovators); }
.sh-dot.investors { background: var(--col-investors); }
.sh-dot.parents   { background: var(--col-parents); }
.sh-dot.church    { background: var(--col-church); }

.sh-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ── Score cells (audit table) ──────────────────────────────────────────── */
.score-cell {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  border-radius: 3px;
  color: white;
}
.score-cell.s1, .score-cell.s2 { background: var(--score-1); }
.score-cell.s3, .score-cell.s4 { background: var(--score-3); }
.score-cell.s5, .score-cell.s6 { background: var(--score-5); }
.score-cell.s7, .score-cell.s8 { background: var(--score-7); color: white; }
.score-cell.s9, .score-cell.s10 { background: var(--score-9); }
.score-cell.total { min-width: 36px; font-size: 13px; }

/* ── Score bars (drawer / deep dive) ────────────────────────────────────── */
.score-bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 10px;
}
.score-bar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.score-bar-num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.score-bar-track {
  grid-column: 1 / 3;
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
}
.score-bar-note {
  grid-column: 1 / 3;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--bg); border-color: #c8c4bc; text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: #15294a; border-color: #15294a; color: white; }
.btn-ghost { border-color: transparent; color: var(--accent); padding: 6px 10px; }
.btn-ghost:hover { background: var(--accent-light); border-color: transparent; }

/* ── Section header ─────────────────────────────────────────────────────── */
.section-header {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.section-divider {
  width: 60px;
  height: 2px;
  background: var(--ink);
  margin-bottom: 16px;
}
.subsection {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.subsection::before {
  content: '▌';
  color: var(--accent);
  font-size: 12px;
}

.prose {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.prose + .subsection { margin-top: 22px; }
.prose p + p { margin-top: 12px; }
