/* =================================================================
   Source Panel · business-plan TOC drawer on the left
================================================================= */
.source-panel {
  position: fixed;
  top: 0; left: 0;
  bottom: calc(var(--script-h) + var(--chrome-bot-h));
  width: var(--source-w);
  background: var(--paper);
  border-right: 1px solid var(--ink);
  z-index: 18;
  display: flex; flex-direction: column;
  transition: width .3s cubic-bezier(.2,.7,.2,1);
  box-shadow: 12px 0 40px rgba(10, 15, 30, 0.04);
}
.source-panel.collapsed { width: var(--source-bar-w); }
.source-panel.collapsed .sp-toc,
.source-panel.collapsed .sp-head .sp-label { display: none; }
.source-panel.collapsed .sp-head {
  flex-direction: column; padding: 14px 8px;
  height: auto;
}

/* ===== Head ===== */
.sp-head {
  flex-shrink: 0;
  height: var(--chrome-bot-h);
  padding: 0 16px 0 var(--sp-4);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: var(--paper);
  gap: 12px;
}
.sp-head .sp-label {
  font-family: var(--mono); font-size: var(--fs-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255, 253, 247, 0.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-head .sp-toggle {
  width: 28px; height: 28px; padding: 0;
  border: none; background: transparent; cursor: pointer;
  color: rgba(255, 253, 247, 0.7);
  display: flex; align-items: center; justify-content: center;
  border-radius: 2px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.sp-head .sp-toggle:hover {
  background: rgba(255, 253, 247, 0.12);
  color: var(--paper);
}
.sp-head .sp-toggle svg { width: 16px; height: 16px; }
.source-panel.collapsed .sp-head .sp-toggle svg { transform: scaleX(-1); }

/* ===== TOC body ===== */
.sp-toc {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 8px 0;
  font-size: var(--fs-sm);
}
.sp-toc::-webkit-scrollbar { width: 8px; }
.sp-toc::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.sp-toc::-webkit-scrollbar-track { background: transparent; }

/* ===== Item (details) ===== */
.sp-item {
  border-bottom: 1px solid var(--line);
  position: relative;
}
.sp-item::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: transparent;
  transition: background .2s;
}
.sp-item.active::before { background: var(--blue-deep); }
.sp-item.active > .sp-sum {
  background: #f0f3fa;
}
.sp-item.active > .sp-sum .sp-ttl {
  color: var(--blue-deep); font-weight: 700;
}

/* Summary (clickable row) */
.sp-sum {
  list-style: none;
  padding: 14px 18px 14px 20px;
  display: grid;
  grid-template-columns: 40px 1fr 16px;
  align-items: center; gap: 10px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.sp-sum::-webkit-details-marker { display: none; }
.sp-sum::marker { content: ""; }
.sp-sum:hover { background: var(--bg-2); }

.sp-num {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 3px 0;
  text-align: center;
  border-radius: 2px;
  font-weight: 600;
}
.sp-item.active .sp-num {
  background: var(--blue-deep); color: var(--paper);
  border-color: var(--blue-deep);
}
.sp-ttl {
  font-family: var(--sans); font-size: var(--fs-sm);
  font-weight: 600; color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.sp-chev {
  width: 14px; height: 14px;
  color: var(--muted);
  transition: transform .2s;
}
.sp-item[open] .sp-chev { transform: rotate(90deg); }

/* Body (content) */
.sp-body {
  padding: 4px 20px 18px 20px;
  border-top: 1px dashed var(--line);
  background: #fcfbf3;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}
.sp-body .sp-p { margin: 12px 0 6px; }
.sp-body .sp-p.sp-ttl {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--blue-deep);
  font-weight: 600;
  margin-top: 14px; margin-bottom: 6px;
}
.sp-body .sp-p.sp-muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.sp-body ul.sp-ul,
.sp-body ol.sp-ol {
  margin: 0; padding: 0 0 0 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.sp-body ul.sp-ul li,
.sp-body ol.sp-ol li {
  font-size: 12.5px; line-height: 1.6;
  color: var(--ink-2);
}
.sp-body ol.sp-ol { padding-left: 22px; }
.sp-body b { color: var(--ink); font-weight: 700; }

.sp-dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}
.sp-dl dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 2px;
}
.sp-dl dd {
  margin: 0; color: var(--ink-2);
}

/* Source-referenced slide highlight — when a slide maps to an active TOC item,
   the slide's head-right label receives a subtle blue accent for visual linkage. */
.slide.has-source .slide-head .head-right .label {
  color: var(--blue-deep);
  font-weight: 600;
  position: relative;
  padding-left: 14px;
}
.slide.has-source .slide-head .head-right .label::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue-deep);
  transform: translateY(-50%);
}
