/* ==========================================================================
   Girdwood Property Tax Analyzer
   Design: Nordic Government Noir
   A dark, authoritative interface for civic data
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */

:root {
  /* Z-score colors - saturated for dark backgrounds */
  --color-zscore-below-2: #22c55e;
  --color-zscore-below-1: #86efac;
  --color-zscore-average: #fbbf24;
  --color-zscore-above-1: #fb923c;
  --color-zscore-above-2: #ef4444;
  --color-zscore-excluded: #52525b;
  --color-new-construction: #a855f7;

  /* Core palette - deep slate with aurora accents */
  --color-bg-primary: #0c0f14;
  --color-bg-secondary: #12161e;
  --color-bg-tertiary: #1a1f2b;
  --color-bg-elevated: #222836;
  --color-bg-hover: #2a3142;

  /* Accent - aurora teal */
  --color-accent: #38bdf8;
  --color-accent-dim: #0ea5e9;
  --color-accent-glow: rgba(56, 189, 248, 0.15);
  --color-accent-subtle: rgba(56, 189, 248, 0.08);

  /* Text hierarchy - brightened for optimal dark mode readability */
  --color-text-primary: #f8fafc;    /* Was #f1f5f9 - pure near-white for headings */
  --color-text-secondary: #a8b8cc;  /* Was #94a3b8 - warmer, brighter body text */
  --color-text-muted: #7a8ba0;      /* Was #64748b - visible labels/captions */
  --color-text-dim: #5a6a7d;        /* Was #475569 - still subtle but legible */

  /* Borders and dividers */
  --color-border: rgba(148, 163, 184, 0.12);
  --color-border-subtle: rgba(148, 163, 184, 0.06);
  --color-border-strong: rgba(148, 163, 184, 0.2);

  /* Semantic colors */
  --color-positive: #22c55e;
  --color-negative: #ef4444;
  --color-warning: #f59e0b;

  /* Shadows - for dark mode depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--color-accent-glow);

  /* Typography */
  --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  /* Transitions */
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --transition-fast: 120ms var(--ease-out);
  --transition-base: 200ms var(--ease-out);
  --transition-slow: 320ms var(--ease-in-out);

  /* Layout */
  --header-height: 60px;
  --panel-width: 420px;
  --legend-width: 220px;

  /* Z-index layers */
  --z-base: 1;
  --z-overlay: 10;
  --z-panel: 100;
  --z-header: 200;
  --z-modal: 300;
  --z-tooltip: 400;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  min-height: 100vh;
  overflow: hidden;
}

::selection {
  background: var(--color-accent);
  color: var(--color-bg-primary);
}

/* Focus states */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

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

a:hover {
  color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; font-weight: 500; }
h4 { font-size: 0.875rem; }

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: -0.02em;
}

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

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

/* --------------------------------------------------------------------------
   App Layout
   -------------------------------------------------------------------------- */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--color-bg-primary);
}

.main-content {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: var(--header-height);
  padding: 0 var(--space-6);
  padding-top: env(safe-area-inset-top, 0);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  z-index: var(--z-header);
  position: relative;
}

/* Subtle top gradient line */
.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-accent-dim) 20%,
    var(--color-accent) 50%,
    var(--color-accent-dim) 80%,
    transparent 100%
  );
  opacity: 0.4;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.025em;
}

.header-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Search */
.header-search {
  flex: 1;
  max-width: 480px;
}

.search-container {
  position: relative;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-4);
  padding-left: 40px;
  font-family: var(--font-display);
  font-size: 16px; /* Prevents iOS auto-zoom on focus */
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.search-input::placeholder {
  color: var(--color-text-dim);
}

.search-input:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-elevated);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg-elevated);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.search-container::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill='%2364748b'%3E%3Cpath d='M432.4 272C432.4 183.6 360.8 112 272.4 112C184 112 112.4 183.6 112.4 272C112.4 360.4 184 432 272.4 432C360.8 432 432.4 360.4 432.4 272zM401.6 435.1C366.1 463.2 321.3 480 272.5 480C157.6 480 64.5 386.9 64.5 272C64.5 157.1 157.6 64 272.5 64C387.4 64 480.5 157.1 480.5 272C480.5 320.8 463.7 365.7 435.6 401.1L569.5 535L586.5 552L552.6 585.9L535.6 568.9L401.7 435z'/%3E%3C/svg%3E");
  background-size: contain;
  pointer-events: none;
}

