/* ═══════════════════════════════════════════════════════════════════
   NLP Complaint Processor — Design System
   Dark-mode-first · Glassmorphism · Cyan/Teal accent
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  /* Background */
  --bg-primary:    #0b1120;
  --bg-secondary:  #111827;
  --bg-card:       rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --bg-input:      rgba(15, 23, 42, 0.9);
  --bg-glass:      rgba(15, 23, 42, 0.55);

  /* Accent */
  --cyan:          #06b6d4;
  --cyan-glow:     rgba(6, 182, 212, 0.25);
  --teal:          #14b8a6;
  --amber:         #f59e0b;
  --amber-soft:    rgba(245, 158, 11, 0.15);
  --emerald:       #10b981;
  --emerald-soft:  rgba(16, 185, 129, 0.15);
  --rose:          #f43f5e;

  /* Text */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-accent:    #22d3ee;

  /* Border */
  --border:         rgba(148, 163, 184, 0.1);
  --border-focus:   rgba(6, 182, 212, 0.5);

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(6, 182, 212, 0.15);

  /* Font */
  --font-ui:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Transition */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(6,182,212,0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(20,184,166,0.06), transparent);
}

/* ── Glass Card ────────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ── Header ────────────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 20px var(--cyan-glow);
}

#app-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  font-size: 0.78rem;
  color: var(--emerald);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.header-badge.error {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--rose);
}
.header-badge.error .status-dot {
  background: var(--rose);
  box-shadow: 0 0 8px var(--rose);
}

/* ── Main ──────────────────────────────────────────────────────── */
#app-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Section Title ─────────────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
}
.section-title svg { color: var(--cyan); }

/* ── Input Panel ───────────────────────────────────────────────── */
#input-panel { padding: 24px 28px 28px; }

/* Tabs */
.input-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

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

/* Textarea */
#complaint-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.7;
  resize: vertical;
  transition: var(--transition);
  outline: none;
}
#complaint-input::placeholder { color: var(--text-muted); }
#complaint-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.input-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Drop Zone */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.05);
  color: var(--text-secondary);
}
.drop-zone.drag-over {
  box-shadow: 0 0 0 3px var(--cyan-glow);
}
.drop-text { font-size: 0.95rem; font-weight: 500; }
.drop-sub  { font-size: 0.8rem; }

.csv-preview {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.15);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Process Button */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #fff;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--cyan-glow);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary.loading {
  pointer-events: none;
}
.btn-primary.loading span { visibility: hidden; }
.btn-primary.loading svg  { visibility: hidden; }
.btn-primary.loading .btn-loader { visibility: visible; }

.btn-loader {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-loader.hidden { visibility: hidden; }

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

/* ── Result Tabs ───────────────────────────────────────────────── */
.result-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px;
  margin-bottom: 4px;
}

.result-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.result-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.result-tab.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
  box-shadow: inset 0 0 12px var(--cyan-glow);
}

.result-panel { display: none; animation: fadeIn 0.35s ease; }
.result-panel.active { display: block; }

/* ── Map ───────────────────────────────────────────────────────── */
.map-container {
  width: 100%;
  height: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* Dark map tiles */
.leaflet-tile-pane { filter: brightness(0.72) contrast(1.15) saturate(0.85) hue-rotate(180deg) invert(1); }
.leaflet-control-attribution { display: none !important; }

/* ── Entity Table ──────────────────────────────────────────────── */
.table-wrapper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
}

#entity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#entity-table thead {
  background: rgba(6, 182, 212, 0.08);
}

#entity-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

#entity-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
}

#entity-table tbody tr {
  transition: var(--transition);
}

#entity-table tbody tr:hover {
  background: rgba(6, 182, 212, 0.04);
}

#entity-table tbody tr:last-child td {
  border-bottom: none;
}

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

/* Entity Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 2px 3px 2px 0;
  white-space: nowrap;
}
.badge-lokasi  { background: rgba(6, 182, 212, 0.15);  color: var(--cyan);    border: 1px solid rgba(6, 182, 212, 0.25); }
.badge-kondisi { background: var(--amber-soft);         color: var(--amber);   border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-infra   { background: var(--emerald-soft);       color: var(--emerald); border: 1px solid rgba(16, 185, 129, 0.25); }

.coord-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Summary Cards ─────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

.summary-card {
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: default;
}
.summary-card:hover {
  border-color: rgba(6, 182, 212, 0.25);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* Card Header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.card-coords {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(6, 182, 212, 0.06);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

/* Reduction Badge */
.card-reduction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
  letter-spacing: 0.02em;
}

