/* ═══════════════════════════════════════════════════════
   ImobiLeads — App CSS (dashboard, builder, leads)
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  /* ── Nova Paleta — ImobiLeads Professional ── */
  --primary:        #C2B7A5;   /* warm tan */
  --primary-light:  #D4CBBB;
  --primary-dark:   #A89A85;
  --accent:         #C2B7A5;
  --secondary:      #607D8B;   /* blue-grey actions */
  --secondary-dark: #455A64;
  --cta:            #D4A96A;   /* warm gold CTA */
  --cta-dark:       #B88840;

  --bg:             #111009;   /* very dark warm black */
  --surface:        #1A1814;   /* dark warm surface */
  --surface2:       #222019;   /* card background */
  --surface3:       #2A2820;   /* hover/elevated */

  --border:         rgba(194,183,165,0.10);
  --border-hover:   rgba(194,183,165,0.24);

  --text:           #EDE8DF;   /* warm white */
  --text-muted:     #8A8278;
  --text-faint:     #514D46;

  --error:          #D97070;
  --success:        #6DB08A;
  --warning:        #D4A050;

  --sidebar-w:     244px;
  --topbar-h:      68px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,0.45);
  --shadow-lg:     0 12px 48px rgba(0,0,0,0.6);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Headings use Josefin Sans ── */
h1, h2, h3, .topbar-left h1 {
  font-family: 'Josefin Sans', sans-serif;
  letter-spacing: 0.3px;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

.sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(96,125,139,0.35);
}
.logo-text strong { font-family: 'Josefin Sans', sans-serif; }
.logo-text strong { display: block; font-size: 15px; font-weight: 700; color: var(--text); }
.logo-text span   { font-size: 11px; color: var(--accent); font-weight: 500; }

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

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(194,183,165,0.1); color: var(--primary); border-left: 2px solid var(--primary); padding-left: 12px; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.user-info strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span   { font-size: 11px; color: var(--text-muted); }
.btn-logout {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-logout:hover { background: rgba(248,113,113,0.1); border-color: var(--error); color: var(--error); }

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding-bottom: 60px;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(17,16,9,0.92);
  backdrop-filter: blur(12px);
  z-index: 50;
}
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}
.topbar-left { flex: 1; }
.topbar-left h1 { font-size: 22px; font-weight: 700; }
.topbar-left p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.topbar-right   { display: flex; gap: 10px; align-items: center; }
.breadcrumb-link { font-size: 13px; color: var(--accent); text-decoration: none; display: block; margin-bottom: 4px; }
.breadcrumb-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(96,125,139,0.35);
  white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(96,125,139,0.5); }

.btn-primary-sm {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 3px 10px rgba(96,125,139,0.3);
}
.btn-primary-sm:hover { transform: translateY(-1px); }

.btn-cta {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--cta) 0%, var(--cta-dark) 100%);
  color: #111; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(212,169,106,0.4);
  white-space: nowrap;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(212,169,106,0.55); }

.btn-ghost {
  padding: 10px 20px;
  background: transparent;
  color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border-hover); }

