@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@300;400;500;600&family=Google+Sans+Text:wght@400;500&family=Roboto+Mono:wght@400;500&display=swap');

/* Fallback to DM Sans if Google Sans unavailable */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Roboto+Mono:wght@400;500&display=swap');

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

:root {
  --blue-600: #1A73E8;
  --blue-700: #1557B0;
  --blue-50:  #E8F0FE;
  --blue-100: #D2E3FC;
  --navy:     #202124;
  --text-primary: #202124;
  --text-secondary: #5F6368;
  --text-tertiary: #80868B;
  --border: #DADCE0;
  --bg-page: #F8F9FA;
  --bg-white: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --green: #188038;
  --green-bg: #E6F4EA;
  --red: #C5221F;
  --red-bg: #FCE8E6;
  --yellow: #B06000;
  --yellow-bg: #FEF7E0;
  --sidebar-w: 256px;
  --header-h: 64px;
  --content-max: 960px;
  --font: 'DM Sans', 'Google Sans', sans-serif;
  --font-mono: 'Roboto Mono', monospace;
}

/* ─── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── HEADER ────────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--navy);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; flex-shrink: 0;
}

.header-logo-mark {
  width: 28px; height: 28px;
  background: var(--blue-600);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font); font-weight: 600; font-size: 13px;
  color: #fff; letter-spacing: 0.5px;
}

.header-logo-text {
  font-family: var(--font); font-weight: 500; font-size: 16px;
  color: rgba(255,255,255,0.87); letter-spacing: 0.1px;
}

.header-logo-text span {
  color: rgba(255,255,255,0.45);
  font-weight: 300;
  margin-left: 6px;
  font-size: 13px;
}

.header-divider {
  width: 1px; height: 20px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}

.header-product {
  font-family: var(--font); font-size: 14px; font-weight: 400;
  color: rgba(255,255,255,0.55);
}

.header-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 3px 10px;
  font-family: var(--font-mono); font-size: 11px;
  color: rgba(255,255,255,0.45);
}

/* ─── LAYOUT ────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  padding-top: var(--header-h);
}

.layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* ─── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 24px 0 32px;
}

.sidebar-section-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 16px 20px 6px;
}

.sidebar-section-label:first-child { padding-top: 4px; }

.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  font-size: 13.5px; font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1.4;
}

.sidebar a:hover {
  background: var(--blue-50);
  color: var(--blue-600);
}

.sidebar a.active {
  background: var(--blue-50);
  color: var(--blue-600);
  border-left-color: var(--blue-600);
  font-weight: 500;
}

.sidebar a .nav-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  opacity: 0.6;
}

.sidebar a.active .nav-icon { opacity: 1; }

.sidebar-sub a {
  padding-left: 36px;
  font-size: 13px;
}

/* ─── MAIN CONTENT ──────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
}

.content {
  max-width: var(--content-max);
}

/* ─── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.page-header-eyebrow {
  font-size: 11px; font-weight: 600;
  color: var(--blue-600);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-header h1 {
  font-size: 28px; font-weight: 400;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.2px;
  margin-bottom: 12px;
}

.page-header p {
  font-size: 15px; color: var(--text-secondary);
  line-height: 1.6; max-width: 680px;
}

.page-meta {
  display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap;
}

.page-meta-item {
  font-size: 12px; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 5px;
}

.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px; font-weight: 500;
}

.status-chip.draft { background: var(--yellow-bg); color: var(--yellow); }
.status-chip.active { background: var(--green-bg); color: var(--green); }
.status-chip.internal { background: var(--blue-50); color: var(--blue-600); }

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

.section h2 {
  font-size: 18px; font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.1px;
}

.section h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section p {
  font-size: 14px; line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
  max-width: 720px;
}

/* ─── THESIS BLOCK ──────────────────────────────────────────── */
.thesis-block {
  background: var(--blue-50);
  border-left: 4px solid var(--blue-600);
  border-radius: 0 8px 8px 0;
  padding: 20px 24px;
  margin: 24px 0;
}

.thesis-block p {
  font-size: 15px; font-weight: 500;
  color: var(--navy);
  line-height: 1.6;
  margin: 0;
  max-width: none;
}