/* Search Results */
.search-results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: var(--z-tooltip);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
}

.search-results.visible,
.search-results:not([hidden]) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--transition-fast);
}

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

.search-result-item:hover,
.search-result-item:focus {
  background: var(--color-bg-hover);
  outline: none;
}

.search-result-address {
  font-weight: 500;
  color: var(--color-text-primary);
}

.search-result-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.search-result-owner {
  color: var(--color-text-muted);
}

.search-result-change {
  font-family: var(--font-mono);
  font-weight: 500;
}

.search-no-results,
.search-error {
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.btn-dashboard {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-dashboard:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
}

.btn-dashboard[aria-expanded="true"] {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.btn-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-info:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
}

.btn-info[aria-expanded="true"] {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

/* --------------------------------------------------------------------------
   Map Container
   -------------------------------------------------------------------------- */

.map-container {
  flex: 1;
  position: relative;
  background: var(--color-bg-primary);
}

#map {
  width: 100%;
  height: 100%;
}

/* Mapbox overrides for dark theme */
.mapboxgl-ctrl-group {
  background: var(--color-bg-elevated) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
}

.mapboxgl-ctrl-group button {
  background: transparent !important;
  border: none !important;
}

.mapboxgl-ctrl-group button + button {
  border-top: 1px solid var(--color-border) !important;
}

.mapboxgl-ctrl-group button:hover {
  background: var(--color-bg-hover) !important;
}

.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,
.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,
.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {
  filter: invert(1) brightness(0.8);
}

.mapboxgl-popup-content {
  background: var(--color-bg-elevated) !important;
  border: 1px solid var(--color-border-strong) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: var(--space-3) var(--space-4) !important;
  font-family: var(--font-display) !important;
  color: var(--color-text-primary) !important;
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
  border-top-color: var(--color-bg-elevated) !important;
}

.mapboxgl-popup-close-button {
  color: var(--color-text-muted) !important;
  font-size: 1.25rem !important;
  padding: var(--space-2) !important;
}

.mapboxgl-popup-close-button:hover {
  color: var(--color-text-primary) !important;
  background: transparent !important;
}

/* --------------------------------------------------------------------------
   Legend
   -------------------------------------------------------------------------- */

.map-legend {
  position: absolute;
  bottom: var(--space-6);
  left: var(--space-4);
  width: var(--legend-width);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  z-index: var(--z-overlay);
  backdrop-filter: blur(8px);
}

.legend-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.legend-description {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3) 0;
  line-height: 1.4;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.legend-swatch {
  width: 24px;
  height: 12px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.legend-swatch-well-below { background: var(--color-zscore-below-2); }
.legend-swatch-below { background: var(--color-zscore-below-1); }
.legend-swatch-average { background: var(--color-zscore-average); }
.legend-swatch-above { background: var(--color-zscore-above-1); }
.legend-swatch-well-above { background: var(--color-zscore-above-2); }
.legend-swatch-exempt {
  background: transparent;
  border: 2px dashed var(--color-text-muted);
}
.legend-swatch-new-construction {
  background: var(--color-new-construction);
}

.legend-item-exempt {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

/* Legend Collapsible (Desktop) */
.legend-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.legend-title::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.map-legend.expanded .legend-title::after {
  transform: rotate(-135deg);
}

/* Hide legend content when collapsed */
.map-legend:not(.expanded) .mode-selector,
.map-legend:not(.expanded) .year-selector,
.map-legend:not(.expanded) .legend-description,
.map-legend:not(.expanded) .legend-items {
  display: none;
}

/* Tax Year Selector */
.year-selector {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-3);
  background: var(--color-bg-primary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.year-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.year-btn:hover {
  color: var(--color-text-secondary);
}

.year-btn.active {
  background: var(--color-accent);
  color: var(--color-bg-primary);
}

/* Hidden state for conditional visibility */
.year-selector.hidden,
.legend-item.hidden {
  display: none;
}

/* Display Mode Selector (Assessment / Land Value) */
.mode-selector {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-3);
  background: var(--color-bg-primary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.mode-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.mode-btn.active {
  background: var(--color-accent);
  color: var(--color-bg-primary);
}

/* --------------------------------------------------------------------------
   Top 10 New Construction Filter Toggle
   -------------------------------------------------------------------------- */

/* Filter Section at Top of Dashboard */
.filter-section-top {
  padding-bottom: var(--space-4) !important;
  margin-bottom: var(--space-4) !important;
  background: var(--color-bg-tertiary);
  margin: calc(-1 * var(--space-6)) !important;
  margin-bottom: var(--space-4) !important;
  padding: var(--space-4) var(--space-6) !important;
  border-bottom: 1px solid var(--color-border);
}

.filter-disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: var(--space-2) 0 0 0;
  line-height: 1.4;
}

.jit-section {
  padding-top: 0 !important;
  border-bottom: none !important;
}

.top10-filter-section {
  padding-bottom: 0 !important;
}

.top10-filter-toggle {
  display: flex;
  gap: 2px;
  background: var(--color-bg-primary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.top10-filter-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.top10-filter-btn:hover {
  color: var(--color-text-secondary);
}

.top10-filter-btn.active {
  background: var(--color-accent);
  color: var(--color-bg-primary);
}

/* JIT Education Tips */
.jit-tip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
}

.jit-tip-text {
  flex: 1;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.jit-tip-dismiss {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.jit-tip-dismiss:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------------------------
   Base Map Toggle
   -------------------------------------------------------------------------- */

.btn-basemap {
  position: absolute;
  bottom: var(--space-6);
  right: var(--space-4);
  height: 36px;
  padding: 0 var(--space-4);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  z-index: var(--z-overlay);
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.btn-basemap:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
}

/* --------------------------------------------------------------------------
   Property Panel
   -------------------------------------------------------------------------- */

.property-panel,
.panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--panel-width);
  height: 100%;
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: var(--z-panel);
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.property-panel.visible,
.property-panel:not([hidden]),
.panel.visible,
.panel:not([hidden]) {
  transform: translateX(0);
}

/* Ensure hidden panels stay hidden */
.property-panel[hidden],
.dashboard-panel[hidden],
.info-panel[hidden],
.panel[hidden] {
  display: none !important;
}

/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-shrink: 0;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.panel-title {
  flex: 1;
  min-width: 0;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* Property Panel Header - Unified Typography */
.panel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-1) 0 0 0;
}

.parcel-id {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--color-text-dim);
}

.property-status-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Property type badges */
.property-status-badge.status-residential {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.property-status-badge.status-condo {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.25);
}

.property-status-badge.status-commercial {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.property-status-badge.status-vacant {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.property-status-badge.status-other {
  color: var(--color-text-muted);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.property-status-badge.status-exempt {
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.owner-name {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin: var(--space-2) 0 0 0;
  letter-spacing: -0.01em;
}

/* Panel Close Button */
.panel-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.panel-close:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

/* Editor's Note Callout */
.editors-note {
  margin: var(--space-4) var(--space-6) 0;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.06) 0%,
    rgba(139, 92, 246, 0.04) 100%
  );
  border-left: 2px solid var(--color-accent-dim);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  position: relative;
}

.editors-note::before {
  content: 'Note';
  position: absolute;
  top: -8px;
  left: var(--space-3);
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-dim);
  background: var(--color-bg-secondary);
  padding: 2px 6px;
  border-radius: 2px;
}

.editors-note-text {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Panel Content */
.panel-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-6);
}

/* Custom scrollbar */
.panel-content::-webkit-scrollbar {
  width: 6px;
}

.panel-content::-webkit-scrollbar-track {
  background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-dim);
}

/* Legacy support for property panel rendering */
.property-address {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
  line-height: 1.3;
}

.property-parcel-id {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Panel Sections */
.panel-section {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
}

.panel-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-heading,
.panel-section h3 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.section-badge {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 2px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

.section-description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}

.section-disclaimer {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--color-warning);
  margin: 0 0 var(--space-2) 0;
}

/* Assessment History Timeline */
.assessment-timeline {
  position: relative;
  padding-left: 64px;
}

/* Continuous vertical line behind all nodes */
.assessment-timeline::before {
  content: '';
  position: absolute;
  left: 48px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--color-text-dim) 0%,
    var(--color-accent-dim) 50%,
    var(--color-text-dim) 100%
  );
  opacity: 0.4;
}

/* Timeline Node */
.timeline-node {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.timeline-marker {
  position: absolute;
  left: -64px;
  width: 64px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
  width: 32px;
  text-align: right;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-text-dim);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.timeline-node-current .timeline-dot {
  width: 12px;
  height: 12px;
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent-glow), 0 0 4px var(--color-accent);
}

.timeline-node-current .timeline-year {
  color: var(--color-accent);
  font-weight: 600;
}

.timeline-content {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.timeline-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
}

.timeline-node-current .timeline-value {
  color: var(--color-text-primary);
}

/* Timeline Connector */
.timeline-connector {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 40px;
  padding: var(--space-1) 0;
}

/* Hide the individual line segments - we use the ::before on parent now */
.timeline-line {
  display: none;
}

.timeline-change-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.timeline-change-dollar {
  font-weight: 600;
}

.timeline-change-divider {
  color: var(--color-text-dim);
  font-weight: 400;
}

.timeline-change-pct {
  opacity: 0.8;
}

/* Timeline Summary */
.timeline-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.timeline-summary-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.timeline-summary-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.timeline-summary-pct {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.85;
}

/* Value Breakdown Section */
.value-breakdown {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
}

.value-breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.value-breakdown-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

/* Stacked Composition Bar */
.value-composition-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-3);
  background: var(--color-bg-primary);
}

