/* ═══════════════════════════════════════════════════════════════
   AZV dos Imóveis — CRM Design System
   main.css — Tokens, Base, Componentes
   ═══════════════════════════════════════════════════════════════ */

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

/* ── CSS Custom Properties (Design Tokens) ─────────────────────── */
:root {
  /* Gold Accent */
  --gold:          #C9A84C;
  --gold-dark:     #A8863A;
  --gold-light:    #E8CC7E;
  --gold-subtle:   #FAF5E8;
  --gold-glow:     rgba(201, 168, 76, 0.15);

  /* Brand Corporate Navy Blue */
  --navy:          #132E59;
  --navy-dark:     #0A1931;
  --navy-light:    #1D3E73;
  --navy-glow:     rgba(19, 46, 89, 0.15);

  /* Vendor / Chart Colors */
  --vendor-1: #4F46E5;
  --vendor-2: #DB2777;
  --vendor-3: #059669;
  --vendor-4: #F59E0B;
  --vendor-5: #0891B2;
  --vendor-6: #7C3AED;

  /* Status */
  --success:       #16A34A;
  --success-bg:    #F0FDF4;
  --warning:       #D97706;
  --warning-bg:    #FFFBEB;
  --danger:        #DC2626;
  --danger-bg:     #FEF2F2;
  --info:          #2563EB;
  --info-bg:       #EFF6FF;

  /* Sidebar (always dark corporate navy) */
  --sidebar-bg:       #0A1931;
  --sidebar-border:   rgba(255,255,255,0.06);
  --sidebar-text:     #A8B5CD;
  --sidebar-hover:    rgba(255, 255, 255, 0.04);
  --sidebar-active:   rgba(201, 168, 76, 0.14);
  --sidebar-active-text: #C9A84C;
  --sidebar-width:    256px;
  --sidebar-collapsed: 68px;

  /* Typography */
  --font-ui:    'Inter', system-ui, sans-serif;
  --font-brand: 'Outfit', system-ui, sans-serif;

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   0.12s ease;
  --transition-base:   0.2s ease;
  --transition-slow:   0.35s ease;

  /* Z-Index */
  --z-sidebar:  100;
  --z-header:   90;
  --z-modal:    200;
  --z-toast:    300;
  --z-tooltip:  150;
}

/* ── Light Mode ────────────────────────────────────────────────── */
:root,
[data-theme="light"] {
  --bg-primary:     #F7F6F3;
  --bg-secondary:   #FFFFFF;
  --bg-tertiary:    #EFEDE8;

  --surface:        #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-hover:  #F5F4F1;

  --border:         #E7E5E0;
  --border-strong:  #C4BFB4;

  --text-primary:   #1A1816;
  --text-secondary: #57534E;
  --text-muted:     #A8A29E;
  --text-inverse:   #FFFFFF;

  --input-bg:       #FFFFFF;
  --input-border:   #D6D3CE;
  --input-focus:    #C9A84C;

  --scrollbar-thumb: #D6D3CE;
  --scrollbar-track: transparent;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl:  0 24px 48px rgba(0,0,0,0.12);

  --kanban-bg: #F0EDE8;
  --kanban-col: #E8E5E0;
}

/* ── Dark Mode (Corporate Navy & Gold) ─────────────────────────── */
[data-theme="dark"] {
  --bg-primary:     #070F1E; /* Very deep corporate blue-black background */
  --bg-secondary:   #0C192E; /* Corporate Navy blue surfaces */
  --bg-tertiary:    #12233E;

  --surface:        #0C192E;
  --surface-elevated: #12233E;
  --surface-hover:  #182E50;

  --border:         #193054;
  --border-strong:  #223F6D;

  --text-primary:   #F0EDE8;
  --text-secondary: #A8B5CD;
  --text-muted:     #63748E;
  --text-inverse:   #0C192E;

  --input-bg:       #12233E;
  --input-border:   #1D355C;
  --input-focus:    #C9A84C;

  --scrollbar-thumb: #3A3835;
  --scrollbar-track: transparent;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.4);
  --shadow-xl:  0 24px 48px rgba(0,0,0,0.5);

  --success-bg:  rgba(22,163,74,0.15);
  --warning-bg:  rgba(217,119,6,0.15);
  --danger-bg:   rgba(220,38,38,0.15);
  --info-bg:     rgba(37,99,235,0.15);
  --gold-subtle: rgba(201,168,76,0.08);

  --kanban-bg: #0E0D0C;
  --kanban-col: #1A1816;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-brand);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { color: var(--text-secondary); }

