/* ─────────────────────────────────────────────────────────────
   PT EDITORIAL — Price Transparency Design System
   Investigative journalism × healthcare data × Stripe restraint
   ──────────────────────────────────────────────────────────── */

:root {
  /* Surfaces — warm cream paper, not cold white */
  --bg-page:      #fbf7ed;
  --bg-surface:   #fffdf8;
  --bg-elevated:  #ffffff;
  --bg-data:      #f5efe2;
  --bg-data-hover:#ede5d3;

  /* Ink — almost-black blue, never pure black */
  --ink-primary:   #1a1f2c;
  --ink-secondary: #4a5060;
  --ink-tertiary:  #6c7280;   /* 4.6:1 contrast on cream — WCAG AA pass */
  --ink-inverse:   #fbf7ed;

  /* Accents — used sparingly */
  --accent-primary: #b04a32;   /* burnt sienna — emphasis, links */
  --accent-success: #2d5a3d;   /* forest — fee schedule, OK */
  --accent-caution: #c8893a;   /* ochre — median, warning */
  --accent-info:    #4a6079;   /* slate — informational */
  --accent-warn:    #9a3320;   /* rust — outliers, errors */

  /* Chart palette — earthy, in fixed order */
  --viz-1: #2d5a3d;  --viz-2: #c8893a;  --viz-3: #4a6079;
  --viz-4: #6b3a4a;  --viz-5: #9a3320;  --viz-6: #2c5566;
  --viz-7: #8a6e3a;  --viz-8: #4d6e8a;

  /* Hairlines + shadows */
  --hairline:        rgba(26,31,44,0.10);
  --hairline-strong: rgba(26,31,44,0.18);
  --hairline-accent: rgba(176,74,50,0.32);
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px -4px rgba(0,0,0,0.06);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px -8px rgba(26,31,44,0.10);
  --shadow-pop:  0 2px 6px rgba(0,0,0,0.08), 0 16px 40px -10px rgba(26,31,44,0.16);

  /* Typography */
  --font-display: "Iowan Old Style", "New York", "Charter", "Hoefler Text",
                  ui-serif, Georgia, "Times New Roman", serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", "Roboto Mono",
               ui-monospace, "Menlo", monospace;

  /* Spatial rhythm */
  --gutter: 1.25rem;
  --gutter-lg: 2rem;
  --read-width: 70ch;
  --content-max: 1200px;
  --content-narrow: 880px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 120ms;
  --duration-base: 240ms;
  --duration-slow: 480ms;
}

/* ── Reset ─────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body {
  background: var(--bg-page);
  color: var(--ink-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.18;
  color: var(--ink-primary);
}
h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); font-weight: 500; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.7rem); font-weight: 500; }
h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.005em; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { color: var(--ink-primary); max-width: var(--read-width); }
a {
  color: var(--accent-primary);
  text-decoration: none;
  text-decoration-skip-ink: auto;
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
a:hover { border-bottom-color: var(--accent-primary); }
a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: 2px;
}
small, .pt-small { font-size: 0.86em; color: var(--ink-secondary); }
em { font-style: italic; }
strong, b { font-weight: 600; }
code, kbd { font-family: var(--font-mono); font-size: 0.92em; }

/* ── Numerals — tabular, monospaced ──────────────────────── */
.pt-num, table .pt-num {
  font-feature-settings: 'tnum' 1, 'cv05' 1;
  font-variant-numeric: tabular-nums;
}
.pt-mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; overflow-wrap: anywhere; }
.pt-section-label {
  font-size: 0.74em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

/* ── Layout primitives ────────────────────────────────────── */
.pt-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.pt-page-narrow {
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.pt-stack > * + * { margin-top: var(--gutter); }
.pt-stack-lg > * + * { margin-top: var(--gutter-lg); }
.pt-row {
  display: flex;
  gap: var(--gutter);
  flex-wrap: wrap;
  align-items: center;
}
.pt-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gutter-lg);
}
.pt-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gutter);
}

/* ── Masthead ─────────────────────────────────────────────── */
.pt-masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gutter);
  flex-wrap: wrap;
  padding: 1.25rem var(--gutter);
  max-width: var(--content-max);
  margin: 0 auto;
  border-bottom: 1px solid var(--hairline);
}
.pt-masthead-mark {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--ink-primary);
  border-bottom: none;
}
.pt-masthead-mark:hover { border-bottom: none; }
.pt-masthead-name {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.pt-masthead-tagline {
  font-size: 0.78em;
  color: var(--ink-secondary);
  font-style: italic;
}
.pt-masthead-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  row-gap: 0.4rem;
}
.pt-masthead-nav a {
  font-size: 0.92rem;
  color: var(--ink-secondary);
  border-bottom: none;
  position: relative;
  padding-bottom: 2px;
}
.pt-masthead-nav a:hover {
  color: var(--ink-primary);
  border-bottom: 1px solid var(--ink-primary);
}
/* Active section: heavier weight + rust accent + 2px underline so the
   current page is unmistakable. aria-current is emitted by base.html. */