.composition-segment {
  height: 100%;
  transition: width var(--transition-base);
}

.composition-land {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

.composition-building {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
}

/* Breakdown Grid */
.value-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.breakdown-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.breakdown-indicator {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.breakdown-land {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

.breakdown-building {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
}

.breakdown-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex: 1;
}

.breakdown-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.breakdown-subvalue {
  flex-basis: 100%;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: -2px;
}

/* Taxable Value Row */
.taxable-value-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.taxable-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.taxable-label > span:first-child {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.taxable-note {
  font-size: 0.6875rem;
  color: var(--color-positive);
  font-style: italic;
}

.taxable-amount {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Legacy support - keep for dashboard/other uses */
.total-change {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.total-change span {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.total-change strong {
  font-family: var(--font-mono);
  font-size: 1rem;
}

/* Change colors */
.change-positive {
  color: var(--color-negative);
}

.change-negative {
  color: var(--color-positive);
}

/* Comparison Stats */
.comparison-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.comparison-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comparison-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.comparison-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

/* Z-Score Visualization */
.zscore-visualization {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.zscore-bar {
  margin-bottom: var(--space-3);
}

.zscore-bar-track {
  height: 8px;
  background: linear-gradient(
    to right,
    var(--color-zscore-below-2) 0%,
    var(--color-zscore-below-2) 16%,
    var(--color-zscore-below-1) 16%,
    var(--color-zscore-below-1) 33%,
    var(--color-zscore-average) 33%,
    var(--color-zscore-average) 66%,
    var(--color-zscore-above-1) 66%,
    var(--color-zscore-above-1) 83%,
    var(--color-zscore-above-2) 83%,
    var(--color-zscore-above-2) 100%
  );
  border-radius: 4px;
  position: relative;
}

.zscore-bar-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 16px;
  background: var(--color-text-primary);
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px var(--color-bg-tertiary);
}

.zscore-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: 0.6875rem;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zscore-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.zscore-label {
  font-weight: 600;
  font-size: 0.9375rem;
}

.zscore-percentile {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.zscore-interpretation {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.zscore-interpretation.positive {
  color: var(--color-positive);
}

.zscore-interpretation.negative {
  color: var(--color-negative);
}

.excluded-notice {
  font-size: 0.875rem;
  color: var(--color-text-dim);
  font-style: italic;
}

/* Property Details Grid */
.property-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.property-details dt {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
}

.property-details dd {
  font-size: 0.9375rem;
  color: var(--color-text-primary);
  font-weight: 500;
}

/* Tax Exemptions */
.exemption-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.exemption-amount {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-md);
}

.exemption-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-positive);
}

.exemption-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.exemption-types {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.exemption-type-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* Property Flags */
.property-flags {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.flag {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.flag-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.flag-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.flag-text {
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* External Link */
.panel-links {
  padding-top: var(--space-4);
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.external-link:hover {
  color: var(--color-text-primary);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.external-link svg {
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Dashboard Panel
   -------------------------------------------------------------------------- */

.dashboard-panel {
  width: var(--panel-width);
}

/* Summary Stats Grid */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
}

.stat-card.stat-primary {
  grid-column: span 2;
  background: var(--color-accent-subtle);
  border-color: rgba(56, 189, 248, 0.2);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.stat-primary .stat-value {
  font-size: 1.5rem;
  color: var(--color-accent);
}

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

/* Land Value Breakdown */
.land-value-breakdown {
  margin-bottom: var(--space-4);
}

.value-bar-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.value-bar {
  display: flex;
  height: 32px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-primary);
}

.value-bar-land {
  background: #34d399;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
}

.value-bar-building {
  background: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
}

.value-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-bg-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.value-bar-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.legend-item-land,
.legend-item-building {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-dot.land {
  background: #34d399;
}

.legend-dot.building {
  background: #60a5fa;
}

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

/* Segment Table */
.segment-table {
  overflow-x: auto;
}

.segment-table table {
  width: 100%;
  border-collapse: collapse;
}

.segment-table th,
.segment-table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}

.segment-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
}

.segment-table td {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.segment-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
}

.segment-table tbody tr:hover {
  background: var(--color-bg-tertiary);
}

/* Top Parcels List */
.top-parcels-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.top-parcel-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.top-parcel-item:hover {
  background: var(--color-bg-hover);
}

.top-parcel-item .rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-dim);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.top-parcel-item .parcel-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.top-parcel-item .address {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-parcel-item .change {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
  margin-left: var(--space-3);
}

/* --------------------------------------------------------------------------
   Loading States
   -------------------------------------------------------------------------- */

.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--color-bg-primary);
  z-index: var(--z-modal);
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.loading-overlay[hidden] {
  opacity: 0;
  pointer-events: none;
}

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

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

.loading-text {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Error States
   -------------------------------------------------------------------------- */

.error-container {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.error-container.visible,
.error-container:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.error-message {
  font-size: 0.875rem;
  color: var(--color-negative);
}

.btn-error-dismiss {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-negative);
  background: transparent;
  border: 1px solid var(--color-negative);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-error-dismiss:hover {
  color: var(--color-bg-primary);
  background: var(--color-negative);
}

/* --------------------------------------------------------------------------
   Data Table (used in dashboard)
   -------------------------------------------------------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}

.data-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
  background: var(--color-bg-tertiary);
}

.data-table td {
  color: var(--color-text-secondary);
}

.data-table tbody tr:hover {
  background: var(--color-bg-tertiary);
}

/* --------------------------------------------------------------------------
   Ranked List
   -------------------------------------------------------------------------- */

.ranked-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ranked-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
}

.ranked-list li:last-child {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Stat Highlight
   -------------------------------------------------------------------------- */

.stat-highlight {
  padding: var(--space-5);
  background: var(--color-accent-subtle);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-lg);
  text-align: center;
}

.stat-highlight .value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
}

.stat-highlight .label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   Distribution Stats
   -------------------------------------------------------------------------- */

.distribution-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.distribution-stats dt {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
  margin-bottom: var(--space-1);
}

.distribution-stats dd {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   Responsive: Tablet
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .property-panel,
  .dashboard-panel,
  .info-panel,
  .panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    max-height: 70vh;
    border-left: none;
    border-top: 1px solid var(--color-border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
    overflow: visible;
  }

  .property-panel.visible,
  .dashboard-panel.visible,
  .info-panel.visible,
  .panel.visible,
  .property-panel:not([hidden]),
  .dashboard-panel:not([hidden]),
  .info-panel:not([hidden]),
  .panel:not([hidden]) {
    transform: translateY(0);
  }

  /* Drag handle indicator */
  .panel::before,
  .property-panel::before,
  .dashboard-panel::before,
  .info-panel::before {
    content: '';
    position: absolute;
    top: var(--space-3);
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--color-border-strong);
    border-radius: 2px;
    z-index: 10;
  }

  /* Make entire panel scrollable on mobile - simplest approach */
  .property-panel,
  .dashboard-panel,
  .info-panel,
  .panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Add padding for drag handle */
  .panel-header {
    padding-top: var(--space-8);
  }

  /* Collapsed state - shows only header */
  .property-panel.collapsed {
    height: auto;
    max-height: none;
    overflow: hidden;
  }

  .property-panel.collapsed .panel-content {
    display: none;
  }

  /* Expanded state - full height */
  .property-panel.expanded {
    height: 85vh;
    max-height: 85vh;
    overflow-y: auto;
  }
}

/* --------------------------------------------------------------------------
   Responsive: Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
    --panel-width: 100%;
  }

  .header {
    padding: 0 var(--space-4);
    gap: var(--space-3);
  }

  .header-brand {
    display: none;
  }

  .header-search {
    max-width: none;
  }

  .header-subtitle {
    display: none;
  }

  .map-legend {
    bottom: auto;
    top: var(--space-4);
    left: var(--space-3);
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    padding: var(--space-3);
  }

  .map-legend .legend-description {
    font-size: 0.6875rem;
    line-height: 1.3;
  }

  .map-legend .mode-selector {
    flex-direction: column;
    gap: 4px;
  }

  .map-legend .mode-btn {
    padding: var(--space-2);
    font-size: 0.6875rem;
  }

  .map-legend .year-selector {
    flex-direction: column;
    gap: 4px;
  }

  .map-legend .year-btn {
    padding: var(--space-2);
    font-size: 0.6875rem;
  }

  /* Mobile: use +/- text instead of chevron */
  .legend-title::after {
    content: '+';
    border: none;
    width: auto;
    height: auto;
    transform: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
  }

  .map-legend.expanded .legend-title::after {
    content: '-';
    transform: none;
  }

  /* Mobile: add spacing when expanded */
  .map-legend.expanded .legend-items {
    margin-top: var(--space-3);
  }

  .map-legend.expanded .legend-description {
    margin-top: var(--space-2);
    margin-bottom: var(--space-1);
  }

  .map-legend.expanded .mode-selector {
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
  }

  .map-legend.expanded .year-selector {
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
  }

  .legend-title {
    margin-bottom: 0;
  }

  .btn-basemap {
    bottom: var(--space-4);
    right: var(--space-3);
    font-size: 0.75rem;
    height: 32px;
    padding: 0 var(--space-3);
  }

  .property-panel,
  .dashboard-panel,
  .info-panel,
  .panel {
    height: 85vh;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Override for collapsed/expanded states on mobile */
  .property-panel.collapsed {
    height: auto;
    max-height: none;
    overflow: hidden;
  }

  .property-panel.expanded {
    height: 85vh;
    max-height: 85vh;
    overflow-y: auto;
  }

  .property-details {
    grid-template-columns: 1fr;
  }

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

  .stat-card.stat-primary {
    grid-column: span 1;
  }
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* --------------------------------------------------------------------------
   Info Panel - Uses standard panel structure
   -------------------------------------------------------------------------- */

.info-panel {
  width: var(--panel-width);
}

/* Author display in info panel */
.info-author {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.info-author-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
}

.info-author-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* Downloads */
.info-downloads {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.download-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.download-link:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-accent);
}

.download-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-accent-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-accent);
  flex-shrink: 0;
}

.download-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.download-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

.download-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Disclaimer - warning box style */
.disclaimer-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.disclaimer-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.disclaimer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--color-warning);
  flex-shrink: 0;
}

.disclaimer-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-warning);
}

.disclaimer-box p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0 0 var(--space-3) 0;
}

.disclaimer-box p:last-child {
  margin-bottom: 0;
}

.disclaimer-box a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.disclaimer-box a:hover {
  color: var(--color-text-primary);
}

/* Panel Footer */
.panel-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  text-align: center;
}

