/* ════════════════════════════════════════════════════════════
   GRUPO MRX — Dashboard Leads Instagram
   Folha de estilos principal  |  Mobile-first & Responsive
   ════════════════════════════════════════════════════════════ */

/* ── THEME VARIABLES ── */
:root {
  --royal:       #1a3c8f;
  --royal-mid:   #2451b3;
  --royal-light: #3a6fd8;
  --royal-pale:  rgba(26, 60, 143, 0.12);
  --gold:        #b8943a;

  /* STATUS */
  --s-declined: #c0392b;
  --s-waiting:  #d4ac0d;
  --s-negot:    #7d3c98;
  --s-sold:     #1e8449;
  --s-future:   #c0589a;

  /* GENDER */
  --g-female: #c0589a;
  --g-male:   #1a3c8f;

  /* TRANSITIONS */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg:      #0d0d0d;
  --bg2:     #141414;
  --bg3:     #1a1a1a;
  --border:  #2a2a2a;
  --text:    #f0f0f0;
  --text2:   #9a9a9a;
  --text3:   #6a6a6a;
  --card:    #141414;
  --card2:   #1a1a1a;
  --shadow:  0 2px 16px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg:      #f5f5f5;
  --bg2:     #ffffff;
  --bg3:     #ebebeb;
  --border:  #d8d8d8;
  --text:    #111111;
  --text2:   #555555;
  --text3:   #999999;
  --card:    #ffffff;
  --card2:   #f9f9f9;
  --shadow:  0 2px 16px rgba(0, 0, 0, 0.08);
}

/* ── RESET & BASE ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { height: 100%; }

body {
  font-family: 'Lato', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; }

button {
  cursor: pointer;
  font-family: 'Lato', sans-serif;
}

input, select {
  font-family: 'Lato', sans-serif;
}

/* ── LOADING INDICATOR ── */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--royal-light);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.loading-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--royal-light);
  animation: blink 0.9s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.3; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.1); }
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--royal-light);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error { border-left-color: var(--s-declined); }
.toast.success { border-left-color: var(--s-sold); }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-240px);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar.open { transform: translateX(0); }

.sidebar-header {
  position: relative;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 4px;
}

.sidebar-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-close {
  position: absolute;
  top: 18px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  transition: color 0.2s;
  padding: 4px;
}

.sidebar-close:hover { color: var(--text); }

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text2);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.3px;
  border-left: 2px solid transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.2s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg3);
}

.nav-item.active {
  color: var(--royal-light);
  border-left-color: var(--royal-light);
  background: var(--royal-pale);
  font-weight: 700;
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text3);
}

/* SIDEBAR OVERLAY */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 199;
}

.sidebar-overlay.show { display: block; }

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.hamburger-btn {
  background: none;
  border: none;
  color: var(--text2);
  display: flex;
  flex-direction: column;
  gap: 4.5px;
  padding: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.hamburger-btn:hover { color: var(--text); }

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s;
}

/* Logo */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 4px;
}

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.logo-text span { color: var(--royal-light); }

.topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.page-title {
  font-size: 0.8rem;
  color: var(--text3);
  font-weight: 300;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* THEME TOGGLE */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 3px 3px 10px;
}

.theme-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text3);
}

.toggle-switch {
  position: relative;
  width: 34px;
  height: 18px;
  background: var(--border);
  border-radius: 99px;
  border: none;
  transition: background 0.2s;
}

.toggle-switch.on { background: var(--royal-mid); }

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
}

.toggle-switch.on .toggle-knob { transform: translateX(16px); }

/* ── MAIN LAYOUT ── */
.main {
  flex: 1;
  padding: 28px;
  /* On mobile, the main is always full-width (no sidebar pushing) */
}

/* ── PAGE SECTIONS ── */
.page { display: none; }
.page.active { display: block; }

/* ── SECTION HEADER ── */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.page-header p {
  font-size: 0.82rem;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 300;
}

/* ── KPI GRID ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--royal-mid);
  box-shadow: 0 4px 20px rgba(26, 60, 143, 0.12);
}

.kpi-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}

.kpi-card-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.kpi-card-sub {
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 8px;
}

.kpi-accent {
  display: inline-block;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── CHARTS ── */
.charts-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.charts-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.chart-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  margin-bottom: 16px;
}

.chart-card-title strong { color: var(--text); }

.chart-wrap { position: relative; }

/* ── TABLE SECTION ── */
.table-toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: none;
}

.table-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  transition: all 0.18s;
}

.filter-chip:hover {
  border-color: var(--royal-mid);
  color: var(--royal-light);
}

