/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
  --bg: #121418;
  --bg-card: #1a1e24;
  --bg-card-hover: #1f2430;
  --border: #2a2e34;
  --border-light: #353a42;
  --text: #e8e8e8;
  --text-muted: #8a8f98;
  --text-dim: #5a5f68;
  --accent: #E8722A;
  --accent-light: #f0944e;
  --teal: #3AAFA9;
  --teal-light: #5ec4bf;
  --gold: #f0c040;
  --coral: #e85d75;
  --slate-blue: #6c8ebf;
  --green: #4caf7d;
  --gray: #6b7280;

  --color-onsight: #f0c040;
  --color-flash: #4caf7d;
  --color-redpoint: #E8722A;
  --color-fell: #6b7280;
  --color-tr: #6c8ebf;

  --color-sport: #E8722A;
  --color-trad: #3AAFA9;
  --color-ice: #6c8ebf;
  --color-mountaineering: #e85d75;
  --color-ski: #a78bfa;
  --color-mixed: #f0c040;
  --color-aid: #6b7280;
  --color-learn: #5ec4bf;

  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'Consolas', monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-w: 250px;
  --header-h: 52px;
  --transition: 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   Auth Gate
   ============================================ */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.auth-gate.auth-gate--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-gate__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px 36px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-gate__icon {
  color: var(--accent);
}

.auth-gate__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.auth-gate__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: -8px;
}

.auth-gate__form {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.auth-gate__input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
}

.auth-gate__input:focus {
  border-color: var(--accent);
}

.auth-gate__btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition);
}

.auth-gate__btn:hover {
  background: var(--accent-light);
}

.auth-gate__error {
  font-size: 0.8rem;
  color: var(--coral);
  min-height: 1.2em;
}

.auth-gate__remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-gate__remember input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================
   Header
   ============================================ */
.dash-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.dash-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-header__icon {
  color: var(--accent);
}

.dash-header__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.data-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray);
  transition: background var(--transition);
}

.data-status--live .data-status__dot { background: var(--green); }
.data-status--cached .data-status__dot { background: var(--gold); }
.data-status--error .data-status__dot { background: var(--coral); }

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,114,42,0.08);
}

.refresh-btn.refreshing svg {
  animation: spin 0.7s linear infinite;
}

.dash-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============================================
   Filter Toggle (mobile)
   ============================================ */
.filter-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.filter-toggle__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--coral);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition);
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.sidebar__close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.sidebar__content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar__content::-webkit-scrollbar { width: 4px; }
.sidebar__content::-webkit-scrollbar-track { background: transparent; }
.sidebar__content::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 85;
}

/* Filter controls */
.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.style-toggle-row {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.style-tog {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex: 1;
  justify-content: center;
}

.style-tog:hover {
  border-color: var(--tog-color);
  color: var(--text);
}

.style-tog.active {
  background: var(--tog-color);
  border-color: var(--tog-color);
  color: #fff;
}

.style-tog__icon {
  font-size: 0.82rem;
  line-height: 1;
}

.style-tog__label {
  font-weight: 500;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pill {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.pill:hover { border-color: var(--accent); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-group--scrollable {
  max-height: 160px;
  overflow-y: auto;
}

.checkbox-group--scrollable::-webkit-scrollbar { width: 3px; }
.checkbox-group--scrollable::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.cb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.8rem;
}

.cb-item:hover { background: var(--bg-card-hover); }

.cb-item input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition);
}

.cb-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.cb-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 1px;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

.cb-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cb-item__count {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.grade-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grade-range__sep {
  color: var(--text-dim);
}

.search-input,
.select-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus,
.select-input:focus {
  border-color: var(--accent);
}

.select-input {
  cursor: pointer;
  flex: 1;
}

.select-input option {
  background: var(--bg-card);
  color: var(--text);
}

.btn-clear {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
}

.btn-clear:hover {
  border-color: var(--coral);
  color: var(--coral);
}

/* ============================================
   Dashboard Main
   ============================================ */
.dashboard {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - var(--header-h));
}

.dashboard__loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 80;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: opacity 0.3s ease;
}

.dashboard__loading[hidden] { display: none; opacity: 0; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Panels
   ============================================ */
.row { display: flex; gap: 16px; }

.row--kpi {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  overflow: visible;
  position: relative;
  z-index: 10;
}

.row--charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.row--pitches, .row--gradeyr {
  display: block;
}

.row--three {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.row--map, .row--table {
  display: block;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), opacity 0.4s ease;
  animation: fadeIn 0.4s ease both;
  display: flex;
  flex-direction: column;
}

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

.panel:hover { border-color: var(--border-light); }

.panel--full { width: 100%; }

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}

