/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
 
:root {
  --color-bg: #0f0f13;
  --color-surface: #18181f;
  --color-surface2: #1f1f2a;
  --color-surface3: #26263a;
  --color-border: #2e2e42;
  --color-border-light: #3a3a52;
  --color-text: #e2e2f0;
  --color-text-muted: #7878a0;
  --color-text-dim: #4a4a68;
  --color-a: #6366f1;
  --color-a-light: #818cf8;
  --color-a-glow: rgba(99,102,241,0.25);
  --color-b: #ec4899;
  --color-b-light: #f472b6;
  --color-b-glow: rgba(236,72,153,0.25);
  --color-overlap: #f59e0b;
  --color-overlap-glow: rgba(245,158,11,0.25);
  --color-success: #10b981;
  --color-danger: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --sidebar-w: 320px;
  --header-h: 56px;
}
 
html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
 
/* ─── HEADER ────────────────────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark { flex-shrink: 0; }
.logo-ring-a,
.logo-ring-b { stroke-width: 2.25; }
.logo-ring-a { stroke: var(--color-a); fill: var(--color-a-glow); }
.logo-ring-b { stroke: var(--color-b); fill: var(--color-b-glow); }
.logo-overlap { fill: var(--color-overlap); }
.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.5px;
}
.logo-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  border-left: 1px solid var(--color-border);
  padding-left: 10px;
  margin-left: 2px;
}
.header-actions {
  display: flex;
  gap: 8px;
}
.btn-icon { display: none; }

.progress-bar {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--color-a), var(--color-b));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.progress-bar.active {
  opacity: 1;
  transition: width 0.2s ease, opacity 0.3s ease;
}

/* ─── LAYOUT ────────────────────────────────────────────────────────────────── */
.app-main {
  display: flex;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--header-h);
}
 
/* ─── SIDEBAR ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease, min-width 0.25s ease;
  position: relative;
  z-index: 10;
}
.sidebar.collapsed {
  width: 40px;
  min-width: 40px;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .person-panel,
.sidebar.collapsed .person-divider,
.sidebar.collapsed .demo-section { display: none; }
.sidebar.collapsed .collapse-btn { transform: rotate(180deg); }
 
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}
.collapse-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.collapse-btn:hover { background: var(--color-surface3); color: var(--color-text); }
 
/* ─── PERSON PANEL ──────────────────────────────────────────────────────────── */
.person-panel {
  padding: 14px;
}
.person-a { border-bottom: none; }
.person-b { padding-top: 10px; }
 
.person-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.person-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
}
.person-name-input {
  flex: 1;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.person-name-input:focus { border-color: var(--color-a-light); }
.person-b .person-name-input:focus { border-color: var(--color-b-light); }
.person-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-a { background: var(--color-a); box-shadow: 0 0 6px var(--color-a-glow); }
.dot-b { background: var(--color-b); box-shadow: 0 0 6px var(--color-b-glow); }
.dot-overlap { background: var(--color-overlap); box-shadow: 0 0 6px var(--color-overlap-glow); }
 
.source-group {
  margin-bottom: 12px;
}
.source-logo { flex-shrink: 0; }
.source-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  user-select: none;
}
.file-drop:hover {
  border-color: var(--color-a-light);
  background: rgba(99,102,241,0.05);
  color: var(--color-a-light);
}
.person-b .file-drop:hover {
  border-color: var(--color-b-light);
  background: rgba(236,72,153,0.05);
  color: var(--color-b-light);
}
.file-drop.drag-over {
  border-color: var(--color-a);
  background: var(--color-a-glow);
}
.file-drop.busy {
  border-style: solid;
  border-color: var(--color-a);
  color: var(--color-a-light);
  cursor: progress;
  animation: drop-pulse 1.2s ease-in-out infinite;
}
.person-b .file-drop.busy {
  border-color: var(--color-b);
  color: var(--color-b-light);
}
@keyframes drop-pulse {
  0%, 100% { background: transparent; }
  50% { background: var(--color-surface3); }
}
.drop-icon { font-size: 18px; }
 
.file-list { margin-top: 5px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 3px 4px;
  border-radius: 4px;
}
.file-item .file-icon { font-size: 13px; }
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-count { color: var(--color-success); font-weight: 600; font-size: 10px; }
.file-item .file-remove { cursor: pointer; color: var(--color-text-dim); margin-left: auto; }
.file-item .file-remove:hover { color: var(--color-danger); }
 