a { color: var(--gold); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

/* ── Layout — App Shell ────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-primary);
  transition: margin-left var(--transition-slow);
}

.page-content {
  padding: 28px 32px;
  max-width: 1400px;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  overflow: hidden;
  transition: width var(--transition-slow);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
}

.sidebar-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-logo-large {
  justify-content: center;
  padding: 20px 14px;
  min-height: 128px;
}

.sidebar-logo-large img {
  width: 224px;
  height: auto;
  max-height: 108px;
}

.sidebar-logo-text {
  font-family: var(--font-brand);
  font-size: 1.1rem;
  font-weight: 700;
  color: #F0EDE8;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo-text span { color: var(--gold); }

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

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  opacity: 0.5;
  padding: 14px 10px 8px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #F0EDE8;
}

.sidebar-item.active {
  background: rgba(201, 168, 76, 0.09);
  color: var(--sidebar-active-text);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 999px;
  background: var(--gold);
}

.sidebar-item .item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: currentColor;
  opacity: 0.78;
}

.sidebar-item:hover .item-icon,
.sidebar-item.active .item-icon {
  opacity: 1;
}

.sidebar-item .item-badge {
  margin-left: auto;
  background: var(--gold);
  color: #1A1816;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sidebar-item .item-badge.danger {
  background: var(--danger);
  color: #fff;
}

.item-icon::before,
.header-icon::before,
.kpi-icon::before,
.empty-icon::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.kpi-icon::before {
  width: 20px;
  height: 20px;
}

.empty-icon::before {
  width: 34px;
  height: 34px;
}

.icon-overview { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='6' height='6' rx='1.4'/%3E%3Crect x='14' y='4' width='6' height='6' rx='1.4'/%3E%3Crect x='4' y='14' width='6' height='6' rx='1.4'/%3E%3Cpath d='M14 17h6M17 14v6'/%3E%3C/svg%3E"); }
.icon-leads { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Ccircle cx='12' cy='12' r='2.3'/%3E%3Cpath d='M12 2.8v2.1M21.2 12h-2.1M12 19.1v2.1M4.9 12H2.8'/%3E%3C/svg%3E"); }
.icon-team { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM15.5 10.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM3.8 19.2c.7-3 2.5-4.5 4.7-4.5s4 1.5 4.7 4.5M13.8 15.2c2.7.2 4.6 1.5 5.4 4'/%3E%3C/svg%3E"); }
.icon-client { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.2'/%3E%3Cpath d='M5.5 19c1-3.4 3.3-5.1 6.5-5.1s5.5 1.7 6.5 5.1'/%3E%3C/svg%3E"); }
.icon-finance { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 7.5h13.2a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4.5a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2Z'/%3E%3Cpath d='M5.8 7.5l8.8-2.6a1.8 1.8 0 0 1 2.2 1.2l.4 1.4M16.4 13h3.3'/%3E%3C/svg%3E"); }
.icon-bot { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='7' width='14' height='11' rx='3'/%3E%3Cpath d='M12 4v3M9.2 12h.1M14.7 12h.1M9 15h6'/%3E%3C/svg%3E"); }
.icon-kanban { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2.4'/%3E%3Cpath d='M9 4v16M15 4v16M6.5 8h5M12.5 13h5M6.5 16h5'/%3E%3C/svg%3E"); }
.icon-logout { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 5H6.8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h2.7M13 8l4 4-4 4M17 12H9'/%3E%3C/svg%3E"); }
.icon-calendar { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2.2'/%3E%3Cpath d='M8 3.5v3M16 3.5v3M4 9h16M8 13h2M13 13h3M8 16.5h2'/%3E%3C/svg%3E"); }
.icon-alert { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4.2 21 19H3L12 4.2Z'/%3E%3Cpath d='M12 9v4.3M12 16.8h.1'/%3E%3C/svg%3E"); }
.icon-check { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='m8.5 12.2 2.2 2.2 4.8-5'/%3E%3C/svg%3E"); }
.icon-trend { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 17.5 9 12l3.5 3.2L20 7.5'/%3E%3Cpath d='M15 7.5h5v5'/%3E%3C/svg%3E"); }
.icon-wallet { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 7.5h13.8a2.2 2.2 0 0 1 2.2 2.2v7a2.2 2.2 0 0 1-2.2 2.2H4.5a2 2 0 0 1-2-2V6.8a2 2 0 0 1 2-2h11.2'/%3E%3Cpath d='M16.5 13.2h4M16.6 13.2h.1'/%3E%3C/svg%3E"); }
.icon-theme { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5a8.5 8.5 0 1 0 0 17 6.2 6.2 0 0 1 0-17Z'/%3E%3C/svg%3E"); }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-base);
  overflow: hidden;
}

.sidebar-user:hover { background: var(--sidebar-hover); }

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1A1816;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info {
  overflow: hidden;
  flex: 1;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #D6D3D1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Top Header ────────────────────────────────────────────────── */
.top-header {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: var(--z-header);
  backdrop-filter: blur(12px);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.top-header-title {
  font-family: var(--font-brand);
  font-size: 1.15rem;
  font-weight: 600;
  flex: 1;
}

.top-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1A1816;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(201,168,76,0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 16px rgba(201,168,76,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(22,163,74,0.2);
}

.btn-success:hover {
  background: var(--success);
  color: white;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { padding: 6px; }

.btn-wa {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,211,102,0.3);
}

.btn-wa:hover {
  box-shadow: 0 4px 16px rgba(37,211,102,0.4);
  transform: translateY(-1px);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

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

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--font-brand);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 24px; }
.card-body.no-pad { padding: 0; }

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

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

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gold-subtle);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.kpi-value {
  font-family: var(--font-brand);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kpi-trend.up { color: var(--success); background: var(--success-bg); }
.kpi-trend.down { color: var(--danger); background: var(--danger-bg); }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  -webkit-appearance: none;
}

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

.form-control:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-control:hover:not(:focus) { border-color: var(--border-strong); }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A8A29E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 5px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: var(--surface-hover);
}

