/* ==========================================================================
   Alpha Prospect — Design tokens
   ========================================================================== */
:root {
  --bg: #F8FAFC;
  --bg-dot: rgba(15, 23, 42, 0.06);
  --surface: #FFFFFF;
  --surface-muted: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --primary: #00D18A;
  --primary-strong: #00B67A;
  --primary-soft: rgba(0, 209, 138, 0.10);
  --primary-soft-strong: rgba(0, 209, 138, 0.16);
  --primary-ring: rgba(0, 209, 138, 0.35);

  --ink: #0F172A;
  --ink-muted: #64748B;
  --ink-faint: #94A3B8;

  --ink-deep: #020403;
  --ink-deep-2: #070B0A;

  --hot: #F97316;
  --hot-soft: rgba(249, 115, 22, 0.10);
  --warm: #D97706;
  --warm-soft: rgba(217, 119, 6, 0.10);
  --cold: #0284C7;
  --cold-soft: rgba(2, 132, 199, 0.10);

  --danger: #E11D48;
  --danger-soft: rgba(225, 29, 72, 0.08);
  --success: #16A34A;
  --success-soft: rgba(22, 163, 74, 0.08);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
  --shadow-primary: 0 8px 24px rgba(0, 209, 138, 0.20);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

::selection { background: var(--primary-soft-strong); color: var(--ink); }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ==========================================================================
   Background texture
   ========================================================================== */
.bg-grid {
  background-image: radial-gradient(var(--bg-dot) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 100%);
}

.glow-orb {
  position: fixed;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: var(--primary);
  filter: blur(140px);
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
}
.glow-orb.top { top: -260px; right: -160px; }
.glow-orb.bottom { bottom: -260px; left: -160px; opacity: 0.07; }

/* ==========================================================================
   Surfaces
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-hover { transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.card-hover:hover {
  border-color: var(--primary-ring);
  box-shadow: var(--shadow-md);
}

.surface-dark {
  background: var(--ink-deep);
  color: #F1F5F9;
  border: 1px solid var(--ink-deep-2);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
  background: var(--primary);
  color: #052E22;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-primary);
  border: 1px solid transparent;
}
.btn-primary:hover { background: var(--primary-strong); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-soft); }

.btn-danger-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.btn-danger-ghost:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.icon-chip {
  background: var(--ink-deep);
  border: 1px solid var(--ink-deep-2);
}

/* ==========================================================================
   Navbar — degradê verde escuro (bom contraste para o logo)
   ========================================================================== */
.app-header-dark {
  background: linear-gradient(120deg, #03110C 0%, #063D2B 55%, #00623F 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.app-header-dark #file-label,
.app-header-dark .text-ink-muted { color: rgba(255, 255, 255, 0.68); }

.app-header-dark .badge-agency-pill {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.app-header-dark .btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
}
.app-header-dark .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.app-header-dark .btn-danger-ghost {
  background: rgba(225, 29, 72, 0.14);
  border-color: rgba(225, 29, 72, 0.4);
  color: #FCA5A5;
}
.app-header-dark .btn-danger-ghost:hover {
  background: rgba(225, 29, 72, 0.24);
  border-color: var(--danger);
  color: #FEE2E2;
}

/* ==========================================================================
   Upload zone (hero)
   ========================================================================== */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface);
  transition: all 0.22s ease;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Floating decorative cards in hero */
.float-card {
  position: absolute;
  animation: floatY 5s ease-in-out infinite;
  filter: drop-shadow(0 12px 24px rgba(15,23,42,0.10));
}
.float-card.delay-1 { animation-delay: 0.6s; }
.float-card.delay-2 { animation-delay: 1.2s; }

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  .float-card { animation: none; }
  .fade-in { animation: none !important; }
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge-hot { background: var(--hot-soft); color: var(--hot); border: 1px solid rgba(249,115,22,0.25); }
.badge-warm { background: var(--warm-soft); color: var(--warm); border: 1px solid rgba(217,119,6,0.25); }
.badge-cold { background: var(--cold-soft); color: var(--cold); border: 1px solid rgba(2,132,199,0.25); }
.badge-neutral { background: var(--surface-muted); color: var(--ink-muted); border: 1px solid var(--border); }

/* ==========================================================================
   Score ring
   ========================================================================== */
.score-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  border: 3px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  flex-shrink: 0;
}

/* ==========================================================================
   Lead list rows
   ========================================================================== */
.lead-row { transition: background-color 0.15s ease, border-color 0.15s ease; cursor: pointer; border-left: 3px solid transparent; }
.lead-row:hover { background: var(--surface-muted); }
.lead-row.active { border-left-color: var(--primary); background: var(--primary-soft); }

.profile-panel {
  max-height: calc(480vh);
  overflow-y: auto;
}
.profile-panel::-webkit-scrollbar { width: 6px; }
.profile-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

#lead-list::-webkit-scrollbar { width: 6px; }
#lead-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ==========================================================================
   SWOT / strengths & weaknesses
   ========================================================================== */
.strength-item {
  border-left: 3px solid var(--success);
  background: var(--success-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.weakness-item {
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ==========================================================================
   Roteiro / timeline
   ========================================================================== */
.step-card { position: relative; padding-left: 1.75rem; }
.step-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.timeline-line {
  position: absolute;
  left: 4px;
  top: 1.4rem;
  bottom: -0.5rem;
  width: 2px;
  background: var(--border);
}

/* ==========================================================================
   Tabs (lead detail)
   ========================================================================== */
.tab-btn {
  border: 1px solid transparent;
  color: var(--ink-muted);
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-size: 0.8125rem;
}
.tab-btn:hover { color: var(--ink); background: var(--surface-muted); }
.tab-btn.active {
  background: var(--ink-deep);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==========================================================================
   Inputs
   ========================================================================== */
input[type="search"],
input[type="text"],
input[type="password"],
select {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input[type="search"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder { color: var(--ink-faint); }

/* Select — sharper corners, custom chevron, more solid presence */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding-right: 2.4rem;
  cursor: pointer;
  background-color: var(--surface-muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
select:hover { border-color: var(--ink-faint); }
select:focus { background-color: var(--surface); }

/* ==========================================================================
   Stats
   ========================================================================== */
.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Copy button state
   ========================================================================== */
.copy-btn.copied { color: var(--primary-strong); border-color: var(--primary); background: var(--primary-soft); }

/* ==========================================================================
   Skeleton loading
   ========================================================================== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ==========================================================================
   Toasts
   ========================================================================== */
#toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  animation: toastIn 0.25s ease;
  border-left: 3px solid var(--primary);
}
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-success { border-left-color: var(--primary); }
.toast.toast-out { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(4px) scale(0.98); } }

/* ==========================================================================
   File processing overlay
   ========================================================================== */
#processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Misc
   ========================================================================== */
.fade-in { animation: fadeIn 0.35s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

@media (max-width: 1024px) {
  .layout-grid { grid-template-columns: 1fr !important; }
  .profile-panel { max-height: none; }
}

/* ========================================================================== 
   Groq AI script generation
   ========================================================================== */
.btn-ai {
  background: var(--ink-deep);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  border: 1px solid var(--ink-deep-2);
  box-shadow: var(--shadow-sm);
}
.btn-ai:hover { transform: translateY(-1px); border-color: var(--primary); }
.btn-ai:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.ai-script-box {
  margin-top: 1rem;
  background: linear-gradient(135deg, rgba(0, 209, 138, 0.08), rgba(2, 4, 3, 0.03));
  border: 1px solid rgba(0, 209, 138, 0.20);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.spinner-mini {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* ========================================================================== 
   AI script size selector
   ========================================================================== */
.ai-size-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ai-size-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 8px;
  padding: 0.42rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  transition: all 0.16s ease;
}

.ai-size-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.ai-size-btn.active {
  color: #052E22;
  background: var(--primary);
  border-color: var(--primary-strong);
  box-shadow: var(--shadow-sm);
}

/* ========================================================================== 
   AI opportunity analysis
   ========================================================================== */
.ai-opportunity-header {
  background: linear-gradient(135deg, rgba(0, 209, 138, 0.10), rgba(2, 4, 3, 0.03));
  border: 1px solid rgba(0, 209, 138, 0.22);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.service-recommendation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.service-recommendation-card:hover {
  border-color: var(--primary-ring);
  box-shadow: var(--shadow-md);
}

.insight-number {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  border: 1px solid rgba(0, 209, 138, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

/* ========================================================================== 
   IA configurável no navegador — UI/UX refinado
   ========================================================================== */
.ai-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
  animation: aiModalFadeIn 0.2s ease;
}
.ai-modal.hidden { display: none; }

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

.ai-modal-card {
  width: min(100vh, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.02);
  animation: aiModalSlideUp 0.25s ease;
}
.ai-modal-card::-webkit-scrollbar { width: 8px; }
.ai-modal-card::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Safety net for short/laptop viewports: compact further instead of scrolling */
@media (max-height: 100vh) {
  .ai-modal { padding: 0.6rem; }
  .ai-modal-header { padding: 0.85rem 1.5rem 0.65rem; }
  .ai-modal-header p.text-sm { display: none; }
  .ai-modal-body { padding: 0.85rem 1.5rem 0.9rem; }
  .ai-modal-body > div { margin-bottom: 0.65rem !important; }
  .ai-provider-card { min-height: 44px; padding: 0.4rem 0.5rem; }
  .ai-test-area { padding: 0.6rem 0.85rem; }
}
@media (max-height: 640px) {
  .ai-provider-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.35rem; }
  .ai-provider-card-badge { display: none; }
  .ai-provider-card { min-height: 36px; }
}

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

.ai-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.75rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.ai-modal-close-btn {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}
.ai-modal-close-btn:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.ai-modal-body { padding: 1.1rem 1.75rem 1.2rem; }

.ai-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.1rem;
}

.ai-field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

/* Wrapper kept for possible future affordances around the select */
.ai-select-wrap { position: relative; margin-top: 0.55rem; }

/* Provider grid — cards clicáveis */
.ai-provider-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.5rem;
}
@media (max-width: 560px) {
  .ai-provider-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ai-provider-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  min-height: 52px;
  justify-content: center;
}
.ai-provider-card:hover {
  border-color: var(--primary-ring);
  background: var(--primary-soft);
}
.ai-provider-card.active {
  border-color: var(--primary);
  background: var(--primary-soft-strong);
  box-shadow: 0 0 0 2px var(--primary-ring);
}
.ai-provider-card.active::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.ai-provider-card-name {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.ai-provider-card-badge {
  font-size: 0.6rem;
  color: var(--ink-faint);
  font-weight: 500;
  line-height: 1.2;
}

/* Key input com toggle de visibilidade */
.ai-key-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 0.55rem;
}

.ai-key-input {
  padding-right: 2.5rem !important;
  font-family: 'Inter', monospace !important;
  letter-spacing: 0.02em;
  width: 100%;
}

.ai-key-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
  border-radius: 6px;
}
.ai-key-toggle:hover { color: var(--ink); }

.ai-key-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.ai-key-dot--empty {
  color: var(--ink-faint);
  border-color: var(--border);
  background: var(--surface-muted);
}
.ai-key-dot--empty::before {
  content: '✕';
  color: var(--ink-faint);
}
.ai-key-dot--ok {
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.25);
  background: var(--success-soft);
}
.ai-key-dot--ok::before {
  content: '✓';
}

/* Test result area */
.ai-test-area {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.ai-test-result {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.ai-test-result.success {
  background: var(--success-soft);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: #166534;
}
.ai-test-result.error {
  background: var(--danger-soft);
  border: 1px solid rgba(225, 29, 72, 0.18);
  color: var(--danger);
}
.ai-test-result.pending {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}
.ai-test-result.hidden { display: none; }

/* Help text */
.ai-help {
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}
.ai-status {
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.ai-status-ok { color: var(--success); font-weight: 600; }
.ai-status-error { color: var(--danger); font-weight: 500; }
.ai-warning {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .85rem;
  border-radius: var(--radius-sm);
  background: var(--warm-soft);
  border: 1px solid rgba(217, 119, 6, 0.18);
  color: var(--ink-muted);
  font-size: .82rem;
  line-height: 1.45;
}
/* ========================================================================== 
   Phone list import modal
   ========================================================================== */
.import-phone-btn {
  cursor: pointer;
  min-height: 44px;
}

.upload-actions .btn-primary,
.upload-actions .btn-ghost {
  min-width: 210px;
  justify-content: center;
}

.phone-list-modal-card {
  width: min(760px, 100%);
}

.phone-list-textarea {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font: 0.9rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.phone-list-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.phone-list-textarea::placeholder { color: var(--ink-faint); }

.phone-list-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--ink-faint);
  font-size: 0.75rem;
  flex-wrap: wrap;
}

#phone-list-preview {
  color: var(--primary-strong);
  font-weight: 700;
}

.phone-list-info-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 209, 138, 0.24);
  background: var(--primary-soft);
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ========================================================================== 
   WhatsApp group list additions
   ========================================================================== */
.phone-list-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
}

.phone-list-mode-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  font-weight: 700;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.16s ease;
}

.phone-list-mode-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.phone-list-mode-btn.active {
  color: #052E22;
  background: var(--primary);
  box-shadow: var(--shadow-primary);
}

.group-avatar,
.group-avatar-sm {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary-soft), var(--surface));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--primary-strong);
  flex-shrink: 0;
}