/* ─── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card h4 {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.card p {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.6; margin: 0;
}

.card .card-tag {
  display: inline-block;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 10px;
  font-family: var(--font-mono);
}

/* ─── TABLE ─────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
}

table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--bg-page);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  line-height: 1.5;
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: #FAFAFA; }

td strong, td code {
  color: var(--text-primary);
}

td code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.tag-green { color: var(--green); font-size: 12px; font-weight: 500; }
.tag-red   { color: var(--red);   font-size: 12px; font-weight: 500; }
.tag-blue  { color: var(--blue-600); font-size: 12px; font-weight: 500; }

/* ─── LAYER BLOCKS ──────────────────────────────────────────── */
.layer-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }

.layer-item {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
}

.layer-number {
  width: 52px; flex-shrink: 0;
  background: var(--bg-page);
  border-right: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 500;
  color: var(--text-tertiary);
}

.layer-body { padding: 16px 20px; flex: 1; }

.layer-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}

.layer-parallel {
  font-size: 11px; font-weight: 500;
  background: var(--yellow-bg);
  color: var(--yellow);
  border-radius: 3px;
  padding: 1px 7px;
}

.layer-desc {
  font-size: 13.5px; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 10px;
}

.layer-exit {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--green-bg);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px; color: var(--green);
  line-height: 1.5;
}

.layer-exit::before { content: '✓'; font-weight: 700; flex-shrink: 0; }

/* ─── CODE BLOCK ────────────────────────────────────────────── */
.code-block {
  background: #1E2127;
  border-radius: 8px;
  padding: 20px 24px;
  margin: 16px 0;
  overflow-x: auto;
}

.code-block pre {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #ABB2BF;
  line-height: 1.7;
  white-space: pre;
}

.code-block .c-key  { color: #61AFEF; }
.code-block .c-val  { color: #98C379; }
.code-block .c-sym  { color: #56B6C2; }
.code-block .c-cmt  { color: #5C6370; font-style: italic; }
.code-block .c-arrow { color: #E5C07B; }

/* ─── GRAPH ─────────────────────────────────────────────────── */
.dep-graph {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.graph-node {
  background: var(--bg-page);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.graph-node.primary {
  background: var(--blue-50);
  border-color: var(--blue-600);
  color: var(--blue-700);
}

.graph-node.terminal {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

.graph-arrow {
  width: 1.5px; height: 24px;
  background: var(--border);
  margin: 0 auto;
  position: relative;
}

.graph-arrow::after {
  content: '';
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
}

.graph-fork {
  display: flex; gap: 40px;
  align-items: flex-start;
  position: relative;
}

.graph-fork-branch {
  display: flex; flex-direction: column; align-items: center;
}

.graph-fork-line {
  height: 24px;
  border-left: 1.5px solid var(--border);
  margin: 0 auto;
}

/* ─── CALLOUT ───────────────────────────────────────────────── */
.callout {
  display: flex; gap: 12px;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 13.5px; line-height: 1.6;
}

.callout.warning {
  background: var(--yellow-bg);
  border: 1px solid #FBCB4A;
  color: var(--yellow);
}

.callout.info {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--blue-700);
}

.callout.success {
  background: var(--green-bg);
  border: 1px solid #CEEAD6;
  color: var(--green);
}

.callout-icon { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

/* ─── BREADCRUMB ────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-tertiary);
  margin-bottom: 20px;
}

.breadcrumb a { color: var(--blue-600); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border); }

/* ─── PROGRESS INDICATOR ────────────────────────────────────── */
.phase-bar {
  display: flex; gap: 4px;
  margin-bottom: 32px;
}

.phase-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  position: relative;
}

.phase-step.done { background: var(--blue-600); }
.phase-step.current { background: var(--blue-600); opacity: 0.5; }

/* ─── METRIC CARD ───────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

.metric-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 22px; font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
}

.metric-unit {
  font-size: 12px; color: var(--text-tertiary);
  margin-top: 2px;
}

/* ─── FOOTER ────────────────────────────────────────────────── */
.page-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}

.page-footer-left {
  font-size: 12px; color: var(--text-tertiary);
}

.page-footer-nav {
  display: flex; gap: 4px;
}

.btn-nav {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--blue-600);
  text-decoration: none;
  background: var(--bg-white);
  transition: background 0.1s, border-color 0.1s;
}

.btn-nav:hover {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

/* ─── MOBILE ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 24px 20px 60px; }
}