.person-stats {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: var(--color-surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}
.stat-key {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}
.person-a .stat-val { color: var(--color-a-light); }
.person-b .stat-val { color: var(--color-b-light); }
 
.person-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  font-size: 14px;
  color: var(--color-text-dim);
  position: relative;
}
.person-divider::before, .person-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
  margin: 0 10px;
}
 
.demo-section {
  padding: 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.demo-hint {
  font-size: 11px;
  color: var(--color-text-muted);
}
 
/* ─── CONTENT ───────────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
 
/* ─── TABS ──────────────────────────────────────────────────────────────────── */
.content-top {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.tab-nav {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 2px;
  padding: 8px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--color-text); background: var(--color-surface2); }
.tab-btn.active { color: var(--color-a-light); border-bottom-color: var(--color-a); }
 
.tab-content { display: none; flex: 1; overflow: hidden; }
.tab-content.active { display: flex; flex-direction: column; }

/* ─── DATE FILTER ───────────────────────────────────────────────────────────── */
.date-filter {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  padding: 6px 14px 6px 0;
  flex-shrink: 0;
}
.date-field {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--color-text-muted);
}
.date-input {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  color-scheme: dark;
  font-family: inherit;
  font-size: 12px;
  padding: 4px 6px;
  outline: none;
}
.date-input:focus { border-color: var(--color-a-light); }
.date-filter.active .date-input { border-color: var(--color-a); }
.date-clear {
  background: none;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 4px;
  visibility: hidden;
}
.date-filter.active .date-clear { visibility: visible; }
.date-clear:hover { color: var(--color-text); background: var(--color-surface3); }
 
/* ─── MAP ───────────────────────────────────────────────────────────────────── */
#tab-map { position: relative; }
 
.map-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.map-toggles {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}
.toggle-label input[type="checkbox"] { accent-color: var(--color-a); width: 14px; height: 14px; }
.toggle-dot { width: 10px; height: 10px; border-radius: 50%; }
.map-options { display: flex; gap: 8px; }
 
#map {
  flex: 1;
  background: #1a1a2e;
  z-index: 1;
}
 
.map-legend {
  position: absolute;
  bottom: 24px;
  right: 14px;
  background: rgba(15,15,19,0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 500;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
 
/* Leaflet overrides */
.leaflet-container { background: #1a1a2e; }
.leaflet-popup-content-wrapper {
  background: var(--color-surface2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--color-surface2); }
.leaflet-popup-content { font-size: 12px; line-height: 1.6; }

/* Overlap cluster popup */
.ovp { min-width: 220px; }
.ovp-title { font-weight: 700; color: var(--color-overlap); margin-bottom: 6px; }
.ovp-match {
  padding: 6px 0;
  border-top: 1px solid var(--color-border);
}
.ovp-side { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.ovp-who { font-weight: 600; }
.ovp-a .ovp-who { color: var(--color-a-light); }
.ovp-b .ovp-who { color: var(--color-b-light); }
.ovp-when { font-size: 11px; color: var(--color-text-muted); }
.ovp-gap { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.ovp-more {
  padding-top: 6px;
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-text-muted);
}
 
/* ─── TIMELINE ──────────────────────────────────────────────────────────────── */
.timeline-controls {
  padding: 10px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.timeline-slider {
  width: 100%;
  accent-color: var(--color-a);
  cursor: pointer;
}
.timeline-dates {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
  align-items: center;
}
.timeline-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--color-a-light); color: var(--color-a-light); }
.chip.active { background: var(--color-a-glow); border-color: var(--color-a); color: var(--color-a-light); }
 
.timeline-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--color-text-muted);
  text-align: center;
}
.empty-icon { font-size: 40px; opacity: 0.5; }
 
/* Timeline Items */
.tl-day-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  padding: 16px 0 6px 28px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2px;
}
.tl-item {
  display: flex;
  gap: 12px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  position: relative;
}
.tl-item:hover { background: var(--color-surface2); }
.tl-item.tl-locatable { cursor: pointer; }
.tl-item.tl-locatable:focus-visible { background: var(--color-surface2); outline: 1px solid var(--color-border-light); outline-offset: -1px; }
/* Connector runs through the dot centers: 4px padding + half of the 12px dot - half the line */
.tl-item::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
  border: 2px solid var(--color-bg);
}
.tl-item.person-a .tl-dot { background: var(--color-a); }
.tl-item.person-b .tl-dot { background: var(--color-b); }
.tl-item.overlap-item .tl-dot { background: var(--color-overlap); }
 
