/* ============================================================
   Policy Synthesis Project — Stylesheet
   Healthcare Reference Materials
   ============================================================ */

/* --- Custom Properties ------------------------------------ */
:root {
  --navy:         #0d1b2a;
  --navy-mid:     #162032;
  --teal:         #1b6ca8;
  --accent:       #00b4d8;
  --accent-light: #90e0ef;
  --success:      #2a9d8f;
  --warning:      #e9c46a;
  --danger:       #e63946;
  --light:        #e8f4f8;
  --text:         #1a1a2e;
  --text-muted:   #64748b;
  --white:        #ffffff;
  --border:       #d1e3f0;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.14);
  --transition: 0.18s ease;
}

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif;
  background: #f0f4f8;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Header ----------------------------------------------- */
#app-header {
  background: var(--navy);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

#app-header .header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

#app-header .header-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--success));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

#app-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

#app-header .subtitle {
  font-size: 0.78rem;
  color: var(--accent-light);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

#app-header .header-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
  text-align: right;
  line-height: 1.5;
}

#app-header .header-live-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--accent-light);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
}
#app-header .header-live-link:hover {
  text-decoration: underline;
  color: #ffffff;
}

/* --- Info Bar --------------------------------------------- */
#info-bar {
  background: var(--teal);
  padding: 6px 28px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.92);
  letter-spacing: 0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

#info-bar .info-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  flex-shrink: 0;
}

/* --- Tab Navigation --------------------------------------- */
#tab-nav {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 28px;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  padding: 14px 26px;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--accent);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn .tab-icon {
  font-size: 1rem;
  opacity: 0.8;
}

/* --- Tab Panels ------------------------------------------- */
.tab-panel {
  display: none;
  padding: 28px;
  min-height: calc(100vh - 160px);
}

.tab-panel.active {
  display: block;
}

/* --- Section Header --------------------------------------- */
.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.section-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 760px;
}

/* --- SVG Containers --------------------------------------- */
.viz-container {
  width: 100%;
  min-height: 600px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.viz-container svg {
  display: block;
  width: 100%;
}

/* --- Tooltip ---------------------------------------------- */
.tooltip {
  position: fixed;
  background: rgba(13, 27, 42, 0.96);
  color: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  pointer-events: none;
  max-width: 320px;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0, 180, 216, 0.25);
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.tooltip.visible {
  opacity: 1;
}

.tooltip strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--accent-light);
}

.tooltip .tt-row {
  display: flex;
  gap: 6px;
  margin: 2px 0;
}

.tooltip .tt-label {
  color: var(--accent-light);
  opacity: 0.7;
  font-size: 11px;
  min-width: 60px;
}

.tooltip .tt-desc {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.82;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 6px;
}

/* --- Legend ----------------------------------------------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #fafcfe;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--white);
  transition: opacity var(--transition), background var(--transition);
  user-select: none;
}

.legend-item:hover {
  background: var(--light);
}

.legend-item.hidden {
  opacity: 0.35;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Table Styles ----------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--white);
}

thead th {
  background: var(--navy);
  color: var(--white);
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

thead th:hover {
  background: var(--navy-mid);
}

thead th .sort-arrow {
  margin-left: 5px;
  opacity: 0.6;
  font-size: 11px;
}

thead th.sorted .sort-arrow {
  opacity: 1;
  color: var(--accent-light);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--light);
}

tbody tr.group-header {
  background: #eef5fa;
  font-weight: 600;
  cursor: pointer;
  border-top: 2px solid var(--border);
}

tbody tr.group-header:hover {
  background: #dceef7;
}

tbody tr.group-header td {
  padding: 9px 14px;
  color: var(--navy);
  font-size: 0.82rem;
}

tbody tr.group-header .group-toggle {
  display: inline-block;
  margin-right: 8px;
  transition: transform var(--transition);
  font-size: 11px;
}

tbody tr.group-header.collapsed .group-toggle {
  transform: rotate(-90deg);
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr.detail-row td {
  background: #f7fbfe;
  padding: 8px 14px 12px 24px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-top: none;
}

/* --- Filter Controls ------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,180,216,0.12);
}

.filter-bar input[type="search"] {
  min-width: 220px;
}

.filter-bar select {
  min-width: 160px;
  cursor: pointer;
}

.filter-bar .filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: -4px;
}

/* --- Badges ----------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--navy);
  white-space: nowrap;
}

.badge-claims      { background: #bde0fe; color: #023e8a; }
.badge-enrollment  { background: #b7e4c7; color: #1b4332; }
.badge-provider    { background: #ffd6a5; color: #7f4f24; }
.badge-survey      { background: #e9d8fd; color: #4a1c96; }
.badge-synthetic   { background: #f8edeb; color: #8b2500; }

.badge-legislation { background: #ffd6d8; color: #7d0a10; }
.badge-agency      { background: #ddd6f3; color: #3d2b8e; }
.badge-program     { background: #c8f0e7; color: #0d5e4a; }
.badge-model       { background: #d0e8f2; color: #0a4a6e; }
.badge-rule        { background: #fdefd0; color: #7a4a00; }

/* code / linkage tags */
code.link-tag {
  display: inline-block;
  font-family: 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
  font-size: 11px;
  background: #eef2f7;
  color: var(--navy-mid);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid #cdd8e3;
  margin: 1px 2px;
}