.pt-masthead-nav a[aria-current="page"] {
  color: var(--accent-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--accent-primary);
}
.pt-masthead-nav a[aria-current="page"]:hover {
  border-bottom: 2px solid var(--accent-primary);
}

/* ── Main + footer ────────────────────────────────────────── */
.pt-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--gutter-lg) var(--gutter) 4rem;
}
.pt-footer {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem var(--gutter);
  border-top: 1px solid var(--hairline);
  font-size: 0.88em;
  color: var(--ink-secondary);
}

/* ── Hero (landing + procedure header) ────────────────────── */
.pt-hero {
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--gutter-lg);
}
.pt-hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.06;
  font-weight: 400;
  max-width: 22ch;
  margin-bottom: 1rem;
}
.pt-hero-title em { color: var(--accent-primary); font-style: italic; }
.pt-hero-lede {
  font-size: 1.18rem;
  line-height: 1.5;
  color: var(--ink-secondary);
  max-width: 56ch;
  margin-bottom: 2rem;
}
.pt-hero-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: stretch;
  max-width: 760px;
  margin-bottom: 1.5rem;
}
.pt-search-input {
  flex: 1 1 380px;
  min-width: 0;
  padding: 0.8rem 1rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.pt-search-input::placeholder { color: var(--ink-tertiary); }
.pt-search-input:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(176,74,50,0.18);
}
.pt-search-state, .pt-search-payer {
  padding: 0.8rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.96rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  cursor: pointer;
}
.pt-hero-quicklinks {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.pt-hero-quicklinks .pt-section-label {
  margin-right: 0.4rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.pt-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.pt-button-primary {
  background: var(--ink-primary);
  color: var(--ink-inverse);
  border-color: var(--ink-primary);
}
.pt-button-primary:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}
.pt-button-secondary {
  background: var(--bg-surface);
  color: var(--ink-primary);
  border-color: var(--hairline-strong);
}
.pt-button-secondary:hover {
  background: var(--bg-data);
  border-color: var(--ink-primary);
}
.pt-button-ghost {
  background: transparent;
  color: var(--ink-primary);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--hairline);
}
.pt-button-ghost:hover { border-color: var(--ink-primary); }

/* ── Chips / pills ────────────────────────────────────────── */
.pt-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.75rem;
  font-size: 0.86rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  text-decoration: none;
  border-bottom: 1px solid var(--hairline-strong);
  transition: all var(--duration-fast) var(--ease-out);
}
.pt-chip:hover {
  background: var(--ink-primary);
  color: var(--ink-inverse);
  border-color: var(--ink-primary);
}
.pt-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.74rem;
  font-weight: 500;
  border-radius: 3px;
  background: var(--bg-data);
  color: var(--ink-secondary);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.pt-pill-success { background: rgba(45,90,61,0.14);  color: var(--accent-success); }