.panel__header .panel__title {
  padding: 0;
  flex: 1;
  min-width: 0;
}

.panel__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel__fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.panel__fs-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,114,42,0.08);
}

.panel--fullscreen {
  position: fixed !important;
  top: var(--header-h) !important;
  left: var(--sidebar-w) !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 95 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}

.panel--fullscreen .panel__header {
  flex-shrink: 0;
  padding: 16px 24px 0;
}

.panel--fullscreen .table-header {
  flex-shrink: 0;
}

.panel--fullscreen .panel__body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
}

.panel--fullscreen .panel__body--map {
  height: auto !important;
  flex: 1 1 0;
  min-height: 0;
  padding: 0;
}

.panel--fullscreen .panel__body--table {
  flex: 1 1 0;
  min-height: 0;
  padding: 0;
  overflow-y: auto;
}

/* SVG charts: constrain to available height, never overflow */
.panel--fullscreen .progression-svg,
.panel--fullscreen .pitches-svg,
.panel--fullscreen .gradeyr-svg,
.panel--fullscreen .treemap-svg {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: block;
}

.panel--fullscreen .scatter-wrap {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.panel--fullscreen .scatter-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Donut charts: center and scale to fit */
.panel--fullscreen .donut-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.panel--fullscreen .donut-svg {
  width: auto;
  height: auto;
  min-width: 140px;
  min-height: 140px;
  max-width: 50vh;
  max-height: 50vh;
  flex-shrink: 1;
}

.panel--fullscreen .donut-legend {
  gap: 8px;
  font-size: 0.9rem;
  overflow-y: auto;
  flex-shrink: 1;
  min-height: 0;
}

.panel--fullscreen .donut-legend__dot {
  width: 12px;
  height: 12px;
}

/* Pyramid / Partners: scroll if rows exceed space */
.panel--fullscreen #gradePyramid,
.panel--fullscreen #partnersChart {
  overflow-y: auto;
}

.panel--fullscreen .pyramid-row {
  margin-bottom: 6px;
  flex-shrink: 0;
}

.panel--fullscreen .pyramid-row__bar-wrap {
  height: 28px;
}

.panel--fullscreen .pyramid-row__label {
  font-size: 0.85rem;
  width: 52px;
}

.panel--fullscreen .pyramid-row__count {
  font-size: 0.82rem;
}

.panel--fullscreen .partner-row {
  margin-bottom: 10px;
  flex-shrink: 0;
}

.panel--fullscreen .partner-row__bar-wrap {
  height: 24px;
}

.panel--fullscreen .partner-row__name {
  font-size: 0.88rem;
  width: 140px;
}

.panel--fullscreen .partner-row__count {
  font-size: 0.82rem;
}

/* Fixed-height helpers inside fullscreen */
.panel--fullscreen .prog-toggles,
.panel--fullscreen .pyramid-legend,
.panel--fullscreen .scatter-legend {
  flex-shrink: 0;
}

.panel--fullscreen .table-pagination {
  flex-shrink: 0;
}

.panel--fullscreen .panel__fs-btn .fs-expand { display: none; }
.panel--fullscreen .panel__fs-btn .fs-collapse { display: inline !important; }

.panel-fs-backdrop {
  position: fixed;
  top: var(--header-h);
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 94;
  animation: fadeInBackdrop 0.2s ease;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel__body {
  padding: 12px 16px 16px;
  flex: 1 1 auto;
}

.panel__body--map {
  padding: 0;
  height: 400px;
  position: relative;
}

.panel__body--table {
  padding: 0;
  overflow-x: auto;
}

/* ============================================
   KPI Cards
   ============================================ */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: border-color var(--transition);
  animation: fadeIn 0.3s ease both;
}

.kpi-card:hover { border-color: var(--accent); }
.kpi-card.clickable { cursor: pointer; position: relative; }

.kpi-detail {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  z-index: 200;
  min-width: 220px;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 0.78rem;
  animation: fadeIn 0.15s ease;
}

.kpi-card.open { position: relative; z-index: 50; border-color: var(--accent); }
.kpi-card.open .kpi-detail { display: block; }

.kpi-detail__row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  gap: 12px;
}