.tl-body { flex: 1; min-width: 0; }
.tl-time { font-size: 10px; color: var(--color-text-muted); margin-bottom: 2px; }
.tl-title { font-size: 13px; font-weight: 500; color: var(--color-text); overflow-wrap: anywhere; }
.tl-sub { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.tl-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 4px;
}
.badge-photo { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-location { background: rgba(99,102,241,0.15); color: var(--color-a-light); }
.badge-checkin { background: rgba(245,158,11,0.15); color: var(--color-overlap); }
.badge-post { background: rgba(236,72,153,0.15); color: var(--color-b-light); }
.badge-place { background: rgba(139,92,246,0.15); color: #a78bfa; }
 
/* ─── OVERLAP TAB ───────────────────────────────────────────────────────────── */
.overlap-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}
.overlap-header h2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.overlap-header p { font-size: 13px; color: var(--color-text-muted); margin-bottom: 12px; }
.overlap-settings {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.overlap-settings label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.overlap-export {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.overlap-results {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.overlap-summary { font-size: 13px; margin-bottom: 12px; }
.overlap-summary .muted { margin-left: 4px; }
 
/* Overlap Cards */
.overlap-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.summary-card {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.summary-card .sv { font-size: 26px; font-weight: 800; color: var(--color-overlap); }
.summary-card .sk { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-muted); margin-top: 4px; }
 
.overlap-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.overlap-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
 
.overlap-card {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-overlap);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.overlap-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.overlap-card:hover,
.overlap-card:focus-visible {
  background: var(--color-surface3);
  border-color: var(--color-overlap);
  outline: none;
}
.overlap-icon { font-size: 18px; color: var(--color-overlap); line-height: 1.2; }
.overlap-info { flex: 1; min-width: 0; }
.overlap-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.overlap-sub { font-size: 11px; color: var(--color-text-muted); margin-bottom: 6px; }
.ov-name-a { color: var(--color-a-light); }
.ov-name-b { color: var(--color-b-light); }
.overlap-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.overlap-card-title { font-size: 14px; font-weight: 600; }
.overlap-card-date { font-size: 11px; color: var(--color-text-muted); }
.overlap-persons {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.overlap-person-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.pill-a { background: var(--color-a-glow); color: var(--color-a-light); border: 1px solid rgba(99,102,241,0.3); }
.pill-b { background: var(--color-b-glow); color: var(--color-b-light); border: 1px solid rgba(236,72,153,0.3); }
.overlap-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--color-text-muted);
}
.overlap-meta span { display: flex; align-items: center; gap: 4px; }
 
.shared-place-card {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-a);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.shared-place-card:hover { background: var(--color-surface3); }
.shared-icon { font-size: 22px; }
.shared-info { flex: 1; }
.shared-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.shared-sub { font-size: 11px; color: var(--color-text-muted); }
.shared-pills { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
 
/* Comparison table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}
.comparison-table th {
  background: var(--color-surface3);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.comparison-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr:hover td { background: var(--color-surface3); }
.col-a { color: var(--color-a-light); }
.col-b { color: var(--color-b-light); }
 
/* ─── SOCIAL TAB ────────────────────────────────────────────────────────────── */
.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}
.social-card {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
}
.social-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
#tab-social { flex-direction: column; overflow-y: auto; }
 
.platform-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--color-surface3);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.platform-icon { font-size: 24px; line-height: 1; }
.platform-info { flex: 1; min-width: 0; }
.platform-handle { font-weight: 400; color: var(--color-text-muted); margin-left: 6px; }
.platform-bio { font-size: 12px; color: var(--color-text-muted); margin-bottom: 8px; }
.platform-posts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.social-post {
  font-size: 12px;
  padding: 6px 8px;
  background: var(--color-surface2);
  border-left: 2px solid var(--color-border-light);
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.connections-section {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.connections-section:last-child { border-bottom: none; }
.platform-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-muted); margin-bottom: 4px; }
.platform-username { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.platform-stats { display: flex; gap: 12px; }
.pstat { font-size: 11px; color: var(--color-text-muted); }
.pstat strong { color: var(--color-text); }
.platform-empty { font-size: 12px; color: var(--color-text-muted); padding: 10px 0; }
 
.social-overlap-card {
  margin: 0 16px 16px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
}
.social-overlap-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.muted { color: var(--color-text-muted); font-size: 12px; }
 
/* ─── METADATA TAB ──────────────────────────────────────────────────────────── */
#tab-metadata { overflow: hidden; }
.metadata-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.metadata-header h2 { font-size: 15px; font-weight: 700; }
.metadata-header p { font-size: 12px; color: var(--color-text-muted); flex: 1; }
.meta-search {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 6px 12px;
  font-size: 12px;
  width: 200px;
  outline: none;
}
.meta-search:focus { border-color: var(--color-a-light); }
.metadata-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 14px 20px;
}
.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.meta-table th {
  background: var(--color-surface3);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
}
.meta-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--color-border);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta-table tr:hover td { background: var(--color-surface2); }
.meta-person-badge {
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
}
.meta-person-a { background: var(--color-a-glow); color: var(--color-a-light); }
.meta-person-b { background: var(--color-b-glow); color: var(--color-b-light); }
.meta-source-badge {
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 10px;
  background: var(--color-surface3);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-light);
}
 
