:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-hover: #243044;
  --text: #e7ecf3;
  --text-muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-dim: #2563eb;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --border: #2d3a4f;
  --sidebar-w: 260px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.sidebar-brand h1 {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-brand small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sidebar nav a {
  display: block;
  padding: 0.45rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar nav a.active { border-left-color: var(--accent); }

.sidebar nav .nav-section {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  max-width: 1200px;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.breadcrumb a { color: var(--text-muted); }

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

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.page-header .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

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

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

.card-featured {
  border-color: var(--accent);
  background: linear-gradient(135deg, #1a2332 0%, #1e2d4a 100%);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.tile h3 { font-size: 0.95rem; margin-bottom: 0.35rem; }
.tile p { font-size: 0.8rem; color: var(--text-muted); }

.tile-primary { border-color: var(--accent-dim); }

.service-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.service-tile {
  background: linear-gradient(145deg, #152238 0%, #1a2d1f 100%);
  border: 2px solid rgba(34, 197, 94, 0.45);
  border-radius: 12px;
  padding: 1.35rem 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  min-height: 140px;
}

.service-tile:hover {
  border-color: var(--success);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.12);
  text-decoration: none;
}

.service-tile-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.service-tile h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.02em;
}

.service-title { font-size: 0.85rem; color: var(--text); margin: 0 0 0.35rem; }
.service-meta { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.service-count { font-size: 0.8rem; color: var(--success); margin: 0; font-weight: 500; }

.service-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  flex-shrink: 0;
}

.service-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.service-detail-head h2 {
  font-size: 1.15rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.85rem;
  margin: 1rem 0 0;
}

.service-facts dt { color: var(--text-muted); margin: 0; }
.service-facts dd { margin: 0; }

.domain-list {
  columns: 2;
  column-gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

.domain-list li {
  break-inside: avoid;
  margin-bottom: 0.35rem;
}

@media (max-width: 640px) {
  .domain-list { columns: 1; }
  .service-tile-grid { grid-template-columns: 1fr; }
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-done { background: rgba(34,197,94,0.2); color: var(--success); }
.badge-progress { background: rgba(234,179,8,0.2); color: var(--warning); }
.badge-pending { background: rgba(139,156,179,0.2); color: var(--text-muted); }
.badge-danger { background: rgba(239,68,68,0.2); color: var(--danger); }
.badge-ref { background: rgba(59,130,246,0.2); color: var(--accent); }

.blockers {
  margin: 1rem 0;
}

.blockers li {
  list-style: none;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  background: rgba(239,68,68,0.1);
  border-left: 3px solid var(--danger);
  border-radius: 0 4px 4px 0;
  font-size: 0.875rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1rem 0;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-hover);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

tr:hover td { background: rgba(255,255,255,0.02); }

.table-wrap { overflow-x: auto; }

pre, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

pre {
  background: #0a0e14;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 1rem 0;
}

.mermaid-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.chart-container {
  position: relative;
  height: 220px;
  margin: 0.5rem 0;
}

.chart-container-sm { height: 160px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.875rem;
}

.checklist-item .icon-pass { color: var(--success); }
.checklist-item .icon-fail { color: var(--text-muted); }

.search-bar {
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-tag {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
}

.filter-tag.active,
.filter-tag:hover {
  border-color: var(--accent);
  color: var(--text);
}

.doc-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

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

.doc-item h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.doc-item p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.page-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.page-footer a { margin-right: 1rem; }

.reading-path ol {
  padding-left: 1.25rem;
  margin: 1rem 0;
}

.reading-path li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; }

.mini-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.mini-stat {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
}

.mini-stat .val { font-size: 1.25rem; font-weight: 600; }
.mini-stat .lbl { font-size: 0.7rem; color: var(--text-muted); }

@media (max-width: 600px) {
  .mini-preview { grid-template-columns: repeat(2, 1fr); }
}