.kpi-detail__row + .kpi-detail__row {
  border-top: 1px solid var(--border);
}

.kpi-detail__key {
  color: var(--text-muted);
  white-space: nowrap;
}

.kpi-detail__val {
  color: var(--text);
  font-family: var(--font-mono);
  text-align: right;
  word-break: break-word;
}

.kpi-card__icon {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.kpi-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.2;
  transition: color var(--transition);
}

.kpi-card__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card__sub {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 3px;
  letter-spacing: 0.02em;
}

/* ============================================
   Grade Pyramid
   ============================================ */
.pyramid-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.pyramid-row__label {
  width: 42px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.pyramid-row__bar-wrap {
  flex: 1;
  height: 18px;
  display: flex;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}

.pyramid-row__seg {
  height: 100%;
  transition: width var(--transition);
  position: relative;
  min-width: 0;
}

.pyramid-row__seg:hover { filter: brightness(1.2); }

.pyramid-row__count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  width: 28px;
  text-align: left;
  flex-shrink: 0;
}

.pyramid-mode-toggle {
  display: flex;
  gap: 2px;
  margin: 0 auto 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  width: fit-content;
}

.pyramid-mode-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pyramid-mode-btn:hover {
  color: var(--text);
}

.pyramid-mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.pyramid-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.pyramid-legend__item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.pyramid-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

/* ============================================
   Progression Chart
   ============================================ */
.progression-svg {
  width: 100%;
  height: auto;
  display: block;
}

.progression-svg text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.progression-svg .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.progression-svg .grid-line {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 2,4;
}

.progression-svg .data-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progression-svg .data-area {
  fill: url(#areaGrad);
  opacity: 0.3;
}

/* ============================================
   Pitches per Year Chart
   ============================================ */
.pitches-svg {
  width: 100%;
  height: auto;
  display: block;
}

.pitches-svg text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.pitches-svg .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.pitches-svg .grid-line {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 2,4;
}

.pitches-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: center;
  padding: 8px 0 4px;
  font-size: 0.72rem;
}

.pitches-legend__item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}

.pitches-legend__dot {
  width: 10px;
  height: 3px;
  border-radius: 1px;
}

.gradeyr-svg {
  width: 100%;
  height: auto;
  display: block;
}

.gradeyr-svg text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.gradeyr-svg .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.gradeyr-svg .grid-line {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 2,4;
}

.progression-svg .data-dot {
  fill: var(--accent);
  stroke: var(--bg-card);
  stroke-width: 2;
  cursor: pointer;
}

.progression-svg .data-dot:hover {
  r: 5;
  fill: var(--accent-light);
}

/* ============================================
   Scatter Plot
   ============================================ */
.scatter-svg {
  width: 100%;
  height: 280px;
}

.scatter-svg text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.scatter-svg .scatter-dot {
  cursor: pointer;
  transition: r 0.15s ease, opacity 0.15s ease;
}

.scatter-svg .scatter-dot:hover {
  r: 5;
  opacity: 1 !important;
}

.scatter-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.scatter-legend__item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.scatter-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.row--scatter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .row--scatter { grid-template-columns: 1fr; }
}

.treemap-svg {
  width: 100%;
  height: 320px;
}

.treemap-rect {
  stroke: var(--bg-card);
  stroke-width: 2;
  transition: opacity 0.15s ease;
  cursor: pointer;
}

.treemap-rect:hover {
  opacity: 0.85;
}

.treemap-label {
  fill: #fff;
  font-family: var(--font-main);
  font-weight: 600;
  pointer-events: none;
}

.treemap-count {
  fill: rgba(255,255,255,0.7);
  font-family: var(--font-mono);
  pointer-events: none;
}

.scatter-wrap {
  position: relative;
}

.scatter-popover {
  position: absolute;
  z-index: 200;
  min-width: 200px;
  max-width: 300px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  pointer-events: auto;
  font-size: 0.78rem;
}

.scatter-popover .kpi-detail__row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  gap: 12px;
}

.scatter-popover .kpi-detail__row + .kpi-detail__row {
  border-top: 1px solid var(--border);
}

.scatter-popover .kpi-detail__key {
  color: var(--text-muted);
  white-space: nowrap;
}

.scatter-popover .kpi-detail__val {
  color: var(--text);
  font-family: var(--font-mono);
  text-align: right;
}

.prog-toggles {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.prog-pill {
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--transition);
}