/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--color-a); color: #fff; }
.btn-primary:hover { background: var(--color-a-light); }
.btn-secondary { background: var(--color-surface2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-surface3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: transparent; color: var(--color-text-muted); border: 1px dashed var(--color-border); }
.btn-outline:hover { border-color: var(--color-a-light); color: var(--color-a-light); }
.btn-demo { background: linear-gradient(135deg, var(--color-a), var(--color-b)); color: #fff; font-weight: 600; width: 100%; justify-content: center; }
.btn-demo:hover { opacity: 0.9; }
 
/* ─── FORM ELEMENTS ─────────────────────────────────────────────────────────── */
.select-sm {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.select-sm:focus { border-color: var(--color-a-light); }
 
/* ─── MODAL ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { font-size: 14px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--color-text-muted); cursor: pointer; font-size: 16px; }
.modal-close:hover { color: var(--color-text); }
.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.modal-body input, .modal-body select {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}
.modal-body input:focus, .modal-body select:focus { border-color: var(--color-a-light); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
}
 
/* ─── TOAST ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  animation: slideIn 0.2s ease;
  pointer-events: auto;
}
.toast-success { border-left: 3px solid var(--color-success); }
.toast-error { border-left: 3px solid var(--color-danger); }
.toast-info { border-left: 3px solid var(--color-a); }
.toast-fade {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
 
/* ─── SCROLLBARS ─────────────────────────────────────────────────────────────*/
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-light); }
 
/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────*/
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .logo-sub { display: none; }
  .social-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .header-inner { padding: 0 12px; }
  .header-actions { gap: 6px; }
  .header-actions .btn { padding: 7px 10px; }
  .btn-icon { display: inline; }
  .btn-label { display: none; }

  .sidebar {
    position: absolute;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    z-index: 600;
    box-shadow: var(--shadow);
  }
  .sidebar:not(.collapsed) { width: min(90vw, 360px); min-width: unset; }
  .sidebar.collapsed { box-shadow: none; }
  /* The collapsed strip sits over the map, so leave room for it */
  .content { margin-left: 40px; }
  .collapse-btn { font-size: 14px; padding: 6px 8px; }

  .content-top { flex-direction: column; gap: 0; }
  .date-filter { order: -1; align-self: stretch; padding: 8px 12px 0; gap: 6px; }
  .date-field { flex: 1; min-width: 0; }
  .date-field span { display: none; }
  .date-input { flex: 1; min-width: 0; width: 100%; }
  .date-clear { visibility: visible; }
  .date-filter:not(.active) .date-clear { opacity: 0.3; pointer-events: none; }
  .tab-nav { padding: 6px 8px 0; }
  .tab-btn { padding: 8px 10px; font-size: 12px; }

  .map-controls { flex-direction: column; align-items: flex-start; padding: 8px 12px; }
  .map-legend { bottom: 22px; right: 8px; padding: 6px 10px; gap: 4px; }
  .legend-item { font-size: 11px; }

  .overlap-header { padding: 14px 12px 12px; }
  .overlap-settings { gap: 10px; }
  .overlap-export { margin-left: 0; }
  .overlap-results { padding: 12px; }

  .social-grid { padding: 12px; gap: 12px; }
  .social-overlap-card { margin: 0 12px 12px; }

  .metadata-header { padding: 12px; }
  .meta-search { width: 100%; }
  .metadata-table-wrap { padding: 12px; }

  .timeline-container { padding: 14px 12px; }

  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; }
}
