/* Modern, clean, appealing UI without heavy frameworks */
:root {
  --bg: #0b1020;
  --panel: rgba(20, 25, 40, 0.8);
  --text: #e5e7eb;
  --muted: #a1a1aa;
  --accent: #60a5fa;
  /* Sognenett fargar frå grafisk profil */
  --turkis: #00b2a9;  /* Pantone 326 C - Hus med fiber og abonnement */
  --blue: #e63946;    /* Raud - Hus med fiber utan abonnement */
  --gray: #313b45;    /* Pantone 432 - Hus utan fiber */
  --border: rgba(255,255,255,0.08);
  --shadow: 0 10px 25px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body { margin: 0; background: linear-gradient(120deg, #0b1020, #121a2f); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

.layout { display: grid; grid-template-rows: 80px 1fr; height: 100%; }

/* Modern Header with Glassmorphism */
.app-header {
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px; 
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px); 
  background: linear-gradient(135deg, rgba(20, 25, 40, 0.95), rgba(11, 16, 32, 0.9));
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

/* Animated background effect */
.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 178, 169, 0.05),
    transparent
  );
  animation: headerShine 8s infinite;
}

@keyframes headerShine {
  0% { left: -100%; }
  100% { left: 100%; }
}

.brand { 
  display: flex; 
  align-items: center; 
  gap: 16px;
  position: relative;
  z-index: 1;
}

/* Logo with pulse animation */
.logo-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-img {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 178, 169, 0.3));
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.logo-wrapper:hover .logo-img {
  transform: scale(1.05) translateY(-2px);
  filter: drop-shadow(0 4px 16px rgba(0, 178, 169, 0.6));
}