.filter-chip.active {
  background: var(--royal);
  border-color: var(--royal);
  color: #fff;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.82rem;
  width: 200px;
}

.search-box input::placeholder { color: var(--text3); }

.search-icon {
  color: var(--text3);
  font-size: 0.85rem;
}

.add-lead-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--royal);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: background 0.18s;
  white-space: nowrap;
}

.add-lead-btn:hover { background: var(--royal-mid); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.leads-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
}

.leads-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--card2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.leads-table thead th:hover { color: var(--text); }
.leads-table thead th[data-sort]:hover { color: var(--royal-light); }

.leads-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.leads-table tbody tr:hover { background: var(--royal-pale); }
.leads-table tbody tr:last-child { border-bottom: none; }

.leads-table tbody td {
  padding: 11px 14px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.leads-table tbody td.col-name { font-weight: 700; }
.leads-table tbody td.col-muted { color: var(--text3); font-size: 0.75rem; }

/* STATUS PILLS */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.pill-declined { background: rgba(192, 57, 43, 0.12);  color: var(--s-declined); }
.pill-waiting  { background: rgba(212, 172, 13, 0.12); color: var(--s-waiting); }
.pill-negot    { background: rgba(125, 60, 152, 0.12); color: var(--s-negot); }
.pill-sold     { background: rgba(30, 132, 73, 0.12);  color: var(--s-sold); }
.pill-future   { background: rgba(192, 88, 154, 0.12); color: var(--s-future); }
.pill-pending  { background: rgba(100, 100, 100, 0.12); color: var(--text3); }

/* BRADESCO BADGE */
.badge-yes { background: rgba(30, 132, 73, 0.1);  color: var(--s-sold);     font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
.badge-no  { background: rgba(192, 57, 43, 0.1);  color: var(--s-declined); font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
.badge-unk { background: rgba(100, 100, 100, 0.1); color: var(--text3);     font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 3px; }

/* ACTION BUTTONS */
.action-wrap { display: flex; gap: 4px; }

.action-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  padding: 4px 9px;
  border-radius: 3px;
  font-size: 0.72rem;
  transition: all 0.15s;
}

.action-btn:hover { border-color: var(--royal-mid); color: var(--royal-light); }
.action-btn.del:hover { border-color: var(--s-declined); color: var(--s-declined); }

/* PAGINATION */
.table-footer {
  background: var(--card2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text3);
  flex-wrap: wrap;
  gap: 8px;
}

.page-btns { display: flex; gap: 3px; flex-wrap: wrap; }

.page-btn {
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  font-size: 0.75rem;
  transition: all 0.15s;
}

.page-btn.active {
  background: var(--royal);
  border-color: var(--royal);
  color: #fff;
}

.page-btn:hover:not(.active) {
  border-color: var(--royal-mid);
  color: var(--royal-light);
}

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text3);
}

.form-input,
.form-select {
  padding: 9px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.18s;
}

.form-input:focus,
.form-select:focus { border-color: var(--royal-mid); }

.form-select option { background: var(--bg2); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-cancel {
  padding: 8px 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text2);
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.15s;
}

.btn-cancel:hover { border-color: var(--text3); }

.btn-save {
  padding: 8px 20px;
  border-radius: 4px;
  border: none;
  background: var(--royal);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.15s;
}

.btn-save:hover { background: var(--royal-mid); }
.btn-save:disabled { background: var(--text3); cursor: not-allowed; }

/* ── INSIGHT BARS ── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bar-label {
  font-size: 0.78rem;
  color: var(--text2);
  min-width: 120px;
}

.bar-track {
  flex: 1;
  height: 5px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s ease;
}

.bar-val {
  font-size: 0.72rem;
  color: var(--text3);
  min-width: 30px;
  text-align: right;
  font-weight: 700;
}

/* ── FUNNEL ── */
.funnel-step {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.funnel-outer {
  flex: 1;
  height: 42px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
}

.funnel-inner {
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 14px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: width 1s ease;
  border-radius: 4px;
  min-width: 80px;
}

.funnel-meta { text-align: right; min-width: 70px; }

.funnel-count {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.funnel-pct { font-size: 0.7rem; color: var(--text3); font-weight: 700; }

/* ── INSIGHT CARDS ── */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.insight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.insight-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}

.insight-card-big {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.insight-card-desc {
  font-size: 0.78rem;
  color: var(--text3);
  margin-top: 6px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--royal-mid); }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — ver css/mobile.css para tablet e mobile
   ════════════════════════════════════════════════════════════ */
