/* ============================================================
   Azulli Finder — tokens alinhados ao app Azulli + dark + mobile
   ============================================================ */

:root {
  --radius: 0.625rem;

  --background: #ffffff;
  --foreground: #0f172a;
  --card: #ffffff;
  --muted: #64748b;
  --muted-bg: #f1f5f9;
  --border: #e2e8f0;
  --input-border: #cbd5e1;
  --surface: #f8fafc;

  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #dbeafe;
  --brand-ink: #1e3a8a;

  --success: #10b981;
  --success-soft: #d1fae5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --sidebar-width: 15rem;
  --header-height: 4rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.dark {
  --background: #0f172a;
  --foreground: #f8fafc;
  --card: #1e293b;
  --muted: #94a3b8;
  --muted-bg: #334155;
  --border: #334155;
  --input-border: #475569;
  --surface: #0b1220;

  --brand: #60a5fa;
  --brand-hover: #93c5fd;
  --brand-soft: rgba(96, 165, 250, 0.15);
  --brand-ink: #dbeafe;

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
}

html, body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background-color: var(--surface);
  color: var(--foreground);
}

.font-display { font-family: 'Poppins', 'Inter', ui-sans-serif, system-ui, sans-serif; }

/* --- Dark: utilitários Tailwind usados nas páginas JS --- */
.dark .bg-white { background-color: var(--card) !important; }
.dark .bg-slate-50 { background-color: var(--muted-bg) !important; }
.dark .border-slate-200,
.dark .border-slate-300 { border-color: var(--border) !important; }
.dark .text-slate-900 { color: var(--foreground) !important; }
.dark .text-slate-800 { color: var(--foreground) !important; }
.dark .text-slate-700,
.dark .text-slate-600 { color: var(--muted) !important; }
.dark .text-slate-500,
.dark .text-slate-400 { color: #94a3b8 !important; }
.dark .hover\:bg-slate-50:hover { background-color: var(--muted-bg) !important; }
.dark .hover\:border-azulli-400:hover { border-color: var(--brand) !important; }
.dark .hover\:bg-azulli-50\/50:hover { background-color: var(--brand-soft) !important; }
.dark .bg-red-50 { background-color: var(--danger-soft) !important; }
.dark .text-red-700 { color: var(--danger) !important; }
.dark .border-red-200 { border-color: rgba(248, 113, 113, 0.35) !important; }

/* --- Layout shell --- */
#app-view { background: var(--surface); }

#sidebar {
  width: var(--sidebar-width);
  background: var(--card);
  border-color: var(--border);
}

#app-header {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border-color: var(--border);
}

#main-content { padding-bottom: calc(1rem + var(--safe-bottom)); }

#sidebar-overlay {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

@media (max-width: 1023px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
  }
  #sidebar.open { transform: translateX(0); }
  #main-panel { margin-left: 0 !important; }
}

@media (min-width: 1024px) {
  #sidebar { transform: none !important; }
  #main-panel { margin-left: var(--sidebar-width); }
  #sidebar-overlay { display: none !important; }
}

/* --- Sidebar nav --- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.nav-item:hover {
  background-color: var(--muted-bg);
  color: var(--foreground);
}
.nav-item.active {
  background-color: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.nav-item.active svg { color: var(--brand); }

/* --- Cards --- */
.finder-card,
.stat-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
}
.stat-card { padding: 1.25rem; }
.stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.stat-card .value {
  margin-top: 0.4rem;
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
}
.stat-card .hint { margin-top: 0.4rem; font-size: 0.75rem; color: var(--muted); }

