/* ===== VARIABLES ===== */
:root {
  --bg: #0C1A2E;
  --bg-2: #112240;
  --bg-3: #1a3352;
  --fg: #E8EFF7;
  --fg-muted: #8BA4BF;
  --accent: #F5A623;
  --accent-dim: rgba(245, 166, 35, 0.12);
  --green: #22C55E;
  --red: #EF4444;
  --border: rgba(245, 166, 35, 0.18);
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* ===== NAV ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(12, 26, 46, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg); font-weight: 600; font-size: 18px;
  letter-spacing: -0.02em;
}
.nav-logo:hover { opacity: 1; }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--fg-muted); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--fg); opacity: 1; }

/* ===== SECTION LABELS ===== */
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}

/* ===== HERO ===== */
.hero {
  padding: 140px 24px 80px;
  max-width: 1100px; margin: 0 auto;
}
.hero-content {
  display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center;
}
.hero-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
}
.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.12;
  color: var(--fg);
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}
.hero-lede {
  font-size: 18px; color: var(--fg-muted); line-height: 1.65;
  margin-bottom: 32px;
  max-width: 480px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-tag {
  font-size: 12px; font-weight: 500; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--fg-muted);
}
.hero-graphic { display: flex; align-items: center; justify-content: center; }
.gate-visual {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.gate-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-muted);
}
.gate-arrows { margin-top: 8px; }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 80px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--border);
}
.hero-stats .stat {
  background: var(--bg-2);
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 40px;
  color: var(--accent);
  line-height: 1;
}
.stat-label { font-size: 13px; color: var(--fg-muted); line-height: 1.5; }

/* ===== PROBLEM ===== */
.problem { padding: 100px 24px; }
.problem-inner { max-width: 1100px; margin: 0 auto; }
.problem-header { max-width: 700px; margin-bottom: 60px; }
.problem-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.problem-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 24px; margin-bottom: 60px;
}
.problem-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.problem-icon { margin-bottom: 20px; }
.problem-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.problem-card p { font-size: 14px; color: var(--fg-muted); line-height: 1.65; }
.problem-quote {
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  padding: 24px 28px;
  border-radius: 0 12px 12px 0;
}
.problem-quote blockquote {
  font-family: var(--font-display);
  font-size: 18px; font-style: italic;
  line-height: 1.5;
  margin-bottom: 12px;
}
.problem-quote cite { font-size: 12px; color: var(--fg-muted); }

/* ===== HOW ===== */
.how { padding: 100px 24px; background: var(--bg-2); }
.how-inner { max-width: 1100px; margin: 0 auto; }
.how-header { max-width: 700px; margin-bottom: 64px; }
.how-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.how-flow {
  display: grid; grid-template-columns: 1fr 40px 1fr 40px 1fr;
  align-items: start;
  gap: 0;
  margin-bottom: 64px;
}
.flow-step {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}
.flow-num {
  font-family: var(--font-display);
  font-size: 13px; color: var(--accent);
  margin-bottom: 16px;
}
.flow-content h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.flow-content p { font-size: 14px; color: var(--fg-muted); line-height: 1.65; }
.flow-arrow { display: flex; align-items: center; justify-content: center; padding-top: 60px; }
.how-verdict {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.verdict-check, .verdict-warn, .verdict-block {
  display: flex; align-items: center; gap: 12px;
}
.verdict-check span { font-size: 13px; color: var(--green); font-weight: 500; }
.verdict-warn span { font-size: 13px; color: var(--accent); font-weight: 500; }
.verdict-block span { font-size: 13px; color: var(--red); font-weight: 500; }

/* ===== STAKEHOLDERS ===== */
.stakeholders { padding: 100px 24px; }
.stakeholders-inner { max-width: 1100px; margin: 0 auto; }
.stakeholders-header { max-width: 700px; margin-bottom: 60px; }
.stakeholders-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.stakeholders-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.stakeholder-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.stakeholder-icon { margin-bottom: 24px; }
.stakeholder-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 12px;
}
.stakeholder-desc { font-size: 14px; color: var(--fg-muted); line-height: 1.65; margin-bottom: 20px; }
.stakeholder-features { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.stakeholder-features li {
  font-size: 13px; color: var(--fg);
  padding-left: 20px; position: relative;
}
.stakeholder-features li::before {
  content: '';
  position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* ===== WEDGE ===== */
.wedge { padding: 100px 24px; background: var(--bg-2); }
.wedge-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 80px; align-items: start;
}
.wedge-left .section-label { margin-bottom: 16px; }
.wedge-left h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}
.wedge-body { font-size: 15px; color: var(--fg-muted); line-height: 1.7; margin-bottom: 20px; }
.wedge-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.wedge-tag {
  font-size: 12px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--fg-muted);
}
.audit-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.audit-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600;
  color: var(--fg-muted);
}
.audit-entry {
  display: grid; grid-template-columns: 60px 1fr auto;
  align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.audit-entry:last-child { border-bottom: none; }
.entry-time { color: var(--fg-muted); font-family: monospace; }
.entry-msg { color: var(--fg); }
.entry-action {
  font-weight: 600; font-size: 11px;
  padding: 3px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.audit-entry.warn .entry-msg { color: var(--accent); }
.audit-entry.warn .entry-action { background: rgba(245,166,35,0.15); color: var(--accent); }
.audit-entry.ok .entry-action { background: rgba(34,197,94,0.12); color: var(--green); }
.audit-entry.block .entry-msg { color: var(--red); }
.audit-entry.block .entry-action { background: rgba(239,68,68,0.12); color: var(--red); }

/* ===== VISION ===== */
.vision { padding: 100px 24px; }
.vision-inner { max-width: 800px; margin: 0 auto; text-align: center; }
.vision-inner .section-label { margin-bottom: 16px; }
.vision-inner h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 28px;
}
.vision-body { font-size: 16px; color: var(--fg-muted); line-height: 1.7; margin-bottom: 20px; }
.vision-pillars {
  display: flex; justify-content: center; gap: 32px;
  margin-top: 48px; flex-wrap: wrap;
}
.pillar {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--fg-muted);
}