.pt-pill-caution { background: rgba(200,137,58,0.18); color: #7a4f1c; }
.pt-pill-info    { background: rgba(74,96,121,0.14);  color: var(--accent-info); }
.pt-pill-warn    { background: rgba(154,51,32,0.16);  color: var(--accent-warn); }

/* Code-type pills — distinct colors so users can disambiguate
   when same numeric code spans systems (e.g. 535 = MS_DRG procedure
   AND CDM injection). Use design palette, NOT generic blues. */
.pt-codetype {
  display: inline-block;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 3px;
  text-transform: uppercase;
}
.pt-codetype-MS_DRG  { background: rgba(74,96,121,0.16);  color: var(--accent-info); }
.pt-codetype-APR_DRG { background: rgba(74,96,121,0.16);  color: var(--accent-info); }
.pt-codetype-CPT     { background: rgba(45,90,61,0.16);   color: var(--accent-success); }
.pt-codetype-HCPCS   { background: rgba(45,90,61,0.16);   color: var(--accent-success); }
.pt-codetype-CDM     { background: rgba(200,137,58,0.20); color: #7a4f1c; }
.pt-codetype-NDC     { background: rgba(107,58,74,0.18);  color: #6b3a4a; }
.pt-codetype-EAPG, .pt-codetype-RC, .pt-codetype-LOCAL,
.pt-codetype-OTHER   { background: rgba(26,31,44,0.10);   color: var(--ink-secondary); }

/* ── Cards ────────────────────────────────────────────────── */
.pt-card {
  background: var(--bg-surface);
  padding: 1.25rem 1.4rem;
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
  border-bottom: 3px solid transparent;
}
.pt-card-accent {
  border-bottom-color: var(--accent-primary);
}
.pt-card h3 { margin-bottom: 0.4rem; }
.pt-card p  { color: var(--ink-secondary); margin-bottom: 0.8rem; }
.pt-link-arrow {
  font-weight: 500;
  color: var(--accent-primary);
}
.pt-link-arrow:hover { border-bottom-color: var(--accent-primary); }

/* ── Tables — editorial, dense, readable ─────────────────── */
.pt-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  font-size: 0.93rem;
}
.pt-table thead th {
  text-align: left;
  padding: 0.7rem 0.85rem;
  background: var(--bg-data);
  border-bottom: 1px solid var(--hairline-strong);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}
.pt-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.pt-table tbody tr:nth-child(even) { background: var(--bg-data); }
.pt-table tbody tr:hover { background: var(--bg-data-hover); }
.pt-table td.pt-num,
.pt-table th.pt-num {
  text-align: right;
  font-feature-settings: 'tnum' 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pt-table td.pt-mono { font-family: var(--font-mono); font-size: 0.88em; }
.pt-table tr.tot td  { font-weight: 600; background: var(--bg-data-hover); }

/* ── Stat blocks (dashboards / hero) ─────────────────────── */
.pt-stat-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1.5rem;
}
.pt-stat {
  background: var(--bg-surface);
  padding: 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.pt-stat-num {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  font-feature-settings: 'tnum' 1;
}
.pt-stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pt-stat-trend {
  font-size: 0.86rem;
  color: var(--ink-tertiary);
}

/* ── Feature row (landing) ───────────────────────────────── */
.pt-feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gutter);
  margin-top: 2.5rem;
}
.pt-feature {
  padding: 1.5rem 1.6rem 1.6rem;
  background: var(--bg-surface);
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.pt-feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.pt-feature::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  height: 3px;
  width: 32px;
  background: var(--accent-primary);
}
.pt-feature h3 { margin-bottom: 0.5rem; }
.pt-feature p  { font-size: 0.96rem; color: var(--ink-secondary); margin-bottom: 1rem; }

/* ── Procedure summary card (search results) ─────────────── */
.pt-procedure-summary {
  background: var(--bg-surface);
  padding: 1.6rem 1.8rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent-primary);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.5rem;
}
.pt-procedure-summary h2 {
  margin-bottom: 0.4rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 500;
}
.pt-procedure-summary .pt-procedure-meta {
  font-size: 0.92rem;
  color: var(--ink-secondary);
  margin-bottom: 1rem;
}
.pt-procedure-summary .pt-procedure-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.pt-procedure-summary .pt-procedure-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.pt-procedure-summary .pt-procedure-stat-num {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  font-feature-settings: 'tnum' 1;
}
.pt-procedure-summary .pt-procedure-stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-secondary);
}
.pt-procedure-summary-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ── Charts ───────────────────────────────────────────────── */
.pt-chart-wrap {
  background: var(--bg-surface);
  padding: 1.4rem 1.5rem 1rem;
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.5rem;
}
.pt-chart-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}
.pt-chart-subtitle {
  font-size: 0.86rem;
  color: var(--ink-secondary);
  margin-bottom: 1rem;
}
.pt-chart-canvas {
  position: relative;
  width: 100%;
  height: 360px;
}
.pt-chart-canvas-tall { height: 480px; }

/* Outlier flags */
.pt-outlier-high {
  color: var(--accent-warn);
  font-weight: 600;
}
.pt-outlier-low {
  color: var(--accent-success);
  font-weight: 600;
}

/* Signed delta-vs-market cell (payer "vs national" column). Colored text +
   a restrained background wash so the cell itself reads green (below market)
   or red (above market) — matching the "the vs-national column is colored"
   copy. The arrow carries the sign so meaning survives without color. */
.pt-delta-cell {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.pt-delta-below { color: var(--accent-success); background: rgba(45,90,61,0.13); }
.pt-delta-above { color: var(--accent-warn);    background: rgba(154,51,32,0.13); }

/* Compare-matrix cell tint. The compare grid colors each cell green/red
   against the procedure's national median (the intro promises this). The
   value + delta text is already colored; the tint is a low-alpha wash applied
   to the whole <td> so the grid reads at a glance. Accessible: low-alpha over
   the cream theme, arrows in the text carry the direction. */
.pt-compare-cheap     { background: rgba(45,90,61,0.10); }
.pt-compare-expensive { background: rgba(154,51,32,0.09); }

/* ── Provenance / methodology footer per row ─────────────── */
.pt-provenance {
  font-size: 0.78rem;
  color: var(--ink-tertiary);
  font-style: italic;
}
.pt-methodology-help {
  cursor: help;
  border-bottom: 1px dotted var(--ink-secondary);
}

/* ── Tooltips (CSS-only) ─────────────────────────────────── */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-primary);
  color: var(--ink-inverse);
  padding: 0.55rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 400;
  white-space: pre-wrap;
  width: max-content;
  max-width: 300px;
  border-radius: 3px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
  z-index: 100;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus::after,
