/* Planning Reporter page. Loaded only by templates/planning_reporter.html. */

.planning-reporter {
  --pr-ink: #1f2d3a;
  --pr-muted: #5b6b7a;
  --pr-accent: #0074D9;
  --pr-accent-soft: #e8f2fc;
  --pr-rule: #dee2e6;
  --pr-panel: #f6f8fa;
  --pr-note: #fff8e6;
  --pr-note-rule: #f0c36d;
}

/* ---------- Layout: filters | content | contents ---------- */

.planning-reporter .main-content {
  color: var(--pr-ink);
  line-height: 1.55;
  scroll-behavior: smooth;
}

.planning-reporter .report-wrapper {
  max-width: 1100px;
  margin: 0 auto;
}

.report-toc {
  flex: 0 0 260px;
  overflow-y: auto;
  border-left: 1px solid var(--pr-rule);
  background: #fff;
  padding: 16px 14px 40px;
  font-size: 0.85em;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.toc-heading {
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85em;
  color: var(--pr-muted);
}

.toc-expand {
  font: inherit;
  font-size: 0.9em;
  padding: 3px 8px;
  border: 1px solid var(--pr-rule);
  border-radius: 4px;
  background: #fff;
  color: var(--pr-accent);
  cursor: pointer;
}
.toc-expand:hover { background: var(--pr-accent-soft); }

.toc-list,
.toc-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-list > li { margin-bottom: 10px; }
.toc-list ol { padding-left: 10px; border-left: 1px solid var(--pr-rule); margin-left: 4px; }
.toc-list ol ol { border-left: none; }

.toc-list a {
  display: block;
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--pr-muted);
  text-decoration: none;
}
.toc-list a:hover { color: var(--pr-ink); background: var(--pr-panel); }
.toc-list a.toc-report { color: var(--pr-ink); font-weight: bold; }
.toc-list a.toc-table {
  font-size: 0.92em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-list a.is-active {
  color: var(--pr-accent);
  background: var(--pr-accent-soft);
  box-shadow: inset 3px 0 0 var(--pr-accent);
  font-weight: bold;
}

/* Inline contents, shown only when there's no room for the right-hand column */
.toc-inline {
  display: none;
  border: 1px solid var(--pr-rule);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 20px;
  font-size: 0.9em;
}
.toc-inline > summary { cursor: pointer; font-weight: bold; }
.toc-inline .toc-list { margin-top: 8px; }

@media (max-width: 1100px) {
  .report-toc { display: none; }
  .toc-inline { display: block; }
}

/* ---------- Report ---------- */

.report {
  padding-bottom: 32px;
  margin-bottom: 40px;
  border-bottom: 3px solid var(--pr-rule);
}

.report [id] { scroll-margin-top: 16px; }

.report-header { margin-bottom: 20px; }
.report-eyebrow {
  margin: 0 0 4px;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pr-muted);
}
.report-header h2 {
  margin: 0;
  font-size: 1.7em;
  color: var(--pr-ink);
}

.report h3 {
  font-size: 1.3em;
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--pr-rule);
}
.report h4 {
  font-size: 1.08em;
  margin: 28px 0 8px;
  color: var(--pr-accent);
}
.report h5 { font-size: 1em; margin: 0 0 6px; }

.report p,
.report li { max-width: 75ch; }

.fine-print {
  font-size: 0.9em;
  color: var(--pr-muted);
}

.source-link { font-size: 0.9em; }

/* Key numbers */
/* Min column width fits the widest number + Messina label (e.g. "2086 384 Messina") */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 16px 0 8px;
}
.stat {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--pr-rule);
  border-radius: 6px;
  background: var(--pr-panel);
}
.stat dt {
  font-size: 0.8em;
  color: var(--pr-muted);
  line-height: 1.3;
}
.stat dd {
  margin: 4px 0 0;
  white-space: nowrap;
  font-size: 1.5em;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}
.stat-primary {
  background: var(--pr-accent-soft);
  border-color: #b9d7f4;
}
.stat-primary dd { color: var(--pr-accent); }
.stat-detail {
  margin-left: 2px;
  font-size: 0.48em;
  letter-spacing: -0.01em;
  font-weight: normal;
  color: var(--pr-muted);
  white-space: nowrap;
}

.stat-pending {
  font-size: 0.6em;
  font-weight: normal;
  color: var(--pr-muted);
}

.term-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.term-counts li { max-width: none; }
.term-count {
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

/* Callouts */
.callout {
  background: var(--pr-note);
  border: 1px solid var(--pr-note-rule);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.93em;
}
.report .callout-title {
  margin: 0 0 8px;
  padding: 0;
  border: none;
  font-size: 1.05em;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-meta { font-style: italic; color: var(--pr-muted); margin-bottom: 0; }

.note-box {
  background: var(--pr-panel);
  border-left: 4px solid var(--pr-rule);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.93em;
}
.note-box ul { margin: 0; padding-left: 20px; }
.note-box li { margin-bottom: 4px; }

/* ---------- Reference tables ---------- */

.ref-table {
  border: 1px solid var(--pr-rule);
  border-radius: 6px;
  margin: 10px 0;
  background: #fff;
}
.ref-table > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}
.ref-table > summary::-webkit-details-marker { display: none; }
.ref-table > summary::before {
  content: "▸";
  color: var(--pr-accent);
  transition: transform 0.15s;
}
.ref-table[open] > summary::before { transform: rotate(90deg); }
.ref-table > summary:hover { background: var(--pr-panel); }
.ref-table-title { flex: 1; font-weight: bold; }
.ref-table-count {
  font-size: 0.85em;
  color: var(--pr-muted);
  white-space: nowrap;
}

.table-scroll {
  max-height: 70vh;
  overflow: auto;
  border-top: 1px solid var(--pr-rule);
}
.table-scroll table { font-size: 0.85em; }
.table-scroll th,
.table-scroll td {
  padding: 5px 10px;
  white-space: nowrap;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-scroll tbody th {
  background: var(--pr-panel);
  color: var(--pr-ink);
}

/* ---------- Print ---------- */

@media print {
  .planning-reporter .sidebar,
  .planning-reporter .sidebar-toggle-label,
  .report-toc,
  .toc-inline { display: none !important; }
  .planning-reporter .container { display: block; height: auto; overflow: visible; }
  .planning-reporter .main-content { overflow: visible; padding: 0; }
  .table-scroll { max-height: none; overflow: visible; }
  .table-scroll th, .table-scroll td { white-space: normal; }
  .report { break-after: page; border-bottom: none; }
  .stat { break-inside: avoid; }
}
