/* ============================================
   NYC Property Dossier — v6 "Glass Vision"
   Modern glassmorphism with Apple Vision Pro aesthetics
   Typography: Space Grotesk + JetBrains Mono + Playfair Display
   ============================================ */

/* --- Z-INDEX SCALE --- */
/*
  Base content layers:     1-10
  Content elements:        100-999
  Dropdowns & popovers:    1000-1999
  Sticky headers/buttons:  2000-2999
  Toasts & notifications:  9000-9999
  Modals & overlays:       10000+
*/

/* --- Universal Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
}

/* --- Design Tokens --- */
:root {
  /* Light base */
  --bg-deep: #f8fafc;
  --bg-base: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;

  /* Glass colors (light mode) */
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-strong: rgba(0, 0, 0, 0.14);
  --border: rgba(0, 0, 0, 0.08);
  --border-color: #e2e8f0;
  --glass-hover: rgba(0, 0, 0, 0.03);

  /* Aurora gradient colors */
  --aurora-blue: #2563eb;
  --aurora-indigo: #4f46e5;
  --aurora-purple: #7c3aed;
  --aurora-cyan: #0891b2;

  /* Text colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #586373; /* WCAG AA compliant contrast ratio 4.52:1 on #0f172a background */
  --text-faint: #6b7a8d;

  /* Accent colors (USGDS civic blues) */
  --accent-blue: #2563eb;
  --accent-indigo: #4f46e5;
  --accent-purple: #7c3aed;
  --accent-cyan: #0891b2;

  /* Status colors */
  --status-green: #059669;
  --status-amber: #b45309;
  --status-red: #dc2626;
  --status-blue: #2563eb;
  --status-blue-bg: rgba(37, 99, 235, 0.06);

  /* Color scales (Tailwind-style, used by tab JS files) */
  --red-50: #fef2f2; --red-100: #fee2e2; --red-600: #dc2626; --red-700: #b91c1c; --red-800: #991b1b;
  --green-50: #f0fdf4; --green-100: #dcfce7; --green-600: #16a34a; --green-700: #15803d;
  --amber-50: #fffbeb; --amber-100: #fef3c7; --amber-500: #f59e0b; --amber-600: #d97706; --amber-700: #b45309;
  --orange-50: #fff7ed; --orange-100: #ffedd5; --orange-600: #ea580c; --orange-700: #c2410c;
  --blue-50: #eff6ff; --blue-100: #dbeafe; --blue-600: #2563eb; --blue-700: #1d4ed8;
  --purple-50: #faf5ff; --purple-100: #f3e8ff; --purple-600: #9333ea; --purple-700: #7e22ce;
  --primary: #2563eb; --primary-50: #eff6ff; --primary-100: #dbeafe; --primary-600: #2563eb;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Space Grotesk', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px; --s9: 64px;

  /* Radius */
  --r1: 8px; --r2: 12px; --r3: 16px; --r4: 20px; --r-pill: 9999px;

  /* Shadows */
  --shadow-glass-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-glass-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-glass-lg: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-glow-blue: 0 0 20px rgba(37, 99, 235, 0.15);
  --shadow-glow-purple: 0 0 20px rgba(124, 58, 237, 0.15);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.2);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 150ms; --t-base: 250ms; --t-slow: 400ms;

  /* Layout */
  --header-h: 72px;
  --sidebar-w: 240px;
  --max-w: 1400px;
}

/* --- Dark Mode --- */
/* Manual dark mode toggle (class-based) */
html.dark-mode {
  /* Dark backgrounds */
  --bg-deep: #0a0a0a;
  --bg-base: #111111;
  --bg-surface: #1a1a1a;
  --bg-elevated: #1f1f1f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;

  /* Dark glass effects */
  --glass-bg: rgba(26, 26, 26, 0.75);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-strong: rgba(255, 255, 255, 0.18);
  --border: rgba(255, 255, 255, 0.1);
  --border-color: #2a2a2a;
  --glass-hover: rgba(255, 255, 255, 0.05);

  /* Dark text colors */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #8a99b3;
  --text-faint: #64748b;

  /* Aurora gradients */
  --aurora-blue: #3b82f6;
  --aurora-indigo: #6366f1;
  --aurora-purple: #8b5cf6;
  --aurora-cyan: #06b6d4;

  /* Accent colors */
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;

  /* Status colors */
  --status-green: #10b981;
  --status-amber: #f59e0b;
  --status-red: #ef4444;
  --status-blue: #3b82f6;
  --status-blue-bg: rgba(59, 130, 246, 0.08);

  /* Shadows */
  --shadow-glass-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-glass-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-glass-lg: 0 12px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.25);
  --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.25);
  --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Automatic dark mode from system preference */
@media (prefers-color-scheme: dark) {
  :root {
    /* Dark backgrounds */
    --bg-deep: #0a0a0a;
    --bg-base: #111111;
    --bg-surface: #1a1a1a;
    --bg-elevated: #1f1f1f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;

    /* Dark glass effects */
    --glass-bg: rgba(26, 26, 26, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-strong: rgba(255, 255, 255, 0.18);
    --border: rgba(255, 255, 255, 0.1);
    --border-color: #2a2a2a;
    --glass-hover: rgba(255, 255, 255, 0.05);

    /* Dark text colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #8a99b3; /* WCAG AA compliant for dark mode */
    --text-faint: #64748b;

    /* Aurora gradients (slightly brighter for dark mode) */
    --aurora-blue: #3b82f6;
    --aurora-indigo: #6366f1;
    --aurora-purple: #8b5cf6;
    --aurora-cyan: #06b6d4;

    /* Accent colors (adjusted for dark mode) */
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;

    /* Status colors (adjusted for dark mode) */
    --status-green: #10b981;
    --status-amber: #f59e0b;
    --status-red: #ef4444;
    --status-blue: #3b82f6;
    --status-blue-bg: rgba(59, 130, 246, 0.08);

    /* Shadows (darker for dark mode) */
    --shadow-glass-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-glass-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-glass-lg: 0 12px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.25);
    --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.25);
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.3);
  }

  /* Dark mode specific adjustments */
  .site-header {
    background: rgba(17, 17, 17, 0.85);
  }

  .site-footer {
    background: rgba(17, 17, 17, 0.8);
  }

  .sidebar {
    background: rgba(10, 10, 10, 0.8);
  }

  .aurora-bg {
    background:
      radial-gradient(ellipse at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.07) 0%, transparent 50%),
      radial-gradient(ellipse at 60% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
      radial-gradient(ellipse at 40% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  }

  .grain-overlay {
    opacity: 0.6;
  }

  .hero {
    background:
      radial-gradient(ellipse 60% 40% at 50% -10%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
      var(--bg-base);
  }

  .card-head,
  .data-table th,
  .collapsible-body {
    background: rgba(255, 255, 255, 0.03);
  }

  .data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.04);
  }

  .data-table {
    border-color: rgba(255, 255, 255, 0.12);
  }

  .data-table th,
  .data-table td {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }

  .leaflet-popup-content-wrapper {
    background: rgba(26, 26, 26, 0.95);
  }

  .leaflet-popup-tip {
    background: rgba(26, 26, 26, 0.95);
  }

  .nav-links {
    background: rgba(17, 17, 17, 0.95);
  }

  ::selection {
    background: rgba(59, 130, 246, 0.25);
    color: var(--text-primary);
  }

  /* Dark mode badge color adjustments for better contrast */
  .badge-amber {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
  }

  .badge-red {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
  }

  .badge-green {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
  }

  /* Dark mode color scale overrides for better contrast */
  :root {
    --red-700: #f87171;
    --red-800: #ef4444;
    --orange-700: #fb923c;
  }

  /* Dark mode component overrides */
  .health-bar {
    background: rgba(255, 255, 255, 0.05);
  }

  .error-state {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
  }

  .error-state .retry-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
  }

  .error-state .retry-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.45);
  }

  /* Dark mode chart canvas adjustment */
  canvas {
    filter: brightness(0.92) contrast(1.05);
  }
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--s4);
  background: var(--accent-blue);
  color: #fff;
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  z-index: 10000;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: var(--s3);
}

/* --- Keyboard Navigation & Accessibility --- */

/* Focus visible styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Focus states for specific components */
.sidebar-tab:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-blue);
  outline: none;
}

.collapsible-toggle:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-blue);
  outline: none;
  background: var(--glass-hover);
}

.btn:focus-visible,
button:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
  outline: none;
}

.nav-link:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-blue);
  outline: none;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Dark mode adjustments for focus states */
@media (prefers-color-scheme: dark) {
  :focus-visible {
    outline-color: var(--accent-indigo);
  }

  .sidebar-tab:focus-visible,
  .collapsible-toggle:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent-indigo);
  }

  .btn:focus-visible,
  button:focus-visible {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.4);
  }

  .nav-link:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent-indigo);
  }
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

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

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

a:hover {
  color: var(--accent-cyan);
}

::selection {
  background: rgba(37, 99, 235, 0.15);
  color: var(--text-primary);
}

/* --- Aurora Background --- */
.aurora-bg {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(79, 70, 229, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 70%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 80%, rgba(8, 145, 178, 0.03) 0%, transparent 50%);
  animation: aurora 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes aurora {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(5%, -5%) rotate(2deg); }
  66% { transform: translate(-5%, 5%) rotate(-2deg); }
}

/* --- Grain Overlay --- */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.015'/%3E%3C/svg%3E");
  opacity: 1;
  pointer-events: none;
  z-index: 1;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
}

h1 { font-size: 3rem; line-height: 1.1; }
h2 { font-size: 2rem; line-height: 1.2; }
h3 { font-size: 1.5rem; line-height: 1.3; }
h4 { font-size: 1rem; line-height: 1.4; }

p {
  color: var(--text-secondary);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
  letter-spacing: -0.01em;
}

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

/* --- Layout --- */
.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.main-content {
  flex: 1;
  padding-top: var(--header-h);
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s6);
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  z-index: 1000;
  transition: background var(--t-base);
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), var(--accent-purple), transparent);
  opacity: 0.4;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
  color: var(--text-primary) !important;
  text-decoration: none !important;
  transition: transform var(--t-base) var(--ease);
}

.logo:hover {
  transform: translateY(-1px);
}

.logo-mark {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r1);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass-sm);
  transition: all var(--t-base);
}

.logo:hover .logo-mark {
  box-shadow: var(--shadow-glow-blue);
}

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

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.logo-accent {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tagline {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: var(--s1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted) !important;
  border-radius: var(--r-pill);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-hover);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.nav-link:hover::before {
  opacity: 1;
}

.nav-link:hover {
  color: var(--text-secondary) !important;
}

.nav-link.active {
  color: var(--accent-blue) !important;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass-sm);
}

.nav-icon {
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity var(--t-fast);
}

.nav-link.active .nav-icon {
  opacity: 1;
}

.nav-label {
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-glass-sm);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-green);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}

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

.status-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* --- Comprehensive Status Badge System --- */
/* Base pill with dot indicator */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all var(--t-base);
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

/* Severity variants */
.status-pill--open {
  background: #fee2e2;
  color: #dc2626;
}

.status-pill--closed {
  background: #dcfce7;
  color: #16a34a;
}

.status-pill--pending {
  background: #fef3c7;
  color: #d97706;
}

.status-pill--active {
  background: #dbeafe;
  color: #2563eb;
}

.status-pill--expired {
  background: #f3f4f6;
  color: #6b7280;
}

.status-pill--critical {
  background: #fecaca;
  color: #991b1b;
  animation: pulse-badge 2s infinite;
}

.status-pill--resolved {
  background: #d1fae5;
  color: #065f46;
}

.status-pill--issued {
  background: #dbeafe;
  color: #1e40af;
}

.status-pill--approved {
  background: #dcfce7;
  color: #166534;
}

.status-pill--filed {
  background: #fef3c7;
  color: #92400e;
}

/* Dark mode variants */
body.dark-mode .status-pill--open {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
}

body.dark-mode .status-pill--closed {
  background: rgba(22, 163, 74, 0.2);
  color: #86efac;
}

body.dark-mode .status-pill--pending {
  background: rgba(217, 119, 6, 0.2);
  color: #fcd34d;
}

body.dark-mode .status-pill--active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

body.dark-mode .status-pill--expired {
  background: rgba(107, 114, 128, 0.2);
  color: #d1d5db;
}

body.dark-mode .status-pill--critical {
  background: rgba(153, 27, 27, 0.2);
  color: #fca5a5;
}

body.dark-mode .status-pill--resolved {
  background: rgba(6, 95, 70, 0.2);
  color: #6ee7b7;
}

body.dark-mode .status-pill--issued {
  background: rgba(30, 64, 175, 0.2);
  color: #93c5fd;
}

body.dark-mode .status-pill--approved {
  background: rgba(22, 101, 52, 0.2);
  color: #86efac;
}

body.dark-mode .status-pill--filed {
  background: rgba(146, 64, 14, 0.2);
  color: #fcd34d;
}

/* Badge pulse animation */
@keyframes pulse-badge {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  50% {
    opacity: 0.9;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0);
  }
}

/* --- Severity-Based Row Highlighting --- */
/* Applies to violation/permit/complaint list items */
.violation-item--open,
.permit-item--open,
.complaint-item--open {
  border-left: 3px solid #dc2626;
  padding-left: calc(var(--s4) - 3px);
}

.violation-item--closed,
.permit-item--closed,
.complaint-item--closed {
  border-left: 3px solid #16a34a;
  padding-left: calc(var(--s4) - 3px);
}

.violation-item--pending,
.permit-item--pending,
.complaint-item--pending {
  border-left: 3px solid #d97706;
  padding-left: calc(var(--s4) - 3px);
}

.violation-item--critical {
  border-left: 3px solid #991b1b;
  padding-left: calc(var(--s4) - 3px);
  background: rgba(220, 38, 38, 0.03);
}

body.dark-mode .violation-item--open,
body.dark-mode .permit-item--open,
body.dark-mode .complaint-item--open {
  border-left-color: #fca5a5;
}

body.dark-mode .violation-item--closed,
body.dark-mode .permit-item--closed,
body.dark-mode .complaint-item--closed {
  border-left-color: #86efac;
}

body.dark-mode .violation-item--pending,
body.dark-mode .permit-item--pending,
body.dark-mode .complaint-item--pending {
  border-left-color: #fcd34d;
}

body.dark-mode .violation-item--critical {
  border-left-color: #fca5a5;
  background: rgba(220, 38, 38, 0.1);
}

/* Hover states for interactive items */
.violation-item--open:hover,
.permit-item--open:hover,
.complaint-item--open:hover {
  background: rgba(220, 38, 38, 0.05);
}

