/* HEARTS Merit System Showcase */

:root {
  --bg: #0a0e14;
  --bg-elevated: #111820;
  --surface: #161f2c;
  --surface-hover: #1c2838;
  --border: #2a3a50;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #e63946;
  --accent-soft: rgba(230, 57, 70, 0.15);
  --blue: #4cc9f0;
  --blue-soft: rgba(76, 201, 240, 0.12);
  --green: #2dd4a8;
  --green-soft: rgba(45, 212, 168, 0.12);
  --gold: #f4c430;
  --gold-soft: rgba(244, 196, 48, 0.12);
  --purple: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: Georgia, 'Times New Roman', serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 0 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #c1121f);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.brand h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand p {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 2.85rem;
}

.nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem 0.35rem;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-icon { font-size: 1rem; width: 1.25rem; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 0.5rem;
}

.main {
  overflow-y: auto;
  max-height: 100vh;
}

.page { display: none; padding: 2rem 2.5rem 4rem; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 640px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--surface) 0%, #1a2540 50%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
  max-width: 600px;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 560px;
  margin-bottom: 1.5rem;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-stat strong {
  display: block;
  font-size: 1.5rem;
  color: var(--blue);
}

.hero-stat span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Cards & Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-card .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-card.accent .value { color: var(--accent); }
.stat-card.blue .value { color: var(--blue); }
.stat-card.green .value { color: var(--green); }
.stat-card.gold .value { color: var(--gold); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-basic { background: #2d3a4d; color: #9aa8bc; }
.badge-minor { background: #1a3d4d; color: #6ec8e8; }
.badge-major { background: #3d3020; color: #e9c46a; }
.badge-complex { background: #3d1a28; color: #f4a3b0; }
.badge-pending { background: #3d3520; color: var(--gold); }
.badge-accepted { background: #1a3d35; color: var(--green); }
.badge-progress { background: #1a2d4d; color: var(--blue); }
.badge-rework { background: #4d2020; color: #f87171; }

/* Workflow diagram */
.flow-diagram {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1rem 0;
  overflow-x: auto;
}

.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
  min-width: 100px;
}

.flow-step.highlight { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.flow-arrow { color: var(--text-muted); padding: 0 0.35rem; font-size: 1.1rem; }

/* Architecture blocks */
.arch-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  margin: 1.5rem 0;
}

.arch-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.arch-box h4 { font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--blue); }
.arch-box ul { list-style: none; font-size: 0.78rem; color: var(--text-muted); }
.arch-box li { padding: 0.15rem 0; }
.arch-arrow { color: var(--text-muted); font-size: 1.25rem; }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
  padding-left: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  transform: translateX(-4px);
}

.timeline-item h4 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.timeline-item .phase { font-size: 0.72rem; color: var(--accent); font-weight: 600; margin-bottom: 0.25rem; }
.timeline-item p { font-size: 0.85rem; color: var(--text-muted); }

/* Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.leaderboard-item:last-child { border-bottom: none; }

.rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.rank-1 { background: linear-gradient(135deg, #ffd700, #b8860b); color: #1a1a1a; }
.rank-2 { background: linear-gradient(135deg, #c0c0c0, #808080); color: #1a1a1a; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); color: #fff; }

.lb-info { flex: 1; }
.lb-name { font-weight: 600; font-size: 0.9rem; }
.lb-dept { font-size: 0.75rem; color: var(--text-muted); }
.lb-points { font-weight: 700; color: var(--blue); font-size: 1rem; }
.lb-etb { font-size: 0.75rem; color: var(--text-muted); }

/* UI Preview tabs */
.ui-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.ui-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.ui-tab:hover { border-color: var(--text-muted); color: var(--text); }
.ui-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.ui-panel { display: none; }
.ui-panel.active { display: block; }

/* Mock dashboard chrome */
.mock-app {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.mock-titlebar {
  background: var(--bg-elevated);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mock-dot { width: 10px; height: 10px; border-radius: 50%; }
.mock-dot.r { background: #ff5f57; }
.mock-dot.y { background: #febc2e; }
.mock-dot.g { background: #28c840; }

.mock-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 380px;
}

.mock-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
}

.mock-nav-item {
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-radius: 6px;
  margin-bottom: 0.15rem;
}

.mock-nav-item.active { background: var(--accent-soft); color: var(--accent); }

.mock-content { padding: 1.25rem; }

/* Docs browser */
.doc-list { list-style: none; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.doc-item:hover { background: var(--surface-hover); }
.doc-item.active { background: var(--blue-soft); }

.doc-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-elevated);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.doc-meta h4 { font-size: 0.9rem; font-weight: 600; }
.doc-meta p { font-size: 0.75rem; color: var(--text-muted); }

.doc-viewer {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-height: 400px;
}

.doc-viewer h3 { font-size: 1.15rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.doc-viewer h4 { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; color: var(--blue); }
.doc-viewer p, .doc-viewer li { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.doc-viewer ul, .doc-viewer ol { padding-left: 1.25rem; margin-bottom: 1rem; }
.doc-viewer code {
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--green);
}

.doc-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .arch-grid { grid-template-columns: 1fr; }
  .arch-arrow { display: none; }
}

/* Policy */
.policy-block {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1rem;
}

.policy-block h4 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.policy-block p { font-size: 0.85rem; color: var(--text-muted); }

.formula-box {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85rem;
  color: var(--green);
  margin: 1rem 0;
  overflow-x: auto;
}

.compare-table td:first-child { font-weight: 500; }
.compare-winner { color: var(--green); font-weight: 600; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Progress bars */
.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

/* Claim flow */
.claim-steps {
  display: flex;
  gap: 0;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.claim-step {
  flex: 1;
  min-width: 120px;
  text-align: center;
  position: relative;
}

.claim-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.claim-step.done .claim-step-circle { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.claim-step.active .claim-step-circle { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.claim-step-label { font-size: 0.72rem; color: var(--text-muted); }

/* Mobile nav toggle */
.mobile-toggle {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  background: var(--accent);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; z-index: 99; width: 260px; height: 100vh; }
}

/* ===== Diagrams ===== */
.diagram-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.diagram-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.diagram-card .diagram-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.diagram-svg {
  width: 100%;
  min-width: 600px;
  height: auto;
  display: block;
}

.diagram-svg text {
  font-family: var(--font);
}

/* Gantt roadmap */
.gantt {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0;
  font-size: 0.78rem;
  min-width: 700px;
}

.gantt-header {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.gantt-weeks {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 2px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.gantt-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.gantt-label {
  font-weight: 600;
  padding-right: 0.75rem;
  font-size: 0.8rem;
}

.gantt-label small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.gantt-track {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 2px;
  height: 28px;
  position: relative;
}

.gantt-bar {
  border-radius: 4px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  grid-row: 1;
}

.gantt-bar.p1 { background: linear-gradient(90deg, #e63946, #c1121f); }
.gantt-bar.p2 { background: linear-gradient(90deg, #457b9d, #1d3557); }
.gantt-bar.p3 { background: linear-gradient(90deg, #2a9d8f, #1a6b5f); }
.gantt-bar.p4 { background: linear-gradient(90deg, #e9c46a, #b8860b); color: #1a1a1a; }
.gantt-bar.p5 { background: linear-gradient(90deg, #a78bfa, #6d28d9); }

.gantt-milestone {
  grid-column: span 1;
  text-align: center;
  font-size: 0.55rem;
  color: var(--gold);
  padding-top: 0.25rem;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.erd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.erd-legend span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.erd-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.erd-legend .dot.core { background: var(--accent); }
.erd-legend .dot.task { background: var(--blue); }
.erd-legend .dot.reward { background: var(--green); }
.erd-legend .dot.audit { background: var(--gold); }

.diagram-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.diagram-tab {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

.diagram-tab.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

.diagram-panel { display: none; }
.diagram-panel.active { display: block; }