.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-gold    { background: var(--gold-subtle);  color: var(--gold-dark); border: 1px solid rgba(201,168,76,0.25); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Source Badges ─────────────────────────────────────────────── */
.badge-whatsapp  { background: rgba(37,211,102,0.12); color: #16A34A; }
.badge-meta-ads  { background: rgba(37,99,235,0.12);  color: #2563EB; }
.badge-instagram { background: rgba(219,39,119,0.12); color: #DB2777; }
.badge-indicacao { background: rgba(124,58,237,0.12); color: #7C3AED; }
.badge-site      { background: rgba(8,145,178,0.12);  color: #0891B2; }
.badge-manual    { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Column Status Colors ──────────────────────────────────────── */
.badge-col-novo-lead      { background: rgba(37,99,235,0.12); color: #2563EB; }
.badge-col-primeiro-contato { background: rgba(8,145,178,0.12); color: #0891B2; }
.badge-col-em-negociacao  { background: rgba(201,168,76,0.15); color: var(--gold-dark); }
.badge-col-visita-agendada { background: rgba(124,58,237,0.12); color: #7C3AED; }
.badge-col-proposta-enviada { background: rgba(217,119,6,0.15); color: var(--warning); }
.badge-col-ganho          { background: rgba(22,163,74,0.12); color: var(--success); }
.badge-col-perdido        { background: rgba(220,38,38,0.12); color: var(--danger); }

/* ── Avatar ────────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1A1816;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
}

.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-full); }
.avatar-sm  { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-md  { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar-lg  { width: 52px; height: 52px; font-size: 1rem; }
.avatar-xl  { width: 72px; height: 72px; font-size: 1.25rem; }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-base);
}

.modal-backdrop.show .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 780px; }
.modal-sm { max-width: 400px; }

.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1.15rem; }

.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Search ────────────────────────────────────────────────────── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding-left: 38px;
  min-width: 240px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* ── Filter Bar ────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

/* ── Toast Notifications ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 0.3s ease forwards;
}

.toast.hide { animation: toastOut 0.3s ease forwards; }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-text { font-size: 0.875rem; color: var(--text-primary); flex: 1; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── Theme Toggle ──────────────────────────────────────────────── */
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.theme-toggle::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.theme-toggle:hover {
  background: var(--gold-subtle);
  color: var(--gold);
  border-color: var(--gold);
}

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
}

.empty-state .empty-icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='14' rx='2.4'/%3E%3Cpath d='M9 9h6M9 12h6M9 15h3'/%3E%3C/svg%3E");
  opacity: 0.4;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h4 { font-size: 1rem; color: var(--text-secondary); }
.empty-state p { font-size: 0.85rem; color: var(--text-muted); max-width: 300px; }

/* ── Profile Editor ────────────────────────────────────────────── */
.profile-section {
  padding: 28px 32px;
  max-width: 1040px;
}

.profile-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 20px;
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-avatar-ring {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

.profile-avatar-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 800;
  overflow: hidden;
}

.profile-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-overlay {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(10, 25, 49, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--transition-base);
}

.profile-avatar-ring:hover .profile-avatar-overlay { opacity: 1; }

.profile-avatar-hint {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: center;
}

.profile-name-display {
  font-family: var(--font-brand);
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.profile-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--gold-subtle);
  color: var(--gold-dark);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 10px;
}

.profile-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.profile-stat-value {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-stat-label {
  color: var(--text-muted);
  font-size: 0.74rem;
  margin-top: 2px;
}

.profile-edit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.profile-edit-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
}

.profile-edit-body { padding: 22px; }

.color-swatch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.color-swatch:hover { transform: scale(1.08); }

.color-swatch.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--bg-primary), 0 0 0 5px currentColor;
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  width: fit-content;
}

.tab-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-ui);
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  background: var(--surface);
  color: var(--gold);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ── Chip / Tag ────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.chip-quente  { background: rgba(220,38,38,0.1);  color: #DC2626; border-color: rgba(220,38,38,0.2); }
.chip-morno   { background: rgba(217,119,6,0.1);  color: #D97706; border-color: rgba(217,119,6,0.2); }
.chip-frio    { background: rgba(37,99,235,0.1);  color: #2563EB; border-color: rgba(37,99,235,0.2); }
.chip-novo    { background: rgba(22,163,74,0.1);  color: #16A34A; border-color: rgba(22,163,74,0.2); }
.chip-fechado { background: var(--gold-subtle); color: var(--gold-dark); border-color: rgba(201,168,76,0.25); }

/* ── Progress Bar ──────────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.progress-bar.success { background: linear-gradient(90deg, #16A34A, #059669); }
.progress-bar.danger  { background: linear-gradient(90deg, #DC2626, #B91C1C); }

/* ── Divider ───────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 20px 0;
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Dropdown ──────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: var(--z-tooltip);
  padding: 6px;
  display: none;
}

.dropdown-menu.open { display: block; animation: fadeInDown 0.15s ease; }

.dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.dropdown-item.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

.animate-fadeIn    { animation: fadeIn 0.25s ease; }
.animate-fadeInUp  { animation: fadeInUp 0.3s ease; }
.animate-fadeInDown { animation: fadeInDown 0.2s ease; }

/* ── Utility Classes ───────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.flex-1 { flex: 1; }

.text-sm  { font-size: 0.875rem; }
.text-xs  { font-size: 0.75rem; }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Loader / Spinner ──────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── Responsive Utilities ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-logo-text,
  .sidebar-item span,
  .sidebar-section-label,
  .sidebar-user-info { display: none; }
  .sidebar-item { justify-content: center; padding: 10px; }
  .sidebar-item .item-badge { display: none; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .page-content { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .top-header { padding: 0 16px; }
  .page-content { padding: 16px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .search-box { width: 100%; }
  .filter-bar .search-box input { width: 100%; }
}

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

/* ── Section Animations ────────────────────────────────────────── */
.section-panel {
  animation: fadeInUp 0.25s ease;
}

.section-panel.hidden { display: none; }

/* ── Page Title ────────────────────────────────────────────────── */
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title h2 {
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title p { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

/* ── Detail Row ────────────────────────────────────────────────── */
.detail-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-muted); font-size: 0.8rem; min-width: 130px; flex-shrink: 0; }
.detail-row .value { color: var(--text-primary); font-weight: 500; }

/* ── Notification Dot ──────────────────────────────────────────── */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  position: absolute;
  top: 2px; right: 2px;
  animation: pulse 2s ease infinite;
}