.logo-glow {
  position: absolute;
  width: 60px;
  height: 60px;
  background: radial-gradient(
    circle,
    rgba(0, 178, 169, 0.3),
    transparent 70%
  );
  border-radius: 50%;
  animation: pulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

.title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title { 
  font-size: 20px; 
  font-weight: 700; 
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, #fff, var(--turkis));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 8px rgba(0, 178, 169, 0.2);
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.actions { 
  display: flex; 
  gap: 12px;
  position: relative;
  z-index: 1;
}

.btn { 
  padding: 12px 20px; 
  border-radius: 12px; 
  text-decoration: none; 
  color: white;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn.primary { 
  background: linear-gradient(135deg, var(--turkis), var(--blue));
  box-shadow: 0 4px 16px rgba(0, 178, 169, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(0, 178, 169, 0.3);
}

.btn.primary:hover { 
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 178, 169, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 178, 169, 0.4);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn.secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn.admin {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn.admin:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn.admin:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Compact Stats in Header */
.stats-header-compact {
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 1;
  position: relative;
  flex-shrink: 0;
}

.stat-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-compact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  transition: width 0.3s ease;
}

.stat-compact.turkis::before {
  background: var(--turkis);
}

.stat-compact.blue::before {
  background: var(--blue);
}

.stat-compact.gray::before {
  background: var(--gray);
}

.stat-compact.accent::before {
  background: var(--accent);
}

.stat-compact:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.stat-compact:hover::before {
  width: 100%;
  opacity: 0.1;
}

.stat-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.stat-text {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.stat-compact.turkis .stat-number {
  color: var(--turkis);
}

.stat-compact.blue .stat-number {
  color: var(--blue);
}

.stat-compact.gray .stat-number {
  color: var(--gray);
}

.stat-compact.accent .stat-number {
  color: var(--accent);
}

.content { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 80px); }
.sidebar {
  padding: 16px; border-right: 1px solid var(--border); background: linear-gradient(180deg, rgba(18,26,47,0.95), rgba(18,26,47,0.75));
}
.map-container { position: relative; }
.map { position: absolute; inset: 0; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px 0; font-size: 16px; font-weight: 600; color: #fff; }
.checkbox { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
/* Modern Card Styling */
.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-card, .stats-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.filter-card:hover, .stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 178, 169, 0.15);
}

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

.filter-group.compact {
  gap: 8px;
}

/* Custom Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
  position: relative;
}

.checkbox-label.compact {
  padding: 8px 10px;
  gap: 10px;
}

.checkbox-label:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-custom {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom {
  background: linear-gradient(135deg, var(--turkis), var(--blue));
  border-color: var(--turkis);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.label {
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  transition: all 0.3s ease;
}

.label.compact {
  padding: 6px 10px;
  font-size: 13px;
}

.label-icon {
  font-size: 16px;
  opacity: 0.8;
}

/* Import Issues Page */
.import-issues-page {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.report-header {
  margin-bottom: 32px;
  animation: slideDown 0.4s ease-out;
}

.report-header h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, var(--turkis) 0%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.report-header p {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
  animation: slideUp 0.5s ease-out;
}

.summary-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}

.summary-card .card-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.summary-card .card-label {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card .card-value {
  font-size: 36px;
  font-weight: 700;
  margin: 0;
}

.summary-card.fuzzy .card-value {
  color: #ff9800;
}

.summary-card.parse .card-value {
  color: #e53e3e;
}

.summary-card.no-match .card-value {
  color: #718096;
}

.filter-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.filter-tabs button {
  flex: 1;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.2s;
}

.filter-tabs button:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--gray);
}

.filter-tabs button.active {
  background: linear-gradient(135deg, var(--turkis) 0%, var(--blue) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 178, 169, 0.3);
}

.issues-table-container {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  animation: slideUp 0.6s ease-out;
}

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

.issues-table thead th {
  text-align: left;
  padding: 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.issues-table tbody tr {
  transition: background 0.2s;
}

.issues-table tbody tr:hover {
  background: rgba(0, 178, 169, 0.05);
}

.issues-table tbody td {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 14px;
  vertical-align: top;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.fuzzy {
  background: rgba(255, 152, 0, 0.15);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge.parse {
  background: rgba(229, 62, 62, 0.15);
  color: #e53e3e;
  border: 1px solid rgba(229, 62, 62, 0.3);
}

.badge.no-match {
  background: rgba(113, 128, 150, 0.15);
  color: #718096;
  border: 1px solid rgba(113, 128, 150, 0.3);
}

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

.matched-list li {
  padding: 6px 12px;
  background: rgba(0, 178, 169, 0.08);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--gray);
  border-left: 3px solid var(--turkis);
}

.matched-list li:last-child {
  margin-bottom: 0;
}

.customer-info {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}

.customer-info strong {
  color: var(--gray);
  display: block;
  margin-bottom: 2px;
}

.label.turkis {
  border: 1px solid rgba(0, 178, 169, 0.45);
  color: var(--turkis);
  background: rgba(0, 178, 169, 0.08);
}

.label.blue {
  border: 1px solid rgba(0, 125, 195, 0.45);
  color: var(--blue);
  background: rgba(0, 125, 195, 0.08);
}

.label.gray {
  border: 1px solid rgba(49, 59, 69, 0.45);
  color: var(--gray);
  background: rgba(49, 59, 69, 0.08);
}

.checkbox-label:hover .label {
  box-shadow: 0 4px 12px rgba(0, 178, 169, 0.2);
}

/* Stats Group */
.stats-group {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  transition: transform 0.3s ease;
}

.stat-value.turkis { color: var(--turkis); }
.stat-value.blue { color: var(--blue); }
.stat-value.gray { color: var(--gray); }

.stat-item:hover .stat-value {
  transform: scale(1.1);
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

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

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-fill.turkis {
  background: linear-gradient(90deg, var(--turkis), rgba(0, 178, 169, 0.7));
  box-shadow: 0 0 10px rgba(0, 178, 169, 0.5);
}

.progress-fill.blue {
  background: linear-gradient(90deg, var(--blue), rgba(0, 125, 195, 0.7));
  box-shadow: 0 0 10px rgba(0, 125, 195, 0.5);
}

.progress-fill.gray {
  background: linear-gradient(90deg, var(--gray), rgba(49, 59, 69, 0.7));
  box-shadow: 0 0 10px rgba(49, 59, 69, 0.5);
}

/* Highlight Stat */
.highlight-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, rgba(0, 178, 169, 0.15), rgba(0, 125, 195, 0.15));
  border-radius: 12px;
  border: 1px solid rgba(0, 178, 169, 0.3);
  transition: all 0.3s ease;
}

.highlight-stat:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 178, 169, 0.3);
}

.highlight-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--turkis);
}

.highlight-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 178, 169, 0.5);
}

.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; color: var(--muted); }
.pill { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.06); color: #fff; font-weight: 600; }
.pill.turkis { color: var(--turkis); border: 1px solid rgba(0,178,169,0.35); }
.pill.blue { color: var(--blue); border: 1px solid rgba(0,125,195,0.35); }
.pill.gray { color: var(--gray); border: 1px solid rgba(49,59,69,0.35); }
.pill.accent { color: var(--accent); border: 1px solid rgba(96,165,250,0.35); }
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ===== TRENDS PANEL ===== */
.trends-card {
  margin-top: 16px;
  min-height: 400px;
}

