/* ==========================================================================
   CMS Provider Profiler Design System Tokens & Variables
   ========================================================================== */
:root {
  --bg-main: #090D16;
  --bg-card: #111827;
  --bg-card-hover: #162032;
  --bg-surface: #1E293B;
  --bg-surface-elevated: #243044;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #06B6D4;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-accent: #38BDF8;
  
  --accent-cyan: #06B6D4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-blue: #2563EB;
  --accent-emerald: #10B981;
  --accent-purple: #A855F7;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;
  
  /* CPT Category Colors */
  --cat-surgery-bg: rgba(168, 85, 247, 0.15);
  --cat-surgery-text: #C084FC;
  --cat-surgery-border: rgba(168, 85, 247, 0.35);

  --cat-imaging-bg: rgba(56, 189, 248, 0.15);
  --cat-imaging-text: #38BDF8;
  --cat-imaging-border: rgba(56, 189, 248, 0.35);

  --cat-labs-bg: rgba(245, 158, 11, 0.15);
  --cat-labs-text: #FBBF24;
  --cat-labs-border: rgba(245, 158, 11, 0.35);

  --cat-em-bg: rgba(16, 185, 129, 0.15);
  --cat-em-text: #34D399;
  --cat-em-border: rgba(16, 185, 129, 0.35);

  --cat-drugs-bg: rgba(244, 63, 94, 0.15);
  --cat-drugs-text: #FB7185;
  --cat-drugs-border: rgba(244, 63, 94, 0.35);

  --cat-anesthesia-bg: rgba(99, 102, 241, 0.15);
  --cat-anesthesia-text: #818CF8;
  --cat-anesthesia-border: rgba(99, 102, 241, 0.35);

  --cat-medicine-bg: rgba(20, 184, 166, 0.15);
  --cat-medicine-text: #2DD4BF;
  --cat-medicine-border: rgba(20, 184, 166, 0.35);

  --cat-other-bg: rgba(100, 116, 139, 0.15);
  --cat-other-text: #94A3B8;
  --cat-other-border: rgba(100, 116, 139, 0.35);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-hover: 0 10px 30px -4px rgba(6, 182, 212, 0.15), 0 0 0 1px rgba(6, 182, 212, 0.3);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-accent);
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
  font-size: 0.875rem;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
.app-header {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0284C7, #06B6D4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.logo-brand {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-accent {
  color: var(--accent-cyan);
}

.logo-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.nav-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 4px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  background: linear-gradient(135deg, #0284C7, #06B6D4);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

.badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #10B981;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-content {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  margin-bottom: 1.25rem;
}

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.panel-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Cards & Layout
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.search-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.4) 0%, var(--bg-card) 100%);
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: flex-end;
}

.search-grid > * {
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 2.25rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

/* ==========================================================================
   Buttons & Chips
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284C7, #06B6D4);
  color: #fff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369A1, #0891B2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--text-accent);
  color: var(--text-accent);
  background: rgba(56, 189, 248, 0.08);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.quick-samples {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-chip {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.12);
}

/* ==========================================================================
   Provider Workspace (Full-Width Stacked Layout)
   ========================================================================== */
.provider-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.provider-results-container {
  width: 100%;
}

.section-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}

.subbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.counter-badge {
  background: var(--bg-surface);
  color: var(--text-accent);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-collapse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-collapse-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}

/* Full-width, wrapping card grid keeps the results strip thin (short) */
.provider-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 4px 4px 0;
}

.provider-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.provider-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.provider-card.selected {
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(17, 24, 39, 0.9) 100%);
  box-shadow: 0 0 0 1px var(--accent-cyan), 0 4px 16px rgba(6, 182, 212, 0.2);
}

.provider-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.provider-card-tax {
  font-size: 0.8rem;
  color: var(--text-accent);
  margin-bottom: 0.4rem;
}

.provider-card-loc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.provider-card-footer {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.text-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Empty & Loading States */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
}

.empty-state svg {
  margin: 0 auto 0.75rem;
  display: block;
}

/* ==========================================================================
   Provider Detail View
   ========================================================================== */
.provider-detail-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-header-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.provider-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4338CA, #6366F1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.detail-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.meta-divider {
  color: var(--text-muted);
}

/* Stats Ribbon */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.15rem 0;
}

.stat-value.text-accent {
  color: var(--accent-cyan);
}