.prog-pill:hover { border-color: var(--text-muted); color: var(--text-muted); }
.prog-pill.active { border-color: var(--text-muted); color: var(--text); background: var(--bg-card-hover); }
.prog-pill.active.current { border-color: var(--accent); color: var(--accent); background: rgba(232,114,42,0.12); }

/* ============================================
   Donut Charts
   ============================================ */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.donut-svg {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  max-width: 40%;
}

.donut-svg circle {
  transition: stroke-dasharray var(--transition), stroke-dashoffset var(--transition);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  flex: 1;
  min-width: 0;
}

.donut-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.donut-legend__item:hover { background: var(--bg-card-hover); }

.donut-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.donut-legend__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-legend__val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ============================================
   Partners Chart
   ============================================ */
.partner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.partner-row__name {
  width: 100px;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.partner-row__bar-wrap {
  flex: 1;
  height: 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 2px;
  overflow: hidden;
}

.partner-row__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  border-radius: 2px;
  transition: width var(--transition);
}

.partner-row__count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ============================================
   Busiest Month
   ============================================ */
.busiest-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   Map
   ============================================ */
.leaflet-container {
  background: var(--bg) !important;
  border-radius: 0 0 var(--radius) var(--radius);
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-tip { background: var(--bg-card) !important; }

.leaflet-popup-content {
  font-family: var(--font) !important;
  font-size: 0.82rem !important;
  margin: 10px 14px !important;
}

.leaflet-popup-content h4 {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--accent);
}

.leaflet-popup-content .popup-stat {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
}

.leaflet-popup-content .popup-stat:last-child { border: none; }

.leaflet-popup-content .popup-stat span:last-child {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* ============================================
   Logbook Table
   ============================================ */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
  gap: 12px;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input--table {
  width: 200px;
}

.table-count {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.log-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition);
}

.log-table th:hover { color: var(--accent); }

.log-table th .sort-arrow {
  margin-left: 4px;
  font-size: 0.65rem;
  opacity: 0.4;
}

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

.log-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}

.log-table tr:hover td { background: var(--bg-card-hover); }

.log-table .grade-cell {
  font-family: var(--font-mono);
  font-weight: 500;
}

.route-link {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  color: var(--text-dim);
  margin-left: 4px;
  transition: color 0.15s ease;
}

.route-link:hover {
  color: var(--accent);
}

.log-table .style-icons {
  display: flex;
  gap: 3px;
}

.style-icon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.style-icon--on { background: var(--color-onsight); }
.style-icon--fl { background: var(--color-flash); }
.style-icon--rp { background: var(--color-redpoint); }
.style-icon--fi { background: var(--color-fell); }
.style-icon--tr { background: var(--color-tr); }
.style-icon--off { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 16px;
}

.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: default; }

/* ============================================
   Mobile Cards (table replacement)
   ============================================ */
.log-cards { display: none; }

.log-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}

.log-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.log-card__route {
  font-weight: 600;
  font-size: 0.88rem;
}

.log-card__grade {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  font-size: 0.88rem;
}

.log-card__details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   Tooltip
   ============================================ */
.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--text);
  z-index: 500;
  white-space: pre-line;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  display: none;
  max-width: 280px;
  line-height: 1.5;
  font-family: var(--font-mono);
  backdrop-filter: blur(8px);
}

.chart-tooltip.visible { display: block; }

/* ============================================
   Fun Facts
   ============================================ */
.row--funfacts { display: block; }

.fun-facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}

.fun-fact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}
.fun-fact-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.fun-fact__icon {
  font-size: 1.35rem;
  margin-bottom: 6px;
  line-height: 1;
}

.fun-fact__value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
  word-break: break-word;
}

.fun-fact__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fun-fact__sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

@media (max-width: 600px) {
  .fun-facts-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
  .fun-fact-card { padding: 12px 8px; }
  .fun-fact__value { font-size: 1.05rem; }
}

/* ============================================
   Footer
   ============================================ */
.dash-footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ============================================
   Year-over-Year Volume
   ============================================ */
.row--yoy { display: block; }

.yoy-svg {
  width: 100%;
  height: auto;
  display: block;
}

.yoy-svg text {
  font-family: var(--font-mono);
}

/* ============================================
   Send Rate + Milestones
   ============================================ */
.row--sendmile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sendrate-svg {
  width: 100%;
  height: auto;
  display: block;
}

.sendrate-svg text {
  font-family: var(--font-mono);
}

/* ============================================
   Grade Milestones
   ============================================ */
.milestones-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
}

