/* ===== 사이드바 — 보고서 섹션 ===== */
.nav-section {
  margin-top: 14px;
  padding: 8px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  gap: 6px;
}
.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-sidebar-text-muted);
  text-transform: uppercase;
}
.nav-section-actions {
  display: inline-flex;
  gap: 4px;
}
.nav-action {
  width: 22px; height: 22px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-action:hover { background: var(--color-sidebar-active); color: #fff; }
.nav-action:disabled { opacity: 0.5; cursor: wait; }
#btn-clear-reports:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.reports-empty {
  margin: 6px 12px;
  font-size: 11.5px;
  color: var(--color-sidebar-text-muted);
  line-height: 1.6;
}
.reports-empty .hint-small {
  display: inline-block;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--color-sidebar-text-muted);
}
.reports-empty code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.reports-list { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.report-item-row {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.report-item-row:hover { background: var(--color-sidebar-hover); }
.report-item-row:has(.report-item.active) { background: var(--color-sidebar-active); }

.report-item {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--color-sidebar-text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-item.active { color: #fff; }
.report-item-title {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-item-meta {
  font-size: 10.5px;
  color: var(--color-sidebar-text-muted);
}
.report-item.active .report-item-meta { color: rgba(255, 255, 255, 0.7); }

.report-item-delete {
  flex-shrink: 0;
  width: 24px;
  margin: 4px 4px 4px 0;
  background: transparent;
  border: none;
  color: var(--color-sidebar-text-muted);
  font-size: 12px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.report-item-row:hover .report-item-delete,
.report-item-row:focus-within .report-item-delete { opacity: 1; }
.report-item-delete:hover {
  background: rgba(239, 68, 68, 0.16);
  color: var(--color-danger);
}

/* ===== 보고서 페이지 본문 ===== */
.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.report-actions {
  display: flex;
  gap: 8px;
}
.btn-secondary, .btn-primary {
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
/* <a> 로 만든 버튼도 동일 정렬 */
a.btn-secondary {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.btn-secondary:hover { background: var(--color-surface-2); color: var(--color-text); }
.btn-secondary.danger:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-primary {
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.hidden { display: none !important; }

/* 편집 모드 — 제목/부제 contenteditable */
.report-title[contenteditable="true"],
.report-subtitle[contenteditable="true"] {
  outline: 2px dashed var(--color-primary);
  outline-offset: 4px;
  border-radius: 4px;
  background: var(--color-primary-soft);
  padding: 2px 6px;
}
.report-title[contenteditable="true"]:focus,
.report-subtitle[contenteditable="true"]:focus {
  outline-style: solid;
  background: #fff;
}

/* 편집 모드 — narrative textarea */
.narrative-edit {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
  min-height: 180px;
  box-sizing: border-box;
}
.narrative-edit:focus {
  outline: none;
  border-style: solid;
  border-color: var(--color-primary);
}

.report-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.report-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.report-section .section-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

/* KPI row 안에서 (이미 dashboard.css 의 .kpi-card 재사용) */
.section-kpi_row .kpi-row { margin-bottom: 0; }
.kpi-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* narrative 마크다운 */
.narrative-body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--color-text);
}
.narrative-body h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
}
.narrative-body h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 14px 0 8px;
}
.narrative-body ul {
  padding-left: 22px;
  margin: 0;
}
.narrative-body strong { font-weight: 600; color: var(--color-primary); }
.narrative-body p { margin: 8px 0; }

/* 표 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.report-table th {
  background: var(--color-surface-2);
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  white-space: nowrap;
}
.report-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: var(--color-surface-2); }
.table-note {
  margin: 8px 2px 0;
  font-size: 11.5px;
  color: var(--color-text-muted);
}

/* 차트 컨테이너 */
.section-chart .chart-body { min-height: 320px; }
