/* ── Variables ─────────────────────────────────────── */
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --secondary: #0ea5e9;
  --secondary-hover: #0284c7;
  --success: #10b981;
  --success-hover: #059669;
  --accent: #f43f5e;
  --bg: #060c1a;
  --surface: rgba(15, 23, 42, 0.7);
  --card: rgba(20, 30, 50, 0.8);
  --border: rgba(255, 255, 255, 0.07);
  --border-active: rgba(99, 102, 241, 0.5);
  --text: #f1f5f9;
  --text-light: #94a3b8;
  --text-muted: #475569;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background blobs ──────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(14, 165, 233, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(244, 63, 94, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

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

/* ── Topbar ────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 12, 26, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.logo-text {
  font-weight: 800;
  font-size: 1.15rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--text);
}

.nav-link.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  color: #818cf8;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-location {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.73rem;
  font-weight: 700;
  color: #34d399;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(1.5);
  }
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fb7185;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
}

/* ── Main content ──────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 28px 72px;
  width: 100%;
}

/* ── Page header ───────────────────────────────────── */
.page-header {
  margin-bottom: 40px;
}

.page-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.22);
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #818cf8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(to right, #f1f5f9, #94a3b8);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 1rem;
  max-width: 540px;
}

/* ── Search card ───────────────────────────────────── */
.search-card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.search-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.search-card-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: flex-end;
}

@media (max-width: 640px) {
  .search-form {
    grid-template-columns: 1fr;
  }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.45;
  pointer-events: none;
}

input {
  width: 100%;
  background: rgba(6, 12, 26, 0.5);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px 13px 40px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.25s ease;
}

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

input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(6, 12, 26, 0.7);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.btn-search {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: none;
  padding: 13px 28px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-search:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px var(--primary-glow);
  filter: brightness(1.1);
}

.btn-search:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ── Error message ─────────────────────────────────── */
.error-banner {
  background: rgba(244, 63, 94, 0.08);
  color: #fb7185;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(244, 63, 94, 0.2);
  margin-bottom: 22px;
  font-size: 0.88rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
}

/* ── Loading ───────────────────────────────────────── */
.loading-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 60px 20px;
}