.violation-item--closed:hover,
.permit-item--closed:hover,
.complaint-item--closed:hover {
  background: rgba(22, 163, 74, 0.05);
}

body.dark-mode .violation-item--open:hover,
body.dark-mode .permit-item--open:hover,
body.dark-mode .complaint-item--open:hover {
  background: rgba(220, 38, 38, 0.15);
}

body.dark-mode .violation-item--closed:hover,
body.dark-mode .permit-item--closed:hover,
body.dark-mode .complaint-item--closed:hover {
  background: rgba(22, 163, 74, 0.15);
}

.nav-toggle {
  display: none;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r1);
  padding: var(--s2);
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  transition: all var(--t-base);
}

.nav-toggle:hover {
  background: var(--glass-hover);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all var(--t-base);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--glass-border);
  padding: var(--s5) var(--s6);
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.footer-stat {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* --- Hero / Search --- */
.hero {
  padding: var(--s9) 0 var(--s8);
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(37, 99, 235, 0.05) 0%, transparent 60%),
    var(--bg-base);
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), var(--accent-purple), transparent);
  opacity: 0.4;
}

.hero-content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s6);
  text-align: center;
}

.hero h1 {
  margin-bottom: var(--s4);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 50%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 8s ease infinite;
  background-size: 200% auto;
}



.hero p {
  max-width: 560px;
  margin: 0 auto var(--s7);
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.search-mode-bar {
  display: flex;
  justify-content: center;
  gap: var(--s2);
  margin-bottom: var(--s6);
}

.mode-btn {
  padding: var(--s2) var(--s5);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--t-base);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.mode-btn:hover {
  color: var(--text-secondary);
  background: var(--glass-hover);
  box-shadow: var(--shadow-glass-sm);
}

.mode-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border-color: transparent;
  box-shadow: var(--shadow-glow-blue);
  font-weight: 600;
}

.search-box {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--s5);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
  z-index: 2;
  transition: color var(--t-base);
}

.search-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: 8px;
  position: absolute;
  right: var(--s5);
  pointer-events: none;
  z-index: 2;
}

kbd {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  font-family: var(--font-mono);
}

.search-input {
  width: 100%;
  padding: var(--s4) var(--s5) var(--s4) 52px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  outline: none;
  transition: all var(--t-base);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass-md);
}

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

.search-input:focus,
.search-input:focus-visible {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-focus), var(--shadow-glow-blue);
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.search-input:focus + .search-icon {
  color: var(--accent-blue);
}

.search-spinner {
  position: absolute;
  right: var(--s5);
  width: 18px;
  height: 18px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.8s linear infinite;
}

.search-spinner.visible {
  opacity: 1;
}



/* --- Recent Search Chips --- */
.recent-searches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s3);
}

.recent-chip {
  padding: var(--s1) var(--s3);
  border-radius: var(--r-pill);
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  transition: all var(--t-fast);
  font-family: var(--font-body);
  font-weight: 500;
}

.recent-chip:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glass-sm);
}

/* --- Autocomplete --- */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + var(--s3));
  left: 0;
  right: 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-glass-lg);
  max-height: 440px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-dropdown.visible {
  display: block;
  animation: slideDown var(--t-slow) var(--ease);
}



.autocomplete-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--t-fast);
  position: relative;
}

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

.autocomplete-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-hover);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.autocomplete-item:hover::before,
.autocomplete-item.highlighted::before {
  opacity: 1;
}

.autocomplete-item-icon {
  position: relative;
  z-index: 1;
  color: var(--accent-blue);
  font-size: 16px;
  opacity: 0.6;
  transition: opacity var(--t-fast);
}

.autocomplete-item:hover .autocomplete-item-icon,
.autocomplete-item.highlighted .autocomplete-item-icon {
  opacity: 1;
}

.autocomplete-item-label {
  position: relative;
  z-index: 1;
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 500;
}

.autocomplete-item-sub {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* --- Result Preview (mini property card) --- */
.result-preview {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.preview-metric {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: var(--glass-bg, rgba(255,255,255,0.5));
  border-radius: 4px;
  border: 1px solid var(--glass-border, rgba(0,0,0,0.06));
}

.preview-loading {
  opacity: 0.6;
  font-style: italic;
}

.preview-error {
  color: var(--text-error, #ef4444);
  opacity: 0.8;
}

/* --- Property Layout --- */
.property-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-h));
}

/* --- Sidebar --- */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: rgba(248, 250, 252, 0.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  padding: var(--s6) 0;
  scroll-behavior: smooth;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--glass-border-strong);
}

.property-content::-webkit-scrollbar,
.data-table-wrap::-webkit-scrollbar,
.autocomplete-dropdown::-webkit-scrollbar {
  width: 4px;
}
.property-content::-webkit-scrollbar-track,
.data-table-wrap::-webkit-scrollbar-track,
.autocomplete-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.property-content::-webkit-scrollbar-thumb,
.data-table-wrap::-webkit-scrollbar-thumb,
.autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 2px;
}
.property-content::-webkit-scrollbar-thumb:hover,
.data-table-wrap::-webkit-scrollbar-thumb:hover,
.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--glass-border-strong);
}

.sidebar-section-label {
  padding: var(--s2) var(--s5);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.sidebar-tab {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s5);
  margin: 2px var(--s3);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--r1);
  cursor: pointer;
  width: calc(100% - var(--s6));
  transition: all var(--t-base);
  text-align: left;
  position: relative;
}

.sidebar-tab::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-purple));
  border-radius: 2px;
  transition: height var(--t-base) var(--ease);
}

.sidebar-tab:hover {
  background: var(--glass-hover);
  color: var(--text-secondary);
  transform: scale(1.02);
}

.sidebar-tab:active {
  transform: scale(0.98);
  transition-duration: 0.1s;
}

.sidebar-tab.active {
  background: var(--glass-bg);
  color: var(--accent-blue);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass-sm);
}

.sidebar-tab.active::before {
  height: 60%;
}

.sidebar-tab-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--t-fast);
}

.sidebar-tab.active .sidebar-tab-icon {
  opacity: 1;
}

.sidebar-tab-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px var(--s2);
  min-width: 24px;
  text-align: center;
  border-radius: var(--r-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-faint);
  transition: all var(--t-base);
  opacity: 0;
  transform: scale(0.8);
}

.sidebar-tab.active .sidebar-tab-count {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--accent-blue);
}

.sidebar-tab-count.has-data {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--accent-blue);
  opacity: 1;
  transform: scale(1);
}

.sidebar-tab-count:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.sidebar-tab-count.has-critical:hover {
  animation: pulse-critical 0.6s ease-in-out;
}

@keyframes pulse-critical {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.15); }
}

.sidebar-tab-count.has-critical {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: var(--status-red);
  opacity: 1;
  transform: scale(1);
}

.sidebar-tab-count.has-warning {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.3);
  color: var(--status-amber);
  opacity: 1;
  transform: scale(1);
}

.sidebar-tab-count.has-success {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
  color: var(--status-green);
  opacity: 1;
  transform: scale(1);
}

/* --- Property Content --- */
.property-content {
  padding: var(--s6);
  overflow-y: auto;
  background: var(--bg-base);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabFadeIn 0.2s ease;
}

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

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

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

/* --- Pagination Animation --- */
.paginated-item-new,
.list-item-animated {
  animation: fadeSlideIn 0.3s ease forwards;
}

/* Staggered entrance for multiple items */
.paginated-item-new:nth-child(1) { animation-delay: 0ms; }
.paginated-item-new:nth-child(2) { animation-delay: 50ms; }
.paginated-item-new:nth-child(3) { animation-delay: 100ms; }
.paginated-item-new:nth-child(4) { animation-delay: 150ms; }
.paginated-item-new:nth-child(5) { animation-delay: 200ms; }
.paginated-item-new:nth-child(6) { animation-delay: 250ms; }
.paginated-item-new:nth-child(7) { animation-delay: 300ms; }
.paginated-item-new:nth-child(8) { animation-delay: 350ms; }
.paginated-item-new:nth-child(9) { animation-delay: 400ms; }
.paginated-item-new:nth-child(10) { animation-delay: 450ms; }

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--s4);
  font-family: var(--font-body);
}

.breadcrumb a {
  color: var(--accent-blue);
  text-decoration: none;
  cursor: pointer;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--text-faint);
}

/* --- Profile Header --- */
.profile-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s5);
  margin-bottom: var(--s7);
  flex-wrap: wrap;
  padding: var(--s6);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass-md);
  position: relative;
  overflow: hidden;
}

.profile-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  opacity: 0.6;
}

.profile-address {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: var(--s2);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  word-break: break-word;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.profile-actions {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  align-self: center;
}

/* --- Quick Facts Panel --- */
.quick-facts-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass-sm);
  padding: var(--s5);
  margin-bottom: var(--s6);
  transition: all var(--t-base);
}

.quick-facts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s4);
}

.quick-fact {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
}

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

.quick-fact-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-fact-value.quick-fact-status {
  font-weight: 700;
}

.quick-fact-value.status-green {
  color: var(--status-green);
}

.quick-fact-value.status-amber {
  color: var(--status-amber);
}

.quick-fact-value.status-red {
  color: var(--status-red);
}

.quick-fact-value.status-blue {
  color: var(--status-blue);
}

.quick-fact-sub {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.quick-fact-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  height: 56px;
  border-radius: var(--r1);
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Cards --- */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  overflow: hidden;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass-sm);
  transition: all var(--t-base), transform var(--t-base) var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-glass-md);
  border-color: var(--glass-border-strong);
  transform: translateY(-2px);
}

.card:active {
  transform: translateY(1px);
  transition-duration: 0.1s;
}

.card:focus-within {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  box-shadow: var(--shadow-focus), var(--shadow-glass-md);
}

.card + .card {
  margin-top: var(--s4);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.015);
}

.card-head h4 {
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 600;
}

.card-body {
  padding: var(--s5);
}

/* --- Health Score Bar --- */
.health-bar {
  height: var(--s2);
  border-radius: var(--s1);
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: var(--s2) 0;
}

.health-bar-fill {
  height: 100%;
  border-radius: var(--s1);
  transition: width 0.8s ease-out;
}

.health-bar-fill.score-good {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.health-bar-fill.score-fair {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.health-bar-fill.score-poor {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.health-score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px var(--s3);
  min-height: 28px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--t-base);
}

.badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.badge-blue {
  color: var(--accent-blue);
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
}

.badge-muted {
  color: var(--text-muted);
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.badge-green {
  color: var(--status-green);
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.2);
}

.badge-red {
  color: var(--status-red);
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.2);
}

.badge-amber {
  color: var(--status-amber);
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.25);
}

.badge-purple {
  color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.2);
}

.clickable-badge {
  cursor: pointer;
  transition: all 0.2s ease;
}

.clickable-badge:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}
.clickable-badge:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s5);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-hover);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn:hover {
  color: var(--text-primary);
  box-shadow: var(--shadow-glass-sm);
}

.btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.btn-accent {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border-color: transparent;
  font-weight: 600;
  box-shadow: var(--shadow-glow-blue);
}

.btn-accent::before {
  background: rgba(255, 255, 255, 0.1);
}

.btn-accent:hover {
  box-shadow: var(--shadow-glow-blue), var(--shadow-glass-md);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.btn-sm {
  padding: 8px var(--s3);
  font-size: 0.8125rem;
  min-height: 36px;
}

.btn.favorited {
  color: #ffffff;
  border-color: #d97706;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.btn.favorited:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
  transform: translateY(-2px);
}

/* Star bounce animation on save */
.btn.just-saved {
  animation: starBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes starBounce {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.15) rotate(-5deg); }
  50% { transform: scale(1.3) rotate(5deg); }
  75% { transform: scale(1.15) rotate(-3deg); }
}

/* Star icon styling */
#fav-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fav-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#fav-btn:hover::after {
  opacity: 1;
}

#fav-btn:not(.favorited) {
  border-color: var(--glass-border-strong);
  background: var(--glass-bg);
}

#fav-btn:not(.favorited):hover {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  transform: translateY(-1px);
}

/* Saved property list enhancements */
.saved-property-item {
  transition: all 0.3s ease;
  position: relative;
}

.saved-property-item:hover {
  transform: translateX(4px);
  background: var(--glass-hover);
}

.saved-star {
  color: #f59e0b !important;
  font-size: 1.25rem;
  animation: starGlow 2s ease-in-out infinite;
}

@keyframes starGlow {
  0%, 100% { text-shadow: 0 0 4px rgba(245, 158, 11, 0.3); }
  50% { text-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }
}

.saved-time {
  color: var(--text-muted);
  font-size: 0.875em;
  font-weight: 400;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.saved-property-item:hover .quick-action-btn {
  opacity: 1;
}

.quick-action-btn:hover {
  background: var(--glass-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: scale(1.1);
}

.quick-action-btn.remove-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.compare-count {
  display: none;
  padding: 2px 6px;
  margin-left: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.15);
  border-radius: 10px;
  color: var(--accent-blue);
}

/* --- Compare Table --- */
.compare-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--r3);
  background: var(--bg-card);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 480px;
}
.compare-table thead {
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
  z-index: 2;
}
.compare-table th,
.compare-table td {
  padding: var(--s3) var(--s4);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}
.compare-label-col {
  width: 140px;
  min-width: 120px;
}
.compare-prop-col {
  min-width: 180px;
  text-align: center !important;
}
.compare-label {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  background: var(--bg-tertiary);
  position: sticky;
  left: 0;
  z-index: 1;
}
.compare-value {
  font-size: 0.82rem;
  color: var(--text-primary);
  text-align: center;
}
.compare-diff {
  background: rgba(37, 99, 235, 0.04);
}
.compare-diff .compare-value {
  font-weight: 600;
}

@media (max-width: 767px) {
  .compare-label-col { width: 100px; min-width: 100px; }
  .compare-table { font-size: 0.75rem; }
  .compare-table th, .compare-table td { padding: var(--s2) var(--s3); }
}

/* --- Stat Grid --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s4);
}

.stat-card {
  padding: var(--s6) var(--s5);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  text-align: center;
  position: relative;
  overflow: hidden;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: all var(--t-base);
  cursor: default;
}

.stat-card[title] {
  cursor: help;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0;
  transition: opacity var(--t-base);
}

.stat-card:hover {
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-glass-md);
  transform: translateY(-2px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 6px;
}

.stat-value.accent {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* --- Collapsible Sections --- */
.collapsible {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r2);
  margin-bottom: var(--s3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease), box-shadow var(--t-fast);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.collapsible::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-purple));
  opacity: 0;
  transition: width var(--t-base), opacity var(--t-base);
}

