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

:root {
  --bg:          #f0ede6;
  --surface:     #ffffff;
  --border:      #e2ddd5;
  --text:        #1a1917;
  --text-2:      #5a5650;
  --text-3:      #9a9590;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --radius:      12px;
  --shadow:      0 2px 16px rgba(0,0,0,0.07);
  --shadow-sm:   0 1px 6px rgba(0,0,0,0.06);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.top-bar {
  height: 54px;
  min-height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #c97474;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: white;
  flex-shrink: 0;
}

.brand-text {
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.brand-name { font-weight: 700; font-size: 17px; color: var(--text); }
.brand-sep  { margin: 0 4px; color: var(--text-3); }

/* Stage filter pills */
.stage-filters {
  display: flex;
  gap: 5px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.stage-filters::-webkit-scrollbar { display: none; }

.stage-pill {
  flex-shrink: 0;
  padding: 5px 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
  white-space: nowrap;
}
.stage-pill:hover  { background: var(--bg); color: var(--text); }
.stage-pill.active { background: var(--text); border-color: var(--text); color: #fff; }

/* Nav arrows */
.stage-nav {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, color 0.13s;
}
.nav-btn:hover { background: var(--bg); color: var(--text); }

/* ── Main layout ──────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Detail panel ─────────────────────────────────────────────────────────── */
.detail-panel {
  width: 310px;
  min-width: 310px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Empty state */
.detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.5;
  padding: 40px 10px;
}
.detail-empty-icon {
  font-size: 28px;
  opacity: 0.4;
}

/* Detail content */
.detail-header {
  margin-bottom: 14px;
}

.detail-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.22;
  margin-bottom: 7px;
  color: var(--text);
}

.detail-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

/* Stages active at */
.detail-stages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.detail-stages-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-right: 3px;
}
.stage-tag {
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--bg);
  font-size: 10.5px;
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* Detail body text */
.detail-body {
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--text);
  flex: 1;
}
.detail-body p { margin-bottom: 9px; }
.detail-body ul {
  padding-left: 16px;
  margin-bottom: 9px;
}
.detail-body li { margin-bottom: 3px; }

/* Links */
.detail-links {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.detail-link {
  font-size: 12.5px;
  color: #6b7db3;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.12s;
}
.detail-link:hover { color: #3d5080; text-decoration: underline; }

/* ── Graph section ────────────────────────────────────────────────────────── */
.graph-section {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

#graph {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Legend ───────────────────────────────────────────────────────────────── */
.legend {
  position: absolute;
  bottom: 18px;
  right: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
  pointer-events: all;
}
.legend-toggle {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  text-align: left;
}
.legend-toggle:hover { color: var(--text); }
.legend-caret { font-size: 8px; }
.legend-body { margin-top: 8px; }

.legend-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 3px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-2);
}
.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Zoom hint ────────────────────────────────────────────────────────────── */
.zoom-hint {
  position: absolute;
  bottom: 18px;
  left: 18px;
  font-size: 11px;
  color: var(--text-3);
  pointer-events: none;
}