.spinner-ring {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loading-text {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ── Preview Card ──────────────────────────────────── */
.preview-card {
  display: none;
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  animation: fadeSlideIn 0.4s ease both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.preview-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.preview-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

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

.preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.preview-stat {
  background: rgba(6, 12, 26, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.preview-stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: #818cf8;
  line-height: 1;
  margin-bottom: 4px;
}

.preview-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.preview-names-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-light);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-names-toggle:hover {
  border-color: var(--border-active);
  color: var(--text);
}

.preview-names-list {
  display: none;
  background: rgba(6, 12, 26, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  max-height: 200px;
  overflow-y: auto;
}

.preview-names-list.open {
  display: block;
}

.preview-name-item {
  font-size: 0.85rem;
  color: var(--text-light);
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.preview-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 0.85rem;
  color: #fbbf24;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 12px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-confirm {
  background: linear-gradient(135deg, var(--success), var(--success-hover));
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-confirm:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* ── Enrich Loading ────────────────────────────────── */
.enrich-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 60px 20px;
}

.enrich-spinner {
  position: relative;
  width: 64px;
  height: 64px;
}

.enrich-spinner::before,
.enrich-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: spin 1.2s linear infinite;
}

.enrich-spinner::before {
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
}

.enrich-spinner::after {
  inset: 8px;
  border-top-color: rgba(16, 185, 129, 0.6);
  animation-duration: 0.9s;
  animation-direction: reverse;
}

.enrich-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.enrich-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 380px;
}

.pulse-bar {
  width: 240px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.pulse-bar-inner {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  animation: pulseSlide 1.8s ease-in-out infinite;
}

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

  100% {
    transform: translateX(350%);
  }
}

.enrich-dot {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ── Results Iframe ────────────────────────────────── */
.results-wrap {
  display: none;
  margin-top: 0;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.results-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn-expand {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-expand:hover {
  border-color: var(--border-active);
  color: var(--text);
}

.results-frame-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

#results-iframe {
  width: 100%;
  height: 78vh;
  border: none;
  display: block;
  background: #f8fafc;
  /* iframe bg while loading */
}

/* ── Empty state ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

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

.empty-sub {
  font-size: 0.88rem;
}

/* ── Viewer banner ─────────────────────────────────── */
.viewer-banner {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 32px;
  display: none;
  align-items: center;
  gap: 20px;
}

.viewer-banner-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(14, 165, 233, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.viewer-banner-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
}

.viewer-banner-text span {
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.6;
}

/* ── Quick links ───────────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 36px;
}

.quick-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.quick-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.quick-card.purple::before {
  background: radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.09) 0%, transparent 70%);
}

.quick-card.blue::before {
  background: radial-gradient(ellipse at top left, rgba(14, 165, 233, 0.09) 0%, transparent 70%);
}

.quick-card.green::before {
  background: radial-gradient(ellipse at top left, rgba(16, 185, 129, 0.09) 0%, transparent 70%);
}

.quick-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3);
}

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

.quick-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.quick-icon.purple {
  background: rgba(99, 102, 241, 0.15);
}

.quick-icon.blue {
  background: rgba(14, 165, 233, 0.15);
}

.quick-icon.green {
  background: rgba(16, 185, 129, 0.15);
}

.quick-info strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.quick-info span {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ── Login Overlay ─────────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(99, 102, 241, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(14, 165, 233, 0.2) 0%, transparent 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

#login-overlay::before,
#login-overlay::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  animation: floatOrb 8s ease-in-out infinite;
}

#login-overlay::before {
  width: 300px;
  height: 300px;
  background: rgba(99, 102, 241, 0.16);
  top: -80px;
  left: -80px;
}

#login-overlay::after {
  width: 240px;
  height: 240px;
  background: rgba(14, 165, 233, 0.13);
  bottom: -60px;
  right: -60px;
  animation-delay: -4s;
}

@keyframes floatOrb {

  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(20px, -20px);
  }
}

.login-box {
  background: rgba(15, 22, 40, 0.9);
  backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 52px 44px;
  border-radius: 28px;
  width: 100%;
  max-width: 400px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 40px 60px -16px rgba(0, 0, 0, 0.75),
    0 0 80px rgba(99, 102, 241, 0.08);
  position: relative;
  z-index: 1;
  text-align: center;
}

.login-logo {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 22px;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.4);
}

.login-box h2 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #c7d2fe, #7dd3fc);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 5px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 30px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.login-form label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  opacity: 0.4;
  pointer-events: none;
}

.login-form input {
  width: 100%;
  background: rgba(6, 12, 26, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 13px 16px 13px 42px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.25s;
}

.login-form input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(6, 12, 26, 0.8);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.login-form input::placeholder {
  color: #334155;
}

.toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 15px;
  transition: color 0.2s;
}

.toggle-pass:hover {
  color: var(--text-light);
}

#login-error {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fb7185;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
  display: none;
}

.login-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35);
}

.login-btn:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(99, 102, 241, 0.5);
}

/* ── Históricos Modal ─────────────────────────────────── */
.h-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

.h-modal-backdrop.open {
  display: flex;
}

.h-modal {
  background: rgba(12, 18, 36, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: slideUp 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.h-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.h-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 3px;
}

.h-modal-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.h-modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.h-modal-close:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.25);
  color: #fb7185;
}

.h-modal-search {
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  flex-shrink: 0;
}

.h-search-icon {
  position: absolute;
  left: 38px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.4;
  pointer-events: none;
}

.h-modal-search input {
  width: 100%;
  background: rgba(6, 12, 26, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.h-modal-search input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.h-list {
  overflow-y: auto;
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.h-list::-webkit-scrollbar {
  width: 4px;
}

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

.h-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.h-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(20, 30, 50, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px 16px;
  transition: all 0.2s;
}

.h-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.07);
}

.h-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.h-item-info {
  flex: 1;
  min-width: 0;
}

.h-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-item-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.h-item-badge {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.h-btn-view {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

.h-btn-view:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.h-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.h-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

/* ── Owner Cards ───────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.owner-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.owner-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  border-color: rgba(99, 102, 241, 0.25);
}

.owner-card.contacted {
  opacity: 0.85;
  border-left: 4px solid var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.contacted-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s;
  user-select: none;
}

.contacted-toggle-wrap:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.contacted-toggle-wrap input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--success);
}

.owner-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 480px) {
  .owner-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .contacted-toggle-wrap {
    justify-content: center;
    padding: 10px;
    background: rgba(16, 185, 129, 0.08);
    /* Slightly more visible on mobile */
  }
}

.owner-card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.owner-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.neighborhood-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(14, 165, 233, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 6px;
  margin-bottom: 6px;
}

.section-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.apartment-list {
  background: rgba(6, 12, 26, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 22px;
}

.apartment-item {
  font-size: 0.88rem;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-light);
}

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

.apto-badge {
  font-weight: 800;
  color: var(--secondary);
}

.phones-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phone-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 12, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 16px;
  gap: 12px;
}

.phone-number {
  font-weight: 800;
  color: var(--text);
  font-size: 1rem;
}

.phone-actions {
  display: flex;
  gap: 8px;
}

.btn-action {
  padding: 8px 14px;
  border-radius: 9px;
  text-decoration: none;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-call {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
}

.btn-wa {
  background: linear-gradient(135deg, var(--success), var(--success-hover));
}

.btn-action.session-marked {
  opacity: 0.4;
  filter: brightness(0.5) grayscale(0.4);
  cursor: default;
}

.btn-enrich {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-enrich:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-enrich:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-lead {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
  font-family: inherit;
}

.btn-lead:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}

/* ── Dashboard Danger Button ────────────────────────── */
.btn-danger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fb7185;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.35);
  transform: translateY(-1px);
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Metrics Grid ───────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

/* ── Metric Card ────────────────────────────────────── */
.metric-card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  animation: fadeSlideIn 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.metric-card.call::before {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}

.metric-card.wa::before {
  background: linear-gradient(180deg, #10b981, #059669);
}

.metric-card.lead::before {
  background: linear-gradient(180deg, #0ea5e9, #0284c7);
}

.metric-card.contact::before {
  background: linear-gradient(180deg, #6366f1, #4f46e5);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5);
}

.metric-card.call:hover {
  border-color: rgba(245, 158, 11, 0.3);
}

.metric-card.wa:hover {
  border-color: rgba(16, 185, 129, 0.3);
}

.metric-card.lead:hover {
  border-color: rgba(14, 165, 233, 0.3);
}

.metric-card.contact:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

.metric-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-card.call .metric-icon-wrap {
  background: rgba(245, 158, 11, 0.13);
}

.metric-card.wa .metric-icon-wrap {
  background: rgba(16, 185, 129, 0.13);
}

.metric-card.lead .metric-icon-wrap {
  background: rgba(14, 165, 233, 0.13);
}

.metric-card.contact .metric-icon-wrap {
  background: rgba(99, 102, 241, 0.13);
}

.metric-card.call .metric-icon-wrap svg {
  color: #f59e0b;
}

.metric-card.wa .metric-icon-wrap svg {
  color: #10b981;
}

.metric-card.lead .metric-icon-wrap svg {
  color: #0ea5e9;
}

.metric-card.contact .metric-icon-wrap svg {
  color: #6366f1;
}

.metric-body {
  flex: 1;
  min-width: 0;
}

.metric-value {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.metric-card.call .metric-value {
  color: #f59e0b;
}

.metric-card.wa .metric-value {
  color: #10b981;
}

.metric-card.lead .metric-value {
  color: #0ea5e9;
}

.metric-card.contact .metric-value {
  color: #818cf8;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  line-height: 1.4;
}

/* ── Chart Card ─────────────────────────────────────── */
.chart-card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  animation: fadeSlideIn 0.5s ease both;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}

.chart-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.chart-card-title svg {
  color: var(--primary);
  opacity: 0.8;
  flex-shrink: 0;
}

.chart-period-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.chart-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

/* ── Charts Grid ────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 0;
}

/* ── Dashboard section divider ───────────────────────── */
.d-section-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  margin-top: 4px;
}

.d-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Dashboard loading ──────────────────────────────── */
.d-loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 50vh;
  padding: 40px 20px;
}

.d-loading-text {
  font-size: 0.88rem;
  color: var(--text-light);
}


/* ── Responsive — 768px ───────────────────────────────── */
@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
    gap: 8px;
  }

  .logo-text {
    display: none;
  }

  .badge-location {
    display: none;
  }

  .btn-logout {
    padding: 8px 10px;
  }

  .nav-link {
    padding: 7px 10px;
    font-size: 0.8rem;
    gap: 5px;
  }

  .main {
    padding: 32px 16px 72px;
  }

  .page-header {
    margin-bottom: 28px;
  }

  .page-label {
    font-size: 0.68rem;
  }

  .search-card {
    padding: 22px 18px;
  }

  .search-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .btn-search {
    width: 100%;
    justify-content: center;
    padding: 14px;
  }

  .quick-links {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 24px;
  }

  .quick-card {
    padding: 16px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  #pagination-controls {
    flex-direction: column;
    gap: 12px !important;
  }

  #pagination-controls button,
  #pagination-controls span {
    width: 100% !important;
    text-align: center;
    box-sizing: border-box;
  }

  #results-iframe {
    height: 65vh;
  }

  /* Modal as bottom sheet */
  .h-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .h-modal {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 88vh;
  }
}

