/* === BASE === */
:root {
  --bg: #161b27;
  --bg-secondary: #1e2535;
  --bg-card: #232b3d;
  --fg: #f0f2f7;
  --fg-muted: #8a95a8;
  --accent: #f0a500;
  --accent-dim: #b87a00;
  --healthy: #3ecf8e;
  --warning: #f59e0b;
  --alert: #ef4444;
  --border: rgba(240, 242, 247, 0.08);
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* === TYPOGRAPHY === */
.mono, .hero-eyebrow span, .stat-number, .stat-label, .pipe-label, .pipe-status,
.hero-badge, .badge-mono, .step-number, .step-badge, .box-mono, .closing-mono,
.footer-mono, .nav-brand .brand-mono, .section-label, .box-meta, .compliance-box .status-dot {
  font-family: 'IBM Plex Mono', monospace;
}

/* === NAV === */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-brand .brand-mono {
  background: var(--accent);
  color: #0a0d14;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 8px;
  letter-spacing: 0.05em;
}

.nav-brand .brand-name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.nav-tagline {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* === SECTION LABELS === */
.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  display: block;
  margin-bottom: 12px;
}

.section-header {
  margin-bottom: 48px;
}

.section-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  max-width: 520px;
}

/* === HERO === */
.hero {
  padding: 72px 48px 64px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.hero-eyebrow {
  margin-bottom: 20px;
}

.hero-eyebrow span {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
}

.hero-headline {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero-sub {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.7;
  max-width: 440px;
  margin-bottom: 40px;
}

.hero-stats {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.5;
  max-width: 120px;
}

.stat-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
  align-self: center;
}

/* === PIPELINE VISUAL === */
.hero-right {
  position: relative;
}

.pipeline-visual {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pipe-segment {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipe-label {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
}

.pipe-bar {
  height: 10px;
  border-radius: 2px;
  position: relative;
}

.pipe-bar.healthy { background: var(--healthy); width: 100%; }
.pipe-bar.warning { background: var(--warning); width: 62%; }
.pipe-bar.alert { background: var(--alert); width: 31%; }

.pipe-status {
  font-size: 12px;
  font-weight: 500;
}

.pipe-healthy .pipe-status { color: var(--healthy); }
.pipe-warning .pipe-status { color: var(--warning); }
.pipe-alert .pipe-status { color: var(--alert); }

.hero-badge {
  margin-top: 20px;
  text-align: center;
}

.badge-mono {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
}

/* === PROBLEMS === */
.problems {
  padding: 80px 48px;
  border-top: 1px solid var(--border);
}

.problems-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.problem-card {
  background: var(--bg-secondary);
  padding: 32px;
  border: 1px solid var(--border);
}

.problem-icon {
  color: var(--accent);
  margin-bottom: 16px;
}

.problem-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

.problem-card p {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* === HOW IT WORKS === */
.howitworks {
  padding: 80px 48px;
  border-top: 1px solid var(--border);
}

.workflow-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step {
  display: grid;
  grid-template-columns: 80px 1fr 140px;
  gap: 32px;
  align-items: center;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.step:last-child { border-bottom: 1px solid var(--border); }

.step-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.4;
  letter-spacing: -0.04em;
}

.step-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.step-content p {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.7;
  max-width: 520px;
}

.step-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 5px 10px;
  text-align: center;
  white-space: nowrap;
}

.step-connector {
  display: none;
}

/* === COMPLIANCE === */
.compliance {
  padding: 80px 48px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.compliance-inner {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 64px;
  align-items: center;
}

.compliance-left h2 {
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.25;
}

.compliance-desc {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 32px;
  line-height: 1.7;
}

.compliance-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compliance-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.compliance-item .check {
  color: var(--healthy);
  font-size: 16px;
  width: 20px;
  flex-shrink: 0;
}

.compliance-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 32px;
  text-align: center;
}

.box-mono {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.box-score {
  font-size: 52px;
  font-weight: 700;
  color: var(--healthy);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.score-unit {
  font-size: 28px;
}

.box-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.box-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  justify-content: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--healthy);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === CLOSING === */
.closing {
  padding: 100px 48px;
  border-top: 1px solid var(--border);
}

.closing-inner {
  max-width: 680px;
}

.closing-tagline {
  display: flex;
  flex-direction: column;
  margin-bottom: 28px;
}

.tagline-line {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--fg);
}

.tagline-line:nth-child(2) {
  color: var(--fg-muted);
}

.closing-sub {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.75;
  margin-bottom: 40px;
  max-width: 560px;
}

.closing-statement {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
}

.closing-mono {
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* === FOOTER === */
.footer {
  padding: 32px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.footer-mono {
  background: var(--accent);
  color: #0a0d14;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 7px;
  letter-spacing: 0.05em;
}

.footer-tagline {
  font-size: 13px;
  color: var(--fg-muted);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .nav { padding: 16px 24px; }
  .hero { padding: 48px 24px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .problems { padding: 60px 24px; }
  .problems-grid { grid-template-columns: 1fr; }
  .howitworks { padding: 60px 24px; }
  .step { grid-template-columns: 60px 1fr; }
  .step-badge { display: none; }
  .compliance { padding: 60px 24px; }
  .compliance-inner { grid-template-columns: 1fr; }
  .closing { padding: 60px 24px; }
  .footer { flex-direction: column; gap: 12px; align-items: flex-start; padding: 24px; }
  .hero-stats { flex-wrap: wrap; gap: 20px; }
}

/* === DASHBOARD === */
.dashboard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 56px;
  border-bottom: 1px solid var(--border);
}

.dashboard-nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.dashboard-nav-left a {
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.dashboard-nav-left a:hover { color: var(--fg); }

.dashboard-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #0a0d14;
}

.btn-primary:hover { background: #ffb81a; }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }

.btn-danger {
  background: transparent;
  color: var(--alert);
  border: 1px solid var(--alert);
}

.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.stat-block {
  padding: 16px 32px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.stat-block:first-child { border-left: 1px solid var(--border); }

.stat-block .stat-val {
  font-size: 28px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-block .stat-lbl {
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'IBM Plex Mono', monospace;
}

/* Main layout */
.dashboard-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 57px - 77px);
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sidebar-title {
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

/* Segment cards */
.segment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.segment-card:hover { border-color: var(--fg-muted); }
.segment-card.selected { border-color: var(--accent); background: rgba(240,165,0,0.05); }

.segment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.seg-name {
  font-size: 13px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--fg);
}

.seg-health-badge {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border: 1px solid;
  border-radius: 3px;
}

.segment-bar-wrap {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.segment-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.segment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-muted);
}

.segment-meta .mono { font-family: 'IBM Plex Mono', monospace; font-size: 11px; }

/* Main content area */
.main-content {
  overflow-y: auto;
  padding: 24px 32px;
}

/* Upload area */
.upload-section {
  padding: 32px 48px;
  border-bottom: 1px solid var(--border);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.upload-box {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-secondary);
}

.upload-box:hover, .upload-box.drag-over {
  border-color: var(--accent);
  background: rgba(240,165,0,0.04);
}

.upload-box-icon {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--accent);
}

.upload-box h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.upload-box p {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.upload-box small {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: 'IBM Plex Mono', monospace;
}

/* JSON input area */
.json-upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.json-upload-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.json-upload-section textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 12px;
  resize: vertical;
  min-height: 140px;
  margin-bottom: 12px;
}

.json-upload-section textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Anomaly panel */
.anomaly-panel {
  display: none;
  padding: 24px 32px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.anomaly-panel.open { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
}

.panel-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
}

.panel-close:hover { color: var(--fg); }

/* Anomaly list */
.anomaly-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 3px solid transparent;
}

.anomaly-row.severity-critical { border-left-color: #ef4444; }
.anomaly-row.severity-high { border-left-color: #f59e0b; }
.anomaly-row.severity-medium { border-left-color: #f0a500; }
.anomaly-row.severity-low { border-left-color: #3ecf8e; }

.anomaly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.anomaly-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

.severity-badge {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  color: #fff;
}

.anomaly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.anomaly-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-label {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.field-value {
  font-size: 13px;
  font-weight: 500;
}

.growth-high { color: #ef4444; }
.growth-moderate { color: #f59e0b; }
.growth-low { color: #3ecf8e; }

.anomaly-pressure {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-muted);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  text-align: center;
  padding: 48px;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.3;
}

.empty-state h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state p {
  font-size: 14px;
  color: var(--fg-muted);
  max-width: 360px;
  line-height: 1.65;
}

/* JSON modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
}

.modal-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Dashboard layout when panel is open */
.dashboard-layout {
  display: grid;
  grid-template-columns: 300px 1fr 360px;
  height: calc(100vh - 57px - 77px);
  overflow: hidden;
}

.dashboard-layout .main-content { border-right: 1px solid var(--border); }

/* Mobile */
@media (max-width: 900px) {
  .dashboard-nav { padding: 0 24px; }
  .upload-section { padding: 24px; }
  .upload-grid { grid-template-columns: 1fr; }
  .dashboard-body { grid-template-columns: 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .anomaly-panel { border-left: none; border-top: 1px solid var(--border); }
  .stats-bar { padding: 0; }
  .stat-block { padding: 12px 16px; }
  .stat-block .stat-val { font-size: 22px; }
  .anomaly-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .dashboard-nav { padding: 0 16px; }
  .dashboard-nav-right { gap: 8px; }
  .btn { padding: 6px 12px; font-size: 12px; }
  .anomaly-grid { grid-template-columns: 1fr; }
}