.stat-subtext {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Year-over-Year Trend Chart */
.chart-section {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.chart-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-note {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.yearly-bars-wrapper {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  height: 110px;
  padding: 0.5rem 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.bar-pill {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, #06B6D4 0%, #0284C7 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 4px;
  position: relative;
}

.bar-pill:hover {
  background: linear-gradient(180deg, #38BDF8 0%, #06B6D4 100%);
  filter: brightness(1.2);
}

.bar-value {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ==========================================================================
   Detailed Procedures Card & CPT Range Filters
   ========================================================================== */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subheading {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.search-input-inline input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  outline: none;
  width: 220px;
  max-width: 100%;
}

.search-input-inline input:focus {
  border-color: var(--border-focus);
}

/* Category Filter Bar */
.category-filters-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-pill {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  padding: 0.3rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.filter-pill.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.825rem;
}

.data-table th {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.data-table th.sortable:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.th-sort-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.72rem;
  opacity: 0.35;
  transition: all 0.15s ease;
}

.data-table th.sortable:hover .th-sort-icon {
  opacity: 0.8;
}

.data-table th.th-sorted {
  color: var(--accent-cyan) !important;
  background: rgba(6, 182, 212, 0.08) !important;
  border-bottom: 2px solid var(--accent-cyan);
}

.data-table th.th-sorted .th-sort-icon {
  opacity: 1;
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Sub-Header Column Filter Row */
.filter-header-row th {
  background: rgba(15, 23, 42, 0.95) !important;
  padding: 6px 8px !important;
  border-bottom: 1px solid rgba(6, 182, 212, 0.25) !important;
}

.col-filter-input {
  width: 100%;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #F8FAFC;
  padding: 4px 6px;
  font-size: 0.75rem;
  outline: none;
  transition: all var(--transition-fast);
}

.col-filter-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
  background: #243044;
}

.col-filter-select {
  width: 100%;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #F8FAFC;
  padding: 4px 4px;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.col-filter-select:focus {
  border-color: var(--accent-cyan);
  background: #243044;
}

.btn-clear-table-filters {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #FB7185;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-clear-table-filters:hover {
  background: var(--accent-rose);
  color: #fff;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Category Badges */
.badge-cat {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-cat-purple {
  background: var(--cat-surgery-bg);
  color: var(--cat-surgery-text);
  border: 1px solid var(--cat-surgery-border);
}

.badge-cat-sky {
  background: var(--cat-imaging-bg);
  color: var(--cat-imaging-text);
  border: 1px solid var(--cat-imaging-border);
}

.badge-cat-amber {
  background: var(--cat-labs-bg);
  color: var(--cat-labs-text);
  border: 1px solid var(--cat-labs-border);
}

.badge-cat-emerald {
  background: var(--cat-em-bg);
  color: var(--cat-em-text);
  border: 1px solid var(--cat-em-border);
}

.badge-cat-rose {
  background: var(--cat-drugs-bg);
  color: var(--cat-drugs-text);
  border: 1px solid var(--cat-drugs-border);
}

.badge-cat-indigo {
  background: var(--cat-anesthesia-bg);
  color: var(--cat-anesthesia-text);
  border: 1px solid var(--cat-anesthesia-border);
}

.badge-cat-teal {
  background: var(--cat-medicine-bg);
  color: var(--cat-medicine-text);
  border: 1px solid var(--cat-medicine-border);
}

.badge-cat-slate {
  background: var(--cat-other-bg);
  color: var(--cat-other-text);
  border: 1px solid var(--cat-other-border);
}

/* ==========================================================================
   Leaderboard Tab Specifics
   ========================================================================== */
.leaderboard-grid {
  display: grid;
  grid-template-columns: 2.5fr 1.2fr 0.9fr 1fr 1.2fr auto;
  gap: 1rem;
  align-items: flex-end;
}

@media (max-width: 1024px) {
  .leaderboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
}

.autocomplete-item {
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--transition-fast);
}

.autocomplete-item:hover {
  background: rgba(6, 182, 212, 0.15);
}

.ac-code {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 55px;
}

.ac-desc {
  font-size: 0.78rem;
  color: var(--text-primary);
  flex: 1;
}

.leaderboard-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.suppression-notice-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  color: #FDE68A;
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  line-height: 1.45;
}

.suppression-notice-box strong {
  color: #FBBF24;
}

.code-badge-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.badge-code {
  background: rgba(6, 182, 212, 0.2);
  color: #38BDF8;
  border: 1px solid rgba(6, 182, 212, 0.4);
  font-family: ui-monospace, monospace;
  font-weight: 700;
}

.badge-category {
  background: rgba(168, 85, 247, 0.2);
  color: #C084FC;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-geo {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-year {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.procedure-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 700px;
}

.leaderboard-quick-stats {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.quick-stat {
  display: flex;
  flex-direction: column;
}

.qs-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.qs-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Rank Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}

.rank-1 {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.rank-2 {
  background: linear-gradient(135deg, #94A3B8, #64748B);
  color: #fff;
}

.rank-3 {
  background: linear-gradient(135deg, #B45309, #78350F);
  color: #fff;
}

.rank-other {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* Comparison Bar */
.volume-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.volume-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #06B6D4, #3B82F6);
  border-radius: var(--radius-full);
}

.btn-profile-jump {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-profile-jump:hover {
  background: var(--accent-cyan);
  color: #fff;
}

/* ==========================================================================
   Loading Overlay & Toasts
   ========================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.spinner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.double-bounce1, .double-bounce2 {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  opacity: 0.6;
  position: absolute;
  animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
  animation-delay: -1.0s;
}

@keyframes sk-bounce {
  0%, 100% { transform: scale(0.0); }
  50% { transform: scale(1.0); }
}

.loading-text {
  margin-top: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background: #1E293B;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s ease forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================================= */
/* QUALITY SCORES & CLINICIAN SCORECARD STYLING */
/* ========================================================================= */

.quality-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.preset-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-preset-npi {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preset-npi:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.quality-hero {
  margin-bottom: 1.5rem;
}

.scorecard-card {
  background: linear-gradient(135deg, rgba(20, 27, 45, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  margin-bottom: 1.5rem;
}

.scorecard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.scorecard-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.01em;
}

.scorecard-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tier-badge .tier-star {
  font-size: 1rem;
}

.tier-emerald {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34D399;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.tier-cyan {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: #22D3EE;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.tier-amber {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #FBBF24;
}

.tier-rose {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #FB7185;
}

.tier-slate {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94A3B8;
}

.scorecard-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 900px) {
  .scorecard-body {
    grid-template-columns: 1fr;
  }
}

/* Big Composite Ring */
.composite-score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.composite-score-circle {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.score-ring-fill {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7; /* 2 * PI * 52 */
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.composite-score-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.composite-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.composite-max {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.composite-label {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.composite-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Category Cards Grid */
.category-scores-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .category-scores-grid {
    grid-template-columns: 1fr;
  }
}

.cat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: all var(--transition-fast);
}

.cat-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.cat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.cat-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cat-icon {
  font-size: 1.1rem;
}

.cat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cat-score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cat-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.cat-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-bar-quality { background: linear-gradient(90deg, #10B981, #34D399); }
.cat-bar-cost { background: linear-gradient(90deg, #06B6D4, #38BDF8); }
.cat-bar-ia { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.cat-bar-pi { background: linear-gradient(90deg, #3B82F6, #60A5FA); }

.cat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Star Rating rendering */
.star-rating-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.star-gold {
  color: #FBBF24;
  font-size: 0.95rem;
  filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
}

.star-gray {
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.95rem;
}

.star-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 4px;
}

/* Action button for switching to quality tab */
.btn-table-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-table-action:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-table-action-star:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #FBBF24;
  color: #FBBF24;
}

.empty-state-card {
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-content {
  max-width: 540px;
  margin: 0 auto;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state-content h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state-content p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* In-page Profile Sub-navigation */
.profile-subnav {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem 0;
  padding: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: fit-content;
}

.subnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.subnav-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.subnav-pill.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.15);
}

.quality-leaderboard-card {
  background: linear-gradient(135deg, rgba(20, 27, 45, 0.85), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ========================================================================== */
/* Clickable Category Cards & Category Filtering */
/* ========================================================================== */
.cat-card-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.cat-card-clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 12px rgba(6, 182, 212, 0.15);
}

.cat-card-clickable.active-cat-card {
  border-color: var(--accent-cyan) !important;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(15, 23, 42, 0.95)) !important;
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.5), 0 8px 20px rgba(0, 0, 0, 0.4) !important;
}

.cat-card-clickable.active-cat-card .cat-filter-hint {
  color: var(--accent-cyan);
  font-weight: 700;
}

.cat-filter-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

/* ========================================================================== */
/* Hierarchical Measure Category Drill-down Picklist */
/* ========================================================================== */
.category-drilldown-panel {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.2s ease-out;
}

.drilldown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

.drilldown-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.drilldown-cat-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.drilldown-cat-btn:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--text-primary);
}

.drilldown-cat-btn.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.drilldown-cat-count {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
}

.drilldown-measures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.drilldown-measure-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.drilldown-measure-card:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.dm-code-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.dm-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.dm-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.dm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.4rem;
  margin-top: 0.2rem;
}

.dm-action-btn {
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.72rem;
}

/* ========================================================================== */
/* Multi-Year Measure Trend Modal & Charting */
/* ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: min(850px, 95vw);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(6, 182, 212, 0.15);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-group {
  flex: 1;
  padding-right: 1rem;
}

.modal-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.modal-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.m-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.m-value {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.trend-chart-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.trend-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.trend-chart-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.trend-bars-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 160px;
  padding: 0 1rem 1rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
}

.trend-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.trend-bar-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.trend-bar-pillar {
  width: 36px;
  background: linear-gradient(180deg, var(--accent-cyan), rgba(6, 182, 212, 0.35));
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.trend-bar-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}

.trend-history-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.5);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-cyan) rgba(15, 23, 42, 0.6);
}

.trend-history-table-wrap .data-table {
  width: 100%;
  border-collapse: collapse;
}

.trend-history-table-wrap th,
.trend-history-table-wrap td {
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.trend-history-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.trend-history-table-wrap::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 3px;
}

.trend-history-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 3px;
}

.trend-history-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
}

/* Row clickable in quality table */
.quality-row-clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.quality-row-clickable:hover td {
  background: rgba(6, 182, 212, 0.06) !important;
}

.btn-trend-icon {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-trend-icon:hover {
  background: var(--accent-cyan);
  color: #0F172A;
}

/* ========================================================================= */
/* CMS METHODOLOGY & DATA RULES HELP CUES & MODAL */
/* ========================================================================= */

.heading-with-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-info-badge {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.btn-info-badge:hover {
  background: var(--accent-cyan);
  color: #0F172A;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

.btn-help-inline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.btn-help-inline:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.info-bubble {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--accent-cyan);
  cursor: help;
  margin-left: 0.25rem;
  opacity: 0.85;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.info-bubble:hover {
  opacity: 1;
  transform: scale(1.2);
}

.methodology-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.methodology-banner .banner-icon {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.methodology-banner .banner-text strong {
  color: var(--text-primary);
}

.btn-text-link {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 0.25rem;
  display: inline;
  transition: color var(--transition-fast);
}

.btn-text-link:hover {
  color: #fff;
}

/* Methodology Modal Specifics */
.methodology-modal-card {
  max-width: min(920px, 95vw);
  max-height: 90vh;
}

.methodology-nav-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1.5rem;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: thin;
}

.mnav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 0.25rem;
}

.mnav-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.mnav-pill:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.methodology-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.methodology-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.methodology-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
}

.mcard-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
}

.mcard-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.icon-cyan {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.icon-amber {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.icon-emerald {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.icon-gold {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.icon-teal {
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.mcard-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.2rem 0;
}

.mcard-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.mcard-content p {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 0.85rem 0;
}

.mcard-callout {
  background: rgba(6, 182, 212, 0.08);
  border-left: 3px solid var(--accent-cyan);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.84rem;
  color: var(--text-primary);
  margin: 0.85rem 0;
}

.mcard-list {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.mcard-list strong {
  color: var(--text-primary);
}

.mcard-proof-box {
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.proof-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #FBBF24;
  display: block;
  margin-bottom: 0.75rem;
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.proof-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
}

.proof-stat.stat-diff {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.35);
}

.pstat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.pstat-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.3;
}

.proof-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.card-highlight-pulse {
  animation: cardPulse 1.8s ease-in-out 2;
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.4) !important;
}

@keyframes cardPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.6);
  }
}

.hidden { display: none !important; }

/* ==========================================================================
   Mobile / Phone Responsive Layout
   These breakpoints apply automatically based on viewport width, so the
   compact layout activates on phones without any user action.
   ========================================================================== */
@media (max-width: 860px) {
  .header-container {
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    white-space: nowrap;
  }

  .header-badges {
    order: 2;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .scorecard-header,
  .leaderboard-quick-stats,
  .leaderboard-summary-header {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0.6rem 0.85rem;
  }

  .main-content {
    padding: 1rem 0.85rem;
  }

  .logo-subtitle {
    display: none;
  }

  .logo-brand {
    font-size: 1.1rem;
  }

  .panel-title {
    font-size: 1.25rem;
  }

  .nav-tab {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
  }

  .btn-info-badge span {
    display: none;
  }

  .search-grid,
  .leaderboard-grid,
  .provider-card-list {
    grid-template-columns: 1fr !important;
  }

  .form-actions,
  .form-actions-leaderboard {
    flex-wrap: wrap;
  }

  .form-actions .btn,
  .form-actions-leaderboard .btn {
    flex: 1 1 auto;
  }

  .quick-samples {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-subbar {
    flex-wrap: wrap;
  }

  .detail-header-main {
    flex-wrap: wrap;
  }

  .detail-title-row {
    gap: 0.5rem;
  }

  .stats-ribbon {
    grid-template-columns: 1fr 1fr;
  }
}