/* ── Responsive — 480px ───────────────────────────────── */
@media (max-width: 480px) {
  .nav-label {
    display: none;
  }

  .nav-link {
    padding: 8px;
  }

  .btn-logout {
    gap: 0;
  }

  .page-title {
    font-size: 1.7rem;
  }

  .page-subtitle {
    font-size: 0.88rem;
  }

  input {
    font-size: 1rem;
    padding: 14px 16px 14px 42px;
  }

  .btn-search {
    font-size: 1rem;
    padding: 15px;
  }

  .empty-state {
    padding: 48px 12px;
  }

  .h-modal {
    max-height: 92vh;
  }

  .h-modal-header {
    padding: 20px 18px 14px;
  }

  .h-modal-search {
    padding: 12px 18px;
  }

  .h-list {
    padding: 10px;
  }

  .h-item {
    padding: 12px;
    gap: 10px;
  }

  .h-item-icon {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .h-item-badge {
    display: none;
  }
}

/* ── Theme Toggle Button ────────────────────────────── */
#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-light);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

#theme-toggle:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ── Light Theme ─────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f0f4fb;
  --surface: rgba(240, 244, 251, 0.9);
  --card: rgba(255, 255, 255, 0.97);
  --border: rgba(0, 0, 0, 0.09);
  --border-active: rgba(99, 102, 241, 0.4);
  --text: #0f172a;
  --text-light: #475569;
  --text-muted: #94a3b8;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] body {
  background: #f0f4fb;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(14, 165, 233, 0.06) 0%, transparent 60%);
}