.panel-footer-text {
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--color-text-dim);
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   Tutorial / Onboarding
   -------------------------------------------------------------------------- */

.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.tutorial-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.tutorial-spotlight {
  position: fixed;
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.4),
    0 0 0 3px var(--color-accent),
    0 0 20px 5px rgba(56, 189, 248, 0.5),
    inset 0 0 20px 5px rgba(56, 189, 248, 0.15);
  pointer-events: none;
  transition: all 0.4s ease-out;
  z-index: 501;
}

.tutorial-tooltip {
  position: fixed;
  max-width: 280px;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 20px var(--color-accent-glow);
  z-index: 503;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.tutorial-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Tooltip arrow */
.tutorial-tooltip::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent);
  border-right: none;
  border-bottom: none;
  transform: rotate(45deg);
}

.tutorial-tooltip.arrow-top::before {
  top: -7px;
  left: 24px;
}

.tutorial-tooltip.arrow-bottom::before {
  bottom: -7px;
  left: 24px;
  transform: rotate(-135deg);
}

.tutorial-tooltip.arrow-left::before {
  left: -7px;
  top: 50%;
  margin-top: -6px;
  transform: rotate(-45deg);
}

.tutorial-tooltip.arrow-right::before {
  right: -7px;
  top: 50%;
  margin-top: -6px;
  transform: rotate(135deg);
}