/* --- Export Button ---------------------------------------- */
.btn-export {
  padding: 8px 18px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), transform var(--transition);
  margin-left: auto;
}

.btn-export:hover {
  background: var(--navy);
  transform: translateY(-1px);
}

.btn-export:active {
  transform: translateY(0);
}

/* --- Reimbursement Swimlane ------------------------------- */
#reimbursement-container {
  overflow-x: auto;
}

.swimlane-svg {
  display: block;
}

.swimlane-row-bg-even {
  fill: #f5f9fc;
}

.swimlane-row-bg-odd {
  fill: #ffffff;
}

.swimlane-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  fill: var(--navy);
}

.swimlane-fee-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  fill: var(--text-muted);
}

.swimlane-model-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  fill: #ffffff;
  pointer-events: none;
}

.swimlane-axis text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  fill: var(--text-muted);
}

.swimlane-axis line,
.swimlane-axis path {
  stroke: var(--border);
}

.swimlane-gridline {
  stroke: #e0eaf2;
  stroke-dasharray: 3,3;
}

.vbp-pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(27, 108, 168, 0.12);
  color: var(--teal);
  border: 1px solid rgba(27, 108, 168, 0.25);
  margin: 1px;
  white-space: nowrap;
}

/* --- Ontology Graph --------------------------------------- */
.node circle {
  cursor: pointer;
  transition: r 0.15s ease;
}

.node circle:hover {
  filter: brightness(1.15);
}

.node text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  fill: var(--text);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(255,255,255,0.9), 0 -1px 3px rgba(255,255,255,0.9);
}

.link {
  stroke: #a8c0d6;
  stroke-opacity: 0.6;
  stroke-width: 1.5px;
  fill: none;
}

.link-label {
  font-size: 9px;
  fill: var(--text-muted);
  pointer-events: none;
}

/* --- Scrollbar Styling ------------------------------------ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f0f4f8; }
::-webkit-scrollbar-thumb { background: #b0c4d4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal); }

/* --- Utilities -------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-navy  { color: var(--navy); }
.fw-bold    { font-weight: 700; }
.mt-4       { margin-top: 16px; }
.mb-4       { margin-bottom: 16px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }

/* --- Stats Row -------------------------------------------- */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  min-width: 140px;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 768px) {
  #app-header { padding: 14px 16px; }
  .tab-panel  { padding: 16px; }
  #tab-nav    { padding: 0 8px; overflow-x: auto; }
  .tab-btn    { padding: 12px 14px; font-size: 0.82rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .stats-row  { gap: 10px; }
}

/* --- Graph Toggle ----------------------------------------- */
.graph-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.graph-toggle-btn {
  padding: 8px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.graph-toggle-btn:hover {
  color: var(--teal);
}

.graph-toggle-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.graph-panel {
  display: none;
}

.graph-panel.active {
  display: block;
}

/* --- Top Shifts ------------------------------------------- */
.top-shifts-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
}

.shifts-header {
  margin-bottom: 20px;
}

.shifts-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}

.shifts-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

.shifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.shift-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

.shift-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}

.shift-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.shift-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--light);
  padding: 2px 8px;
  border-radius: 12px;
}

.shift-trend-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.04em;
}

.shift-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
  line-height: 1.35;
}

.shift-node-tag {
  font-size: 0.72rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 12px;
  background: rgba(27,108,168,0.08);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
}

.shift-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 10px;
}

.shift-catalyst {
  font-size: 0.82rem;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.5;
}