/* ===== FOOTER ===== */
.footer { padding: 60px 24px 40px; border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto;
  gap: 80px;
}
.footer-brand {}
.footer-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 17px;
  margin-bottom: 12px;
  color: var(--fg);
}
.footer-brand p { font-size: 14px; color: var(--fg-muted); max-width: 280px; }
.footer-links { display: flex; gap: 60px; }
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col-head { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 4px; }
.footer-col a { font-size: 14px; color: var(--fg); }
.footer-col a:hover { color: var(--accent); opacity: 1; }
.footer-bottom { grid-column: 1 / -1; padding-top: 40px; border-top: 1px solid var(--border); margin-top: 20px; }
.footer-bottom p { font-size: 12px; color: var(--fg-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; gap: 48px; }
  .hero-graphic { display: none; }
  .hero-stats { grid-template-columns: 1fr; }
  .problem-grid { grid-template-columns: 1fr; }
  .how-flow { grid-template-columns: 1fr; }
  .flow-arrow { display: none; }
  .how-verdict { grid-template-columns: 1fr; }
  .stakeholders-grid { grid-template-columns: 1fr; }
  .wedge-inner { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 40px; }
  .footer-links { gap: 32px; }
  .nav-links { display: none; }
}
/* ===== APP PAGE WRAPPER ===== */
.app-page {
  padding: 100px 24px 60px;
  max-width: 1100px;
  margin: 0 auto;
}
.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 20px;
}
.app-header h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.app-header p { font-size: 15px; color: var(--fg-muted); }

/* ===== GATE LAYOUT ===== */
.gate-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: start;
}
.gate-left {}
.gate-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== TEXTAREA ===== */
.draft-area {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}
.draft-area label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.draft-area textarea {
  width: 100%;
  min-height: 240px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}
.draft-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.draft-area textarea::placeholder { color: var(--fg-muted); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
}
.gate-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

/* ===== RESULTS ===== */
.results-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.results-header h2 {
  font-size: 15px;
  font-weight: 600;
}
.score-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
}
.score-badge.low { background: rgba(239,68,68,0.15); color: var(--red); }
.score-badge.medium { background: rgba(245,166,35,0.15); color: var(--accent); }
.score-badge.high { background: rgba(34,197,94,0.12); color: var(--green); }

.risk-list { display: flex; flex-direction: column; gap: 12px; }
.risk-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  border-left-width: 3px;
}
.risk-item.critical { border-left-color: var(--red); }
.risk-item.warning { border-left-color: var(--accent); }
.risk-item.info { border-left-color: var(--fg-muted); }
.risk-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.risk-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}
.risk-tag.critical { background: rgba(239,68,68,0.2); color: var(--red); }
.risk-tag.warning { background: rgba(245,166,35,0.2); color: var(--accent); }
.risk-tag.info { background: rgba(139,164,191,0.2); color: var(--fg-muted); }
.risk-rule { font-size: 11px; color: var(--fg-muted); }
.risk-item p {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.55;
}
.risk-item code {
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
}
.risk-item blockquote {
  font-size: 13px;
  color: var(--fg-muted);
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-top: 6px;
  font-style: italic;
}
.no-risks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}
.no-risks span { font-size: 28px; }
.no-risks p { font-size: 14px; color: var(--fg-muted); }

/* ===== REWRITE PANEL ===== */
.rewrite-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.rewrite-panel h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--green);
}
.rewrite-panel textarea {
  width: 100%;
  min-height: 180px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

/* ===== SIDEBAR ===== */
.sidebar-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.sidebar-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--fg-muted);
}
.rule-list { display: flex; flex-direction: column; gap: 10px; }
.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.rule-item span { color: var(--accent); font-weight: 600; }

/* ===== TRUTH DOC ===== */
.truth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rules-section { margin-top: 24px; }
.rules-section h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}
.rule-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}
.rule-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.rule-entry-header span {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
}
.btn-remove {
  background: none;
  border: none;
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
}
.btn-remove:hover { opacity: 0.7; }
.rules-list { display: flex; flex-direction: column; gap: 8px; }
.empty-rules {
  padding: 24px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* ===== LOADING ===== */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-muted);
  font-size: 14px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; gap: 48px; }
  .hero-graphic { display: none; }
  .hero-stats { grid-template-columns: 1fr; }
  .problem-grid { grid-template-columns: 1fr; }
  .how-flow { grid-template-columns: 1fr; }
  .flow-arrow { display: none; }
  .how-verdict { grid-template-columns: 1fr; }
  .stakeholders-grid { grid-template-columns: 1fr; }
  .wedge-inner { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 40px; }
  .footer-links { gap: 32px; }
  .nav-links { display: none; }
  .gate-layout { grid-template-columns: 1fr; }
  .app-header { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero { padding: 120px 20px 60px; }
  .vision-pillars { gap: 20px; }
}