/* --- Loader --- */
.loader {
  width: 20px; height: 20px;
  border: 2.5px solid color-mix(in srgb, var(--brand) 20%, transparent);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loader-lg { width: 36px; height: 36px; border-width: 3.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Score badge --- */
.score-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 0.75rem;
  padding: 2px 8px; border-radius: 999px;
}
.score-low    { background: #fef2f2; color: #b91c1c; }
.score-mid    { background: #fff7ed; color: #c2410c; }
.score-high   { background: #ecfdf5; color: #047857; }
.score-elite  { background: #eef2ff; color: #4338ca; }
.dark .score-low    { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.dark .score-mid    { background: rgba(251, 146, 60, 0.15); color: #fdba74; }
.dark .score-high   { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.dark .score-elite  { background: rgba(129, 140, 248, 0.15); color: #a5b4fc; }

/* --- Status pill --- */
.status-pill {
  font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 4px;
}
.status-novo            { background:#eff6ff; color:#1d4ed8; }
.status-qualificado     { background:#ecfeff; color:#0e7490; }
.status-contatado       { background:#fef9c3; color:#a16207; }
.status-em_negociacao   { background:#ffedd5; color:#c2410c; }
.status-assinante       { background:#dcfce7; color:#15803d; }
.status-descartado      { background:#f1f5f9; color:#475569; }
.dark .status-novo            { background: rgba(96,165,250,.15); color:#93c5fd; }
.dark .status-qualificado     { background: rgba(34,211,238,.12); color:#67e8f9; }
.dark .status-contatado       { background: rgba(250,204,21,.12); color:#fde047; }
.dark .status-em_negociacao   { background: rgba(251,146,60,.12); color:#fdba74; }
.dark .status-assinante       { background: rgba(52,211,153,.12); color:#6ee7b7; }
.dark .status-descartado      { background: rgba(148,163,184,.12); color:#cbd5e1; }

/* --- Kanban --- */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.kanban-column {
  flex: 0 0 min(85vw, 280px);
  scroll-snap-align: start;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  min-height: min(60vh, 420px);
}
@media (min-width: 1280px) {
  .kanban-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(220px, 1fr));
    overflow-x: auto;
  }
  .kanban-column { flex: unset; min-width: 220px; }
}
.kanban-column-header {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 0.8rem; padding: 0.25rem 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border); margin-bottom: 0.25rem;
  color: var(--foreground);
}
.kanban-column.drag-over { background: var(--brand-soft); border-color: var(--brand); }
.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  padding: 0.7rem 0.8rem;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
}
.kanban-card:hover { box-shadow: 0 4px 10px -2px rgba(15, 23, 42, 0.15); }
.kanban-card.dragging { opacity: 0.5; transform: scale(0.98); }

/* --- Table --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600;
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.85rem 0.75rem; border-bottom: 1px solid var(--border);
  vertical-align: top; font-size: 0.875rem;
}
.data-table tr:hover td { background: var(--muted-bg); }

/* --- Toast --- */
.toast {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.75rem 0.9rem; border-radius: 0.625rem;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.2);
  animation: slideIn 0.25s ease-out;
  max-width: min(100vw - 2rem, 24rem);
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-warn    { border-left: 4px solid #d97706; }
.toast-info    { border-left: 4px solid var(--brand); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

#toast-container {
  left: 1rem;
  right: 1rem;
  max-width: none;
}
@media (min-width: 640px) {
  #toast-container { left: auto; right: 1rem; max-width: 24rem; }
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-end;
  justify-content: center; z-index: 60;
  padding: 0;
  animation: fade 0.15s ease-out;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 1rem; }
}
.modal-card {
  background: var(--card);
  border-radius: 1rem 1rem 0 0;
  max-width: 640px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  border: 1px solid var(--border);
}
@media (min-width: 640px) {
  .modal-card { border-radius: 0.875rem; max-height: 90vh; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* --- Buttons & inputs --- */
.btn-primary {
  background: var(--brand); color: white; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: 0.5rem; transition: background-color 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 0.875rem; min-height: 2.5rem;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary {
  background: var(--card); color: var(--foreground); font-weight: 500;
  padding: 0.55rem 1rem; border-radius: 0.5rem; border: 1px solid var(--input-border);
  transition: background-color 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 0.875rem; min-height: 2.5rem;
}
.btn-secondary:hover { background: var(--muted-bg); }
.btn-danger {
  background: var(--danger); color: white; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: 0.5rem; transition: background-color 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 0.875rem; min-height: 2.5rem;
}
.btn-danger:hover { background: #b91c1c; }

.input, .select, .textarea {
  width: 100%; padding: 0.55rem 0.75rem;
  border: 1px solid var(--input-border); border-radius: 0.5rem;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 1rem; background: var(--card); color: var(--foreground);
  min-height: 2.75rem;
}
@media (min-width: 640px) {
  .input, .select, .textarea { font-size: 0.875rem; min-height: auto; }
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.textarea { font-family: inherit; resize: vertical; min-height: 80px; }
.label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--foreground); margin-bottom: 0.35rem;
}

/* --- Login --- */
#login-view { background: var(--surface); }
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
}
.login-hero {
  background: linear-gradient(135deg, #050a30 0%, #1e3a8a 45%, #2563eb 100%);
}

.theme-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 0.5rem;
  border: 1px solid var(--border); background: var(--card);
  color: var(--foreground); transition: background 0.15s;
}
.theme-toggle-btn:hover { background: var(--muted-bg); }

.chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.75rem; padding: 0.25rem 0.625rem;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--muted-bg); color: var(--muted);
}

/* --- Pitch IA --- */
.pitch-tabs {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.pitch-tab {
  font-size: 0.8125rem; font-weight: 600;
  padding: 0.45rem 0.875rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--muted-bg);
  color: var(--muted); transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pitch-tab:hover { color: var(--foreground); }
.pitch-tab-active {
  background: var(--brand-soft); border-color: var(--brand);
  color: var(--brand);
}
.pitch-panel { font-size: 0.875rem; }
.pitch-empty {
  padding: 1rem; border-radius: 0.75rem;
  border: 1px dashed var(--border); color: var(--muted);
  background: var(--muted-bg); text-align: center;
}
.pitch-block-label, .pitch-section-label {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem;
}
.pitch-message {
  white-space: pre-wrap; line-height: 1.55;
  padding: 1rem; border-radius: 0.75rem;
  background: var(--muted-bg); border: 1px solid var(--border);
  color: var(--foreground);
}
.pitch-message-compact { padding: 0.75rem 1rem; }
.pitch-details {
  border: 1px solid var(--border); border-radius: 0.75rem;
  background: var(--card); overflow: hidden;
}
.pitch-details summary {
  cursor: pointer; padding: 0.75rem 1rem;
  font-size: 0.8125rem; font-weight: 600; color: var(--foreground);
  list-style: none;
}
.pitch-details summary::-webkit-details-marker { display: none; }
.pitch-details-body { padding: 0 1rem 1rem; }
.pitch-section { margin-top: 0.75rem; }
.pitch-section-body {
  white-space: pre-wrap; line-height: 1.5;
  color: var(--foreground); font-size: 0.8125rem;
}
.pitch-list {
  margin: 0.35rem 0 0; padding-left: 1.1rem;
  color: var(--foreground); font-size: 0.8125rem;
}
.pitch-list li + li { margin-top: 0.5rem; }

.pitch-compliance {
  padding: 0.75rem 1rem; border-radius: 0.75rem;
  background: color-mix(in srgb, var(--brand) 8%, var(--muted-bg));
  border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--border));
}
.pitch-compliance-title {
  font-size: 0.75rem; font-weight: 700; color: var(--brand);
  margin-bottom: 0.25rem;
}
.pitch-compliance-text {
  font-size: 0.75rem; color: var(--muted); line-height: 1.45; margin: 0;
}
