/* ============================================
   ECP Banco Digital — Documentation Site
   Design System: Dark Theme + Lime Accent
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg: #0b0f14;
  --surface: #131c28;
  --surface-2: #0f1620;
  --lime: #b7ff2a;
  --lime-dim: rgba(183, 255, 42, 0.12);
  --text: #eaf2ff;
  --text-2: #a9b7cc;
  --muted: #7b8aa3;
  --border: #1c2836;
  --success: #3dff8b;
  --danger: #ff4d4d;
  --info: #4da3ff;
  --warning: #ffcc00;
  --radius: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-w: 280px;
  --topbar-h: 60px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content";
}

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

a:hover {
  opacity: 0.85;
  text-decoration: underline;
}

img {
  max-width: 100%;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--lime);
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 12px 0;
}

pre code {
  background: none;
  padding: 0;
}

/* --- Sidebar --- */
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-logo .logo-icon {
  font-size: 1.5rem;
  color: var(--lime);
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-nav li a:hover {
  background: var(--lime-dim);
  color: var(--text);
  text-decoration: none;
  opacity: 1;
}

.sidebar-nav li a.active {
  background: var(--lime-dim);
  color: var(--lime);
  font-weight: 600;
}

.sidebar-nav li a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 16px 12px 6px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.sidebar-footer a:hover {
  background: var(--lime-dim);
  color: var(--text);
  text-decoration: none;
  opacity: 1;
}

/* --- Topbar --- */
.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  z-index: 90;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-meta .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.topbar-meta .status-dot.green { background: var(--success); }
.topbar-meta .status-dot.yellow { background: var(--warning); }
.topbar-meta .status-dot.red { background: var(--danger); }

/* --- Main Content --- */
.content {
  grid-area: content;
  padding: 32px;
  margin-top: var(--topbar-h);
  max-width: 1100px;
  width: 100%;
}

.content > h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.content > .subtitle {
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 32px;
}

.content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 12px;
}

.content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-2);
  margin: 16px 0 8px;
}

.content p {
  color: var(--text-2);
  margin-bottom: 12px;
  line-height: 1.7;
}

.content ul, .content ol {
  color: var(--text-2);
  padding-left: 24px;
  margin-bottom: 12px;
}

.content li {
  margin-bottom: 6px;
  line-height: 1.6;
}

/* --- Section --- */
.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-icon {
  font-size: 1.4rem;
}

/* --- Artifact Card --- */
.artifact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.artifact-card:hover {
  border-color: rgba(183, 255, 42, 0.25);
}

.artifact-card.highlighted {
  border-left: 3px solid var(--lime);
}

.artifact-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.artifact-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.artifact-body {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.7;
}

.artifact-body strong {
  color: var(--text);
  font-weight: 600;
}

.artifact-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.artifact-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.approved {
  background: rgba(61, 255, 139, 0.12);
  color: var(--success);
}

.badge.pending {
  background: rgba(255, 204, 0, 0.12);
  color: var(--warning);
}

.badge.rejected {
  background: rgba(255, 77, 77, 0.12);
  color: var(--danger);
}

.badge.info {
  background: rgba(77, 163, 255, 0.12);
  color: var(--info);
}

.badge.lime {
  background: var(--lime-dim);
  color: var(--lime);
}

.badge.neutral {
  background: rgba(123, 138, 163, 0.12);
  color: var(--muted);
}

/* --- KR Cards --- */
.kr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.kr-card .kr-id {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lime);
  font-weight: 700;
  margin-bottom: 6px;
}

.kr-card .kr-description {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}

.kr-card .kr-meta {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 12px;
}

.kr-card .kr-metric {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 12px;
  font-style: italic;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--lime);
  transition: width 0.6s ease;
}

.progress-bar .progress-fill.low { background: var(--danger); }
.progress-bar .progress-fill.mid { background: var(--warning); }
.progress-bar .progress-fill.high { background: var(--lime); }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

/* --- ADR Styling --- */
.adr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.adr-card .adr-id {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--info);
  font-weight: 700;
  margin-bottom: 4px;
}

.adr-card .adr-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.adr-card .adr-status {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 8px;
}

.adr-card .adr-body {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* --- Epic / Feature / Story Hierarchy --- */
.epic-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--lime);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.epic-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.epic-id {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lime);
  font-weight: 700;
  white-space: nowrap;
}

.epic-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.epic-description {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 16px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.feature-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.feature-id {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--info);
  font-weight: 700;
}

.feature-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}

.feature-description {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.story-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 2px solid rgba(123, 138, 163, 0.2);
}

.story-item {
  padding: 8px 12px;
  background: rgba(11, 15, 20, 0.4);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-2);
}

.story-id {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warning);
  font-weight: 700;
}

/* --- Risk Grid --- */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.risk-card .risk-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 6px;
}

.risk-card .risk-verdict {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.risk-card .risk-confidence {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.risk-card .risk-body {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 32px;
  margin: 24px 0;
}

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

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lime);
  border: 2px solid var(--surface);
}

.timeline-item.pending::before {
  background: var(--muted);
}

.timeline-item .timeline-phase {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lime);
  font-weight: 700;
}

.timeline-item .timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 2px 0;
}

.timeline-item .timeline-desc {
  font-size: 0.82rem;
  color: var(--text-2);
}

/* --- Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}

.data-table tr:hover td {
  background: rgba(183, 255, 42, 0.03);
}

.data-table td:first-child {
  color: var(--text);
  font-weight: 500;
}

/* --- Grid layouts --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* --- Quick Links --- */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.quick-link:hover {
  border-color: var(--lime);
  background: var(--lime-dim);
  text-decoration: none;
  opacity: 1;
}

.quick-link .ql-icon {
  font-size: 1.3rem;
}

/* --- File reference pills --- */
.file-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  margin: 2px;
}

/* --- Stat cards --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--lime);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Mermaid dark theme overrides --- */
.mermaid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  text-align: center;
}

/* --- Business rules list --- */
.rules-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.rule-item {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.85rem;
}

.rule-item .rule-id {
  color: var(--warning);
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
}

.rule-item .rule-text {
  color: var(--text-2);
}

/* --- Endpoints list --- */
.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
}

.endpoint .method {
  display: inline-block;
  width: 60px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.method.get { background: rgba(77, 163, 255, 0.15); color: var(--info); }
.method.post { background: rgba(61, 255, 139, 0.15); color: var(--success); }
.method.put { background: rgba(255, 204, 0, 0.15); color: var(--warning); }
.method.patch { background: rgba(255, 204, 0, 0.15); color: var(--warning); }
.method.delete { background: rgba(255, 77, 77, 0.15); color: var(--danger); }

.endpoint .path {
  color: var(--text-2);
}

/* --- SLO Table --- */
.slo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

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

.slo-card .slo-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.slo-card .slo-target {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--lime);
  margin-bottom: 4px;
}

.slo-card .slo-desc {
  font-size: 0.78rem;
  color: var(--muted);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "content";
  }

  .sidebar {
    display: none;
  }

  .topbar {
    left: 0;
  }

  .content {
    margin-left: 0;
    padding: 24px 16px;
  }

  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kr-grid,
  .risk-grid,
  .quick-links,
  .stat-grid,
  .rules-list,
  .slo-grid {
    grid-template-columns: 1fr;
  }

  .content > h1 {
    font-size: 1.4rem;
  }

  .content h2 {
    font-size: 1.15rem;
  }

  .data-table {
    font-size: 0.78rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 16px 12px;
  }

  .artifact-card {
    padding: 16px;
  }
}