.collapsible:hover {
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-glass-sm);
}

.collapsible.open {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-glass-md);
}

.collapsible.open::before {
  width: 3px;
  opacity: 1;
}

.collapsible-toggle {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: var(--s4) var(--s5);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  transition: background var(--t-fast);
}

.collapsible-toggle:hover {
  background: var(--glass-hover);
}

.collapsible-toggle:hover .collapsible-chevron {
  transform: translateX(2px);
  color: var(--accent-blue);
}

.collapsible.open .collapsible-toggle:hover .collapsible-chevron {
  transform: rotate(90deg) translateY(2px);
}

.collapsible-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.3s var(--ease-spring), color var(--t-base) var(--ease);
  margin-right: var(--s2);
  flex-shrink: 0;
}

.collapsible.open .collapsible-chevron {
  transform: rotate(90deg);
  color: var(--accent-blue);
}

.collapsible-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 var(--s5);
  border-top: 1px solid transparent;
  background: rgba(0, 0, 0, 0.01);
  opacity: 0;
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out, padding 0.3s ease-out, border-color 0.2s ease-out;
}

.collapsible.open .collapsible-body {
  max-height: 3000px; /* Large enough for most content */
  padding: var(--s4) var(--s5) var(--s5);
  border-top-color: var(--glass-border);
  opacity: 1;
  transition: max-height 0.4s ease-in, opacity 0.3s ease-in 0.1s, padding 0.4s ease-in, border-color 0.3s ease-in;
}

/* --- Date Box --- */
.date-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  padding: var(--s2) 0;
  flex-shrink: 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r1);
  font-family: var(--font-mono);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.date-box-month {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-blue);
  letter-spacing: 0.06em;
}

.date-box-day {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.date-box-year {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

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

.data-table th {
  text-align: left;
  padding: var(--s3) var(--s4);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-base);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 10;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.data-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-secondary);
  vertical-align: top;
  transition: background var(--t-fast);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.data-table tr:hover td {
  background: var(--glass-hover);
}

.data-table td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

.data-table-wrap {
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--r2);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  position: relative;
}

/* --- Health Score Circle --- */
.risk-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.risk-green { border-color: var(--status-green) !important; }
.risk-amber { border-color: var(--status-amber) !important; }
.risk-red { border-color: var(--status-red) !important; }

/* --- Button Group --- */
.btn-group {
  display: flex;
  gap: var(--s2);
  align-items: center;
  flex-wrap: wrap;
}

/* --- Alert Boxes --- */
.alert-box {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  padding: var(--s5);
  border-radius: var(--r3);
  margin-bottom: var(--s4);
  border: 1px solid;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.alert-box-blue {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.15);
}

.alert-box-red {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.15);
}

.alert-box-green {
  background: rgba(5, 150, 105, 0.06);
  border-color: rgba(5, 150, 105, 0.15);
}

.alert-box-amber {
  background: rgba(217, 119, 6, 0.06);
  border-color: rgba(217, 119, 6, 0.15);
}

.alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.alert-text h4 {
  font-size: 0.9375rem;
  margin-bottom: 4px;
}

.alert-text p {
  font-size: 0.875rem;
  line-height: 1.6;
}

.owner-info h4 {
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.owner-info p {
  font-size: 0.8125rem;
}

/* --- Skeleton Loading --- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e9ecef;
  border-radius: 6px;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 1.5s infinite;
}



/* Dark mode shimmer adjustment */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: #2d3748;
  }
  .skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  }
}

.skeleton-text { height: 14px; margin: 8px 0; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.wide { width: 80%; }
.skeleton-text.long { width: 90%; }
.skeleton-title { height: 22px; width: 50%; margin: 12px 0 16px; }
.skeleton-card { height: 80px; margin: 8px 0; padding: 16px; border-radius: 8px; }
.skeleton-row { display: flex; gap: 12px; margin: 8px 0; }
.skeleton-row .skeleton { flex: 1; height: 40px; }

/* Legacy skeleton line for backwards compat */
.skeleton-line {
  height: 14px;
  margin-bottom: var(--s3);
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

/* --- Empty / Error States --- */
.empty-state {
  text-align: center;
  padding: var(--s9) var(--s6);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--s5);
  opacity: 0.35;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: var(--s3);
  color: var(--text-secondary);
  font-family: var(--font-display);
}

.empty-state p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Property List Items --- */
.property-list-item {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--t-fast);
  position: relative;
}

.property-list-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-hover);
  opacity: 0;
  transition: opacity var(--t-fast);
}

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

.property-list-item:hover::before {
  opacity: 1;
}

.property-list-icon {
  position: relative;
  z-index: 1;
  color: var(--accent-blue);
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity var(--t-fast);
}

.property-list-item:hover .property-list-icon {
  opacity: 1;
}

.property-list-address {
  position: relative;
  z-index: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.property-list-meta {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.property-list-chevron {
  position: relative;
  z-index: 1;
  color: var(--text-muted);
  font-size: 18px;
  margin-left: auto;
  transition: all var(--t-fast);
}

.property-list-item:hover .property-list-chevron {
  transform: translateX(3px);
  color: var(--accent-blue);
}

/* --- Summary Grid --- */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}

.summary-item {
  padding: var(--s4) var(--s5);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: all var(--t-base);
}

.summary-item:hover {
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-glass-sm);
}

.summary-item-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.summary-item-value {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* --- Map --- */
.map-frame {
  width: 100%;
  height: 280px;
  border-radius: var(--r3);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass-sm);
}

.map-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  filter: none;
}

/* --- Map Container (Leaflet) --- */
.map-container {
  padding: var(--s7) var(--s6) var(--s8);
  max-width: 1400px;
  margin: 0 auto;
}

.map-header {
  margin-bottom: var(--s6);
}

.map-title {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--s2);
}

.map-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.map-instructions {
  margin-top: var(--s5);
  padding: var(--s5);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.map-instructions p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0;
}

#property-map {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--glass-border);
}

/* Override Leaflet popup styles to match design system */
.leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: var(--r3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.95);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: var(--s6);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: var(--s4) var(--s7);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #ffffff;
  border-radius: var(--r-pill);
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: var(--shadow-glass-lg), var(--shadow-glow-blue);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  z-index: 9000; /* Toasts layer */
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.toast.toast-success { background: rgba(16, 185, 129, 0.95); }
.toast.toast-error { background: rgba(239, 68, 68, 0.95); }

/* --- AI Badge --- */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
  padding: var(--s2) var(--s4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* --- Section Heading --- */
.section-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--s4);
  margin-top: var(--s6);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--glass-border);
  position: relative;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  opacity: 0.7;
}

.section-heading:first-child {
  margin-top: 0;
}

/* --- Source Link --- */
.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: var(--s2);
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r1);
  text-decoration: none !important;
  transition: all var(--t-base);
  vertical-align: middle;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  position: relative;
}
.source-link::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: var(--r2);
}

.source-link:hover {
  color: var(--accent-blue);
  border-color: rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.06);
  box-shadow: var(--shadow-glass-sm);
}

/* --- Responsive --- */
@media (max-width: 767px) {
  :root {
    --header-h: 64px;
  }

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

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    top: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-top: 1px solid var(--glass-border);
    padding: 0;
    z-index: 100;
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar {
    scrollbar-width: none;
  }

  .sidebar-section-label {
    display: none;
  }

  .sidebar-tab {
    padding: var(--s3) var(--s4);
    margin: 0;
    border-radius: 0;
    min-width: auto;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    min-height: 44px;
    justify-content: center;
    scroll-snap-align: start;
    border-top: 3px solid transparent;
    transition: border-color 0.2s ease;
  }

  .sidebar-tab.active {
    border-top-color: var(--accent-blue);
  }

  .sidebar-tab::before {
    display: none;
  }

  .sidebar-tab-icon {
    display: block;
    font-size: 1.1rem;
  }

  .sidebar-tab-label {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
  }

  .sidebar-tab-count {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.65rem;
    padding: 2px 4px;
    min-width: 16px;
    height: 16px;
    line-height: 12px;
  }

  .property-content {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .hero {
    padding: var(--s8) 0 var(--s7);
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 0.9375rem;
  }

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

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

  .stat-value {
    font-size: 1.5rem;
  }

  .badge {
    padding: 8px var(--s3);
    min-height: 36px;
  }

  .btn-sm {
    padding: 10px var(--s4);
    min-height: 40px;
  }

  .collapsible-toggle {
    min-height: 48px;
  }

  .profile-bar {
    flex-direction: column;
  }

  .profile-address {
    font-size: 1.75rem;
  }

  .nav-toggle {
    display: flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--s3);
    gap: var(--s2);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    border-radius: var(--r2);
    justify-content: flex-start;
  }

  .status-pill {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    gap: var(--s2);
    text-align: center;
  }

  .logo-tagline {
    display: none;
  }

  .data-table-wrap,
  .data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .data-table-wrap::after,
  .data-table-wrapper::after {
    content: '→';
    position: sticky;
    right: 0;
    top: 0;
    padding: var(--s2) var(--s3);
    background: linear-gradient(to left, var(--glass-bg) 60%, transparent);
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--accent-blue);
    font-weight: 600;
    pointer-events: none;
    float: right;
    height: 100%;
    display: flex;
    align-items: center;
    min-width: 40px;
    opacity: 0.7;
  }

  .data-table {
    min-width: 600px;
  }

  /* Larger touch targets on mobile */
  .data-table td,
  .data-table th {
    padding: var(--s4) var(--s3);
    min-height: 44px;
  }

  .sidebar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .back-to-top {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .dark-mode-toggle {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .filter-bar {
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: var(--s2) var(--s3);
  }

  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .stats-bar {
    flex-wrap: wrap;
  }

  .stats-bar-item {
    min-width: calc(33% - var(--s3));
  }

  .data-row {
    flex-wrap: wrap;
  }

  .data-row-date {
    width: auto;
  }

  /* Key-value grids → single column on mobile */
  .kv-grid {
    grid-template-columns: 1fr !important;
  }

  /* Search input → full width, hide kbd hint */
  .search-input {
    padding-right: var(--s4);
  }

  .search-input-wrap kbd {
    display: none;
  }
}

@media (max-width: 640px) {
  /* Enhanced table handling on small screens */
  .data-table-wrap,
  .data-table-wrapper {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table th,
  .data-table td {
    white-space: nowrap;
    min-width: 100px;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: var(--s7) 0 var(--s6);
  }

  .hero h1 {
    font-size: 1.875rem;
  }

  .profile-address {
    font-size: 1.375rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 1.25rem;
  }

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

/* --- Stagger Animations --- */
.stat-card,
.collapsible,
.summary-item {
  animation: staggerIn var(--t-slow) var(--ease) backwards;
}

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 60ms; }
.stat-card:nth-child(3) { animation-delay: 120ms; }
.stat-card:nth-child(4) { animation-delay: 180ms; }
.stat-card:nth-child(5) { animation-delay: 240ms; }
.stat-card:nth-child(6) { animation-delay: 300ms; }

.collapsible:nth-child(1) { animation-delay: 0ms; }
.collapsible:nth-child(2) { animation-delay: 50ms; }
.collapsible:nth-child(3) { animation-delay: 100ms; }
.collapsible:nth-child(4) { animation-delay: 150ms; }
.collapsible:nth-child(5) { animation-delay: 200ms; }

.summary-item:nth-child(1) { animation-delay: 0ms; }
.summary-item:nth-child(2) { animation-delay: 80ms; }
.summary-item:nth-child(3) { animation-delay: 160ms; }
.summary-item:nth-child(4) { animation-delay: 240ms; }
.summary-item:nth-child(5) { animation-delay: 320ms; }
.summary-item:nth-child(6) { animation-delay: 400ms; }

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

/* --- Tab Badge Pop Animation --- */
.tab-count.animated {
  animation: badge-pop 0.3s var(--ease-spring);
}

@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.filter-btn {
  padding: 6px var(--s3);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--r-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-base) var(--ease), background var(--t-base), color var(--t-base), transform var(--t-fast);
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--glass-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-glow-blue);
}

.filter-count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  background: var(--glass-bg);
  margin-left: 4px;
}

.filter-btn.active .filter-count {
  background: rgba(255,255,255,0.3);
}

/* --- Violation Severity Indicators --- */
.severity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.severity-critical { background: var(--status-red); box-shadow: 0 0 6px rgba(220, 38, 38, 0.4); }
.severity-warning { background: var(--status-amber); }
.severity-info { background: var(--accent-blue); }
.severity-ok { background: var(--status-green); }

/* --- Source Pills for LLC Engine --- */
.source-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
}

.source-pill.p1 { background: rgba(5, 150, 105, 0.12); color: #059669; }
.source-pill.p2 { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.source-pill.p3 { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.source-pill.p4 { background: rgba(217, 119, 6, 0.12); color: #d97706; }

/* --- Owner Avatar --- */
.owner-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

/* --- Data Table Enhancements --- */
.data-table th {
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  background: var(--bg-surface);
}

.data-table th .sort-arrow {
  margin-left: var(--s1);
  opacity: 0.3;
  font-size: 0.7rem;
}

.data-table th.sorted .sort-arrow {
  opacity: 1;
}

/* --- Responsive Improvements (consolidated into 768px block above) --- */

/* --- Summary Cards --- */
.violation-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s5);
}

.summary-card {
  padding: var(--s3);
  border-radius: 4px;
  border-left: 3px solid var(--glass-border-strong);
}

.summary-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.summary-card-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.summary-card-detail {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* --- Inline Style Replacement Utilities --- */
.text-detail {
  font-size: 0.78rem;
}
.text-muted-sm {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Focus Styles (Accessibility) --- */
.btn:focus-visible,
.nav-link:focus-visible,
.mode-btn:focus-visible,
.sidebar-tab:focus-visible,
.collapsible-toggle:focus-visible,
.property-list-item:focus-visible,
.filter-btn:focus-visible,
.source-link:focus-visible,
.autocomplete-item:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.autocomplete-item:focus-visible {
  box-shadow: var(--shadow-focus);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Disable aurora and gradient animations */
  .aurora-bg {
    animation: none !important;
  }

  .hero h1 {
    animation: none !important;
    background: var(--text-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .skeleton {
    animation: none !important;
  }

  .status-dot {
    animation: none !important;
  }
}

/* --- Disabled States --- */
.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.filter-btn:disabled, .mode-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* --- Link Focus --- */
a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Loading Button State --- */
.btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* --- Back to Top Button --- */
.back-to-top {
  position: fixed;
  bottom: 72px;
  right: 20px;
  z-index: 999;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--card-bg, rgba(255,255,255,0.9));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-color);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary, #2563eb);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* --- Dark Mode Toggle --- */
.dark-mode-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--card-bg, rgba(255,255,255,0.9));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-color);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-mode-toggle:hover {
  background: var(--primary, #2563eb);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.dark-mode-toggle:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* --- Cell Truncate Utility --- */
.cell-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-truncate:hover {
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  background: var(--glass-bg);
  box-shadow: var(--shadow-glass-md);
  position: relative;
  z-index: 5;
  padding: var(--s2);
  border-radius: var(--r1);
}

/* --- Glossary Tooltips --- */
.glossary-term {
  position: relative;
  border-bottom: 1px dashed var(--text-muted);
  cursor: help;
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease);
}

.glossary-term:hover,
.glossary-term:focus,
.glossary-term:focus-within {
  border-bottom-color: var(--accent-blue);
}

/* Tooltip popup */
.glossary-term::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--s2) var(--s3);
  background: var(--bg-deep);
  color: var(--text-primary);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--r1);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  max-width: 280px;
  box-shadow: var(--shadow-glass-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  z-index: 1000;
  font-family: var(--font-body);
}

.glossary-term:hover::after,
.glossary-term:focus::after,
.glossary-term:focus-within::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Arrow pointer */
.glossary-term::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--bg-deep);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
  z-index: 1001;
}