.tutorial-message {
  font-size: 0.9375rem;
  color: var(--color-text-primary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.tutorial-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.tutorial-progress {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.tutorial-btn {
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tutorial-btn-next {
  background: var(--color-accent);
  color: var(--color-bg-primary);
  border: none;
}

.tutorial-btn-next:hover {
  background: var(--color-accent-dim);
}

.tutorial-btn-skip {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.tutorial-btn-skip:hover {
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

/* Highlight effect for target elements during tutorial */
.tutorial-highlight {
  z-index: 502 !important;
  pointer-events: auto;
}

/* Map legend needs position preserved when highlighted */
.map-legend.tutorial-highlight {
  position: absolute;
}

/* Mobile adjustments for tutorial */
@media (max-width: 768px) {
  .tutorial-tooltip {
    max-width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
  }

  .tutorial-tooltip.arrow-top::before,
  .tutorial-tooltip.arrow-bottom::before {
    left: 50%;
    margin-left: -6px;
  }
}

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

@media print {
  body {
    background: white;
    color: black;
  }

  .header,
  .map-legend,
  .btn-basemap,
  .loading-overlay,
  .error-container {
    display: none !important;
  }

  .main-content {
    display: block;
  }

  .map-container {
    display: none;
  }

  .property-panel,
  .dashboard-panel,
  .info-panel,
  .panel {
    position: static;
    width: 100%;
    max-height: none;
    transform: none !important;
    background: white;
    border: none;
  }

  .info-panel {
    display: none;
  }

  .panel-close {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Building Panel (Multi-Unit Properties)
   -------------------------------------------------------------------------- */

.building-header .building-info {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-accent);
  margin: 0;
}

/* Building Summary Stats */
.building-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.building-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

.building-stat .stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.building-stat .stat-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Building Stats Grid (new compact layout) */
.building-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.building-stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

.building-stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.building-stat-card .stat-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-dim);
}

/* Unit Search/Filter */
.unit-search {
  margin-bottom: var(--space-4);
}

.unit-filter-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-4);
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.unit-filter-input::placeholder {
  color: var(--color-text-dim);
}

.unit-filter-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg-elevated);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

/* Unit List - no nested scroll, flows with panel */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Unit Card */
.unit-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.unit-card:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
}

.unit-card-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.unit-card-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

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

.unit-address {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-card-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.unit-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.unit-change {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  min-width: 50px;
  text-align: right;
}

.unit-card-owner {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  padding-left: 18px; /* Align with address after dot */
}

/* Missing Unit Card */
.unit-card.unit-missing {
  opacity: 0.6;
  cursor: default;
}

.unit-card.unit-missing:hover {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-subtle);
}

.unit-pending-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.15);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* No Units Found */
.no-units-found {
  text-align: center;
  padding: var(--space-6);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Missing Data Notice */
.missing-data-notice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--color-warning);
}