[data-tooltip]:focus-within::after { opacity: 1; }
[data-tooltip] { outline: none; }
[data-tooltip]:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── First-paint stagger animation ───────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .pt-hero, .pt-feature-row, .pt-stat-block, .pt-procedure-summary,
  .pt-chart-wrap, .pt-table {
    animation: pt-fade-up var(--duration-slow) var(--ease-out) both;
  }
  .pt-hero { animation-delay: 40ms; }
  .pt-feature-row { animation-delay: 160ms; }
  .pt-stat-block { animation-delay: 240ms; }
  .pt-procedure-summary { animation-delay: 80ms; }
  @keyframes pt-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .pt-masthead { padding: 1rem var(--gutter); }
  .pt-masthead-tagline { display: none; }
  .pt-masthead-nav { gap: 0.9rem; }
  .pt-hero-title { font-size: 1.95rem; }
  .pt-hero-lede { font-size: 1.02rem; }
  .pt-stat-num { font-size: 1.55rem; }
  .pt-table { font-size: 0.85rem; }
  .pt-table thead th, .pt-table td { padding: 0.5rem 0.6rem; }
  .pt-procedure-summary { padding: 1.2rem 1.2rem; }
  .pt-procedure-stats { gap: 1.2rem; }

  /* Wide tables (search results, by-state, by-hospital, dashboard top
     procedures, the 11-column raw-rate table on code_detail, and the
     audit-trail / by-code tables on hospital_detail) need horizontal scroll
     on mobile rather than squashed columns — turn each .pt-table into its own
     scroll container by default and shadow the edges so users see
     scrollability. */
  .pt-table {
    display: block;
    /* Containment: a wide table must scroll INSIDE its column, never widen the
       page. `min-width:0` overrides the default `min-width:auto` so a flex/grid
       ancestor (.pt-procedure-summary, .pt-oop-widget, .pt-row, .pt-main item)
       can shrink below the table's intrinsic content width instead of being
       stretched past the 390 px viewport; `max-width:100%` caps the scroll
       container at the column width so overflow-x lives on the table, not the
       body. */
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    background: linear-gradient(to right, var(--bg-surface), var(--bg-surface)),
                linear-gradient(to right, var(--bg-surface), var(--bg-surface)),
                linear-gradient(to right, rgba(0,0,0,0.10), rgba(0,0,0,0)),
                linear-gradient(to left, rgba(0,0,0,0.10), rgba(0,0,0,0));
    background-position: left center, right center, left center, right center;
    background-repeat: no-repeat;
    background-size: 20px 100%, 20px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  .pt-table thead, .pt-table tbody, .pt-table tr { display: table; width: max-content; min-width: 100%; }
  .pt-table tr { table-layout: fixed; }

  /* Floor the intrinsic width so the multi-column price tables (search,
     code, rankings) actually demand horizontal space and the .pt-table's
     overflow-x:auto engages — without this a 3-column result on a wide phone
     could crush its own columns instead of scrolling, hiding the price cols. */
  .pt-table thead, .pt-table tbody { min-width: 720px; }

  /* The page-level offenders (code_detail, hospital_detail) place a wide
     .pt-table inside `.pt-main` and inside flex/grid wrappers. A CSS grid track
     and a flex item both default to `min-width:auto`, so the wide table's
     intrinsic width would expand its track/item and push body width past the
     viewport (the observed 21–58 px leak at 390 px). `min-width:0` lets every
     content column shrink to the viewport, after which the table's own
     `overflow-x:auto` (above) takes over. Desktop is unaffected: there the table
     already fits its column, so `min-width:0` is a no-op (nothing wants to be
     wider than the track). */
  .pt-main,
  .pt-procedure-summary,
  .pt-oop-widget,
  .pt-row { min-width: 0; }

  /* The sortable/filterable macro tables (rankings, by-state, payer detail)
     are wrapped in a flex `.pt-sort-form`, and the JS scroll-affordance adds a
     `.pt-scroll-wrap`. Both are flex/block ancestors that default to
     min-width:auto and would stretch to the table's intrinsic width, pushing
     body width past the viewport (and starving the table's own overflow-x:auto
     so it never scrolls). Cap them at the column width so the inner .pt-table
     becomes the scroll container — same containment the cards above get. */
  .pt-sort-form,
  .pt-scroll-wrap { min-width: 0; max-width: 100%; }
  .pt-sort-form { width: 100%; }
  /* And the table itself, as a flex item inside the form, must be allowed to
     shrink below its content width before overflow-x:auto can engage. */
  .pt-sort-form > .pt-table,
  .pt-scroll-wrap > .pt-table { min-width: 0; }
}