.glossary-term:hover::before,
.glossary-term:focus::before,
.glossary-term:focus-within::before {
  opacity: 1;
}

/* Mobile: Show tooltip on tap/focus */
@media (max-width: 767px) {
  .glossary-term::after {
    max-width: 220px;
    white-space: normal;
    font-size: 12px;
  }

  /* Make tooltips tappable on mobile */
  .glossary-term {
    -webkit-tap-highlight-color: transparent;
  }

  .glossary-term:active::after,
  .glossary-term:active::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .glossary-term::after {
    background: var(--bg-elevated);
    border-color: var(--glass-border-strong);
  }

  .glossary-term::before {
    border-top-color: var(--bg-elevated);
  }
}

/* --- Print Styles --- */
@media print {
  /* Reset to clean white background */
  body {
    background: #fff !important;
    font-size: 11pt;
    color: #000;
  }

  /* Hide interactive elements and navigation */
  .sidebar,
  .site-header,
  .site-footer,
  .nav-bar,
  .nav-links,
  .nav-toggle,
  .profile-actions,
  .search-area,
  .search-box,
  .hero,
  .toast,
  .autocomplete-dropdown,
  .search-spinner,
  .source-link,
  .filter-btn,
  .mode-btn,
  .btn-sm[onclick],
  .btn[onclick],
  .back-to-top,
  .dark-mode-toggle,
  .breadcrumb {
    display: none !important;
  }

  /* Hide decorative elements */
  .aurora-bg,
  .grain-overlay,
  .skip-link {
    display: none !important;
  }

  /* Full-width layout */
  .property-layout {
    display: block;
    grid-template-columns: none !important;
  }

  .property-content {
    margin: 0 !important;
    padding: 1rem !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: visible !important;
    height: auto !important;
  }

  /* Show all collapsible sections open */
  .collapsible {
    page-break-inside: avoid;
    margin-bottom: 1rem;
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .collapsible-body {
    max-height: none !important;
    display: block;
    overflow: visible !important;
    height: auto !important;
    border-top: 1px solid #ddd !important;
    background: #fff !important;
  }

  .collapsible-chevron {
    display: none;
  }

  /* Profile bar - prominent at top */
  .profile-bar {
    border: 2px solid #000 !important;
    border-radius: 0 !important;
    padding: 12pt !important;
    margin-bottom: 16pt !important;
    background: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
  }

  .profile-bar::before {
    display: none !important;
  }

  .profile-address {
    font-size: 18pt;
    margin-bottom: 8pt;
    color: #000;
  }

  .profile-meta {
    margin-bottom: 0;
  }

  /* Remove glassmorphism effects */
  .card,
  .stat-card,
  .summary-item,
  .alert-box,
  .data-table-wrap,
  .map-instructions {
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
  }

  /* Badges with visible borders */
  .badge {
    border: 1px solid #666 !important;
    background: #fff !important;
    padding: 4pt 8pt;
  }

  /* Remove animations and transitions */
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Page break rules */
  .tab-panel {
    display: block !important;
    page-break-inside: avoid;
    margin-bottom: 1.5rem;
  }

  .tab-panel:not(.active) {
    display: none !important;
  }

  .card,
  .stat-card,
  .summary-item {
    page-break-inside: avoid;
  }

  /* Links */
  a {
    color: #000;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: "";
  }

  /* Reasonable margins */
  @page {
    margin: 0.75in;
  }

  /* Tables */
  .data-table {
    border-collapse: collapse;
  }

  .data-table th,
  .data-table td {
    border: 1px solid #ccc;
    padding: 6pt;
  }

  .data-table th {
    background: #f5f5f5 !important;
    font-weight: bold;
  }

  /* Ensure consistent spacing */
  h1, h2, h3, h4 {
    page-break-after: avoid;
    color: #000;
  }

  /* Table row page breaks */
  .data-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .data-table thead {
    display: table-header-group;
  }

  .data-table tbody {
    display: table-row-group;
  }

  .collapsible-header {
    page-break-after: avoid;
  }

  /* Status indicators remain visible */
  .badge-blue { color: #2563eb; }
  .badge-red { color: #dc2626; }
  .badge-green { color: #059669; }
  .badge-amber { color: #92400e; }
}

/* --- Error State Styles --- */
.error-state {
  padding: var(--s4);
  text-align: center;
  color: var(--text-muted);
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--r3);
  margin: var(--s3) 0;
}

.error-state .retry-btn {
  margin-top: var(--s3);
  padding: 6px 16px;
  border-radius: var(--r-pill);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  font-family: var(--font-body);
  font-weight: 500;
}

.error-state .retry-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glass-sm);
}

.error-state .retry-btn:active {
  transform: scale(0.98);
}

/* --- Page Transition Animation --- */


#main-content,
.property-layout,
#search-results {
  animation: fadeIn 0.3s ease-out;
}


.stat-value.warn {
  color: var(--status-amber);
}

/* --- Alerts/Notifications --- */
.alert-bell-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r1);
  padding: var(--s2);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
}

.alert-bell-btn:hover {
  background: var(--bg-surface);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-1px);
}

.alert-bell-btn.active {
  background: var(--status-blue-bg);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.alert-bell-btn.active:hover {
  background: rgba(37, 99, 235, 0.12);
}

.bell-icon {
  font-size: 18px;
  line-height: 1;
}

.alert-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--status-red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: var(--r-pill);
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-base);
  font-family: var(--font-mono);
}

.alert-summary-badge {
  background: var(--status-red);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow-glass-sm);
}

.alerts-panel {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r3);
  padding: var(--s4);
  margin-top: var(--s4);
  box-shadow: var(--shadow-glass-md);
}

.alerts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--border);
}

.alerts-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-item {
  padding: var(--s3);
  border-radius: var(--r2);
  background: var(--bg-surface);
  margin-bottom: var(--s2);
  display: flex;
  align-items: start;
  gap: var(--s3);
  border: 1px solid var(--border);
  transition: all var(--t-fast) var(--ease);
}

.alert-item:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-blue);
  transform: translateX(4px);
  box-shadow: var(--shadow-glass-sm);
}

.alert-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.alert-item-icon.violation {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-red);
}

.alert-item-icon.permit {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-blue);
}

.alert-item-icon.sale {
  background: rgba(5, 150, 105, 0.1);
  color: var(--status-green);
}

.alert-item-content {
  flex: 1;
}

.alert-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.alert-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.alert-empty {
  text-align: center;
  padding: var(--s6);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.alert-empty-icon {
  font-size: 2rem;
  margin-bottom: var(--s3);
  opacity: 0.5;
}

@media (prefers-color-scheme: dark) {
  .alert-badge {
    box-shadow: 0 0 0 2px var(--bg-base);
  }

  .alert-item {
    background: var(--bg-elevated);
  }

  .alert-item:hover {
    background: var(--bg-surface);
  }
}

/* --- Comparison Table --- */
.comparison-table-wrapper {
  overflow-x: auto;
  margin-top: var(--s5);
}

.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-base);
  border-radius: var(--r2);
  overflow: hidden;
  box-shadow: var(--shadow-glass-sm);
}

.comparison-table thead {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #ffffff;
}

.comparison-table th {
  padding: var(--s4);
  text-align: left;
  font-weight: 600;
  font-size: 0.9375rem;
  border-bottom: 2px solid var(--glass-border);
}

.comparison-field-header {
  position: sticky;
  left: 0;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  z-index: 2;
  min-width: 180px;
}

.comparison-property-header {
  text-align: center;
  min-width: 200px;
}

.comparison-table tbody tr {
  transition: background var(--t-fast) var(--ease);
}

.comparison-table tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

.comparison-table tbody tr:hover {
  background: var(--glass-hover);
}

.comparison-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.comparison-field-label {
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-primary);
  z-index: 1;
  border-right: 2px solid var(--border);
}

.comparison-table tbody tr:nth-child(even) .comparison-field-label {
  background: var(--bg-secondary);
}

.comparison-table tbody tr:hover .comparison-field-label {
  background: var(--glass-hover);
}

.comparison-value {
  text-align: center;
  color: var(--text-secondary);
}

.compare-count {
  display: inline-block;
  background: var(--status-amber);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  margin-left: var(--s2);
  min-width: 28px;
  text-align: center;
}

.btn-danger {
  background: var(--status-red);
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  .comparison-table thead {
    background: linear-gradient(135deg, #1d4ed8, #3730a3);
  }

  .comparison-field-header {
    background: linear-gradient(135deg, #1d4ed8, #3730a3);
  }

  .comparison-field-label {
    background: var(--bg-elevated);
  }

  .comparison-table tbody tr:nth-child(even) .comparison-field-label {
    background: var(--bg-secondary);
  }
}

@media (max-width: 767px) {
  .comparison-table {
    font-size: 0.8125rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: var(--s2) var(--s3);
  }

  .comparison-field-header,
  .comparison-field-label {
    min-width: 140px;
  }

  .comparison-property-header {
    min-width: 160px;
  }
}



/* --- Paginated List & Show More Button --- */
.paginated-list-container { display: flex; flex-direction: column; gap: 0.75rem; }
.show-more-container { margin: 1.5rem 0 1rem; display: flex; justify-content: center; padding: 0 1rem; }
.btn-show-more { background: transparent; border: 1.5px solid var(--glass-border-strong); color: var(--text-secondary); padding: 0.75rem 1.5rem; border-radius: 8px; font-size: 0.9375rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; width: 100%; max-width: 400px; display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: inherit; }
.btn-show-more:hover { background: var(--glass-hover); border-color: var(--accent-blue); color: var(--accent-blue); transform: translateY(-1px); }
.btn-show-more:active { transform: translateY(0); }
.btn-show-more .show-more-count { color: var(--text-muted); font-weight: 400; }
.btn-show-more:hover .show-more-count { color: var(--accent-blue); }
@media (prefers-color-scheme: dark) { .btn-show-more { border-color: var(--glass-border-strong); color: var(--text-secondary); } .btn-show-more:hover { background: var(--glass-hover); border-color: var(--accent-blue); color: var(--accent-blue); } }

/* --- Virtual Scrolling Lists --- */
.virtual-list {
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border-strong) transparent;
}

.virtual-list::-webkit-scrollbar {
  width: 8px;
}

.virtual-list::-webkit-scrollbar-track {
  background: transparent;
}

.virtual-list::-webkit-scrollbar-thumb {
  background: var(--glass-border-strong);
  border-radius: 4px;
}

.virtual-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

.virtual-list-spacer {
  width: 100%;
}

.virtual-list-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem;
}

/* --- CSV Export Button --- */
.export-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 6px; background: transparent; color: var(--text-color); font-size: 0.78rem; cursor: pointer; transition: all 0.2s; font-family: inherit; font-weight: 500; }
.export-btn:hover { background: var(--glass-hover, #f3f4f6); border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.export-btn::before { content: '📥'; font-size: 0.9em; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }



/* ============================================
   MOBILE OPTIMIZATIONS — Responsive Card Layouts
   ============================================ */

/* --- Tablet & Mobile (≤768px) --- */
@media (max-width: 767px) {
  /* Table-to-Card Transform */
  .data-table {
    display: block;
    border: none;
  }

  .data-table thead {
    display: none; /* Hide headers on mobile */
  }

  .data-table tbody {
    display: block;
  }

  .data-table tr {
    display: block;
    margin-bottom: var(--s3);
    border-radius: var(--r2);
    padding: var(--s4);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all var(--t-fast) var(--ease);
  }

  .data-table tr:hover {
    box-shadow: var(--shadow-glass-md);
    border-color: var(--glass-border-strong);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--s2) 0;
    border: none;
    font-size: 0.875rem;
    gap: var(--s3);
  }

  .data-table td:not(:last-child) {
    border-bottom: 1px solid var(--glass-border);
  }

  /* Add labels via data-label attribute */
  .data-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 40%;
  }

  .data-table td:first-child {
    padding-top: 0;
  }

  .data-table td:last-child {
    padding-bottom: 0;
  }

  /* Comparison table mobile */
  .comparison-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .comparison-table thead,
  .comparison-table tbody,
  .comparison-table tr {
    display: block;
  }

  .comparison-table th,
  .comparison-table td {
    display: block;
    text-align: left;
    padding: var(--s2) var(--s3);
  }

  /* Search results as cards */
  .search-result-item {
    display: block;
    padding: var(--s4);
    margin-bottom: var(--s3);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--r2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all var(--t-fast) var(--ease);
  }

  .search-result-item:hover {
    box-shadow: var(--shadow-glass-md);
    border-color: var(--glass-border-strong);
  }

  /* Collapsible items — larger tap targets */
  .collapsible-toggle {
    min-height: 52px;
    padding: var(--s4);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Touch-friendly buttons */
  .btn,
  button,
  [role="button"] {
    min-height: 44px; /* iOS minimum tap target */
    min-width: 44px;
    padding: var(--s3) var(--s5);
    -webkit-tap-highlight-color: transparent;
  }

  .btn-sm {
    min-height: 40px;
    padding: var(--s2) var(--s4);
  }

  /* Badge touch targets */
  .badge {
    min-height: 40px;
    padding: var(--s2) var(--s4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Property header stack */
  .property-header {
    flex-direction: column;
    gap: var(--s4);
    padding: var(--s5) var(--s4);
  }

  .property-header-left,
  .property-header-right {
    width: 100%;
    text-align: center;
  }

  /* Horizontal scroll hint for tabs */
  .sidebar::after {
    content: '→';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95));
    padding: 0 var(--s4);
    pointer-events: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    opacity: 0.7;
  }

  .sidebar.scrolled-end::after {
    display: none;
  }

  /* Prevent text selection on double-tap */
  .sidebar-tab,
  .collapsible-toggle,
  .btn {
    -webkit-user-select: none;
    user-select: none;
  }

  /* Full-width cards for list items */
  .list-item,
  .property-item,
  .violation-item {
    width: 100%;
    padding: var(--s4);
    margin-bottom: var(--s3);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--r2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }

  /* Spacing adjustments for better content density */
  .property-content {
    padding: var(--s4);
  }

  .section-title {
    font-size: 1.25rem;
    margin-bottom: var(--s4);
  }
}

/* --- Small Mobile (≤480px) --- */
@media (max-width: 480px) {
  /* Quick Facts to single column */
  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: var(--s3);
  }

  .stat-card {
    padding: var(--s5) var(--s4);
  }

  /* Larger touch targets */
  .btn,
  button,
  [role="button"] {
    min-height: 48px;
    font-size: 1rem;
  }

  .collapsible-toggle {
    min-height: 56px;
    font-size: 1rem;
  }

  /* Font size improvements for readability */
  body {
    font-size: 1rem;
  }

  .data-table td {
    font-size: 0.9375rem;
  }

  .data-table td::before {
    font-size: 0.75rem;
  }

  /* Reduce margins for more content space */
  .property-content {
    padding: var(--s3);
  }

  .collapsible {
    margin-bottom: var(--s2);
  }

  .collapsible-content {
    padding: var(--s3);
  }

  /* Sidebar tabs — larger labels */
  .sidebar-tab-label {
    font-size: 0.75rem;
    max-width: 72px;
  }

  /* Hero text adjustments */
  .hero h1 {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .hero p {
    font-size: 0.9375rem;
  }

  /* Modal/Dialog full-screen on very small devices */
  .modal,
  .dialog,
  .auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
  }

  .modal-content,
  .dialog-content {
    height: 100%;
    overflow-y: auto;
    border-radius: 0;
  }
}