.trends-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.auto-play-btn {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--accent);
}

.auto-play-btn:hover {
  background: rgba(96, 165, 250, 0.2);
  transform: scale(1.05);
}

.auto-play-btn.active {
  background: rgba(96, 165, 250, 0.25);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
}

.trend-content {
  margin-bottom: 20px;
  max-height: 600px;
  overflow-y: auto;
}

.trend-content::-webkit-scrollbar {
  width: 6px;
}

.trend-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.trend-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.trend-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.trend-description {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.trend-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.trend-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
}

.trend-item.risk {
  border-left: 3px solid #ef4444;
}

.trend-item.success {
  border-left: 3px solid var(--turkis);
}

.trend-rank {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 50%;
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}

.trend-rank.success {
  background: rgba(0, 178, 169, 0.15);
  border-color: rgba(0, 178, 169, 0.3);
  color: var(--turkis);
}

.trend-details {
  flex: 1;
  min-width: 0;
}

.trend-details.wide {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trend-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.trend-stat {
  font-size: 12px;
  color: var(--muted);
}

.trend-percent {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  padding: 2px 8px;
  background: rgba(96, 165, 250, 0.1);
  border-radius: 6px;
  white-space: nowrap;
}

.trend-percent.risk {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.trend-percent.success {
  color: var(--turkis);
  background: rgba(0, 178, 169, 0.1);
}

.trend-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.summary-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.trends-navigation {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.nav-dot:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.2);
}

.nav-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: 14px;
}

/* Clickable stat card */
.stat-compact.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat-compact.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(96, 165, 250, 0.3);
}

/* Addresses page */
.addresses-page {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}

.addresses-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.back-button {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
}

.addresses-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.addresses-count {
  font-size: 14px;
  color: var(--muted);
  margin: 5px 0 0 0;
}

.addresses-table-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.addresses-table thead {
  background: rgba(96, 165, 250, 0.1);
  border-bottom: 2px solid var(--accent);
}

.addresses-table th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.addresses-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.addresses-table th.sortable:hover {
  background: rgba(96, 165, 250, 0.2);
  color: var(--accent);
}

.addresses-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.addresses-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.addresses-table td {
  padding: 14px 16px;
  color: var(--text);
  font-size: 14px;
}

.addresses-table tbody tr:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 1000px) {
  .content { grid-template-columns: 1fr; }
  .sidebar { height: 380px; overflow: auto; }
  .map-container { height: calc(100vh - 64px - 380px); }
  
  .addresses-table {
    font-size: 12px;
  }
  
  .addresses-table th,
  .addresses-table td {
    padding: 10px 12px;
  }
}

/* ==================== SEARCH BAR ==================== */

.search-bar-wrapper {
  position: relative;
  margin-bottom: 16px;
  z-index: 100;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.search-bar:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.search-bar:focus-within {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--turkis);
  box-shadow: 0 0 0 3px rgba(0, 178, 169, 0.1);
}

.search-icon {
  font-size: 18px;
  color: var(--muted);
  margin-right: 12px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  padding: 14px 0;
  font-family: inherit;
}

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

.search-loader {
  font-size: 16px;
  animation: spin 1s linear infinite;
  margin-left: 8px;
  flex-shrink: 0;
}

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