/* ── Form niceties ────────────────────────────────────────── */
form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.75rem 0; }
input[type="text"], input[type="search"] {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
}
input[type="text"]:focus-visible, input[type="search"]:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(176,74,50,0.18);
}
select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 0.8rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  cursor: pointer;
}
button {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  background: var(--ink-primary);
  color: var(--ink-inverse);
  border: 1px solid var(--ink-primary);
  border-radius: 3px;
  cursor: pointer;
  font-weight: 500;
  transition: background var(--duration-fast) var(--ease-out);
}
button:hover { background: var(--accent-primary); border-color: var(--accent-primary); }

/* Details/summary disclosures */
details { background: var(--bg-surface); padding: 0.6rem 1rem; border-radius: 3px; }
details summary { cursor: pointer; font-weight: 500; }
details[open] summary { margin-bottom: 0.5rem; }

/* ─────────────────────────────────────────────────────────────
   Sortable + filterable tables (sort_table.html macro)
   ──────────────────────────────────────────────────────────── */
.pt-table-interactive thead th.pt-sort-header { padding-bottom: 0.25rem; }
.pt-sort-link {
  text-decoration: none;
  color: var(--ink-primary);
  font-weight: 500;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  border-bottom: none;
}
.pt-sort-link:hover { color: var(--accent-primary); }
.pt-sort-active { color: var(--accent-primary); }
.pt-sort-arrow { font-size: 0.7em; }

.pt-filter-row td {
  border-top: 1px solid var(--hairline);
  padding: 0.4rem 0.6rem;
  background: var(--bg-subtle, #f5efde);
}
.pt-filter-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: var(--bg-paper, var(--bg-surface));
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-primary);
}
.pt-filter-input:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: -1px;
}

.pt-row-link:hover { background: var(--bg-subtle, #f5efde); }

/* ────────────────────────────────────────────────────────────
   Dashboard search bar + leaderboard tile grid
   ──────────────────────────────────────────────────────────── */
.pt-dashboard-search {
  display: flex; gap: 0.5rem; margin-top: 1rem; max-width: 720px;
}
.pt-search-input {
  flex: 1; padding: 0.7rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  font-family: var(--font-body); font-size: 1rem;
  background: var(--bg-paper, #fbf7ed);
}
.pt-search-input:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: -1px;
}

.pt-leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 2rem 0 2.5rem;
}
.pt-leaderboard-tile-card {
  display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--bg-surface);
  padding: 1.2rem 1.4rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink-primary);
  box-shadow: var(--shadow-soft);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.pt-leaderboard-tile-card:hover,