.btn-ghost-sm {
  padding: 7px 14px;
  background: transparent;
  color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.btn-ghost-sm:hover { background: var(--surface2); color: var(--text); }

.btn-ghost-outline {
  padding: 8px 14px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.btn-ghost-outline:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  padding: 10px 20px;
  background: rgba(248,113,113,0.15);
  color: var(--error); border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.btn-danger:hover { background: rgba(248,113,113,0.25); }

/* ═══════════════════════════════════════════════════════
   STATS CARDS
═══════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 28px 32px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fadeInUp 0.4s ease both;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: 99px;
}
.stat-purple::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-blue::before   { background: linear-gradient(90deg, var(--secondary), #78909C); }
.stat-green::before  { background: linear-gradient(90deg, var(--success), #8EC9A4); }
.stat-orange::before { background: linear-gradient(90deg, var(--cta), #E8C28A); }

.stat-icon { font-size: 26px; width: 44px; height: 44px; background: var(--surface2); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-body { flex: 1; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; font-family: 'Josefin Sans', sans-serif; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-badge {
  position: absolute; top: 14px; right: 16px;
  font-size: 11px; color: var(--primary);
  background: rgba(194,183,165,0.1);
  padding: 3px 8px; border-radius: 99px;
}

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

/* ═══════════════════════════════════════════════════════
   CHARTS ROW
═══════════════════════════════════════════════════════ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px 32px 0;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.badge-info {
  font-size: 11px; background: rgba(167,139,250,0.1);
  color: var(--accent); padding: 3px 8px; border-radius: 99px;
}

.source-chart { display: flex; flex-direction: column; gap: 10px; }
.source-row { display: flex; align-items: center; gap: 10px; }
.source-name { font-size: 13px; width: 80px; color: var(--text-muted); text-transform: capitalize; }
.source-bar-wrap { flex: 1; background: var(--surface2); border-radius: 99px; height: 8px; overflow: hidden; }
.source-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }
.source-count { font-size: 13px; font-weight: 600; min-width: 28px; text-align: right; }

.status-chart { display: flex; flex-direction: column; gap: 10px; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface2); border-radius: var(--radius-sm); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-name { font-size: 14px; flex: 1; margin-left: 10px; }
.status-num { font-size: 15px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════
   FORMS GRID
═══════════════════════════════════════════════════════ */
.forms-section {
  padding: 28px 32px 0;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 { font-size: 18px; font-weight: 700; }
.section-actions { display: flex; gap: 10px; }

.search-input {
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: inherit; font-size: 13px;
  outline: none; transition: border-color 0.15s;
  width: 220px;
}
.search-input:focus { border-color: var(--primary-light); }

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fadeInUp 0.3s ease both;
}
.form-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.form-card-thumb {
  height: 100px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  position: relative;
}
.form-card-thumb .form-type-badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 99px; letter-spacing: 0.5px;
  background: rgba(0,0,0,0.35); color: white;
  backdrop-filter: blur(4px);
}
.form-card-thumb .form-status-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
}
.badge-active   { background: rgba(52,211,153,0.15); color: #34d399; }
.badge-draft    { background: rgba(156,163,175,0.15); color: #9ca3af; }
.badge-paused   { background: rgba(251,191,36,0.15); color: #fbbf24; }

.form-card-body { padding: 16px 18px; }
.form-card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-card-sub { font-size: 12px; color: var(--text-muted); }

.form-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.form-card-leads { font-size: 13px; color: var(--accent); font-weight: 600; }
.form-card-actions { display: flex; gap: 6px; }

.btn-icon {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); border-color: var(--border-hover); }
.btn-icon.danger:hover { background: rgba(248,113,113,0.1); color: var(--error); border-color: rgba(248,113,113,0.3); }

/* ═══════════════════════════════════════════════════════
   LEADS PAGE
═══════════════════════════════════════════════════════ */
.link-section { padding: 20px 32px 0; }
.link-card {
  background: var(--surface);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius);
  padding: 18px 24px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px;
}
.link-card-left { flex: 1; min-width: 0; }
.link-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; margin-bottom: 4px; }
.link-url { font-size: 14px; color: var(--accent); font-family: 'Courier New', monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.btn-copy {
  padding: 8px 16px;
  background: rgba(167,139,250,0.1);
  color: var(--accent); border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-copy:hover { background: rgba(167,139,250,0.2); }

.utm-helper { background: var(--surface2); border-radius: var(--radius-sm); padding: 14px 18px; }
.utm-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.utm-examples { display: flex; flex-direction: column; gap: 6px; }
.utm-example { font-size: 12px; color: #6b7280; font-family: 'Courier New', monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utm-source-label { color: var(--accent); font-weight: 600; }

.leads-section { padding: 24px 32px 0; }

.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-select {
  padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 13px; outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--primary-light); }

.leads-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.leads-table { width: 100%; border-collapse: collapse; }
.leads-table thead { background: var(--surface2); }
.leads-table th { padding: 13px 16px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; white-space: nowrap; }
.leads-table td { padding: 13px 16px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: top; }
.leads-table tr:hover td { background: rgba(255,255,255,0.02); }
.table-loading { text-align: center; padding: 40px; color: var(--text-muted); }

.lead-name { font-weight: 600; font-size: 14px; }
.lead-phone { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lead-answers { display: flex; flex-direction: column; gap: 3px; max-width: 240px; }
.lead-ans { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-ans strong { color: var(--text); }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.pill-novo       { background: rgba(167,139,250,0.12); color: var(--accent); }
.pill-em_contato { background: rgba(59,130,246,0.12); color: #60a5fa; }
.pill-convertido { background: rgba(52,211,153,0.12); color: var(--success); }
.pill-perdido    { background: rgba(248,113,113,0.12); color: var(--error); }

.utm-tag {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; text-transform: lowercase;
  background: rgba(167,139,250,0.08); color: var(--accent);
}

.date-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.pagination { display: flex; gap: 8px; padding: 20px 0; justify-content: center; }
.page-btn {
  padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--surface2); color: var(--text); }

/* Drawer */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 400px; max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-header h3 { font-size: 16px; font-weight: 700; }
.drawer-close {
  width: 32px; height: 32px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted);
  cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.drawer-close:hover { background: var(--surface2); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }

.drawer-answer { margin-bottom: 16px; }
.drawer-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; margin-bottom: 6px; }
.drawer-value  { font-size: 14px; font-weight: 500; }

.drawer-meta { background: var(--surface2); border-radius: var(--radius-sm); padding: 14px; margin-top: 20px; }
.drawer-meta p { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.drawer-meta p:last-child { margin-bottom: 0; }
.drawer-meta strong { color: var(--text); }

.notes-area {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 13px; resize: vertical;
  outline: none; margin-top: 6px;
}
.notes-area:focus { border-color: var(--primary-light); }

/* ═══════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  max-width: 420px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal h3   { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.modal p    { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }

.modal-field { text-align: left; max-width: 500px; }
.form-group  { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.3px; margin-bottom: 8px; }
.modal-input, .modal-textarea {
  width: 100%; padding: 11px 14px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus, .modal-textarea:focus { border-color: var(--primary-light); }
.modal-textarea { resize: vertical; }

/* Toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.mini-toggle { position: relative; display: inline-block; cursor: pointer; }
.mini-toggle input { display: none; }
.mini-track {
  display: block; width: 40px; height: 22px;
  background: var(--surface3); border-radius: 99px;
  position: relative; transition: background 0.2s;
}
.mini-toggle input:checked ~ .mini-track { background: var(--primary); }
.mini-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: transform 0.2s;
}
.mini-toggle input:checked ~ .mini-track .mini-thumb { transform: translateX(18px); }

/* Loading */
.loading-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 80px 20px;
  color: var(--text-muted); grid-column: 1/-1;
}
.spinner-lg {
  width: 36px; height: 36px;
  border: 3px solid var(--surface2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row  { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); padding: 20px 16px 0; }
  .charts-row, .forms-section, .leads-section, .link-section { padding-left: 16px; padding-right: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-right { display: none; }
  .drawer { width: 100vw; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value  { font-size: 24px; }
}

/* ═══════════════════════════════════════════════════════
   UI/UX ENHANCEMENTS — Motion, Polish & Micro-interactions
═══════════════════════════════════════════════════════ */

/* ── Skeleton shimmer loader ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--surface2) 25%,
    var(--surface3) 50%,
    var(--surface2) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite ease-in-out;
  border-radius: var(--radius-sm);
}
.skeleton-text  { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card  { height: 120px; border-radius: var(--radius); }
.skeleton-row   { height: 48px; border-radius: var(--radius-sm); margin-bottom: 6px; }

/* ── Staggered card entrance animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.anim-fade-up   { animation: fadeUp 0.35s cubic-bezier(0.16,1,0.3,1) both; }
.anim-fade-in   { animation: fadeIn 0.25s ease both; }
.anim-slide-r   { animation: slideRight 0.3s cubic-bezier(0.16,1,0.3,1) both; }
.anim-scale-in  { animation: scaleIn 0.25s cubic-bezier(0.16,1,0.3,1) both; }

/* Stagger children */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 60ms; }
.stagger-children > *:nth-child(3) { animation-delay: 120ms; }
.stagger-children > *:nth-child(4) { animation-delay: 180ms; }
.stagger-children > *:nth-child(5) { animation-delay: 240ms; }
.stagger-children > *:nth-child(6) { animation-delay: 300ms; }

/* ── Enhanced stat cards with glow on hover ── */
.stat-card {
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px var(--border-hover);
}
.stat-card:hover .stat-icon {
  transform: scale(1.08);
  transition: transform 0.2s cubic-bezier(0.16,1,0.3,1);
}
.stat-icon { transition: transform 0.2s cubic-bezier(0.16,1,0.3,1); }

/* ── Glowing primary color variants for stat cards ── */
.stat-purple:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(194,183,165,0.06); }
.stat-green:hover  { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(109,176,138,0.08); }
.stat-orange:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(212,169,106,0.1); }
.stat-blue:hover   { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(96,125,139,0.1); }

/* ── Form card improved hover ── */
.form-card {
  cursor: pointer;
}
.form-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px var(--border-hover);
}
.form-card:active { transform: translateY(-1px); transition-duration: 0.1s; }

/* ── Nav item smooth indicator ── */
.nav-item {
  position: relative;
  overflow: hidden;
}
.nav-item::after {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform 0.2s cubic-bezier(0.16,1,0.3,1);
}
.nav-item.active::after { transform: scaleY(1); }
.nav-item.active { border-left: none; padding-left: 14px; }

/* ── Topbar blur enhancement ── */
.topbar {
  background: rgba(17,16,9,0.88);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid rgba(194,183,165,0.08);
}

/* ── Gradient text for key numbers ── */
.gradient-text {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-text-gold {
  background: linear-gradient(135deg, var(--cta) 0%, #E8C28A 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Enhanced button states ── */
.btn-primary, .btn-cta, .btn-primary-sm {
  position: relative;
  overflow: hidden;
}
.btn-primary::after, .btn-cta::after, .btn-primary-sm::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.btn-primary:hover::after, .btn-cta:hover::after, .btn-primary-sm:hover::after {
  background: rgba(255,255,255,0.06);
}
.btn-primary:active, .btn-cta:active, .btn-primary-sm:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}

/* ── Enhanced toast notification ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.96); }
}
.toast-msg {
  animation: toastIn 0.25s cubic-bezier(0.16,1,0.3,1) both;
}
.toast-msg.hiding {
  animation: toastOut 0.2s ease both;
}

/* ── Status pill pulse indicator ── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.status-live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
  margin-right: 5px;
}

/* ── Progress bar animated fill ── */
@keyframes progressFill {
  from { width: 0%; }
}
.progress-bar-animated {
  animation: progressFill 1s cubic-bezier(0.16,1,0.3,1) both;
}

/* ── Source bar enhanced animation ── */
.source-bar {
  animation: progressFill 0.9s cubic-bezier(0.16,1,0.3,1) both;
}

/* ── Card glow border on hover (glass variant) ── */
.card-glow {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.card-glow:hover {
  border-color: rgba(194,183,165,0.2);
  box-shadow: 0 0 0 1px rgba(194,183,165,0.1), var(--shadow);
}

/* ── Table row transition ── */
.leads-table tbody tr {
  transition: background 0.1s;
}

/* ── Input focus ring enhancement ── */
.modal-input:focus, .modal-textarea:focus, .notes-area:focus, .search-input:focus {
  box-shadow: 0 0 0 3px rgba(194,183,165,0.1);
}

/* ── Drawer slide-in enhancement ── */
.drawer {
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}

/* ── Modal backdrop blur enhancement ── */
.modal-overlay {
  backdrop-filter: blur(8px) saturate(1.4);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
}

/* ── Sidebar logo pulse effect ── */
.logo-icon {
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.sidebar-logo:hover .logo-icon {
  transform: scale(1.05) rotate(-2deg);
  box-shadow: 0 6px 20px rgba(96,125,139,0.5);
}

/* ── Form status badge pulse for active ── */
.badge-active {
  position: relative;
}
.badge-active::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #34d399;
  margin-right: 4px;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ── Btn-sm improvements (for forms table) ── */
.btn-sm {
  transition: all 0.15s cubic-bezier(0.16,1,0.3,1);
}
.btn-sm:hover {
  transform: translateY(-1px) scale(1.04);
}
.btn-sm:active {
  transform: scale(0.96);
  transition-duration: 0.08s;
}

/* ── Scrollbar — warmer color ── */
::-webkit-scrollbar-thumb {
  background: rgba(194,183,165,0.15);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(194,183,165,0.25);
}

/* ── Page content fade-in ── */
.main-content > :first-child {
  animation: fadeIn 0.3s ease both;
}

/* ── Section header divider line ── */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
  margin: 24px 0;
}

/* ── Empty state improved ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
  display: block;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto 20px;
}

/* ── Tooltip utility ── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface3);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  border: 1px solid var(--border);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 999;
  font-family: 'Inter', sans-serif;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Reduced motion support ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skeleton { animation: none; background: var(--surface2); }
}