.search-clear {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  margin-left: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(20, 25, 40, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  overflow: hidden;
  animation: dropdownSlideIn 0.2s ease-out;
}

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

.search-results-header {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.search-result-item:hover,
.search-result-item.selected {
  background: rgba(0, 178, 169, 0.1);
  border-left: 3px solid var(--turkis);
  padding-left: 13px;
}

.result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.result-address {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.result-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.result-badge.HC_WITH_SUB {
  background: rgba(0, 178, 169, 0.15);
  color: var(--turkis);
  border: 1px solid rgba(0, 178, 169, 0.3);
}

.result-badge.HC_NO_SUB {
  background: rgba(0, 125, 195, 0.15);
  color: var(--blue);
  border: 1px solid rgba(0, 125, 195, 0.3);
}

.result-location {
  font-size: 12px;
  color: var(--muted);
}

.search-no-results {
  padding: 32px 16px;
  text-align: center;
}

.no-results-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

.search-no-results p {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.search-no-results small {
  color: var(--muted);
  font-size: 12px;
}

/* Layer Toggle Buttons */
.layer-toggle-buttons {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 1000;
}

.layer-btn {
  padding: 10px 16px;
  background: rgba(20, 25, 40, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.layer-btn:hover {
  background: rgba(30, 35, 50, 0.95);
  border-color: var(--turkis);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.layer-btn.active {
  background: var(--turkis);
  border-color: var(--turkis);
  color: white;
  box-shadow: 0 4px 16px rgba(0, 178, 169, 0.4);
}

.layer-btn.active:hover {
  background: #009d95;
  transform: translateY(-1px);
}

/* Map marker popup */
.map-popup {
  position: absolute;
  min-width: 260px;
  max-width: 340px;
  padding: 14px;
  background: rgba(20, 25, 40, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  color: var(--text);
  z-index: 1000;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.popup-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex: 1;
}

.popup-close {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  line-height: 22px;
  text-align: center;
  font-weight: 700;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.popup-close:hover {
  background: rgba(255,255,255,0.12);
}

.popup-content p {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.popup-status {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.popup-status.status-with-sub {
  background: rgba(0, 178, 169, 0.18);
  border: 1px solid #00b2a9;
  color: #d9fbf8;
}

.popup-status.status-no-sub {
  background: rgba(230, 57, 70, 0.16);
  border: 1px solid #e63946;
  color: #ffd9dd;
}

.popup-status.status-no-fiber {
  background: rgba(49, 59, 69, 0.16);
  border: 1px solid #313b45;
  color: var(--text);
}

/* Popup action buttons */
.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.popup-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.popup-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--turkis);
  color: var(--turkis);
}

.popup-btn.copied {
  background: rgba(0, 178, 169, 0.2);
  border-color: var(--turkis);
  color: var(--turkis);
}

/* Dark/Light Mode Support */
:root {
  --theme-mode: dark;
}

:root[data-theme="light"] {
  --bg: #f5f7fa;
  --panel: rgba(255, 255, 255, 0.9);
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, 0.1);
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] body {
  background: linear-gradient(120deg, #f5f7fa, #e4e9f2);
}

:root[data-theme="light"] .app-header {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(245, 247, 250, 0.9));
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
}

:root[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .title {
  background: linear-gradient(135deg, #1a1a2e, var(--turkis));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

:root[data-theme="light"] .map-popup {
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
}

:root[data-theme="light"] .popup-content h4 {
  color: #1a1a2e;
}

:root[data-theme="light"] .popup-content p {
  color: #6b7280;
}

:root[data-theme="light"] .popup-btn {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a2e;
}

:root[data-theme="light"] .stat-number {
  color: #1a1a2e;
}

:root[data-theme="light"] .stat-compact.turkis .stat-number {
  color: #008a82;
}

:root[data-theme="light"] .stat-compact.blue .stat-number {
  color: #c82333;
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

:root[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Export button with loading state */
.export-wrapper {
  position: relative;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.export-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.export-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.export-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(20, 25, 40, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 14px;
  animation: slideInRight 0.3s ease-out;
}

.toast.success {
  border-left: 4px solid var(--turkis);
}

.toast.error {
  border-left: 4px solid #e63946;
}

.toast.info {
  border-left: 4px solid var(--accent);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

:root[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
}

/* Last updated indicator */
.last-updated {
  position: fixed;
  bottom: 24px;
  left: 360px;
  padding: 8px 14px;
  background: rgba(20, 25, 40, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted);
  z-index: 100;
  cursor: default;
  transition: all 0.2s ease;
}

.last-updated:hover {
  background: rgba(20, 25, 40, 0.95);
  color: var(--text);
}

:root[data-theme="light"] .last-updated {
  background: rgba(255, 255, 255, 0.9);
  color: #6b7280;
}

:root[data-theme="light"] .last-updated:hover {
  background: rgba(255, 255, 255, 0.98);
  color: #1a1a2e;
}

/* Auth Button Styles */
.auth-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 14px;
  color: var(--muted);
}

.auth-button {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(96, 165, 250, 0.1);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-button:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.auth-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-button.logout {
  background: rgba(230, 57, 70, 0.1);
  color: #e63946;
  border-color: rgba(230, 57, 70, 0.2);
}

.auth-button.logout:hover {
  background: rgba(230, 57, 70, 0.2);
  border-color: #e63946;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(96, 165, 250, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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