/* --- Dark Mode Toggle Button --- */
.dark-mode-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--glass-border-strong);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glass-lg);
  transition: all var(--t-base) var(--ease);
  user-select: none;
}

.dark-mode-toggle:hover {
  transform: scale(1.08) rotate(10deg);
  box-shadow: var(--shadow-glass-lg), var(--shadow-glow-blue);
  border-color: var(--accent-blue);
}

.dark-mode-toggle:active {
  transform: scale(0.95);
}

.dark-mode-toggle:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Dark mode specific component adjustments */
html.dark-mode .site-header {
  background: rgba(17, 17, 17, 0.85);
}

html.dark-mode .site-footer {
  background: rgba(17, 17, 17, 0.8);
}

html.dark-mode .sidebar {
  background: rgba(10, 10, 10, 0.8);
}

html.dark-mode .aurora-bg {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
}

html.dark-mode .grain-overlay {
  opacity: 0.6;
}

html.dark-mode .hero {
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
    var(--bg-base);
}

html.dark-mode .card-head,
html.dark-mode .data-table th,
html.dark-mode .collapsible-body {
  background: rgba(255, 255, 255, 0.03);
}

html.dark-mode .data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

/* Mobile adjustments for dark mode toggle */
@media (max-width: 767px) {
  .dark-mode-toggle {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

/* --- Print Styles --- */
@media print {
  .back-to-top,
  .dark-mode-toggle {
    display: none !important;
  }

  /* Hide navigation and controls */
  .sidebar,
  .nav-toggle,
  .btn,
  button,
  .search-bar,
  .filter-bar {
    display: none !important;
  }

  /* Expand all collapsibles */
  .collapsible {
    page-break-inside: avoid;
  }

  .collapsible-content {
    display: block;
    max-height: none !important;
  }

  .collapsible-toggle::after {
    display: none;
  }

  /* Remove dark mode */
  :root {
    --bg-deep: #ffffff;
    --bg-base: #ffffff;
    --bg-surface: #f8f8f8;
    --bg-elevated: #ffffff;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;
    --glass-bg: #ffffff;
    --glass-border: #cccccc;
  }

  /* Show tables in standard format */
  .data-table {
    display: table;
    border-collapse: collapse;
  }

  .data-table thead {
    display: table-header-group;
  }

  .data-table tbody {
    display: table-row-group;
  }

  .data-table tr {
    display: table-row;
  }

  .data-table td {
    display: table-cell;
  }

  .data-table td::before {
    display: none;
  }

  /* Better page breaks */
  h1, h2, h3 {
    page-break-after: avoid;
  }

  .stat-card,
  .collapsible,
  .property-item {
    page-break-inside: avoid;
  }

  /* Remove shadows and glass effects */
  * {
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* Hide site header and footer */
  .site-header,
  .site-footer,
  .breadcrumb,
  .scroll-top,
  #toast-container,
  .profile-actions,
  .tab-panel:not(.active) {
    display: none !important;
  }

  /* Property header and layout */
  .property-layout {
    display: block;
    width: 100% !important;
  }

  .property-content {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .profile-bar {
    display: block;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333 !important;
  }

  .profile-address {
    font-size: 20pt !important;
    margin-bottom: 8px !important;
    color: #000 !important;
  }

  .profile-meta {
    font-size: 10pt !important;
    margin-bottom: 10px !important;
  }

  /* Add generated date header */
  .profile-bar::before {
    content: "Property Report — Generated " attr(data-report-date) !important;
    display: block !important;
    font-size: 9pt !important;
    color: #666 !important;
    margin-bottom: 12px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #ddd !important;
  }

  /* Quick facts panel */
  .quick-facts-panel {
    margin-bottom: 20px !important;
    page-break-inside: avoid !important;
  }

  .quick-facts-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
  }

  .quick-fact {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    background: #f9f9f9 !important;
  }

  .quick-fact-label {
    font-size: 8pt !important;
    color: #666 !important;
    margin-bottom: 4px !important;
  }

  .quick-fact-value {
    font-size: 11pt !important;
    font-weight: bold !important;
    color: #000 !important;
  }

  /* Active tab content */
  .tab-panel.active {
    display: block !important;
  }

  /* Limit content to fit on pages */
  .collapsible {
    margin-bottom: 12px !important;
  }

  .collapsible-header {
    font-size: 11pt !important;
    font-weight: bold !important;
    padding: 6px 0 !important;
    border-bottom: 1px solid #ddd !important;
  }

  .collapsible-content {
    padding: 8px 0 !important;
    font-size: 9pt !important;
  }

  /* Table formatting */
  .data-table {
    font-size: 8pt !important;
    margin: 8px 0 !important;
  }

  .data-table th {
    background: #f0f0f0 !important;
    padding: 4px 6px !important;
    border: 1px solid #ddd !important;
  }

  .data-table td {
    padding: 3px 6px !important;
    border: 1px solid #ddd !important;
  }

  /* Badges */
  .badge {
    padding: 2px 6px !important;
    font-size: 8pt !important;
    border: 1px solid #ccc !important;
    background: #f5f5f5 !important;
    color: #000 !important;
  }
}

/* ============================================
   Toast Notifications
   ============================================ */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  background: rgba(22, 163, 74, 0.95);
  color: white;
}

.toast-error {
  background: rgba(220, 38, 38, 0.95);
  color: white;
}

.toast-warning {
  background: rgba(217, 119, 6, 0.95);
  color: white;
}

.toast-info {
  background: rgba(37, 99, 235, 0.95);
  color: white;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Loading Progress Bar */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), var(--accent-cyan));
  z-index: 10001;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.loading-bar.active {
  animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.loading-bar.complete {
  width: 100% !important;
  opacity: 0;
  transition: width 0.2s, opacity 0.4s 0.3s;
}

/* Tab Loading Spinner */
.tab-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: tabSpinning 0.6s linear infinite;
}

@keyframes tabSpinning {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Empty State Messages */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
  min-height: 200px;
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-message {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 400px;
}

/* Skeleton Shimmer Effect */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--border-color) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}



.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

.skeleton-card {
  height: 120px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}


/* ===================================
   Enhanced Search Autocomplete
   =================================== */

/* Dropdown Animation */