.notice-icon {
  font-size: 1rem;
}

/* Back to Building Button */
.back-to-building {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-accent);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
  margin-bottom: var(--space-3);
}

.back-to-building:hover {
  color: var(--color-text-primary);
}

.back-arrow {
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Map Popup - Redesigned
   -------------------------------------------------------------------------- */

.map-popup {
  min-width: 160px;
  max-width: 220px;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.popup-address {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.popup-unit-badge {
  display: inline-flex;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.popup-owner {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.popup-metric {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-subtle);
}

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

.popup-change {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.popup-period {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.popup-rank {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: auto;
}

.popup-rank-high {
  color: var(--color-negative);
  background: rgba(239, 68, 68, 0.15);
}

.popup-rank-low {
  color: var(--color-positive);
  background: rgba(34, 197, 94, 0.15);
}

/* Popup Exempt State */
.popup-exempt {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--color-text-muted);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border-subtle);
}

.popup-no-data {
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

/* ==========================================================================
   Dashboard Enhancements - Distribution Chart & Bar Charts
   ========================================================================== */

/* Stats Context Line */
.stats-context {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

.stats-context-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.stats-context-item::after {
  content: '•';
  margin-left: var(--space-2);
  color: var(--color-border);
}

.stats-context-item:last-child::after {
  display: none;
}

/* Distribution Breakdown */
.distribution-breakdown {
  padding: var(--space-2) 0;
}

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  margin-bottom: var(--space-4);
}

.distribution-bucket {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) var(--space-2);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  text-align: center;
  transition: transform var(--transition-fast);
}

.distribution-bucket:first-child {
  border-radius: var(--radius-md) var(--radius-sm) var(--radius-sm) var(--radius-md);
}

.distribution-bucket:last-child {
  border-radius: var(--radius-sm) var(--radius-md) var(--radius-md) var(--radius-sm);
}

.bucket-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-dim);
  margin-bottom: var(--space-1);
}

.bucket-range {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* Bucket sentiment colors */
.bucket-negative {
  border-bottom: 2px solid var(--color-zscore-below-2);
}

.bucket-neutral {
  border-bottom: 2px solid var(--color-zscore-below-1);
}

.bucket-highlight {
  background: var(--color-bg-elevated);
  border-bottom: 2px solid var(--color-accent);
}

.bucket-highlight .bucket-label {
  color: var(--color-accent);
}

.bucket-highlight .bucket-range {
  color: var(--color-text-primary);
  font-weight: 500;
}

.bucket-warm {
  border-bottom: 2px solid var(--color-zscore-above-1);
}

.bucket-hot {
  border-bottom: 2px solid var(--color-zscore-above-2);
}

/* Distribution Summary */
.distribution-summary {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.summary-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-dim);
}

.summary-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Responsive: stack buckets on mobile */
@media (max-width: 600px) {
  .distribution-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .distribution-bucket:first-child {
    border-radius: var(--radius-md) var(--radius-sm) var(--radius-sm) var(--radius-sm);
  }

  .distribution-bucket:last-child {
    border-radius: var(--radius-sm) var(--radius-sm) var(--radius-md) var(--radius-sm);
  }

  .distribution-bucket:nth-child(3) {
    border-radius: var(--radius-sm) var(--radius-md) var(--radius-sm) var(--radius-sm);
  }
}

/* Horizontal Bar Chart */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}

.bar-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.bar-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
}

.bar-count {
  font-size: 0.6875rem;
  color: var(--color-text-dim);
  margin-top: -2px;
}

.bar-track {
  height: 8px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width var(--transition-slow);
}

/* Bar colors based on value magnitude */
.bar-fill.bar-decrease {
  background: var(--color-zscore-below-2);
}

.bar-fill.bar-low {
  background: var(--color-zscore-below-1);
}

.bar-fill.bar-medium {
  background: var(--color-zscore-average);
}

.bar-fill.bar-high {
  background: var(--color-zscore-above-1);
}

.bar-fill.bar-very-high {
  background: var(--color-zscore-above-2);
}

/* Responsive adjustments for distribution chart */
@media (max-width: 480px) {
  .distribution-percentile-labels {
    font-size: 0.5625rem;
  }

  .distribution-track {
    height: 24px;
    margin: 0;
  }

  .distribution-value-labels {
    font-size: 0.6875rem;
    padding: 0;
  }

  .distribution-insights li {
    font-size: 0.75rem;
  }

  .bar-row {
    gap: var(--space-1);
  }

  .bar-track {
    height: 6px;
  }
}
