/* ── Theory panel ────────────────────────────────────────────────────── */
#theory-panel {
  display: none;
  flex: 1;
  overflow: hidden;
}

#theory-sidebar {
  width: 195px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.theory-sidebar-header {
  padding: 6px 8px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.theory-cat-header {
  padding: 8px 8px 2px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

.theory-item {
  display: flex;
  flex-direction: column;
  padding: 4px 8px 4px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
  margin: 1px 4px;
  transition: background 0.1s;
}
.theory-item:hover { background: var(--bg-raised); }
.theory-item.active {
  background: var(--color-green-soft);
  border-color: rgba(69,212,131,0.35);
}
.theory-item-practica {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.theory-item-name {
  font-size: 12px;
  line-height: 1.3;
}
.theory-item.active .theory-item-name { color: var(--color-green); }
.theory-item.active .theory-item-practica { color: var(--color-green); }

/* ── Detail panel ──────────────────────────────────────────────────── */
#theory-detail {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.theory-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 13px;
}

.theory-detail-inner { max-width: 920px; }

.theory-header {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.theory-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}
.theory-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.theory-practica { color: var(--color-green); font-weight: bold; }

.theory-body {
  display: grid;
  grid-template-columns: 295px 1fr;
  gap: 14px;
}
.theory-left, .theory-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Schematic */
.theory-schematic-box {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}
.theory-schematic-box svg { width: 100%; height: auto; display: block; }

/* Section headers */
.theory-schematic-label,
.theory-scope-label,
.theory-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}

/* Scope notes */
.theory-scope-box {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}
.theory-probe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}
.probe-text { color: var(--text-main); font-size: 12px; }
.theory-scope-notes {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
  padding-top: 5px;
}

/* Right column sections */
.theory-section {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.theory-formula {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-green);
  padding: 2px 0;
  line-height: 1.7;
}
.theory-measure,
.theory-step {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-main);
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.45;
}
.theory-measure:last-child, .theory-step:last-child { border-bottom: none; }
.theory-measure-num,
.theory-step-num {
  background: var(--color-green-soft);
  color: var(--color-green);
  border-radius: 3px;
  font-size: 10px;
  padding: 1px 4px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  font-weight: bold;
  min-width: 14px;
  text-align: center;
}
.theory-warning {
  background: #1a1000;
  border: 1px solid #442200;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--color-amber);
  line-height: 1.5;
}
.theory-components { font-size: 12px; color: var(--text-main); }
.theory-signal { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

@media (max-width: 860px) {
  .theory-body { grid-template-columns: minmax(0, 1fr); }
  #theory-sidebar { width: 160px; }
}