.group-avatar { width: 76px; height: 76px; }
.group-avatar-sm { width: 42px; height: 42px; border-radius: 14px; }
.group-avatar img,
.group-avatar-sm img { width: 100%; height: 100%; object-fit: cover; display: block; }

.group-preview-card {
  background: linear-gradient(135deg, rgba(0, 209, 138, 0.08), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(0, 209, 138, 0.22);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.group-link-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  color: var(--ink-muted);
  word-break: break-all;
}

.group-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--surface-muted);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.group-status-pill.loaded {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: rgba(0, 209, 138, 0.28);
}


/* ==========================================================================
   Extension download / install modal
   ========================================================================== */
.extension-install-modal-card { max-width: 920px; }
.extension-download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-soft), #fff 70%);
}
.extension-steps-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.extension-install-steps {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.extension-install-steps li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  color: var(--ink-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}
.extension-install-steps span {
  width: 1.45rem;
  height: 1.45rem;
  flex: 0 0 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 0.75rem;
  border: 1px solid var(--primary-ring);
}
.extension-install-steps p { margin: 0; }
@media (max-width: 520px) {
  .extension-download-card { align-items: stretch; flex-direction: column; }
  .extension-download-card .btn-primary { width: 100%; }
}

/* Visual installation guide */
.extension-install-modal-card {
  width: min(960px, 100%);
  max-width: 960px;
}
.extension-visual-guide-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}
.extension-guide-note {
  font-size: 0.72rem;
  color: var(--ink-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}
.extension-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.extension-visual-grid figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.extension-visual-grid img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
}
.extension-visual-grid figcaption {
  padding: 0.65rem 0.75rem;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.extension-visual-grid figcaption strong,
.extension-visual-grid figcaption code {
  color: var(--ink);
  font-weight: 700;
}
.extension-visual-grid figcaption code {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.05rem 0.3rem;
}
@media (max-width: 760px) {
  .extension-visual-grid { grid-template-columns: 1fr; }
}