.pt-leaderboard-tile-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}
.pt-leaderboard-tile-card ol {
  list-style: none; padding: 0; margin: 0; flex: 1;
}
.pt-leaderboard-tile-card li {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--hairline);
  font-size: 0.92rem;
}
.pt-leaderboard-tile-card li:last-child { border-bottom: none; }
.pt-tile-row-rank {
  color: var(--ink-tertiary);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
}
.pt-tile-row-label {
  overflow: hidden;
  display: flex; flex-direction: column; gap: 0.15rem;
  min-width: 0;
}
.pt-tile-row-detail {
  color: var(--ink-tertiary);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-tile-row-value {
  font-weight: 600;
  white-space: nowrap;
}
.pt-leaderboard-tile-card .pt-link-arrow {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

/* ----------------------------------------------------------------------
   OOP estimator widget — sticky form panel + breakdown result card.
   Lives on procedure pages directly under the summary stats.
   ---------------------------------------------------------------------- */
.pt-oop-widget {
  background: var(--bg-surface);
  padding: 1.4rem 1.6rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent-primary);
  margin: 1.5rem 0 2rem;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.2fr);
  gap: 2rem;
}
@media (max-width: 720px) { .pt-oop-widget { grid-template-columns: 1fr; } }
.pt-oop-header { display: flex; flex-direction: column; gap: 0.4rem; }
.pt-oop-title { margin: 0; font-family: var(--font-display); font-size: 1.4rem; }
.pt-oop-form { display: grid; gap: 0.7rem; }
.pt-oop-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.86rem; }
.pt-oop-form input[type=number],
.pt-oop-form select {
  padding: 0.5rem 0.7rem; border: 1px solid var(--hairline);
  border-radius: 2px; font-family: var(--font-mono); font-size: 1rem;
  background: var(--bg-paper, #fbf7ed);
  /* Constrain to the grid column: unconstrained <select>/<input number> default
     to content-box + a browser min-width (a long payer <option> forces it wide),
     overflowing the viewport on phones. Fill the column, no overflow. */
  width: 100%; min-width: 0; box-sizing: border-box;
}
.pt-oop-form input[type=number]:focus,
.pt-oop-form select:focus {
  outline: 2px solid var(--accent-primary); outline-offset: -1px;
}

.pt-oop-result-grid { display: grid; gap: 1rem; }
.pt-oop-headline {
  background: rgba(176, 74, 50, 0.06);
  padding: 1rem 1.2rem; border-radius: 3px;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.pt-oop-headline-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-secondary);
}
.pt-oop-headline-value {
  font-size: 2.2rem; font-family: var(--font-display);
  color: var(--accent-primary); font-weight: 600;
}
.pt-oop-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 1rem; font-size: 0.93rem; }
.pt-oop-breakdown dt { color: var(--ink-secondary); }
.pt-oop-breakdown dd { margin: 0; font-weight: 500; }
.pt-oop-plan { color: var(--ink-tertiary); font-style: italic; }
.pt-oop-disclaimer { color: var(--ink-tertiary); font-size: 0.78rem; line-height: 1.5; }
.pt-oop-error {
  background: rgba(176, 74, 50, 0.08); padding: 0.8rem 1rem;
  border-radius: 3px; color: var(--accent-warn, #b04a32);
}
.pt-pill {
  display: inline-block; padding: 0.18rem 0.6rem; border-radius: 999px;
  font-size: 0.74rem; letter-spacing: 0.04em; margin-top: 0.3rem;
  width: fit-content;
}
.pt-pill-warn    { background: rgba(176, 74, 50, 0.15); color: #7a3322; }
.pt-pill-info    { background: rgba(74, 96, 121, 0.15); color: #3a4a60; }
.pt-pill-success { background: rgba(45, 90, 61, 0.15); color: #1f3f2a; }

/* ----------------------------------------------------------------------
   Share strip — Copy link / Export CSV / Print on every explorer page.
   ---------------------------------------------------------------------- */
.pt-share-strip {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  margin: 0 0 1.5rem; align-items: center;
}
.pt-share-strip .pt-button { font-size: 0.85rem; }
.pt-share-copy-success {
  background: rgba(45, 90, 61, 0.15) !important;
  color: #1f3f2a !important;
  border-color: rgba(45, 90, 61, 0.4) !important;
}

/* ----------------------------------------------------------------------
   Methodology page — long-form editorial layout with TOC + glossary.
   ---------------------------------------------------------------------- */
.pt-methodology { max-width: 760px; margin: 0 auto; }
.pt-methodology-hero { margin-bottom: 2rem; }
.pt-methodology-hero h1 { margin: 0.4rem 0; }
.pt-methodology-toc {
  background: var(--bg-surface);
  padding: 1rem 1.4rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent-primary);
  margin-bottom: 2.5rem;
}
.pt-methodology-toc ol {
  list-style: decimal inside;
  margin: 0; padding: 0;
  columns: 2; column-gap: 2rem;
  font-size: 0.92rem;
}
.pt-methodology-toc li { padding: 0.15rem 0; }
.pt-methodology-section {
  scroll-margin-top: 1rem;
  margin: 2.5rem 0;
  padding-top: 1rem;
  border-top: 1px dotted var(--hairline);
}
.pt-methodology-section h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 1rem;
}
.pt-methodology-section h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 1.4rem 0 0.4rem;
}
.pt-methodology-section p { line-height: 1.65; margin: 0 0 1rem; }
.pt-callout {
  background: rgba(176, 74, 50, 0.06);
  border-left: 3px solid var(--accent-primary);
  padding: 0.9rem 1.2rem;
  border-radius: 0 3px 3px 0;
  margin: 1rem 0;
}
.pt-codeset-list, .pt-glossary {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.7rem 1.4rem;
}
.pt-codeset-list dt, .pt-glossary dt {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.92rem;
}
.pt-codeset-list dd, .pt-glossary dd {
  margin: 0; line-height: 1.55;
}
.pt-codeblock {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 1rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.5;
}
.pt-citation-example {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  background: var(--bg-surface);
  padding: 0.8rem 1rem;
  border-radius: 2px;
  border-left: 2px solid var(--ink-tertiary, #888);
  margin: 0.4rem 0 1rem;
  word-break: break-word;
}

/* ── Compliance freshness pills ──────────────────────────── */
.pt-freshness-pill {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
.pt-freshness-fresh          { background: #d6efd9; color: #1e6b2a; }
.pt-freshness-aging          { background: #fff3c7; color: #6d5500; }
.pt-freshness-stale          { background: #fde2c7; color: #8a3a00; }
.pt-freshness-expired        { background: #f7c8c2; color: #842018; }
.pt-freshness-never_ingested { background: #e3e0d8; color: #555;    }

/* ── Compliance missing-field heatmap cells ──────────────── */
.pt-missing-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-right: 0.7rem;
}
.pt-missing-cell[data-pct-bucket="green"]  { background: #ebf6ec; color: #1e6b2a; }
.pt-missing-cell[data-pct-bucket="yellow"] { background: #fff7da; color: #6d5500; }
.pt-missing-cell[data-pct-bucket="red"]    { background: #fbe4e0; color: #842018; }

/* ── Glossary in-copy term ───────────────────────────────── */
.pt-glossary-term {
  border-bottom: 1px dotted var(--ink-tertiary, #888);
  cursor: help;
}
@media print {
  .pt-glossary-term { border-bottom: none; }
  .pt-glossary-term::after { display: none !important; }
}

/* ── Cash-price callout (procedure pages) ────────────────── */
.pt-cash-callout {
  background: linear-gradient(135deg, #fff8e7 0%, #fff3d0 100%);
  border-left: 3px solid var(--accent-warn, #b04a32);
  padding: 1.2rem 1.5rem;
  border-radius: 4px;
  margin: 1.4rem 0 1.8rem;
  display: grid;
  gap: 0.8rem;
}
.pt-cash-headline { display: flex; flex-direction: column; gap: 0.3rem; }
.pt-cash-title { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; }
.pt-cash-numbers { display: flex; gap: 2.4rem; flex-wrap: wrap; }
.pt-cash-number { display: flex; flex-direction: column; gap: 0.2rem; }
.pt-cash-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-secondary);
}
.pt-cash-value {
  font-size: 1.6rem; font-family: var(--font-display); font-weight: 600;
  color: var(--ink-primary);
}
.pt-cash-cheaper { color: #1e6b2a; }
.pt-cash-pricier { color: #842018; }

/* ── Negotiated-price hero band (code page — the answer users came for) ──
   FIX #4: the "Typical negotiated price" must be the DOMINANT number on the
   page, above the cash callout. Value font-size sits above every other figure
   (cash value 1.6rem, h1 ~2.6rem) so a patient's eye lands here first. */
.pt-price-hero {
  margin: 0.4rem 0 1.6rem;
  padding: 1.4rem 1.6rem 1.5rem;
  background: linear-gradient(135deg, #fbf7ed 0%, #f5ecd8 100%);
  border-left: 4px solid var(--accent-primary, #b04a32);
  border-radius: 5px;
}
.pt-price-hero-label {
  display: block;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-secondary); margin-bottom: 0.25rem;
}
.pt-price-hero-value {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1.05;
  color: var(--accent-primary, #b04a32);
  letter-spacing: -0.01em;
}
.pt-price-hero-sub {
  margin: 0.55rem 0 0;
  max-width: none;
  font-size: 1.02rem;
  color: var(--ink-secondary);
}
.pt-price-hero-sub strong { color: var(--ink-primary); font-weight: 600; }
.pt-price-hero-note {
  margin: 0.5rem 0 0;
  max-width: none;
  font-size: 0.86rem;
  color: var(--ink-tertiary);
}
@media (max-width: 540px) {
  .pt-price-hero { padding: 1.1rem 1.1rem 1.2rem; }
  .pt-price-hero-value { font-size: clamp(2.3rem, 11vw, 3rem); }
}

/* ── Cash discount pill (hospital_detail offerings) ──────── */
.pt-cash-discount-pill {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #d6efd9;
  color: #1e6b2a;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ── ZIP-radius "near me" affordances (Plan 3 L1) ──────────── */
.pt-near-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(74, 96, 121, 0.08);
  padding: 0.55rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  font-size: 0.92rem;
}
.pt-near-summary-warn {
  background: rgba(154, 51, 32, 0.08);
  color: #9a3320;
}
.pt-near-clear {
  margin-left: auto;
  font-size: 0.86em;
  color: var(--accent-primary);
  text-decoration: underline;
}

.pt-near-label, .pt-radius-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
}
.pt-near-input {
  padding: 0.8rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.96rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  width: 8.5rem;
  font-variant-numeric: tabular-nums;
}
.pt-near-input::placeholder { color: var(--ink-tertiary); }
.pt-radius-select {
  padding: 0.8rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.96rem;
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  cursor: pointer;
  min-width: 6rem;
}

.pt-miles-pill {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.06rem 0.5rem;
  border-radius: 999px;
  background: rgba(74, 96, 121, 0.12);
  color: var(--ink-secondary);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Search-results form layout — wrap the new ZIP/radius inputs nicely
   on narrow screens. */
.pt-search-form {
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 600px) {
  .pt-near-input, .pt-radius-select { width: 100%; }
  .pt-near-label, .pt-radius-label { width: 100%; }
}

/* ── WCAG-AA + 375 px mobile + 44 px touch-target sweep (Plan 3 L6) */

/* 2.4.7 focus visible — explicit, high-contrast outline on every
   interactive element. --accent-primary (#b04a32) on cream cream
   gives ~5.4:1, well above the 3:1 NCAG requirement. */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: 2px;
}
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline-offset: 2px;
}

/* 2.5.5 + Apple HIG — 44x44 minimum target for buttons / chips /
   share-strip / interactive icons. Inline links inside flowing text
   get the WCAG 2.5.5 exception, so we don't pin every <a> in the
   page; only call-to-action affordances. */
.pt-button, .pt-chip,
.pt-share-strip > *,
.pt-citation-trigger, .pt-citation-close, .pt-citation-copy,
.pt-near-clear {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pt-glossary-term { padding: 0 2px; }
.pt-link-arrow { padding: 0 0.4rem; }

/* Mobile-first stack: at <=600 px every multi-column flex/grid collapses
   so we never force a horizontal scroll on the body. */
@media (max-width: 600px) {
  .pt-hero-search {
    flex-direction: column;
    gap: 0.5rem;
  }
  .pt-hero-search input,
  .pt-hero-search select,
  .pt-hero-search button {
    width: 100%;
  }
  .pt-share-strip {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  .pt-share-strip > * { width: 100%; justify-content: center; }
  .pt-procedure-stats { flex-direction: column; gap: 0.7rem; }
  .pt-leaderboard-grid { grid-template-columns: 1fr; }
  .pt-cash-numbers { gap: 1rem; }
  .pt-oop-widget { grid-template-columns: 1fr; gap: 1rem; }
  .pt-table-wrap { overflow-x: auto; }
}

/* ── Screen-reader-only utility (WCAG 1.3.1, 4.1.3) ─────────── */
/* Standard accessible-clip pattern: visually clipped to a 1px box but
   still announced by AT. Used by chart_sr_summary.html and by form
   labels paired with placeholder-only inputs. */
.pt-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Cite-this-view popover (Plan 3 R9) ────────────────────── */
.pt-citation-wrap { position: relative; display: inline-block; }
.pt-citation-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 360px;
  max-width: 480px;
  background: var(--bg-paper, #fbf7ed);
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(26, 31, 44, 0.16);
  padding: 1.1rem 1.3rem;
  z-index: 50;
  max-height: 70vh;
  overflow-y: auto;
}
.pt-citation-popover[hidden] { display: none; }
.pt-citation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}
.pt-citation-header h3 { margin: 0; font-size: 1.05rem; }
.pt-citation-close {
  background: none;
  border: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-tertiary);
  cursor: pointer;
  /* WCAG 2.5.5 + Apple HIG — 44x44 minimum target. */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pt-citation-close:hover, .pt-citation-close:focus-visible {
  color: var(--ink-primary);
}
.pt-citation-style {
  padding: 0.7rem 0;
  border-top: 1px dotted var(--hairline);
}
.pt-citation-style:first-of-type { border-top: 0; }
.pt-citation-style-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}
.pt-citation-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-secondary);
  word-break: break-word;
}
.pt-citation-note { margin-top: 0.6rem; }
.pt-citation-copied { color: #1e6b2a; }

@media (max-width: 600px) {
  .pt-citation-popover {
    position: fixed;
    top: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
    min-width: 0;
  }
}

/* ── Wide-table scroll affordance (shared) ──────────────────────
   The base.html scanner adds .pt-scrollable to any data table whose content
   overflows its box, wraps it in a non-scrolling .pt-scroll-wrap, and pins a
   one-time .pt-scroll-hint pill to the wrapper's right edge. A right-edge
   shadow on the table signals "there's more →"; the pill names the payoff
   ("prices") and fades on first scroll. Both retire once the table fits. */
.pt-scroll-wrap { position: relative; }
.pt-table.pt-scrollable {
  /* Right-edge fade signals hidden content to the right. Only present while
     the table overflows; the wrapper (not the table) hosts the pinned hint. */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent 100%);
          mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent 100%);
}
.pt-scroll-wrap > .pt-scroll-hint {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-inverse);
  background: var(--accent-primary);
  border-radius: 999px;
  box-shadow: 0 1px 5px rgba(26, 31, 44, 0.3);
  pointer-events: none;
  opacity: 0.97;
  transition: opacity var(--duration-base, 220ms) var(--ease-out, ease);
}
.pt-scroll-hint.pt-scroll-hint-gone { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .pt-scroll-hint { transition: none; }
}

/* ── Payer-name drill-in link (rankings: top/lowest payers) ─────
   Renders the payer name itself as a link to its by-name profile when the
   profile resolves. Matches the clickable-row feel: rust on hover + underline,
   no permanent decoration so the table stays calm. */
a.pt-cell-link {
  color: var(--ink-primary);
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
a.pt-cell-link:hover,
a.pt-cell-link:focus-visible {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* Missing-description treatment for codesets-blocked codes (APR-DRG etc.).
   The Code + Type columns already identify the row, so a clean muted em-dash
   beats a redundant "(description pending)" string. */
.pt-desc-missing {
  color: var(--ink-tertiary);
  font-style: italic;
}