/* Before / After Compare Layout */
.card-compare {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Shared section style */
.card-section {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border);
}

/* BEFORE — Teks Asli */
.card-section--original {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.12);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

/* AFTER — Hasil Ekstraksi */
.card-section--summary {
  background: rgba(6, 182, 212, 0.06);
  border-color: rgba(6, 182, 212, 0.22);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}

/* Section Label (header inside section) */
.card-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.card-section--original .card-section-label {
  color: var(--text-muted);
}
.card-section--summary .card-section-label {
  color: var(--cyan);
}

/* Section Text */
.card-section-text {
  font-size: 0.875rem;
  line-height: 1.75;
}
.card-section--original .card-section-text {
  color: var(--text-muted);
}
.card-section--summary .card-section-text {
  color: var(--text-primary);
  font-weight: 500;
}

/* Arrow Divider */
.card-compare-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
  background: linear-gradient(180deg,
    rgba(6, 182, 212, 0.08) 0%,
    rgba(6, 182, 212, 0.12) 50%,
    rgba(6, 182, 212, 0.08) 100%
  );
  border-left: 1px solid rgba(6, 182, 212, 0.22);
  border-right: 1px solid rgba(6, 182, 212, 0.22);
  position: relative;
}
.card-compare-arrow svg {
  flex-shrink: 0;
  animation: bounce-arrow 1.8s ease-in-out infinite;
}

@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(3px); }
}


/* ── Stats ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 22px 20px;
  text-align: center;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }

.stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.stat-number.accent-cyan    { color: var(--cyan); }
.stat-number.accent-amber   { color: var(--amber); }
.stat-number.accent-emerald { color: var(--emerald); }

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.chart-box {
  padding: 24px;
}
.chart-box h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ── Processing Overlay ────────────────────────────────────────── */
#processing-overlay {
  animation: fadeIn 0.3s ease;
}

.overlay-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 36px;
  text-align: center;
}

.overlay-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
}

.spinner-svg {
  width: 100%;
  height: 100%;
  animation: spin 1.2s linear infinite;
}

.overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.overlay-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  font-family: var(--font-mono);
}

.overlay-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 24px;
}

.overlay-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  border-radius: 100px;
  transition: width 0.5s ease;
  box-shadow: 0 0 12px var(--cyan-glow);
}

.overlay-steps {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.step-item {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.04);
  border: 1px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-item.active {
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.06);
  border-color: rgba(6, 182, 212, 0.15);
}

.step-item.done {
  color: var(--emerald);
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.15);
}

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

.overlay-count {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Summary Banner ────────────────────────────────────────────── */
.summary-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px 28px;
  margin-bottom: 8px;
  animation: fadeIn 0.4s ease;
}

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

.banner-num {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.banner-num.banner-valid {
  color: var(--emerald);
}

.banner-num.banner-discarded {
  color: var(--rose);
}

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

.banner-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  margin: 0 8px;
}

/* ── Report Generation Card Styles ──────────────────────────────── */
.report-actions-card {
  margin-top: 16px;
  margin-bottom: 16px;
  padding: 20px 24px;
}

.report-actions-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.report-title-desc h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.report-title-desc p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.report-buttons {
  display: flex;
  gap: 12px;
}

.btn-secondary-outline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

.btn-accent-gradient {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--cyan-glow);
  transition: var(--transition);
}

.btn-accent-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

/* ── Ranking Leaderboard Styles ────────────────────────────────── */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ranking-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.ranking-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.ranking-item:nth-child(1) .ranking-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.ranking-item:nth-child(2) .ranking-badge {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #fff;
  border: none;
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.4);
}

.ranking-item:nth-child(3) .ranking-badge {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #fff;
  border: none;
  box-shadow: 0 0 10px rgba(180, 83, 9, 0.4);
}

.ranking-name {
  font-weight: 600;
  color: var(--text-primary);
}

.ranking-count {
  font-weight: 500;
  color: var(--cyan);
  font-family: var(--font-mono);
}

.ranking-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  border-radius: 100px;
  width: 0;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Utilities ─────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .report-actions-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .report-buttons {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .header-inner { padding: 12px 16px; }
  #app-main { padding: 16px 12px 40px; }
  #input-panel { padding: 18px 16px 20px; }
  .map-container { height: 320px; }
  .header-badge { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