.shift-implications {
  margin: 0;
  padding-left: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.shift-implications li {
  margin-bottom: 3px;
}

/* --- Company graph edge styles ---------------------------- */
.link-serves { stroke: #f4a261; stroke-dasharray: 4,3; }
.link-partner { stroke: #2a9d8f; stroke-dasharray: 2,2; }
.link-funds   { stroke: #6a4c93; stroke-dasharray: 6,3; }
.link-tension { stroke: #e63946; stroke-dasharray: 8,3; }
.link-hier    { stroke: #a8c0d6; stroke-dasharray: none; }

/* ============================================================
   Taxonomy Reference — Important Variables & Distinctions
   ============================================================ */

#taxonomy-reference {
  margin-top: 40px;
  border-top: 2px solid var(--border);
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.ref-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ref-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.ref-section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 900px;
}

/* --- Comparison / variable map tables --------------------- */
.ref-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  line-height: 1.5;
}

.ref-table th {
  background: var(--navy);
  color: #fff;
  padding: 9px 12px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: bottom;
}

.ref-table th .ref-th-sub {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.75;
  white-space: normal;
  margin-top: 2px;
}

.ref-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef2f6;
  vertical-align: top;
  color: var(--text);
  font-size: 0.8rem;
}

.ref-table tr:last-child td {
  border-bottom: none;
}

.ref-table tr:nth-child(odd) td {
  background: #fafbfc;
}

.ref-feature-col {
  min-width: 130px;
  white-space: nowrap;
  font-weight: 600 !important;
  color: var(--navy) !important;
  background: #f0f4f8 !important;
}

/* Variable map table — tighter columns */
.ref-table-var th,
.ref-table-var td {
  min-width: 110px;
}

.ref-table code {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 0.77rem;
  background: #e8f0f8;
  color: #1e40af;
  padding: 1px 5px;
  border-radius: 3px;
}

.ref-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 4px;
  margin-top: -6px;
}

.ref-note code {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 0.75rem;
  background: #e8f0f8;
  color: #1e40af;
  padding: 1px 5px;
  border-radius: 3px;
}

/* --- Deep-dive cards (per coding system) ------------------ */
.ref-deepdive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.ref-deepdive-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ref-deepdive-title {
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 12px;
}

.ref-deepdive-card ul {
  margin: 0;
  padding: 10px 14px 12px 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ref-deepdive-card li {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.55;
}

/* --- Claim forms / glossary definition lists -------------- */
.ref-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ref-block-title {
  background: #f0f4f8;
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.ref-deflist {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ref-def-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: start;
}

.ref-def-row:last-child {
  border-bottom: none;
}

.ref-def-term {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e40af;
  background: #e8f0f8;
  padding: 3px 8px;
  border-radius: 3px;
  align-self: start;
  line-height: 1.4;
}

.ref-def-body {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.6;
}

/* --- Analytic domain cards -------------------------------- */
.ref-analytic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 12px 14px;
}

.ref-analytic-card {
  background: #fafbfc;
  border: 1px solid #e2eaf3;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ref-analytic-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--teal);
  padding: 5px 10px;
}

.ref-analytic-card ul {
  margin: 0;
  padding: 8px 12px 10px 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ref-analytic-card li {
  font-size: 0.79rem;
  color: var(--text);
  line-height: 1.5;
}

/* --- Quick starter grid ----------------------------------- */
.ref-starter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 12px 14px;
}

.ref-starter-card {
  background: #fafbfc;
  border: 1px solid #e2eaf3;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ref-starter-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: #264653;
  padding: 5px 10px;
}

.ref-starter-card ul {
  margin: 0;
  padding: 8px 10px 10px 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ref-starter-card li {
  font-size: 0.79rem;
  color: var(--text);
  line-height: 1.5;
}

.ref-starter-card code {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 0.75rem;
  background: #e8f0f8;
  color: #1e40af;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ============================================================
   Program Eligibility Outline — Reimbursement Tab
   ============================================================ */

.reimb-outline {
  margin-top: 40px;
  border-top: 2px solid var(--border);
  padding-top: 28px;
  font-size: 0.88rem;
}

/* --- Outline header + key --------------------------------- */
.outline-header {
  margin-bottom: 24px;
}

.outline-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.outline-header p {
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 860px;
  margin-bottom: 14px;
}

.outline-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.outline-key span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Badge variants --------------------------------------- */
.ol-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.4;
}

.ol-base      { background: #dbeafe; color: #1e40af; }
.ol-adjust    { background: #d1fae5; color: #065f46; }
.ol-penalty   { background: #fee2e2; color: #991b1b; }
.ol-innovation{ background: #ede9fe; color: #5b21b6; }
.ol-ended     { background: #f1f5f9; color: #475569; }
.ol-report    { background: #fef9c3; color: #854d0e; }
.ol-pricing   { background: #fce7f3; color: #9d174d; }
.ol-audit     { background: #e0f2fe; color: #0369a1; }

/* --- Per-service-type collapsible sections ---------------- */
.outline-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}

.outline-svc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.outline-svc-header:hover {
  background: #edf2f7;
}

.outline-svc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.outline-svc-name {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.9rem;
  flex: 1;
}

.outline-svc-toggle {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.outline-section.collapsed .outline-svc-toggle {
  transform: rotate(-90deg);
}

.outline-section.collapsed .outline-body {
  display: none;
}

/* --- Body rows -------------------------------------------- */
.outline-body {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outline-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: start;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.outline-row:last-child {
  border-bottom: none;
}

.ol-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-top: 2px;
}

/* --- VBP list --------------------------------------------- */
.outline-vbp-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.outline-vbp-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.4;
}

/* --- CMMI category blocks --------------------------------- */
.outline-cats-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outline-cat-block {
  background: #fafbfc;
  border-radius: 4px;
  overflow: hidden;
}

.outline-cat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  background: #f1f5f9;
}

.outline-model-list {
  margin: 0;
  padding: 6px 10px 6px 14px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.outline-model-list li {
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1.5;
  font-size: 0.83rem;
}

/* --- ACO Overlay note ------------------------------------- */
.outline-aco-overlay {
  margin-top: 20px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
}

.outline-aco-overlay h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 8px;
}

.outline-aco-overlay p {
  font-size: 0.83rem;
  color: #166534;
  line-height: 1.6;
  margin-bottom: 10px;
}

.outline-aco-overlay ul {
  margin: 0 0 10px 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.outline-aco-overlay li {
  font-size: 0.83rem;
  color: #166534;
  line-height: 1.5;
}

.outline-aco-overlay p:last-child {
  margin-bottom: 0;
  font-size: 0.8rem;
  color: #15803d;
  font-style: italic;
}

/* --- Key Takeaways ---------------------------------------- */
.outline-takeaways {
  margin-top: 20px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.outline-takeaways h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.outline-takeaways ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.outline-takeaways li {
  font-size: 0.83rem;
  color: var(--text);
  line-height: 1.65;
}

.outline-takeaways li strong {
  color: var(--navy);
  display: block;
  margin-bottom: 2px;
}

/* ============================================================
   Analytical Stacks Tab
   ============================================================ */

/* --- Filter bar ------------------------------------------- */
.analytical-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.analytical-filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #f8fafc;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.analytical-filter-btn:hover {
  background: #e8f0f8;
  border-color: var(--primary);
  color: var(--primary);
}

.analytical-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* --- Task grid -------------------------------------------- */
.analytical-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.task-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s;
}

.task-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* --- Card header ------------------------------------------ */
.task-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  background: #f8fafc;
  user-select: none;
}

.task-card-header:hover {
  background: #eef4fb;
}

.task-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 26px;
  text-align: center;
  background: #e2eaf3;
  border-radius: 4px;
  padding: 2px 6px;
}

.task-name-label {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
}

.task-status-badge {
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 10px;
}

.badge-built {
  background: #d1fae5;
  color: #065f46;
}

.badge-specified {
  background: #fef3c7;
  color: #92400e;
}

.badge-deferred {
  background: #f3f4f6;
  color: #6b7280;
}

.task-toggle-icon {
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.task-card:not(.collapsed) .task-toggle-icon {
  transform: rotate(180deg);
}

/* --- Card body -------------------------------------------- */
.task-card-body {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.task-card.collapsed .task-card-body {
  display: none;
}

.task-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  border-bottom: 1px solid #e2eaf3;
  padding-bottom: 4px;
}

.task-method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .task-method-grid {
    grid-template-columns: 1fr;
  }
}

.task-method-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.task-method-grid p {
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
  line-height: 1.55;
}

.task-scale-row {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}

.task-use-cases,
.task-caveats {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.task-use-cases li,
.task-caveats li {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}

.task-modules {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding-top: 4px;
  border-top: 1px dashed #e2eaf3;
}

.task-status-note {
  font-size: 0.8rem;
  color: #92400e;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

/* --- Cross-cutting section -------------------------------- */
.analytical-crosscut {
  margin-top: 8px;
  padding: 20px 22px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 28px;
}

.analytical-crosscut h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
}

.analytical-crosscut p {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.55;
}

.crosscut-lib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin-bottom: 14px;
}

.crosscut-lib-table th {
  text-align: left;
  padding: 6px 10px;
  background: #e8f0f8;
  color: var(--navy);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.crosscut-lib-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e9eef5;
  color: var(--text);
  vertical-align: top;
}

.crosscut-lib-table tr:last-child td {
  border-bottom: none;
}

/* --- Volume & grain reference ----------------------------- */
.analytical-volgrain {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.analytical-volgrain h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.volgrain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.volgrain-table th {
  text-align: left;
  padding: 6px 10px;
  background: #e8f0f8;
  color: var(--navy);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.volgrain-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e9eef5;
  color: var(--text);
  vertical-align: top;
}

.volgrain-table tr:last-child td {
  border-bottom: none;
}

.volgrain-table tr:nth-child(even) td {
  background: #f8fafc;
}
