*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #f4f4f4;
  color: #222;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

#sidebar {
  width: 180px;
  background: #2c2c2c;
  color: #ddd;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 1rem 0;
  overflow: hidden;
  transition: width 0.25s ease;
}

body.sidebar-collapsed #sidebar {
  width: 0;
  padding: 0;
}

#sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 180px;
  transform: translateY(-50%);
  z-index: 100;
  width: 18px;
  height: 40px;
  background: #2c2c2c;
  color: #aaa;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.25s ease;
}

#sidebar-toggle:hover { color: #fff; background: #3a3a3a; }

body.sidebar-collapsed #sidebar-toggle {
  left: 0;
}

.sidebar-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
  padding: 0 1rem 0.75rem;
  border-bottom: 1px solid #3a3a3a;
  margin-bottom: 0.5rem;
}

#sidebar a.sidebar-title {
  color: #888;
  padding: 0 1rem 0.75rem;
  border-left: none;
}

#sidebar a.sidebar-title:hover { background: transparent; color: #bbb; }
#sidebar a.sidebar-title.active { background: transparent; color: #ccc; border-left: none; }

#sidebar ul { list-style: none; }

#sidebar details > summary {
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

#sidebar details > summary::-webkit-details-marker { display: none; }

#sidebar details > summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.6rem;
  transition: transform 0.15s;
  vertical-align: middle;
}

#sidebar details[open] > summary::before { transform: rotate(90deg); }

#sidebar a {
  display: block;
  padding: 0.5rem 1rem 0.5rem 1.5rem;
  color: #ccc;
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}

#sidebar a:hover { background: #383838; color: #fff; }
#sidebar a.active { border-left-color: #4a9eff; color: #fff; background: #333; }

/* ── Content area ────────────────────────────────────────────────────────── */

#content {
  flex: 1;
  overflow: auto;
  padding: 2rem;
}

.demo-section { display: none; }
/* Cap content width on large monitors so full-width charts keep a sane aspect
   ratio instead of stretching into thin strips. min() keeps it fluid below the cap. */
.demo-section.active { display: block; max-width: min(1400px, 100%); }

h2 { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.4rem; }