.milestones-list::-webkit-scrollbar { width: 4px; }
.milestones-list::-webkit-scrollbar-track { background: transparent; }
.milestones-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.milestone-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.milestone-item:last-child { border-bottom: none; }

.milestone-item--highest {
  background: rgba(232, 114, 42, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.milestone-item__grade {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}

.milestone-item--highest .milestone-item__grade {
  color: var(--accent);
}

.milestone-item__line {
  width: 2px;
  min-height: 24px;
  align-self: stretch;
  background: var(--border-light);
  flex-shrink: 0;
}

.milestone-item--highest .milestone-item__line {
  background: var(--accent);
}

.milestone-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.milestone-item__route {
  font-size: 0.82rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.milestone-item__meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ============================================
   Activity Calendar
   ============================================ */
.row--calendar { display: block; }

.calendar-svg {
  display: block;
  width: 100%;
  height: auto;
}

.calendar-svg text {
  font-family: var(--font-mono);
}

.calendar-scroll {
  overflow-x: auto;
}

.calendar-scroll::-webkit-scrollbar { height: 4px; }
.calendar-scroll::-webkit-scrollbar-track { background: transparent; }
.calendar-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 8px 0 0;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.calendar-legend__cell {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.calendar-legend--type {
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-legend__type-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   Partner Performance
   ============================================ */
.row--partperf { display: block; }

.pperf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pperf-row__name {
  width: 100px;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.pperf-row__bar-wrap {
  flex: 1;
  height: 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 2px;
  overflow: visible;
  position: relative;
}

.pperf-row__bar-avg {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  border-radius: 2px;
  transition: width var(--transition);
}

.pperf-row__bar-max {
  position: absolute;
  top: -2px;
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 1px;
  transform: translateX(-50%);
}

.pperf-row__info {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
}

.pperf-row__count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Fullscreen overrides for new panels */
.panel--fullscreen .yoy-svg,
.panel--fullscreen .sendrate-svg,
.panel--fullscreen .calendar-svg {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: block;
}

.panel--fullscreen .milestones-list {
  max-height: none;
  overflow-y: auto;
}

.panel--fullscreen #partnerPerfChart {
  overflow-y: auto;
}

.panel--fullscreen .pperf-row {
  margin-bottom: 10px;
  flex-shrink: 0;
}

.panel--fullscreen .pperf-row__bar-wrap {
  height: 24px;
}

.panel--fullscreen .pperf-row__name {
  font-size: 0.88rem;
  width: 140px;
}

/* ============================================
   Current Level Cards
   ============================================ */
.row--current-level { display: block; }

.clevel-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.clevel-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  transition: border-color var(--transition);
}

.clevel-card:hover { border-color: var(--accent); }

.clevel-card__label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.clevel-card__value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.2;
}

.clevel-card__trend {
  margin-top: 4px;
}

.clevel-trend {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
}

.clevel-trend--up { color: var(--green); }
.clevel-trend--down { color: var(--coral); }
.clevel-trend--flat { color: var(--text-dim); }

.clevel-card__sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.clevel-card--volume .clevel-card__value {
  color: var(--teal);
}

/* ============================================
   Success Rate by Grade
   ============================================ */
.row--successrate { display: block; }

.sr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.sr-row__label {
  width: 42px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sr-row__bar-wrap {
  flex: 1;
  height: 18px;
  display: flex;
  border-radius: 2px;
  overflow: visible;
  background: rgba(255,255,255,0.03);
  position: relative;
}

.sr-row__seg {
  height: 100%;
  transition: width var(--transition);
  min-width: 0;
}

.sr-row__seg:hover { filter: brightness(1.2); }

.sr-row__threshold {
  position: absolute;
  top: -2px;
  width: 2px;
  height: calc(100% + 4px);
  background: var(--coral);
  opacity: 0.5;
  border-radius: 1px;
  pointer-events: none;
}

.sr-row__pct {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.sr-row__count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ============================================
   Onsight vs Redpoint Over Time
   ============================================ */
.row--onsightrp { display: block; }

.onsightrp-svg {
  width: 100%;
  height: auto;
  display: block;
}

.onsightrp-svg text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.onsightrp-svg .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.onsightrp-svg .grid-line {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 2,4;
}

/* ============================================
   Grade Velocity
   ============================================ */
.row--velocity {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.velocity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
}

.velocity-list::-webkit-scrollbar { width: 4px; }
.velocity-list::-webkit-scrollbar-track { background: transparent; }
.velocity-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.velocity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.velocity-item:last-child { border-bottom: none; }

.velocity-item--latest {
  background: rgba(232, 114, 42, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.velocity-item__grades {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 110px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.velocity-item__bar-wrap {
  flex: 1;
  height: 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 2px;
  overflow: hidden;
}

.velocity-item__bar {
  height: 100%;
  border-radius: 2px;
  transition: width var(--transition);
}

.velocity-item__days {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 48px;
  text-align: right;
  flex-shrink: 0;
  cursor: pointer;
}

/* ============================================
   Climbing Consistency
   ============================================ */
.consistency-svg {
  width: 100%;
  height: auto;
  display: block;
}

.consistency-svg text {
  font-family: var(--font-mono);
}

/* Fullscreen overrides for new panels */
.panel--fullscreen .onsightrp-svg,
.panel--fullscreen .consistency-svg {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: block;
}

.panel--fullscreen .velocity-list {
  max-height: none;
  overflow-y: auto;
}

.panel--fullscreen .sr-row {
  margin-bottom: 6px;
  flex-shrink: 0;
}

.panel--fullscreen .sr-row__bar-wrap {
  height: 28px;
}

.panel--fullscreen .sr-row__label {
  font-size: 0.85rem;
  width: 52px;
}

/* ============================================
   Panel Info Tooltips
   ============================================ */
.panel__info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}

.panel__info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition);
  flex-shrink: 0;
  font-family: var(--font);
}

.panel__info-btn:hover,
.panel__info-btn:focus {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,114,42,0.08);
}

.panel__info-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: -8px;
  width: 280px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.panel__info-tip::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 12px;
  width: 8px;
  height: 8px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  border-top: 1px solid var(--border-light);
  transform: rotate(45deg);
}

.panel__info-wrap:hover .panel__info-tip,
.panel__info-wrap:focus-within .panel__info-tip,
.panel__info-wrap.info-open .panel__info-tip {
  display: block;
}

@media (max-width: 768px) {
  .panel__info-tip {
    width: 220px;
    right: -4px;
    font-size: 0.72rem;
  }
}

/* ============================================
   Session Fatigue & Day-of-Week
   ============================================ */
.row--fatigue-dow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.fatigue-svg,
.dow-svg,
.restperf-svg,
.plateau-svg,
.volload-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .row--charts { grid-template-columns: 1fr; }
  .row--three { grid-template-columns: 1fr 1fr; }
  .row--velocity { grid-template-columns: 1fr; }
  .row--fatigue-dow { grid-template-columns: 1fr; }
  .clevel-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 300px;
    transform: translateX(-100%);
    z-index: 200;
    top: 0;
    padding-top: var(--header-h);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay { display: block; }
  .sidebar__close { display: block; }

  .filter-toggle { display: flex; }

  .dashboard { margin-left: 0; padding: 12px; gap: 12px; }

  .row--kpi {
    grid-template-columns: repeat(2, 1fr);
  }

  .row--kpi > :last-child {
    grid-column: 1 / -1;
  }

  .row--charts { grid-template-columns: 1fr; }
  .row--three { grid-template-columns: 1fr; }

  .panel__body--map { height: 300px; }

  .search-input--table { width: 140px; }

  .log-table { display: none; }
  .log-cards { display: block; }

  .table-header { flex-direction: column; align-items: stretch; }
  .table-controls { justify-content: space-between; }

  .row--sendmile { grid-template-columns: 1fr; }
  .row--velocity { grid-template-columns: 1fr; }
  .row--fatigue-dow { grid-template-columns: 1fr; }

  .clevel-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .velocity-item__grades {
    width: 80px;
    font-size: 0.68rem;
  }

  .donut-wrap {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
  }
  .donut-svg {
    width: 90px;
    height: 90px;
    max-width: 90px;
    flex-shrink: 0;
  }
  .donut-legend {
    flex: 1;
    min-width: 0;
    gap: 2px;
    overflow: hidden;
  }
  .donut-legend__item {
    padding: 2px 4px;
    font-size: 0.68rem;
  }
  .donut-legend__name {
    font-size: 0.68rem;
  }
  .donut-legend__val {
    font-size: 0.65rem;
  }
}

@media (max-width: 374px) {
  .row--kpi { grid-template-columns: 1fr; }
  .row--kpi > :last-child { grid-column: auto; }
  .kpi-card__value { font-size: 1.3rem; }
}