/* Enhanced Dropdown Container */
.search-dropdown-enhanced {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1),
              0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  animation: slideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode .search-dropdown-enhanced {
  background: rgba(17, 24, 39, 0.95);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
              0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar for Dropdown */
.search-dropdown-enhanced::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown-enhanced::-webkit-scrollbar-track {
  background: transparent;
}

.search-dropdown-enhanced::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.search-dropdown-enhanced::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Category Header within Results */
.search-category-header {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.dark-mode .search-category-header {
  background: rgba(17, 24, 39, 0.95);
}

/* Search Result Card */
.search-result-card {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 12px;
  margin: 4px 8px;
  border-radius: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.search-result-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--borough-color);
  transition: width 0.2s ease;
}

.search-result-card:hover {
  background: var(--glass-hover);
  border-color: var(--primary-color, #2563eb);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-result-card:hover::before {
  width: 6px;
}

.search-result-card.active,
.search-result-card:focus {
  background: var(--glass-active);
  border-color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dark-mode .search-result-card {
  background: rgba(17, 24, 39, 0.6);
  border-color: rgba(75, 85, 99, 0.3);
}

.dark-mode .search-result-card:hover {
  background: rgba(31, 41, 55, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Borough Color Variants */
.search-result-card[data-borough="1"] { --borough-color: #3b82f6; } /* Manhattan */
.search-result-card[data-borough="2"] { --borough-color: #f59e0b; } /* Bronx */
.search-result-card[data-borough="3"] { --borough-color: #10b981; } /* Brooklyn */
.search-result-card[data-borough="4"] { --borough-color: #8b5cf6; } /* Queens */
.search-result-card[data-borough="5"] { --borough-color: #ef4444; } /* Staten Island */

/* Card Content Layout */
.search-result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 8px;
}

.search-result-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.search-result-address {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.search-result-bbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.search-result-borough {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--borough-color);
  color: white;
  opacity: 0.9;
}

/* Mini Metrics Row */
.search-result-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Metric Pills */
.search-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}

.search-metric-pill i {
  font-size: 0.85rem;
  opacity: 0.8;
}

.dark-mode .search-metric-pill {
  background: rgba(31, 41, 55, 0.6);
  border-color: rgba(75, 85, 99, 0.4);
}

/* Metric Type Colors */
.search-metric-pill.year {
  color: #6366f1;
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.search-metric-pill.units {
  color: #8b5cf6;
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.search-metric-pill.value {
  color: #10b981;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.search-metric-pill.owner {
  color: #f59e0b;
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

/* Empty State */
.search-result-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.search-result-empty i {
  font-size: 2rem;
  opacity: 0.3;
  display: block;
  margin-bottom: 8px;
}

/* Loading State */
.search-result-loading {
  padding: 16px;
  text-align: center;
}

.search-result-loading .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color, #2563eb);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .search-dropdown-enhanced {
    max-height: 300px;
    border-radius: 8px;
  }
  
  .search-result-card {
    margin: 4px 4px;
    padding: 10px;
  }
  
  .search-result-metrics {
    gap: 6px;
  }
  
  .search-metric-pill {
    font-size: 0.7rem;
    padding: 3px 8px;
  }
  
  .search-result-address {
    font-size: 0.9rem;
  }
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
  .search-dropdown-enhanced {
    max-height: 350px;
  }
}

/* Keyboard Navigation Indicator */
.search-result-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-color, #2563eb),
              0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Recent Searches Specific Styles */
.search-result-card.recent {
  opacity: 0.9;
}

.search-result-card.recent::before {
  background: var(--text-secondary);
  opacity: 0.3;
}

.search-result-card.recent:hover::before {
  opacity: 0.6;
}

/* Owner Search Results */
.search-result-card.owner-result .search-result-address {
  color: var(--primary-color, #2563eb);
}

.search-result-card.owner-result .search-metric-pill.owner {
  font-weight: 600;
}

/* ============================================
   STICKY TAB BAR (Added 2026-03-29)
   Sticky navigation bar for property details
   ============================================ */

/* Sidebar container with sticky positioning */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: box-shadow var(--t-base) var(--ease), background var(--t-base) var(--ease);
}

/* Sticky state enhancement (add via JS when scrolled) */
.sidebar.is-sticky {
  box-shadow: var(--shadow-glass-lg);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

/* Scroll progress indicator at top of sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--accent-blue) 0%,
    var(--accent-indigo) 33%,
    var(--accent-purple) 66%,
    var(--accent-cyan) 100%
  );
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.1s linear;
  z-index: 101;
  border-radius: 0 0 2px 2px;
  opacity: 0;
}

.sidebar.is-sticky::before {
  opacity: 1;
}

/* Compact mode for sticky tabs (reduces spacing when scrolled) */
.sidebar.is-compact .sidebar-tab {
  padding: var(--s2) var(--s4);
  font-size: 0.8125rem;
  margin: 1px var(--s2);
}

.sidebar.is-compact .sidebar-tab-icon {
  font-size: 14px;
  width: 20px;
}

.sidebar.is-compact .sidebar-tab-count {
  font-size: 0.6875rem;
  padding: 2px var(--s1);
  min-width: 20px;
}

.sidebar.is-compact .sidebar-section-title {
  font-size: 0.625rem;
  padding: var(--s2) var(--s4);
  margin-top: var(--s2);
}

/* Horizontal scroll for mobile (touch-friendly) */
@media (max-width: 767px) {
  .sidebar.is-mobile-scrollable {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    max-height: none;
    padding: var(--s2) var(--s3);
    gap: var(--s2);
    white-space: nowrap;
  }

  .sidebar.is-mobile-scrollable::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .sidebar.is-mobile-scrollable .sidebar-tab {
    flex-shrink: 0;
    width: auto;
    padding: var(--s2) var(--s4);
    margin: 0;
  }

  .sidebar.is-mobile-scrollable .sidebar-section-title {
    display: none;
  }
}

/* Enhanced active tab indicator with smooth animation */
.sidebar-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: var(--s3);
  right: var(--s3);
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transform: scaleX(0);
  transition: all var(--t-base) var(--ease-spring);
}

.sidebar.is-sticky .sidebar-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* Smooth scroll snap for content sections */
.tab-panel {
  scroll-margin-top: calc(var(--header-h) + var(--s4));
}

/* Scroll-to-top button enhancement when sticky bar is active */
.back-to-top.with-sticky-bar {
  bottom: calc(var(--s6) + 72px);
}

/* Dark mode variants for sticky bar */
html.dark-mode .sidebar.is-sticky {
  background: rgba(17, 17, 17, 0.85);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
}

html.dark-mode .sidebar::before {
  background: linear-gradient(90deg,
    var(--aurora-blue) 0%,
    var(--aurora-indigo) 33%,
    var(--aurora-purple) 66%,
    var(--aurora-cyan) 100%
  );
}

/* PDF Report Mode - Enhanced print styles */
@media print {
  body.pdf-report-mode #pdf-report-header,
  body.pdf-report-mode #pdf-report-footer {
    display: block !important;
  }

  /* Show all tab panels in PDF mode */
  body.pdf-report-mode .tab-panel {
    display: block !important;
    page-break-before: auto;
    page-break-after: auto;
  }

  body.pdf-report-mode .tab-panel:not(.active) {
    display: block !important;
  }

  /* Add visual separation between tabs */
  body.pdf-report-mode .tab-panel + .tab-panel {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
  }

  /* Ensure all collapsibles are expanded */
  body.pdf-report-mode .collapsible {
    margin-bottom: 1rem;
  }

  body.pdf-report-mode .collapsible-body {
    display: block !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Hide the map entirely in PDF */
  body.pdf-report-mode #map,
  body.pdf-report-mode .map-container {
    display: none !important;
  }
}

/* ===== MICRO-INTERACTIONS & PREMIUM ENHANCEMENTS ===== */

/* Enhanced skeleton pulse with gradient sweep */
.skeleton-pulse {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #e9ecef 0%, #f8f9fa 50%, #e9ecef 100%);
  background-size: 200% 100%;
  animation: skeleton-sweep 2s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes skeleton-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html.dark-mode .skeleton-pulse {
  background: linear-gradient(90deg, #2d3748 0%, #3a4556 50%, #2d3748 100%);
  background-size: 200% 100%;
}

/* Loading dots animation for "Loading..." text */
.loading-dots::after {
  content: '';
  display: inline-block;
  animation: loading-dots 1.4s infinite;
}

@keyframes loading-dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.loading-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 2px;
  background: currentColor;
  border-radius: 50%;
  animation: loading-dot-bounce 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading-dot-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* Fade-in entrance animations for dynamic content */
.fade-in-up {
  opacity: 0;
  transform: translateY(10px);
  animation: fade-in-up 0.3s ease forwards;
}

@keyframes fade-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-scale {
  opacity: 0;
  transform: scale(0.95);
  animation: fade-in-scale 0.2s ease forwards;
}

@keyframes fade-in-scale {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered animation delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }

/* Focus-visible keyboard navigation (already defined, enhanced here) */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  transition: outline-offset 0.2s ease;
}

/* Dark mode variants for hover states */
html.dark-mode .card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.15);
}

html.dark-mode .sidebar-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

html.dark-mode .btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html.dark-mode .badge:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html.dark-mode .collapsible:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Accessibility: respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .sidebar,
  .sidebar-tab,
  .sidebar::before,
  .sidebar-tab.active::after,
  .card,
  .btn,
  .badge,
  .collapsible,
  .skeleton-pulse,
  .loading-dot,
  .fade-in-up,
  .fade-in-scale {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   ROUND 12: MOBILE NAVIGATION ENHANCEMENTS
   ============================================================ */

/* --- Mobile Bottom Navigation Bar --- */
@media (max-width: 767px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
  }

  /* Add bottom padding to body so content isn't hidden behind bottom nav */
  body {
    padding-bottom: 80px !important;
  }

  /* Bottom Nav Items */
  .mobile-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    color: var(--text-secondary);
    text-decoration: none;
    min-width: 60px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-bottom-nav-item .nav-icon {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-bottom-nav-item .nav-label {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
  }

  .mobile-bottom-nav-item.active {
    color: var(--accent);
    background: var(--accent-transparent, rgba(37, 99, 235, 0.1));
    transform: scale(1.05);
  }

  .mobile-bottom-nav-item:active {
    transform: scale(0.95);
  }

  /* Swipe Indicator */
  .swipe-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(var(--text-secondary-rgb, 107, 114, 128), 0.3);
    border-radius: 2px;
    margin-top: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .tabs.swiping-left {
    transform: translateX(-10px);
    transition: transform 0.1s ease-out;
  }

  .tabs.swiping-right {
    transform: translateX(10px);
    transition: transform 0.1s ease-out;
  }

  /* Mobile Tab Improvements - Hide scrollbar but keep scroll */
  .tabs {
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
  }

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

  .tab-btn {
    scroll-snap-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Touch Ripple Effect */
  .touch-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transform: scale(0);
    animation: ripple 0.6s ease-out;
  }

  @keyframes ripple {
    to {
      transform: scale(4);
      opacity: 0;
    }
  }

  /* Remove tap highlight and delay on all interactive elements */
  button,
  a,
  .btn,
  .card,
  .tab-btn,
  .sidebar-tab,
  input,
  select,
  textarea {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* Mobile Card Improvements */
  .card {
    padding: 16px !important;
  }

  .card h2 {
    font-size: 1.3rem;
  }

  .card h3 {
    font-size: 1.1rem;
  }

  .grid {
    gap: 12px !important;
  }

  /* Pull-to-Refresh Indicator */
  .pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    width: 40px;
    height: 40px;
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
  }

  .pull-refresh-indicator.pulling {
    transform: translateX(-50%) translateY(20px);
  }

  .pull-refresh-indicator::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid var(--accent);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
  }
} /* End @media (max-width: 767px) from line 5854 */

/* Disable animations for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-nav-item,
  .swipe-indicator,
  .tabs,
  .touch-ripple,
  .pull-refresh-indicator {
    animation: none !important;
    transition: none !important;
  }

  .tabs.swiping-left,
  .tabs.swiping-right {
    transform: none !important;
  }
}

/* ============================================
   COMPREHENSIVE PRINT STYLES
   Professional property report printing
   ============================================ */

@media print {
  /* ===== Page Setup ===== */
  @page {
    margin: 1cm 1.5cm;
    size: letter;
  }

  @page :first {
    margin-top: 2cm;
  }

  /* ===== Force Light Theme - Override All Variables ===== */
  :root,
  .dark-mode {
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #666666;
    --border-color: #dddddd;
    --border-light: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
  }

  /* Remove visual effects to save ink */
  * {
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    text-shadow: none !important;
    background-image: none !important;
  }

  /* ===== Hide Non-Print Elements ===== */
  .search-container,
  .mobile-bottom-nav,
  .tabs,
  .tab-btn,
  .save-btn,
  .compare-btn,
  .toast-container,
  .keyboard-help-modal,
  .pull-refresh-indicator,
  footer,
  nav,
  .nav-bar,
  .nav-links,
  button:not(.data-button),
  input[type="button"],
  input[type="submit"],
  input[type="reset"],
  .search-bar,
  .filter-bar,
  .dark-mode-toggle,
  .back-to-top,
  .sidebar,
  .nav-toggle,
  .autocomplete-dropdown,
  .swipe-indicator,
  .touch-ripple,
  .notification-bell,
  .auth-modal,
  .modal-overlay,
  .profile-actions,
  .keyboard-shortcuts,
  input[type="range"],
  input[type="checkbox"]:not(.data-checkbox),
  .toggle-switch,
  .slider {
    display: none !important;
  }

  /* Hide map container (Leaflet doesn't print well) */
  #map,
  .leaflet-container,
  .map-container {
    display: none !important;
  }

  /* Hide loading states and animations */
  .loading,
  .spinner,
  .skeleton,
  .loading-overlay {
    display: none !important;
  }

  /* ===== Typography for Print ===== */
  body {
    font-size: 11pt !important;
    line-height: 1.4 !important;
    font-family: 'Georgia', 'Times New Roman', serif !important;
    color: #1a1a1a !important;
    background: #ffffff !important;
    margin: 0;
    padding: 0;
  }

  h1 {
    font-size: 18pt !important;
    margin-bottom: 6pt !important;
    margin-top: 0 !important;
    page-break-after: avoid;
  }

  h2 {
    font-size: 14pt !important;
    margin-top: 12pt !important;
    margin-bottom: 4pt !important;
    border-bottom: 1pt solid #999999 !important;
    padding-bottom: 2pt !important;
    page-break-after: avoid;
    break-before: page;
  }

  h2:first-of-type {
    break-before: auto;
  }

  h3 {
    font-size: 12pt !important;
    margin-top: 8pt !important;
    margin-bottom: 4pt !important;
    page-break-after: avoid;
  }

  h4, h5, h6 {
    font-size: 11pt !important;
    font-weight: bold !important;
    margin-top: 6pt !important;
    margin-bottom: 3pt !important;
    page-break-after: avoid;
  }

  p {
    margin: 4pt 0;
    orphans: 3;
    widows: 3;
  }

  /* Show URLs after links */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666666;
    font-style: italic;
  }

  /* But not for internal/javascript links */
  a[href^="#"]::after,
  a[href^="javascript"]::after,
  a[href=""]::after {
    content: none;
  }

  a {
    color: #2563eb !important;
    text-decoration: underline;
  }

  /* ===== Card Layout for Print ===== */
  .card,
  .property-card,
  .stat-card,
  .detail-card {
    border: 1pt solid #dddddd !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    padding: 8pt !important;
    margin-bottom: 8pt !important;
    page-break-inside: avoid;
  }

  /* Force single column layouts */
  .grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .property-grid,
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 8pt !important;
  }

  /* Expand all collapsible sections */
  .collapsible,
  .collapse,
  .accordion-content,
  details {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  details {
    page-break-inside: avoid;
  }

  details summary {
    display: block !important;
    font-weight: bold;
    margin-bottom: 4pt;
  }

  details summary::marker,
  details summary::-webkit-details-marker {
    display: none;
  }

  details[open] summary::after {
    content: none;
  }

  /* Status badges - add border for B&W visibility */
  .badge,
  .status-badge,
  .tag,
  .chip {
    border: 1pt solid #000000 !important;
    padding: 2pt 4pt !important;
    margin: 0 2pt !important;
    font-size: 9pt !important;
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 0 !important;
    display: inline-block !important;
  }

  /* Preserve status colors for clarity */
  .badge.success,
  .status-badge.success,
  .badge.resolved {
    background: #d1fae5 !important;
    border-color: #059669 !important;
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .badge.warning,
  .status-badge.warning,
  .badge.pending {
    background: #fef3c7 !important;
    border-color: #d97706 !important;
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .badge.danger,
  .status-badge.danger,
  .badge.violation {
    background: #fee2e2 !important;
    border-color: #dc2626 !important;
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ===== Table Print Styles ===== */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 8pt 0 !important;
    page-break-inside: auto;
    font-size: 10pt !important;
  }

  thead {
    display: table-header-group;
  }

  tbody {
    display: table-row-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    page-break-inside: avoid;
  }

  th {
    font-weight: bold !important;
    border-bottom: 2pt solid #333333 !important;
    padding: 4pt !important;
    text-align: left !important;
    background: #f5f5f5 !important;
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  td {
    padding: 4pt !important;
    border: 0.5pt solid #dddddd !important;
  }

  /* Alternate row coloring */
  tbody tr:nth-child(even) {
    background: #f5f5f5 !important;
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* ===== Page Break Control ===== */
  .violation-item,
  .permit-item,
  .complaint-item,
  .document-item,
  .record-item,
  .list-item {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 6pt;
  }

  .chart-container,
  .graph-container,
  .visualization-container {
    page-break-inside: avoid;
    break-inside: avoid;
    margin: 8pt 0;
  }

  /* Avoid breaks after headings */
  h1, h2, h3, h4, h5, h6 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* ===== Print Header/Footer ===== */
  .print-header {
    display: block !important;
    position: relative;
    margin-bottom: 12pt;
    padding-bottom: 8pt;
    border-bottom: 2pt solid #333333;
  }

  .print-header h1 {
    margin: 0 0 4pt 0 !important;
    font-size: 16pt !important;
  }

  .print-header .property-address {
    font-size: 12pt;
    color: #555555;
    margin-bottom: 2pt;
  }

  .print-header .report-date {
    font-size: 9pt;
    color: #666666;
    font-style: italic;
  }

  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt;
    color: #666666;
    padding: 4pt;
    border-top: 0.5pt solid #cccccc;
  }

  /* ===== Chart Handling ===== */
  canvas {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  svg {
    max-width: 100% !important;
    height: auto !important;
  }

  .chart-wrapper,
  .gauge-container,
  .heatmap-container {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ===== Data Lists and Records ===== */
  ul, ol {
    margin: 4pt 0 4pt 12pt;
    padding: 0;
  }

  li {
    margin: 2pt 0;
    page-break-inside: avoid;
  }

  dl {
    margin: 4pt 0;
  }

  dt {
    font-weight: bold;
    margin-top: 4pt;
  }

  dd {
    margin-left: 12pt;
    margin-bottom: 2pt;
  }

  /* ===== Property-Specific Sections ===== */
  .property-header,
  .property-overview,
  .owner-info,
  .building-info {
    page-break-inside: avoid;
  }

  .tab-panel {
    display: block !important;
    page-break-before: auto;
  }

  /* Add separation between major sections */
  .tab-panel + .tab-panel {
    margin-top: 12pt;
    padding-top: 12pt;
    border-top: 1pt solid #cccccc;
  }

  /* ===== Metrics and Statistics ===== */
  .stat-value {
    font-size: 14pt !important;
    font-weight: bold !important;
    color: #000000 !important;
  }

  .stat-label {
    font-size: 9pt !important;
    color: #666666 !important;
    text-transform: uppercase;
  }

  /* ===== Image Handling ===== */
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  /* Hide decorative images */
  img[alt=""],
  img:not([alt]),
  .icon,
  .emoji {
    display: none !important;
  }

  /* ===== Utility Classes ===== */
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .page-break-before {
    break-before: page;
    page-break-before: always;
  }

  .page-break-after {
    break-after: page;
    page-break-after: always;
  }

  .keep-together {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* ===== Comparative Views ===== */
  .compare-container,
  .comparison-grid {
    display: block !important;
  }

  .compare-property {
    page-break-inside: avoid;
    border: 1pt solid #dddddd;
    padding: 8pt;
    margin-bottom: 8pt;
  }

  /* ===== Optimize for Black & White Printing ===== */
  .highlight,
  .emphasis,
  mark {
    background: #eeeeee !important;
    color: #000000 !important;
    border: 0.5pt solid #cccccc !important;
    padding: 0 2pt;
  }

  /* ===== Footer Content ===== */
  .report-footer-content::before {
    content: "Generated from nyc-property-lookup.pages.dev";
    display: block;
    font-size: 8pt;
    color: #888888;
  }

  /* ===== Accessibility - Ensure Contrast ===== */
  * {
    color-adjust: economy;
    -webkit-print-color-adjust: economy;
  }

  .preserve-color {
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ========================================================================
   DARK MODE ENHANCEMENTS - Polished styling for improved UX
   ======================================================================== */

/* Smooth theme transitions - scoped to theme-relevant properties */
:root {
  --theme-transition: background-color 0.3s ease, border-color 0.3s ease,
                      color 0.2s ease, box-shadow 0.3s ease;
}

* {
  transition: var(--theme-transition);
}

/* ===== Dark Mode Color Refinements ===== */
.dark-mode {
  --bg-card: #1e2330;
  --text-primary: #e8eaf0;
  --border-color: rgba(255,255,255,0.08);
  --accent-glow: rgba(99,102,241,0.3);
  --card-hover-bg: #242938;
  --status-open: #ff6b6b;
  --status-closed: #51cf66;
  --status-pending: #ffa94d;
}

/* ===== Dark Mode Card Enhancements ===== */
.dark-mode .card,
.dark-mode .info-card,
.dark-mode .stat-card,
.dark-mode .data-card {
  background: var(--bg-card);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06),
              0 2px 8px rgba(0,0,0,0.3),
              0 4px 16px rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
}

.dark-mode .card:hover,
.dark-mode .info-card:hover,
.dark-mode .stat-card:hover {
  background: var(--card-hover-bg);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.2),
              0 4px 16px rgba(0,0,0,0.4),
              0 0 20px rgba(99,102,241,0.1);
}

/* Gradient border effect for premium cards */
.dark-mode .premium-card,
.dark-mode .highlight-card {
  position: relative;
  background: linear-gradient(135deg, #1e2330 0%, #1a1f2e 100%);
  border: none;
}

.dark-mode .premium-card::before,
.dark-mode .highlight-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(99,102,241,0));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ===== Dark Mode Table Styles ===== */
.dark-mode table {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.dark-mode thead {
  background: rgba(0,0,0,0.3);
}

.dark-mode th {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid rgba(99,102,241,0.3);
}

.dark-mode tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

.dark-mode tbody tr:hover {
  background: rgba(99,102,241,0.1);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.2);
}

.dark-mode td {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* ===== Dark Mode Form Elements ===== */
.dark-mode input[type="text"],
.dark-mode input[type="email"],
.dark-mode input[type="password"],
.dark-mode input[type="search"],
.dark-mode textarea,
.dark-mode select {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.dark-mode input:focus,
.dark-mode textarea:focus,
.dark-mode select:focus {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1),
              inset 0 1px 3px rgba(0,0,0,0.2);
  outline: none;
}

.dark-mode .search-input {
  background: rgba(0,0,0,0.4);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

.dark-mode input[type="range"] {
  background: transparent;
}

.dark-mode input[type="range"]::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(99,102,241,0.2),
              0 2px 4px rgba(0,0,0,0.3);
}

.dark-mode input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(99,102,241,0.3),
              0 2px 8px rgba(0,0,0,0.4);
}

.dark-mode input[type="range"]::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(99,102,241,0.2),
              0 2px 4px rgba(0,0,0,0.3);
}

/* ===== Dark Mode Status Badges ===== */
.dark-mode .status-badge {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.dark-mode .status-open,
.dark-mode .violation-open {
  background: rgba(255,107,107,0.15);
  color: #ffa8a8;
  border-color: rgba(255,107,107,0.3);
  box-shadow: 0 0 8px rgba(255,107,107,0.2);
}

.dark-mode .status-closed,
.dark-mode .violation-closed {
  background: rgba(81,207,102,0.15);
  color: #8ce99a;
  border-color: rgba(81,207,102,0.3);
}

.dark-mode .status-pending {
  background: rgba(255,169,77,0.15);
  color: #ffc078;
  border-color: rgba(255,169,77,0.3);
  box-shadow: 0 0 8px rgba(255,169,77,0.15);
}

.dark-mode .status-approved {
  background: rgba(34,139,230,0.15);
  color: #74c0fc;
  border-color: rgba(34,139,230,0.3);
}

/* ===== Dark Mode Charts & Visualizations ===== */
.dark-mode .chart-container,
.dark-mode .gauge-container {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
}

.dark-mode .gauge-background {
  background: rgba(0,0,0,0.3);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}

.dark-mode .bar-chart {
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 19%,
    rgba(255,255,255,0.02) 19%,
    rgba(255,255,255,0.02) 20%
  );
}

.dark-mode .sparkline-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.dark-mode .timeline-connector {
  background: rgba(255,255,255,0.1);
}

.dark-mode .timeline-connector::before {
  box-shadow: 0 0 12px rgba(99,102,241,0.4);
}

/* ===== Dark Mode Navigation ===== */
.dark-mode .tab-nav {
  background: rgba(30,35,48,0.95);
  border-bottom: 1px solid transparent;
  background-image: linear-gradient(to bottom, transparent 0%, rgba(99,102,241,0.1) 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.dark-mode .tab-button.active {
  color: #a5b4fc;
  position: relative;
}

.dark-mode .tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6366f1, transparent);
  box-shadow: 0 0 12px rgba(99,102,241,0.6);
}

.dark-mode .sticky-header {
  background: rgba(17,24,39,0.98);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(99,102,241,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* ===== Dark Mode Scrollbar Styling ===== */
.dark-mode ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.dark-mode ::-webkit-scrollbar-track {
  background: var(--bg-body);
  border-radius: 4px;
}

.dark-mode ::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
  background-clip: padding-box;
}

.dark-mode ::-webkit-scrollbar-thumb:active {
  background: rgba(255,255,255,0.35);
  background-clip: padding-box;
}

/* Firefox scrollbar */
.dark-mode * {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

/* ===== Dark Mode Primary CTAs with Accent Glow ===== */
.dark-mode .btn-primary,
.dark-mode .primary-action,
.dark-mode .submit-btn {
  box-shadow: 0 4px 12px rgba(99,102,241,0.3),
              0 0 20px rgba(99,102,241,0.15);
}

.dark-mode .btn-primary:hover,
.dark-mode .primary-action:hover {
  box-shadow: 0 6px 16px rgba(99,102,241,0.4),
              0 0 30px rgba(99,102,241,0.25);
  transform: translateY(-1px);
}

.dark-mode .btn-primary:active {
  box-shadow: 0 2px 8px rgba(99,102,241,0.3),
              0 0 15px rgba(99,102,241,0.2);
  transform: translateY(0);
}

/* ===== Dark Mode Image/Icon Handling ===== */
.dark-mode .dark-invert {
  filter: invert(1) hue-rotate(180deg);
}

.dark-mode .map-icon,
.dark-mode .location-marker {
  filter: brightness(1.3) contrast(1.1);
}

.dark-mode img:not(.preserve-color) {
  opacity: 0.9;
}

.dark-mode .icon-white {
  filter: brightness(0.9);
}

/* ===== Dark Mode Dropdown & Select Menus ===== */
.dark-mode .dropdown-menu,
.dark-mode .select-menu {
  background: #1a1f2e;
  border: 1px solid rgba(99,102,241,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5),
              0 0 0 1px rgba(255,255,255,0.05);
}

.dark-mode .dropdown-item:hover,
.dark-mode .select-option:hover {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
}

.dark-mode .dropdown-divider {
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ===== Dark Mode Modal & Overlay ===== */
.dark-mode .modal-overlay {
  background: rgba(0,0,0,0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dark-mode .modal-content {
  background: #1e2330;
  border: 1px solid rgba(99,102,241,0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6),
              0 0 0 1px rgba(255,255,255,0.05);
}

/* ===== Dark Mode Loading States ===== */
.dark-mode .skeleton,
.dark-mode .loading-placeholder {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0.1) 50%,
    rgba(255,255,255,0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}



.dark-mode .spinner {
  border-color: rgba(255,255,255,0.1);
  border-top-color: #6366f1;
  filter: drop-shadow(0 0 8px rgba(99,102,241,0.3));
}

/* ===== Dark Mode Tooltips ===== */
.dark-mode .tooltip {
  background: rgba(0,0,0,0.95);
  border: 1px solid rgba(99,102,241,0.4);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5),
              0 0 20px rgba(99,102,241,0.2);
}

.dark-mode .tooltip::before {
  border-top-color: rgba(99,102,241,0.4);
}

/* ===== Dark Mode Alert/Notification Boxes ===== */
.dark-mode .alert-info {
  background: rgba(34,139,230,0.1);
  border-left: 3px solid #228be6;
  color: #74c0fc;
}

.dark-mode .alert-warning {
  background: rgba(255,169,77,0.1);
  border-left: 3px solid #ffa94d;
  color: #ffc078;
}

.dark-mode .alert-error {
  background: rgba(255,107,107,0.1);
  border-left: 3px solid #ff6b6b;
  color: #ffa8a8;
}

.dark-mode .alert-success {
  background: rgba(81,207,102,0.1);
  border-left: 3px solid #51cf66;
  color: #8ce99a;
}

/* ===== Dark Mode Data Grid & Property Cards ===== */
.dark-mode .property-grid-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dark-mode .property-grid-item:hover {
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4),
              0 0 0 1px rgba(99,102,241,0.2);
  transform: translateY(-2px);
}

/* ===== Dark Mode Separator Lines ===== */
.dark-mode hr,
.dark-mode .divider {
  border-color: rgba(255,255,255,0.08);
  opacity: 1;
}

/* ===== Dark Mode Print Adjustments ===== */
@media print {
  .dark-mode {
    --bg-card: #ffffff;
    --text-primary: #000000;
    --border-color: #cccccc;
  }

  .dark-mode .card,
  .dark-mode .info-card,
  .dark-mode table {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }
}

/* ========================================
   ANIMATIONS & TRANSITIONS LIBRARY
   ======================================== */

/* ===== Entrance Animations ===== */
.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
  opacity: 0;
}

.animate-slide-up {
  animation: slideUp 0.4s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
}

.animate-slide-down {
  animation: slideDown 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(-20px);
}

.animate-slide-left {
  animation: slideLeft 0.3s ease-out forwards;
  opacity: 0;
  transform: translateX(20px);
}

.animate-slide-right {
  animation: slideRight 0.3s ease-out forwards;
  opacity: 0;
  transform: translateX(-20px);
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out forwards;
  opacity: 0;
  transform: scale(0.9);
}

.animate-blur-in {
  animation: blurIn 0.4s ease-out forwards;
  opacity: 0;
  filter: blur(10px);
}

/* ===== Keyframes for Entrance Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes blurIn {
  from {
    opacity: 0;
    filter: blur(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

/* ===== Loading Animations ===== */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

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

.animate-bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ===== Hover & Interaction Transitions ===== */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.hover-scale {
  transition: transform 0.2s ease;
}

.hover-scale:hover {
  transform: scale(1.03);
}

.hover-rotate {
  transition: transform 0.3s ease;
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

.hover-brightness {
  transition: filter 0.2s ease;
}

.hover-brightness:hover {
  filter: brightness(1.1);
}

/* ===== Stagger Classes for List Animations ===== */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }
.stagger-9 { animation-delay: 0.45s; }
.stagger-10 { animation-delay: 0.5s; }

/* ===== Counter Animation (CSS Houdini) ===== */
@supports (counter-reset: num var(--num)) {
  @property --num {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
  }

  .animate-count {
    transition: --num 1s ease-out;
    counter-reset: num var(--num);
  }

  .animate-count::after {
    content: counter(num);
  }
}

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    var(--border-color) 37%,
    var(--bg-card) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 4px;
  min-height: 1em;
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 0.75em;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ===== Notification Animations ===== */
.animate-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-flash {
  animation: flash 0.5s;
}

@keyframes flash {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.5; }
}

.animate-wiggle {
  animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* ===== Page Transition Animations ===== */
.page-enter {
  animation: pageEnter 0.3s ease-out;
}

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

.page-exit {
  animation: pageExit 0.2s ease-in;
}

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

/* ===== Slide & Reveal Animations ===== */
.animate-slide-in-bottom {
  animation: slideInBottom 0.4s ease-out forwards;
  transform: translateY(100%);
}

@keyframes slideInBottom {
  to {
    transform: translateY(0);
  }
}

.animate-slide-out-bottom {
  animation: slideOutBottom 0.3s ease-in forwards;
}

@keyframes slideOutBottom {
  to {
    transform: translateY(100%);
  }
}

.animate-expand {
  animation: expand 0.3s ease-out;
}

@keyframes expand {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 1000px;
    opacity: 1;
  }
}

.animate-collapse {
  animation: collapse 0.2s ease-in;
}

@keyframes collapse {
  from {
    max-height: 1000px;
    opacity: 1;
  }
  to {
    max-height: 0;
    opacity: 0;
  }
}

/* ===== Progress & Loading Bars ===== */
.animate-progress {
  animation: progress 2s ease-in-out;
}

@keyframes progress {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

.animate-indeterminate {
  position: relative;
  overflow: hidden;
}

.animate-indeterminate::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(99, 102, 241, 0.5),
    transparent
  );
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  to {
    transform: translateX(150%);
  }
}

/* ===== Attention Seekers ===== */
.animate-heartbeat {
  animation: heartbeat 1.3s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

.animate-rubber-band {
  animation: rubberBand 1s;
}

@keyframes rubberBand {
  0% { transform: scale(1); }
  30% { transform: scaleX(1.25) scaleY(0.75); }
  40% { transform: scaleX(0.75) scaleY(1.25); }
  50% { transform: scaleX(1.15) scaleY(0.85); }
  65% { transform: scaleX(0.95) scaleY(1.05); }
  75% { transform: scaleX(1.05) scaleY(0.95); }
  100% { transform: scale(1); }
}

/* ===== Utility: Animation Delays ===== */
.delay-50 { animation-delay: 50ms; }
.delay-100 { animation-delay: 100ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* ===== Utility: Animation Durations ===== */
.duration-75 { animation-duration: 75ms; }
.duration-100 { animation-duration: 100ms; }
.duration-150 { animation-duration: 150ms; }
.duration-200 { animation-duration: 200ms; }
.duration-300 { animation-duration: 300ms; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }
.duration-1000 { animation-duration: 1000ms; }

/* ===== Utility: Transition Timings ===== */
.transition-fast { transition-duration: 150ms; }
.transition-base { transition-duration: 300ms; }
.transition-slow { transition-duration: 500ms; }

.ease-linear { transition-timing-function: linear; }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* ===== Reduced Motion Support (Accessibility) ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Disable all custom animations for reduced motion */
  .animate-fade-in,
  .animate-slide-up,
  .animate-slide-down,
  .animate-slide-left,
  .animate-slide-right,
  .animate-scale-in,
  .animate-blur-in,
  .animate-pulse,
  .animate-spin,
  .animate-bounce,
  .animate-shimmer,
  .animate-shake,
  .animate-flash,
  .animate-wiggle,
  .page-enter,
  .page-exit,
  .skeleton,
  .animate-heartbeat,
  .animate-rubber-band {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ===== Dark Mode Animation Adjustments ===== */
.dark-mode .animate-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  background-size: 200% 100%;
}

.dark-mode .skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(255, 255, 255, 0.05) 37%,
    var(--bg-card) 63%
  );
  background-size: 400% 100%;
}

.dark-mode .hover-glow:hover {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.dark-mode .hover-lift:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* End of Animations Library */

/* ========================================================================
   RESPONSIVE DESIGN SYSTEM
   Systematic breakpoints for optimal cross-device experience
   ======================================================================== */

/* ===== Wide Desktop (≥1440px) ===== */
@media (min-width: 1440px) {
  .container, .app-container {
    max-width: 1400px;
    margin: 0 auto;
  }

  .grid-3-col, .metrics-grid, .card-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  #map { height: 600px; }
  .property-header { padding: 32px; }
  .stats-card, .metric-card { padding: 28px; }
}

/* ===== Tablet Landscape (1024px-1279px) ===== */
@media (max-width: 1279px) and (min-width: 1024px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .grid-3-col, .metrics-grid, .card-grid, .violations-grid, .permits-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card, .metric-card, .stats-card { padding: 18px; }
  #map { height: 400px; }
  .property-header { padding: 20px; }
  .search-container { max-width: 600px; }
}

/* ===== Tablet Portrait (768px-1023px) ===== */
@media (max-width: 1023px) and (min-width: 768px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }
  body { font-size: 14px; }

  .container, .app-container { padding: 16px; }
  .split-view, .two-col-layout { flex-direction: column; }

  .grid-3-col, .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-grid { grid-template-columns: 1fr; }
  .card, .metric-card, .stats-card { padding: 16px; }

  .nav-tabs { gap: 8px; }
  .nav-tabs button {
    font-size: 13px;
    padding: 10px 16px;
  }

  #map { height: 350px; }
  .property-header { padding: 16px; }
  .property-address {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .search-container { max-width: 100%; }

  .data-table th:nth-child(n+5),
  .data-table td:nth-child(n+5) {
    display: none;
  }

  .compare-grid { grid-template-columns: 1fr; }
}

/* ===== Mobile Large (480px-767px) ===== */
@media (max-width: 767px) and (min-width: 480px) {
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.15rem; }
  h3 { font-size: 0.95rem; }
  body { font-size: 14px; }

  .grid-3-col, .metrics-grid, .card-grid, .violations-grid, .permits-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card, .metric-card, .stats-card {
    width: 100%;
    padding: 14px;
  }

  .metric-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .metric-card .metric-value { font-size: 1.5rem; }
  .metric-card .metric-label { font-size: 0.85rem; }

  .chart-container { height: 250px; }

  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) {
    display: none;
  }

  #map { height: 300px; }
  .property-header { padding: 14px; }
  .property-address {
    flex-direction: column;
    gap: 8px;
  }

  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }

  .nav-tabs button {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .search-input {
    font-size: 14px;
    padding: 10px 40px 10px 12px;
  }

  .btn-primary, .btn-secondary {
    padding: 10px 16px;
    font-size: 14px;
  }

  .dashboard-grid { grid-template-columns: 1fr; }

  .auth-modal {
    width: 95%;
    max-width: 400px;
    padding: 20px;
  }
}

/* ===== Mobile Small (≤479px) ===== */
@media (max-width: 479px) {
  h1 { font-size: 1.1rem; }
  h2 { font-size: 1rem; }
  h3 { font-size: 0.9rem; }
  body { font-size: 13px; }

  .container, .app-container { padding: 12px; }

  .card, .metric-card, .stats-card {
    padding: 12px;
    margin-bottom: 8px;
  }

  .card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

  .metric-row {
    flex-direction: column;
    gap: 8px;
  }

  .metric-card { width: 100%; }

  /* Tab labels - icon-only mode */
  .nav-tabs button span.tab-text { display: none; }
  .nav-tabs button {
    padding: 10px;
    min-width: 44px;
  }

  /* Table - card-style rows */
  .data-table thead { display: none; }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
  }

  .data-table td {
    text-align: left;
    padding: 6px 0;
    border: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    display: inline-block;
    width: 120px;
  }

  #map { height: 250px; }
  .property-header { padding: 12px; }
  .property-title { font-size: 1rem; }
  .search-container { margin-bottom: 12px; }

  .search-input {
    font-size: 14px;
    padding: 10px 36px 10px 10px;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }

  .button-group {
    flex-direction: column;
    gap: 8px;
  }

  .chart-container { height: 200px; }

  .auth-modal {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    padding: 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .compare-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .compare-property-card { padding: 12px; }
}

/* ===== Touch Target Sizes (Mobile) ===== */
@media (max-width: 767px) {
  button, .btn, .nav-tabs button, a.button, .icon-button {
    min-height: 44px;
    min-width: 44px;
  }

  .button-group { gap: 8px; }
  .nav-tabs { gap: 8px; }

  input[type="checkbox"],
  input[type="radio"] {
    width: 24px;
    height: 24px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea,
  select {
    min-height: 44px;
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* ===== Landscape Mobile (max-height: 500px) ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .property-header { padding: 8px 16px; }
  .card, .metric-card { padding: 10px; }

  h1 { font-size: 1.2rem; }
  h2 { font-size: 1rem; }

  #map {
    height: calc(100vh - 120px);
    max-height: 350px;
  }

  .nav-tabs button { padding: 6px 12px; }
  .property-description { display: none; }

  .auth-modal {
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ===== Container Queries (Progressive Enhancement) ===== */
@supports (container-type: inline-size) {
  .metric-container,
  .widget-container {
    container-type: inline-size;
  }

  @container (max-width: 400px) {
    .metric-card {
      flex-direction: column;
      align-items: flex-start;
    }

    .metric-value { font-size: 1.5rem; }
    .metric-label { font-size: 0.85rem; }
  }

  @container (max-width: 300px) {
    .chart-container { height: 180px; }
    .card-header h3 { font-size: 0.9rem; }
  }
}

/* ===== Print Styles ===== */
@media print {
  .nav-tabs,
  .search-container,
  .btn,
  .button-group,
  #map {
    display: none !important;
  }

  .tab-content { display: block !important; }

  body {
    background: white;
    color: black;
    font-size: 12pt;
  }

  .card, .property-header {
    border: 1px solid #ccc;
    page-break-inside: avoid;
    box-shadow: none;
    background: white !important;
  }

  a {
    color: #0066cc;
    text-decoration: underline;
  }
}

/* ===== Reduced Motion Preference ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* End of Responsive Design System */

/* R19: Premium Visual Polish */

/* 1. Glassmorphism card variants */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.glass-card-dark {
  background: rgba(30, 30, 30, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* 2. Gradient text effects */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

.gradient-text-blue {
  background: linear-gradient(135deg, #0066cc 0%, #004c99 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 3. Card hover lift effects */
.card-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
}

.card-lift:hover {
  transform: translateY(-8px) rotateX(2deg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-3d {
  perspective: 1000px;
}

.card-3d .card {
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}

.card-3d .card:hover {
  transform: translateZ(20px) rotateX(5deg);
}

/* 4. Smooth page transitions (View Transition API) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-old(root) {
  animation-name: fade-out;
}

::view-transition-new(root) {
  animation-name: fade-in;
}

@keyframes fade-out {
  to {
    opacity: 0;
    transform: scale(0.98);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
}

/* 5. Loading shimmer refinement */
.loading-shimmer-refined {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e8e8e8 20%,
    #f0f0f0 40%,
    #e8e8e8 60%,
    #f0f0f0 80%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: shimmer-refined 2s ease-in-out infinite;
}

@keyframes shimmer-refined {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-refined {
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
}

.skeleton-refined::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  height: 100%;
  width: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: skeleton-wave 1.5s ease-in-out infinite;
}

@keyframes skeleton-wave {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 6. Focus ring styles */
*:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.focus-ring-success:focus-visible {
  outline-color: #28a745;
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
}

.focus-ring-danger:focus-visible {
  outline-color: #dc3545;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
}

/* 7. Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
  border: 2px solid #f1f1f1;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #888 #f1f1f1;
}

.dark-scrollbar::-webkit-scrollbar-track {
  background: #2a2a2a;
}

.dark-scrollbar::-webkit-scrollbar-thumb {
  background: #666;
  border-color: #2a2a2a;
}

.dark-scrollbar {
  scrollbar-color: #666 #2a2a2a;
}

/* 8. Selection highlighting */
::selection {
  background-color: rgba(0, 102, 204, 0.2);
  color: inherit;
}

::-moz-selection {
  background-color: rgba(0, 102, 204, 0.2);
  color: inherit;
}

.code-block::selection,
.code-block ::-moz-selection {
  background-color: rgba(102, 126, 234, 0.3);
}

/* 9. Number counter animation */
@keyframes count-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.counter-animate {
  animation: count-up 0.5s ease-out;
}

@keyframes pulse-number {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.number-pulse {
  display: inline-block;
  animation: pulse-number 0.6s ease-in-out;
}

.counter-stagger:nth-child(1) { animation-delay: 0s; }
.counter-stagger:nth-child(2) { animation-delay: 0.1s; }
.counter-stagger:nth-child(3) { animation-delay: 0.2s; }
.counter-stagger:nth-child(4) { animation-delay: 0.3s; }
.counter-stagger:nth-child(5) { animation-delay: 0.4s; }

/* 10. Tooltip system */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  max-width: 300px;
  white-space: normal;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-tooltip]::after {
  content: '';
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tooltip-position="bottom"]::before {
  bottom: auto;
  top: calc(100% + 12px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-position="bottom"]::after {
  bottom: auto;
  top: calc(100% + 6px);
  border-top-color: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.9);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-position="bottom"]:hover::before,
[data-tooltip-position="bottom"]:hover::after {
  transform: translateX(-50%) translateY(0);
}

[data-tooltip-position="left"]::before {
  left: auto;
  right: calc(100% + 12px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}

[data-tooltip-position="left"]::after {
  left: auto;
  right: calc(100% + 6px);
  bottom: auto;
  top: 50%;
  border-top-color: transparent;
  border-left-color: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) translateX(4px);
}

[data-tooltip-position="left"]:hover::before,
[data-tooltip-position="left"]:hover::after {
  transform: translateY(-50%) translateX(0);
}

[data-tooltip-position="right"]::before {
  left: calc(100% + 12px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}

[data-tooltip-position="right"]::after {
  left: calc(100% + 6px);
  bottom: auto;
  top: 50%;
  border-top-color: transparent;
  border-right-color: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) translateX(-4px);
}

[data-tooltip-position="right"]:hover::before,
[data-tooltip-position="right"]:hover::after {
  transform: translateY(-50%) translateX(0);
}

[data-tooltip-variant="info"]::before {
  background: rgba(0, 102, 204, 0.95);
}

[data-tooltip-variant="info"]::after {
  border-top-color: rgba(0, 102, 204, 0.95);
}

[data-tooltip-variant="success"]::before {
  background: rgba(40, 167, 69, 0.95);
}

[data-tooltip-variant="success"]::after {
  border-top-color: rgba(40, 167, 69, 0.95);
}

[data-tooltip-variant="warning"]::before {
  background: rgba(255, 193, 7, 0.95);
  color: #000;
}

[data-tooltip-variant="warning"]::after {
  border-top-color: rgba(255, 193, 7, 0.95);
}

[data-tooltip-variant="danger"]::before {
  background: rgba(220, 53, 69, 0.95);
}

[data-tooltip-variant="danger"]::after {
  border-top-color: rgba(220, 53, 69, 0.95);
}

/* End R19: Premium Visual Polish */

/* R20: Document Intelligence Styles */
.document-intelligence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.doc-type-summary {
  margin-top: 12px;
  text-align: center;
}

/* Mortgage Tracker */
.mortgage-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mortgage-comparison {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mortgage-bar-container {
  width: 100%;
  height: 40px;
  background: #f3f4f6;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  position: relative;
}

.mortgage-bar {
  height: 100%;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.mortgage-bar.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.mortgage-bar.satisfied {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.mortgage-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.active {
  background: #3b82f6;
}

.legend-dot.satisfied {
  background: #10b981;
}

.debt-estimate {
  padding: 12px;
  background: #fef3c7;
  border-radius: 6px;
  border-left: 4px solid #f59e0b;
}

.debt-estimate .amount {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #d97706;
  margin: 4px 0;
}

.lender-breakdown {
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.lender-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.lender-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}

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

.lender-name {
  color: #374151;
  flex: 1;
}

.lender-count {
  color: #6b7280;
  font-weight: 600;
}

/* Transaction Velocity */
.velocity-display {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.velocity-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.velocity-count {
  font-size: 32px;
  font-weight: 700;
  color: #1f2937;
}

.velocity-years {
  font-size: 28px;
  font-weight: 700;
  color: #3b82f6;
}

.velocity-text {
  color: #6b7280;
}

.velocity-rate {
  padding: 8px 16px;
  background: #dbeafe;
  border-radius: 6px;
  color: #1e40af;
  font-size: 14px;
}

.velocity-trend {
  font-size: 14px;
  font-weight: 600;
}

.velocity-range {
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

/* Notable Documents */
.notable-docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.notable-doc-item {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.notable-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.severity-badge {
  font-size: 16px;
}

.notable-date {
  margin-left: auto;
  font-size: 12px;
  color: #6b7280;
}

.notable-reason {
  font-size: 13px;
  color: #374151;
  margin-top: 4px;
}

/* Recording Lag Analysis */
.lag-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lag-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
}

.lag-label {
  color: #6b7280;
  font-size: 13px;
}

.lag-value {
  font-weight: 700;
  color: #1f2937;
  font-size: 15px;
}

.lag-assessment {
  padding: 12px;
  background: #f0fdf4;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
}

/* Document Search */
.doc-search-container {
  margin-top: 12px;
}

.doc-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.doc-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.doc-search-results {
  margin-top: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-result-item {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}

.result-date {
  font-size: 12px;
  color: #6b7280;
}

.result-party {
  font-size: 13px;
  color: #374151;
  margin: 3px 0;
}

.result-amount {
  font-size: 14px;
  font-weight: 700;
  color: #059669;
  margin-top: 6px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .document-intelligence-grid {
    grid-template-columns: 1fr;
  }

  .velocity-main {
    font-size: 14px;
  }

  .velocity-count {
    font-size: 24px;
  }

  .velocity-years {
    font-size: 22px;
  }
}
/* End R20: Document Intelligence Styles */