[data-theme="light"] body::after {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: #f8fafc !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
  background: #fff !important;
  border-color: rgba(99, 102, 241, 0.5) !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1) !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .spinner-ring {
  border-color: rgba(0, 0, 0, 0.06);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
}

[data-theme="light"] .page-title {
  background: linear-gradient(to right, #0f172a, #475569);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .login-box {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 40px 60px -16px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .login-form input {
  background: rgba(240, 244, 251, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

[data-theme="light"] .login-form input:focus {
  background: #fff;
}

[data-theme="light"] .login-form input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .h-modal {
  background: rgba(255, 255, 255, 0.99);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .h-modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .h-modal-search {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .h-modal-close {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .h-search-input {
  background: rgba(240, 244, 251, 0.8) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

[data-theme="light"] .phone-entry {
  background: rgba(240, 244, 251, 0.8);
  border-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .owner-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .metric-card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

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

[data-theme="light"] #theme-toggle:hover {
  background: rgba(99, 102, 241, 0.08);
}



.logo-imob {
  color: #eee;
}

[data-theme="light"] .logo-imob {
  color: #1e293b !important;
}

[data-theme="light"] .logo-text span:last-child {
  color: #4f46e5 !important;
}

[data-theme="light"] body {
  background: #f0f4fb !important;
}

[data-theme="light"] body::before {
  background: radial-gradient(ellipse 80% 60% at 10% -10%, rgba(99, 102, 241, 0.07) 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 90% 110%, rgba(14, 165, 233, 0.05) 0%, transparent 60%) !important;
}

[data-theme="light"] body::after {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.035) 1px, transparent 1px) !important;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .nav-link {
  color: #475569 !important;
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
  background: rgba(99, 102, 241, 0.08) !important;
  color: #4f46e5 !important;
}

[data-theme="light"] .btn-logout {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #475569 !important;
}

[data-theme="light"] .btn-logout:hover {
  background: rgba(244, 63, 94, 0.06) !important;
  color: #f43f5e !important;
}

[data-theme="light"] .page-label {
  color: #4f46e5 !important;
}

[data-theme="light"] .page-title {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: none !important;
}

[data-theme="light"] .page-subtitle {
  color: #64748b !important;
}

[data-theme="light"] input {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

[data-theme="light"] input:focus {
  background: #fff !important;
  border-color: rgba(99, 102, 241, 0.5) !important;
}

[data-theme="light"] input::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] label {
  color: #475569 !important;
}

[data-theme="light"] select {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

/* Buy Credits Modal */
[data-theme="light"] .buy-credits-modal {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .buy-credit-card {
  background: #f8fafc !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .buy-credit-card:hover {
  background: #f1f5f9 !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}

[data-theme="light"] .buy-credit-card.selected {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3) !important;
}

[data-theme="light"] .b-card-name {
  color: #0f172a !important;
}

[data-theme="light"] .close-buy-credits {
  color: #64748b !important;
}

[data-theme="light"] .close-buy-credits:hover {
  color: #0f172a !important;
  background: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .spinner-ring {
  border-color: rgba(0, 0, 0, 0.07) !important;
  border-top-color: var(--primary) !important;
  border-right-color: var(--secondary) !important;
}

[data-theme="light"] #login-overlay {
  background: #f0f4fb !important;
}

[data-theme="light"] .login-box {
  background: rgba(255, 255, 255, 0.99) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  box-shadow: 0 40px 60px -16px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .login-box h2 {
  background: linear-gradient(to right, #4f46e5, #0ea5e9) !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

[data-theme="light"] .login-sub {
  color: #64748b !important;
}

[data-theme="light"] .login-form label {
  color: #475569 !important;
}

[data-theme="light"] .login-form input {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

[data-theme="light"] .login-form input:focus {
  background: #fff !important;
}

[data-theme="light"] .login-form input::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .toggle-pass {
  color: #94a3b8 !important;
}

[data-theme="light"] #login-error {
  background: rgba(244, 63, 94, 0.06) !important;
}

[data-theme="light"] .metric-card {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .metric-card:hover {
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.10) !important;
}

[data-theme="light"] .chart-card {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .chart-card-title {
  color: #0f172a !important;
}

[data-theme="light"] .chart-description {
  color: #64748b !important;
}

[data-theme="light"] .owner-card {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .owner-card:hover {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.10) !important;
}

[data-theme="light"] .owner-card.contacted {
  background: rgba(16, 185, 129, 0.04) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

[data-theme="light"] .owner-name {
  color: #0f172a !important;
}

[data-theme="light"] .owner-age,
[data-theme="light"] .owner-cpf {
  color: #475569 !important;
}

[data-theme="light"] .owner-card-top {
  border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .contacted-toggle-wrap {
  background: rgba(0, 0, 0, 0.03) !important;
  color: #475569 !important;
}

[data-theme="light"] .contacted-toggle-wrap:hover {
  background: rgba(0, 0, 0, 0.06) !important;
  color: #0f172a !important;
}

[data-theme="light"] .neighborhood-tag {
  background: rgba(14, 165, 233, 0.08) !important;
  color: #0284c7 !important;
  border-color: rgba(14, 165, 233, 0.15) !important;
}

[data-theme="light"] .section-title {
  color: #64748b !important;
}

[data-theme="light"] .phone-entry {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .phone-number {
  color: #0f172a !important;
}

[data-theme="light"] .apartment-list {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .apartment-item {
  border-bottom-color: rgba(0, 0, 0, 0.05) !important;
  color: #475569 !important;
}

[data-theme="light"] .d-section-label {
  color: #475569 !important;
}

[data-theme="light"] .h-modal-backdrop {
  background: rgba(15, 23, 42, 0.2) !important;
  backdrop-filter: blur(6px) !important;
}

[data-theme="light"] .h-modal {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .h-modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .h-modal-title {
  color: #0f172a !important;
}

[data-theme="light"] .h-modal-sub {
  color: #64748b !important;
}

[data-theme="light"] .h-modal-close {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  color: #64748b !important;
}

[data-theme="light"] .h-modal-search {
  background: #f8fafc !important;
  border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .h-search-input {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.09) !important;
  color: #0f172a !important;
}

[data-theme="light"] .h-item {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .h-item:hover {
  background: #f8fafc !important;
}

[data-theme="light"] .h-item-addr {
  color: #0f172a !important;
}

[data-theme="light"] .h-item-meta,
[data-theme="light"] .h-item-credits {
  color: #64748b !important;
}

[data-theme="light"] .h-item-badge {
  background: rgba(99, 102, 241, 0.08) !important;
  color: #4f46e5 !important;
}

[data-theme="light"] .h-item-icon {
  background: rgba(99, 102, 241, 0.08) !important;
}

[data-theme="light"] .h-loading,
[data-theme="light"] .h-empty {
  color: #94a3b8 !important;
}

[data-theme="light"] .modal-overlay,
[data-theme="light"] .modal-backdrop {
  background: rgba(15, 23, 42, 0.2) !important;
  backdrop-filter: blur(6px) !important;
}

[data-theme="light"] .modal,
[data-theme="light"] .modal-box {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .modal-header {
  color: #0f172a !important;
  border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

/* ── Theme Toggle Button (FAB) ── */
#theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#theme-toggle:hover {
  transform: translateY(-4px) scale(1.05);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.4);
}

[data-theme="light"] #theme-toggle {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] #theme-toggle:hover {
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

/* ── Modals: Support & Tutorial ── */
[data-theme="light"] .support-modal,
[data-theme="light"] .tut-modal {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .support-modal h3,
[data-theme="light"] .tut-modal h2 {
  color: #0f172a !important;
}

[data-theme="light"] .support-modal-sub,
[data-theme="light"] .tut-modal p {
  color: #64748b !important;
}

[data-theme="light"] .support-modal-close {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #64748b !important;
}

[data-theme="light"] .support-modal-close:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* ── Mobile Hamburger & Sidebar ─────────────────────── */
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-light);
  flex-shrink: 0;
}

.btn-hamburger:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9990;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 88vw);
  height: 100dvh;
  background: rgba(10, 18, 35, 0.97);
  backdrop-filter: blur(24px);
  border-left: 1px solid rgba(99, 102, 241, 0.2);
  z-index: 9991;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-sidebar.open {
  transform: translateX(0);
}

.mobile-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.mobile-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.mobile-sidebar-brand .logo-text {
  font-size: 1.1rem;
}

.btn-sidebar-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
  font-size: 1.1rem;
}

.btn-sidebar-close:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.mobile-sidebar-user {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(99, 102, 241, 0.05);
  border-bottom: 1px solid var(--border);
}

.mobile-sidebar-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.mobile-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 8px 6px;
  margin-top: 8px;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 12px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--text);
}

.mobile-nav-link.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.mobile-nav-link.danger {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.06);
  border-color: rgba(244, 63, 94, 0.15);
}

.mobile-nav-link.danger:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
}

.mobile-nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  transition: all 0.2s;
}

.mobile-nav-link.active .mobile-nav-icon {
  background: rgba(99, 102, 241, 0.2);
}

.mobile-nav-link.danger .mobile-nav-icon {
  background: rgba(244, 63, 94, 0.1);
}

.mobile-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
    height: 58px;
  }

  .topbar-right {
    gap: 8px;
  }

  /* Hide desktop nav, show hamburger */
  .topbar-nav {
    display: none !important;
  }

  .btn-hamburger {
    display: flex;
  }

  .topbar .btn-logout {
    display: none;
  }

  .btn-logout .nav-label {
    display: none;
  }

  /* Hide logo text — icon only on mobile */
  .topbar-logo .logo-text {
    display: none;
  }
}

/* ── Credit / Plan Badge ───────────────────────────── */
.credit-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fbbf24;
  white-space: nowrap;
}

.credit-badge.low {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.credit-badge.admin-badge {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.plan-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.22);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #818cf8;
  white-space: nowrap;
}

.credit-badge-skeleton {
  height: 30px;
  width: 72px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.credit-badge-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Admin visibility ───────────────────────────────── */
.admin-only,
.admin-only-nav {
  display: none !important;
}