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

:root {
  --primary: #d9362a;
  --primary-dark: #b82a1f;
  --primary-light: #fde8e6;
  --primary-hover: #c53024;
  --whatsapp: #25d366;
  --whatsapp-dark: #1da851;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #a0a0b8;
  --sidebar-active: #d9362a;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.03);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Login ─── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 50%, #1a1a2e 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-header {
  text-align: center;
  padding: 40px 32px 24px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--primary);
  color: white;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  border-radius: 16px;
  margin-bottom: 16px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.login-form {
  padding: 0 32px 32px;
}

.login-error {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 54, 42, 0.1);
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-full { width: 100%; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ─── Dashboard Layout ─── */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.2s;
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 800;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 15px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.2px;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar-nav {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  user-select: none;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
}

.sidebar-item.active {
  background: var(--primary);
  color: white;
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: var(--sidebar-text);
}

.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-footer a:hover { color: white; }

/* Main */
.main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.topbar-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.topbar-refresh:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.topbar-refresh.loading svg { animation: spin 0.8s linear infinite; }

/* Content */
.content {
  padding: 24px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.section { display: none; }
.section.active { display: block; }

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-value .small { font-size: 16px; }

.kpi-trend {
  font-size: 12px;
  color: var(--whatsapp);
}

.kpi-trend.down { color: var(--primary); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-mini {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.kpi-mini-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.kpi-mini-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* Charts */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.chart-container {
  position: relative;
  min-height: 280px;
}

/* Table */
.table-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-filters select, .table-filters input {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 120px;
}

.table-filters select:focus, .table-filters input:focus {
  border-color: var(--primary);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all 0.15s;
}

.filter-chip.active {
  background: var(--primary);
  color: white;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-hot { background: #fef2f2; color: #dc2626; }
.badge-warm { background: #fffbeb; color: #d97706; }
.badge-cold { background: #f3f4f6; color: #6b7280; }
.badge-true { background: #ecfdf5; color: #059669; }
.badge-false { background: #f3f4f6; color: #9ca3af; }

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-whatsapp { background: #ecfdf5; color: var(--whatsapp-dark); }

/* Insights */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .insights-grid { grid-template-columns: 1fr; }
}

.insight-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}

.insight-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.insight-card-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.insight-card-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-kpi { height: 90px; margin-bottom: 16px; }
.skeleton-chart { height: 300px; margin-bottom: 24px; }
.skeleton-text { height: 14px; margin-bottom: 8px; width: 60%; }
.skeleton-text.wide { width: 80%; }

/* States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--bg);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.error-state {
  text-align: center;
  padding: 40px 20px;
  background: #fef2f2;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.error-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.error-state-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Insights Loading */
.insight-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .content {
    padding: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    padding: 10px 16px;
  }

  .topbar-right span {
    display: none;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

.sidebar-overlay.open { display: block; }

/* ============================= */
/* GLOBAL FILTERS + RESPONSIVE */
/* ============================= */

.section-title-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.global-filter-bar {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.global-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.global-filter-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.global-filter-head p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

#activePeriodLabel {
  background: rgba(217, 54, 42, 0.08);
  color: #d9362a;
  border: 1px solid rgba(217, 54, 42, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.global-filters {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
}

.filter-group select,
.filter-group input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  padding: 0 13px;
  background: #fff;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

#applyFiltersBtn {
  height: 44px;
  border: none;
  border-radius: 14px;
  background: #d9362a;
  color: #fff;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(217, 54, 42, 0.18);
}

.metric-description {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #8f98a8;
}

/* TABLET */
@media (max-width: 1024px) {
  .global-filters {
    grid-template-columns: 1fr 1fr;
  }

  #applyFiltersBtn {
    width: 100%;
  }

  .content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* MOBILE */
@media (max-width: 767px) {
  .main {
    width: 100%;
  }

  .topbar {
    min-height: 64px;
    padding: 0 14px;
    gap: 10px;
  }

  .topbar-left,
  .topbar-right {
    gap: 8px;
  }

  .topbar-right span {
    display: none;
  }

  .topbar-refresh {
    padding: 9px 12px;
    font-size: 12px;
  }

  .content {
    padding: 14px;
  }

  .global-filter-bar {
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 18px;
  }

  .global-filter-head {
    flex-direction: column;
    gap: 10px;
  }

  #activePeriodLabel {
    width: fit-content;
  }

  .global-filters {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .filter-group select,
  .filter-group input,
  #applyFiltersBtn {
    height: 46px;
    font-size: 14px;
  }

  .sidebar {
    width: min(86vw, 320px);
  }

  .stats-grid,
  .kpi-grid,
  .cards-grid,
  .charts-grid {
    grid-template-columns: 1fr !important;
  }

  .card,
  .metric-card,
  .chart-card {
    border-radius: 18px;
  }

  .chart-container,
  .chart-wrapper {
    min-height: 260px;
    overflow-x: auto;
  }

  table {
    min-width: 760px;
  }

  .table-wrapper,
  .leads-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* SMALL MOBILE */
@media (max-width: 420px) {
  .content {
    padding: 10px;
  }

  .global-filter-bar {
    padding: 12px;
  }

  .topbar-refresh {
    font-size: 0;
    width: 42px;
    height: 42px;
    justify-content: center;
  }

  .topbar-refresh svg {
    margin: 0;
  }
}
/* FIX RESPONSIVE CHART RE-FLOW */
.chart-card,
.chart-container {
  min-width: 0 !important;
  max-width: 100% !important;
}

.chart-container {
  position: relative !important;
  overflow: hidden !important;
}

.chart-container canvas {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* ============================= */
/* LEADS CONVERSATION MODAL */
/* ============================= */

.conversation-btn {
  border: none;
  background: rgba(217, 54, 42, .09);
  color: #d9362a;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.conversation-btn:hover {
  background: rgba(217, 54, 42, .15);
}

.conversation-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.conversation-modal {
  width: min(760px, 100%);
  max-height: 86vh;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
}

.conversation-modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.conversation-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.conversation-modal-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.conversation-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: #f3f4f6;
  font-size: 24px;
  cursor: pointer;
}

.conversation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
}

.conversation-meta span {
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}

.conversation-chat {
  padding: 18px;
  overflow-y: auto;
  background: #f4f6f8;
}

.chat-row {
  display: flex;
  margin-bottom: 12px;
}

.chat-row.chat-user {
  justify-content: flex-end;
}

.chat-row.chat-bot {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-user .chat-bubble {
  background: #d9362a;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bot .chat-bubble {
  background: #fff;
  color: #111827;
  border: 1px solid rgba(15,23,42,.08);
  border-bottom-left-radius: 4px;
}

.chat-author {
  display: block;
  font-size: 11px;
  font-weight: 800;
  opacity: .7;
  margin-bottom: 5px;
}

@media (max-width: 767px) {
  .conversation-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .conversation-modal {
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
  }

  .chat-bubble {
    max-width: 88%;
  }
}

/* ============================= */
/* MIA LOGO */
/* ============================= */

.mia-logo-sidebar {
  width: 100%;
  max-width: 180px;
  height: auto;
  display: block;
  object-fit: contain;
}

.sidebar-brand {
  padding: 10px 6px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 12px;
}

@media (max-width: 767px) {
  .mia-logo-sidebar {
    max-width: 150px;
  }

  .sidebar-brand {
    padding-top: 14px;
    padding-bottom: 14px;
  }
}
/* ============================= */
/* LOGIN LOGO */
/* ============================= */

.login-logo-img {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
  margin: 0 auto 22px;
  object-fit: contain;
}

@media (max-width: 767px) {
  .login-logo-img {
    max-width: 200px;
  }
}

/* ======================================== */
/* AI INSIGHTS */
/* ======================================== */

.ai-executive-card {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
}

.ai-executive-left h3 {
  font-size: 28px;
  margin-bottom: 10px;
  font-weight: 800;
}

.ai-executive-left p {
  color: rgba(255,255,255,.72);
  line-height: 1.7;
  max-width: 820px;
}

.ai-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.ai-score-ring {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 6px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-score-ring strong {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.ai-score-ring span {
  margin-top: 6px;
  font-size: 11px;
  opacity: .72;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ai-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.ai-insight-card {
  background: #fff;
  border-radius: 22px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,.04);
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
}

.ai-insight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(0,0,0,.08);
}

.ai-insight-card.priority-high {
  border-top: 4px solid #ef4444;
}

.ai-insight-card.priority-medium {
  border-top: 4px solid #f59e0b;
}

.ai-insight-card.priority-low {
  border-top: 4px solid #10b981;
}

.ai-insight-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ai-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-secondary);
}

.ai-priority {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f4f4f5;
}

.ai-insight-card h3 {
  font-size: 20px;
  line-height: 1.3;
  margin-bottom: 14px;
  font-weight: 800;
  color: #111827;
}

.ai-summary {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 22px;
}

.ai-detail {
  margin-bottom: 16px;
}

.ai-detail strong {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ai-detail span {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

.ai-action {
  margin-top: 20px;
  padding: 16px;
  border-radius: 16px;
  background: #f9fafb;
  border: 1px solid #ececec;
}

.ai-action strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ai-action span {
  color: #111827;
  line-height: 1.6;
  font-weight: 500;
}

.ai-card-footer {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
}

.ai-card-footer span {
  color: var(--text-secondary);
  font-size: 13px;
}

.ai-card-footer strong {
  font-size: 18px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .ai-executive-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .ai-score-ring {
    width: 100px;
    height: 100px;
  }

  .ai-executive-left h3 {
    font-size: 22px;
  }
}

@media (max-width: 767px) {
  .ai-insights-grid {
    grid-template-columns: 1fr;
  }

  .ai-insight-card {
    padding: 20px;
  }

  .ai-executive-card {
    padding: 22px;
  }

  .ai-executive-left h3 {
    font-size: 20px;
  }

  .ai-score-ring strong {
    font-size: 28px;
  }
}
/* ======================================== */
/* AI LOADING STATE */
/* ======================================== */

.ai-loading-state {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.ai-loading-icon {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d9362a 0%, #ff695f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 34px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(217,54,42,.25);
  animation: aiPulse 1.8s infinite ease-in-out;
}

.ai-loading-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #111827;
}

.ai-loading-state p {
  max-width: 620px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.ai-loading-state small {
  color: #9ca3af;
  font-size: 13px;
}

@keyframes aiPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.06);
    opacity: .82;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}
/* ======================================== */
/* AI SCORE HELP */
/* ======================================== */

.ai-score-box {
  display: flex;
  align-items: center;
  gap: 34px;
  flex-shrink: 0;
}

.ai-score-help {
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
  color: rgba(255,255,255,.74);
  max-width: 280px;
}

.ai-score-help strong {
  color: #fff;
  font-weight: 800;
}

.ai-score-help-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.ai-score-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ai-score-dot.red {
  background: #ef4444;
}

.ai-score-dot.orange {
  background: #f97316;
}

.ai-score-dot.yellow {
  background: #fbbf24;
}

.ai-score-dot.gray {
  background: #9ca3af;
}

@media (max-width: 900px) {
  .ai-score-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .ai-score-help {
    max-width: 100%;
  }
}
/* FIX AI INSIGHTS LAYOUT: score arriba, cards abajo */
.ai-executive-card {
  width: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 32px !important;
  margin-bottom: 28px !important;
}

.ai-insights-grid {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
  gap: 20px !important;
  clear: both !important;
}

@media (max-width: 900px) {
  .ai-executive-card {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .ai-score-box {
    width: 100% !important;
    justify-content: flex-start !important;
  }
}
