/* ========== Paleta v0.2 — Dark default ========== */
:root {
  /* Default = DARK */
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243447;
  --surface-3: #2d4257;
  --texto: #e5e7eb;
  --texto-suave: #9ca3af;
  --borda: #2d4257;
  --gold-500: #c9a961;
  --gold-300: #e0c98a;
  --navy-900: #0a1a3a;
  --whatsapp: #25d366;

  --urgent: #ff3030;
  --warn: #ff8a00;
  --ok: #00d97e;
  --info: #3b82f6;
  --erro: var(--urgent);
  --sucesso: var(--ok);

  --sombra: 0 4px 16px rgba(0,0,0,0.4);
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* ===== Design tokens v0.17 (UI/UX Pro Max) ===== */
  /* Spacing escala 4pt (Material Design) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;

  /* Border radius tokens */
  --radius-sm: 4px;  --radius-md: 6px;  --radius-lg: 8px;
  --radius-xl: 12px; --radius-2xl: 16px; --radius-pill: 999px;

  /* Type scale (mobile-first com base 16px) */
  --text-xs: 11px;  --text-sm: 13px;  --text-base: 14px;
  --text-lg: 16px;  --text-xl: 18px;  --text-2xl: 22px;
  --text-3xl: 28px; --text-4xl: 36px;

  /* Line heights */
  --lh-tight: 1.25; --lh-base: 1.5; --lh-loose: 1.75;

  /* Transitions com easing consistente */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 150ms var(--ease-in-out);
  --t-base: 200ms var(--ease-in-out);
  --t-slow: 300ms var(--ease-out);

  /* Touch targets */
  --touch-min: 44px;

  /* Elevation/Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.45);
  --shadow-focus: 0 0 0 3px rgba(201,169,97,0.35);
}

/* ===== Accessibility globals ===== */
/* Focus-visible robusto pra todos elementos interativos */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  box-shadow: var(--shadow-focus);
  outline-offset: 2px;
}

/* prefers-reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Tabular numbers em valores monetários e datas (evita layout shift) */
.metric-value, .badge-pago, .badge-pendente, td:has(.money),
[data-tabular] { font-variant-numeric: tabular-nums; }

[data-theme="light"] {
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f5f0e6;
  --surface-3: #ebe5d5;
  --texto: #1a1a2e;
  --texto-suave: #5a5a6e;
  --borda: #e5e0d3;
  --gold-500: #c9a961;
  --gold-300: #b8924f;
  --navy-900: #0a1a3a;
  --urgent: #c0392b;
  --warn: #d97706;
  --ok: #27ae60;
  --info: #2563eb;
  --sombra: 0 2px 8px rgba(10, 26, 58, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--texto);
  background: var(--bg);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Mobile: aumenta base pra 16px (evita iOS zoom em inputs <16px) */
@media (max-width: 768px) {
  body { font-size: var(--text-lg); }
  input, select, textarea { font-size: var(--text-lg); }
}
h1, h2, h3, h4 { font-family: var(--serif); color: var(--texto); font-weight: 600; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
a { color: var(--gold-500); text-decoration: none; }
a:hover { color: var(--gold-300); }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea {
  font-family: inherit; font-size: var(--text-base);
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  border: 1px solid var(--borda);
  border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--texto);
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--texto-suave); opacity: 0.7; }
label {
  display: block;
  font-size: var(--text-xs);
  color: var(--texto-suave);
  margin-bottom: var(--space-1);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-row { margin-bottom: var(--space-3); }

/* Touch device: input min-height 44 */
@media (pointer: coarse) {
  input, select, textarea { min-height: var(--touch-min); }
}

/* Skip link a11y — visível só ao focar via teclado */
.skip-link {
  position: absolute; top: -100px; left: 0;
  background: var(--gold-500); color: var(--navy-900);
  padding: var(--space-2) var(--space-4);
  z-index: 9999; text-decoration: none;
  font-weight: 600;
  border-bottom-right-radius: var(--radius-md);
  transition: top var(--t-fast);
}
.skip-link:focus { top: 0; }

/* ========== Shell ========== */
.app-shell { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.app-shell.collapsed { grid-template-columns: 64px 1fr; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--borda);
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 20px 16px; font-family: var(--serif); font-size: 18px;
  color: var(--gold-500); border-bottom: 1px solid var(--borda);
  white-space: nowrap; overflow: hidden;
}
.collapsed .sidebar-brand { font-size: 0; }
.collapsed .sidebar-brand::before { content: 'KV'; font-size: 16px; color: var(--gold-500); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--texto-suave); padding: 12px 16px 6px; }
.collapsed .sidebar-section { display: none; }
.sidebar-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); color: var(--texto-suave);
  cursor: pointer; border-left: 3px solid transparent;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  font-size: var(--text-base);
}
.sidebar-item:hover { background: var(--surface-2); color: var(--texto); }
.sidebar-item.active { background: var(--surface-2); color: var(--gold-500); border-left-color: var(--gold-500); }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.collapsed .sidebar-item span { display: none; }
.sidebar-toggle {
  padding: 12px 16px; background: transparent; color: var(--texto-suave);
  text-align: left; border-top: 1px solid var(--borda); font-size: 12px;
}
.sidebar-toggle:hover { color: var(--texto); }

.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.breadcrumb { color: var(--texto-suave); font-size: 13px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-search { background: var(--surface-2); border: 1px solid var(--borda); padding: 6px 10px; border-radius: 6px; color: var(--texto); width: 240px; font-size: 13px; }
.theme-toggle, .logout-btn, .bell-btn {
  background: transparent; color: var(--texto); padding: 6px 10px;
  border-radius: 6px; border: 1px solid var(--borda); position: relative;
}
.theme-toggle:hover, .logout-btn:hover, .bell-btn:hover { background: var(--surface-2); }
.bell-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--urgent); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 10px;
  min-width: 18px; text-align: center;
  box-shadow: 0 0 8px rgba(255,48,48,0.6);
}
.bell-pulse {
  animation: bell-shake 0.6s ease-in-out 3;
  box-shadow: 0 0 20px rgba(37,211,102,0.7) !important;
  border-color: var(--whatsapp) !important;
}
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-10deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  80% { transform: rotate(10deg); }
}
.bell-dropdown {
  position: absolute; top: 56px; right: 16px; z-index: 800;
  background: var(--surface); border: 1px solid var(--borda); border-radius: 8px;
  width: 380px; max-height: 480px; overflow-y: auto;
  box-shadow: var(--sombra);
}
.bell-dropdown h3 { padding: 12px 16px; border-bottom: 1px solid var(--borda); font-size: 14px; }
.bell-item { padding: 10px 16px; border-bottom: 1px solid var(--borda); cursor: pointer; font-size: 13px; }
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: var(--surface-2); }
.bell-item-titulo { font-weight: 600; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.bell-item-meta { color: var(--texto-suave); font-size: 11px; }
.bell-empty { padding: 20px; text-align: center; color: var(--texto-suave); font-size: 13px; }

#view-container { flex: 1; overflow: auto; padding: 24px; }

/* ========== Componentes ========== */
/* Botões — touch-friendly + transitions consistentes */
.btn-primary, .btn-secondary, .btn-danger {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-base);
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.btn-primary { background: var(--gold-500); color: #0a1a3a; }
.btn-primary:hover { background: var(--gold-300); }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary { background: var(--surface-2); color: var(--texto); border: 1px solid var(--borda); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-secondary:active { transform: scale(0.97); }
.btn-danger { background: var(--urgent); color: white; box-shadow: 0 0 8px rgba(255,48,48,0.4); }
.btn-danger:hover { background: #d52020; }
.btn-danger:active { transform: scale(0.97); }

.btn-wa {
  background: var(--whatsapp); color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  display: inline-flex; align-items: center; gap: var(--space-1);
  text-decoration: none;
  transition: opacity var(--t-fast);
}
.btn-wa:hover { color: white; opacity: 0.85; }

.btn-icon {
  background: transparent;
  color: var(--texto-suave);
  min-width: 32px; min-height: 32px;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--t-fast), background var(--t-fast);
}
.btn-icon:hover { color: var(--texto); background: var(--surface-2); }
.btn-icon:active { transform: scale(0.92); }

/* Touch device (mobile/tablet): touch targets ≥44×44 */
@media (pointer: coarse) {
  .btn-icon { min-width: var(--touch-min); min-height: var(--touch-min); }
  .btn-primary, .btn-secondary, .btn-danger { min-height: var(--touch-min); }
  .sidebar-item { min-height: var(--touch-min); }
}

/* Estado disabled padrão */
button:disabled, .btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}

.card {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: 8px; padding: 16px; box-shadow: var(--sombra);
}

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metric { background: var(--surface); padding: 18px; border-radius: 8px; border-left: 4px solid var(--gold-500); }
.metric-label { font-size: 11px; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.8px; }
.metric-value { font-size: 28px; font-family: var(--serif); color: var(--gold-500); margin-top: 6px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
th {
  background: var(--surface-2); color: var(--texto-suave);
  text-align: left; padding: var(--space-3);
  font-weight: 600; font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.8px;
  position: sticky; top: 0;
  border-bottom: 1px solid var(--borda);
}
td { padding: var(--space-3); border-bottom: 1px solid var(--borda); color: var(--texto); font-size: var(--text-base); }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: var(--surface-2); cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--borda); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 10px 16px; background: transparent; color: var(--texto-suave); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--texto); }
.tab.active { color: var(--gold-500); border-bottom-color: var(--gold-500); font-weight: 600; }

/* ========== Kanban (CRM Leads — 5 colunas fixas) ========== */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; height: calc(100vh - 200px); }
.kanban-col { background: var(--surface); border: 1px solid var(--borda); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; overflow: hidden; }
.kanban-col-head { font-family: var(--serif); font-size: 14px; color: var(--gold-500); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.kanban-col-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.kanban-col-body.drag-over { background: rgba(201,169,97,0.05); border-radius: 6px; }
.lead-card { background: var(--surface-2); padding: 12px; border-radius: 6px; border: 1px solid var(--borda); cursor: grab; transition: transform 0.1s, box-shadow 0.1s; }
.lead-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.lead-card:active { cursor: grabbing; }
.lead-card.dragging { opacity: 0.4; }
.lead-card-nome { font-weight: 600; margin-bottom: 4px; color: var(--texto); }
.lead-card-assunto { font-size: 12px; color: var(--texto-suave); margin-bottom: 8px; }
.lead-card-actions { display: flex; gap: 6px; align-items: center; }

/* ========== Kanban Tarefas v0.18 ========== */
.tarefas-hero {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap;
}
.tarefas-hero h1 { font-size: var(--text-3xl); }
.tarefas-stats { display: flex; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }
.t-stat {
  font-size: var(--text-sm); color: var(--texto-suave);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; background: var(--surface-2);
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.t-stat strong { color: var(--texto); font-weight: 700; }
.t-stat-warn { background: rgba(255,138,0,0.15); color: var(--warn); }
.t-stat-warn strong { color: var(--warn); }
.t-stat-danger { background: rgba(255,48,48,0.15); color: var(--urgent); }
.t-stat-danger strong { color: var(--urgent); }
.tarefas-hero-actions { display: flex; gap: var(--space-2); }

.tarefas-filter-bar {
  display: flex; gap: var(--space-2); align-items: center;
  margin-bottom: var(--space-4); flex-wrap: wrap;
  padding: var(--space-3); background: var(--surface);
  border: 1px solid var(--borda); border-radius: var(--radius-lg);
}
.tarefas-search { position: relative; flex: 1; min-width: 240px; display: flex; align-items: center; }
.tarefas-search svg { position: absolute; left: var(--space-3); color: var(--texto-suave); pointer-events: none; }
.tarefas-search input { padding-left: 36px; background: var(--surface-2); }
.tarefas-filter-select { width: auto; min-width: 160px; }
.tarefas-chip {
  background: var(--surface-2); color: var(--texto-suave);
  border: 1px solid var(--borda);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill); font-size: var(--text-sm);
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.tarefas-chip:hover { color: var(--texto); border-color: var(--gold-500); }
.tarefas-chip.active { background: var(--gold-500); color: var(--navy-900); border-color: var(--gold-500); font-weight: 600; }
.tarefas-chip.active.danger { background: var(--urgent); color: white; border-color: var(--urgent); }

.kanban-tarefas {
  display: flex; gap: var(--space-3);
  overflow-x: auto; padding-bottom: var(--space-3);
  min-height: calc(100vh - 320px);
  scroll-snap-type: x proximity;
}
.kanban-tarefas::-webkit-scrollbar { height: 8px; }
.kanban-tarefas::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.tarefa-col {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-3);
  min-width: 300px; max-width: 300px;
  display: flex; flex-direction: column;
  scroll-snap-align: start;
}
.tarefa-col-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-3); padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--borda);
}
.tarefa-col-titulo {
  font-family: var(--serif); font-size: var(--text-base);
  color: var(--texto); font-weight: 700;
  display: flex; align-items: center; gap: var(--space-2);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.tarefa-col-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.tarefa-col-contador {
  background: var(--surface-2); padding: 3px 10px;
  border-radius: var(--radius-pill); font-size: var(--text-xs);
  color: var(--texto-suave); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tarefa-col-body {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-2);
  min-height: 80px;
  padding: var(--space-1); margin: calc(var(--space-1) * -1);
}
.tarefa-col-body.drag-over {
  background: rgba(201,169,97,0.08); border-radius: var(--radius-lg);
  outline: 2px dashed var(--gold-500); outline-offset: -4px;
}
.tarefa-col-empty {
  padding: var(--space-6) var(--space-3); text-align: center;
  color: var(--texto-suave); font-size: var(--text-xs);
  border: 1.5px dashed var(--borda); border-radius: var(--radius-md);
  font-style: italic;
}
.tarefa-col-add {
  background: transparent; color: var(--texto-suave);
  border: 1.5px dashed var(--borda);
  padding: var(--space-2); border-radius: var(--radius-md);
  margin-top: var(--space-2); cursor: pointer;
  font-size: var(--text-sm); font-weight: 500;
  transition: all var(--t-fast);
}
.tarefa-col-add:hover { color: var(--gold-500); border-color: var(--gold-500); background: rgba(201,169,97,0.05); }

.tarefa-card {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--borda);
  cursor: grab; overflow: hidden;
  display: flex;
  animation: cardEnter 300ms var(--ease-out) backwards;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tarefa-card-bar { width: 4px; flex-shrink: 0; }
.tarefa-card-body { flex: 1; padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.tarefa-card-head { display: flex; justify-content: space-between; align-items: center; }
.tarefa-prio-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--radius-pill);
  text-transform: uppercase; letter-spacing: 0.4px;
  display: inline-flex; align-items: center; gap: 3px;
}
.tarefa-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--card-accent, var(--gold-500)); }
.tarefa-card:active { cursor: grabbing; transform: scale(0.98); }
.tarefa-card.dragging { opacity: 0.4; transform: rotate(2deg); }
.tarefa-card.prazo-atrasado { box-shadow: 0 0 0 1px var(--urgent), 0 0 16px rgba(255,48,48,0.25); }
.tarefa-card.prazo-urgente { box-shadow: 0 0 0 1px var(--warn), 0 0 12px rgba(255,138,0,0.2); }
.tarefa-card.lead-recem-chegado {
  box-shadow: 0 0 0 1px var(--whatsapp), 0 0 16px rgba(37,211,102,0.4);
  animation: flash-in 1.5s ease-out;
}
@keyframes flash-in {
  0% { transform: scale(0.95); background: rgba(37,211,102,0.3); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.tarefa-card-titulo { font-weight: 600; color: var(--texto); font-size: var(--text-sm); line-height: 1.3; }
.tarefa-card-desc { font-size: var(--text-xs); color: var(--texto-suave); line-height: 1.4; }
.tarefa-meta-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-3); padding: 3px 8px;
  border-radius: var(--radius-sm); font-size: 11px; color: var(--texto-suave);
}
.tarefa-card-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.tarefa-card-footer { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-top: auto; }
.tarefa-card-actions { display: inline-flex; gap: var(--space-1); align-items: center; }
.tarefa-prazo {
  font-size: 11px; padding: 3px 8px;
  border-radius: var(--radius-sm); background: var(--surface-3);
  color: var(--texto-suave); font-weight: 500;
  display: inline-flex; align-items: center; gap: 3px;
}
.tarefa-prazo.proximo { background: rgba(255,138,0,0.2); color: var(--warn); }
.tarefa-prazo.urgente { background: rgba(255,138,0,0.3); color: var(--warn); font-weight: 600; }
.tarefa-prazo.atrasado { background: var(--urgent); color: white; font-weight: 700; }
.tarefa-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 10px; font-weight: 700;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.tarefa-avatar-empty { background: var(--surface-3) !important; color: var(--texto-suave); border-style: dashed; }
.tarefa-add-col {
  background: transparent; border: 2px dashed var(--borda);
  color: var(--texto-suave); border-radius: var(--radius-xl);
  padding: var(--space-4); min-width: 220px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-2);
  transition: all var(--t-fast);
  align-self: flex-start; height: 120px;
}
.tarefa-add-col:hover { color: var(--gold-500); border-color: var(--gold-500); background: rgba(201,169,97,0.04); }
.col-actions { display: flex; gap: 4px; }

@media (max-width: 768px) {
  .tarefa-col { min-width: 85vw; max-width: 85vw; }
  .tarefas-hero { flex-direction: column; }
  .tarefas-hero-actions { width: 100%; }
  .tarefas-hero-actions button { flex: 1; }
}

/* ========== Calendário ========== */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-mes { font-family: var(--serif); font-size: 22px; color: var(--gold-500); min-width: 240px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { background: var(--surface-2); padding: 8px; text-align: center; font-size: 11px; text-transform: uppercase; color: var(--texto-suave); letter-spacing: 0.6px; border-radius: 6px; }
.cal-day {
  background: var(--surface); border: 1px solid var(--borda); border-radius: 6px;
  min-height: 100px; padding: 6px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: background 0.15s;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.outside { opacity: 0.3; }
.cal-day.today { border-color: var(--gold-500); box-shadow: 0 0 8px rgba(201,169,97,0.3); }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--texto-suave); margin-bottom: 2px; }
.cal-day.today .cal-day-num { color: var(--gold-500); }
.cal-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: white;
}
.cal-badge.audiencia { background: var(--urgent); }
.cal-badge.prazo { background: var(--warn); }
.cal-badge.tarefa { background: var(--info); }
.cal-badge.prazo-fatal { background: var(--urgent); animation: pulse 1.5s infinite; }
.cal-overflow { font-size: 10px; color: var(--texto-suave); }
.cal-legenda { display: flex; gap: 16px; margin-top: 16px; font-size: 12px; color: var(--texto-suave); }
.cal-legenda-item { display: flex; align-items: center; gap: 6px; }
.cal-legenda-dot { width: 12px; height: 12px; border-radius: 3px; }

/* ========== Badges/status ========== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-ativo { background: rgba(0,217,126,0.18); color: var(--ok); }
.badge-arquivado { background: rgba(156,163,175,0.18); color: var(--texto-suave); }
.badge-suspenso { background: rgba(255,138,0,0.18); color: var(--warn); }
.badge-pago { background: rgba(0,217,126,0.18); color: var(--ok); }
.badge-pendente { background: rgba(255,48,48,0.18); color: var(--urgent); }
.badge-fatal { background: var(--urgent); color: white; animation: pulse 1.5s infinite; box-shadow: 0 0 8px rgba(255,48,48,0.5); }
.badge-prioridade-baixa { background: rgba(156,163,175,0.18); color: var(--texto-suave); }
.badge-prioridade-normal { background: rgba(59,130,246,0.18); color: var(--info); }
.badge-prioridade-alta { background: rgba(255,138,0,0.18); color: var(--warn); }
.badge-prioridade-urgente { background: var(--urgent); color: white; }
@keyframes pulse { 0%,100% {opacity:1;} 50% {opacity:0.55;} }

/* ========== Toast / Modal / Spinner ========== */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; background: var(--surface); color: var(--texto); border: 1px solid var(--borda); border-radius: 6px; box-shadow: var(--sombra); transform: translateX(120%); transition: transform 0.3s; max-width: 360px; }
.toast.toast-show { transform: translateX(0); }
.toast-sucesso { border-left: 3px solid var(--ok); }
.toast-erro { border-left: 3px solid var(--urgent); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
  backdrop-filter: blur(4px);
  animation: fadeIn 200ms var(--ease-out);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl);
  min-width: min(480px, 90vw); max-width: 90vw; max-height: 90vh;
  overflow: auto; box-shadow: var(--shadow-xl);
  animation: scaleIn 250ms var(--ease-out);
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--borda); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { color: var(--gold-500); font-size: 18px; }
.modal-close { background: transparent; font-size: 24px; color: var(--texto-suave); }
.modal-close:hover { color: var(--texto); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--borda); display: flex; gap: 8px; justify-content: flex-end; }

.spinner-wrap { display: flex; justify-content: center; padding: var(--space-10); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--borda); border-top-color: var(--gold-500); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loader — substitui spinner em listas/cards (Material shimmer pattern) */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-md);
  display: block;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin: var(--space-2) 0; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-card { height: 80px; margin-bottom: var(--space-2); }
.skeleton-circle { width: 40px; height: 40px; border-radius: var(--radius-pill); }
.skeleton-list { padding: var(--space-4); }

/* ========== Login ========== */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--borda); padding: 40px; border-radius: 10px; min-width: 380px; box-shadow: var(--sombra); }
.login-brand { font-family: var(--serif); font-size: 24px; color: var(--gold-500); text-align: center; margin-bottom: 8px; }
.login-sub { text-align: center; color: var(--texto-suave); margin-bottom: 24px; font-size: 13px; }

/* ========== Cliente externo (sempre light) ========== */
.cliente-shell { max-width: 900px; margin: 0 auto; padding: 40px 20px; background: #fafaf7; min-height: 100vh; color: #1a1a2e; }
.cliente-header { background: #0a1a3a; color: white; padding: 32px; border-radius: 10px; border-top: 4px solid #c9a961; margin-bottom: 24px; }
.cliente-header h1 { color: #e0c98a; }
.cliente-header .cliente-cpf { color: rgba(255,255,255,0.7); font-size: 13px; margin-top: 4px; }
.cliente-section { background: white; padding: 24px; border-radius: 10px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.cliente-section h2 { color: #0a1a3a; border-bottom: 2px solid #c9a961; padding-bottom: 8px; margin-bottom: 16px; font-size: 18px; }
.cliente-empty { color: #5a5a6e; font-style: italic; }
.cliente-item { padding: 12px 0; border-bottom: 1px solid #e5e0d3; color: #1a1a2e; }
.cliente-item:last-child { border-bottom: none; }
.cliente-item:hover { background: #f5f0e6; cursor: pointer; padding-left: 8px; transition: padding 0.15s; }

/* ========== Dropzone de upload ========== */
.dropzone {
  flex: 1;
  border: 2px dashed var(--borda);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  color: var(--texto-suave);
  transition: background 0.15s, border-color 0.15s;
  font-size: 13px;
}
.dropzone:hover { border-color: var(--gold-500); color: var(--texto); }
.dropzone.drag-over {
  border-color: var(--gold-500);
  background: rgba(201, 169, 97, 0.08);
  color: var(--gold-500);
}
.btn-link {
  background: transparent;
  color: var(--gold-500);
  text-decoration: underline;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.btn-link:hover { color: var(--gold-300); }

/* ========== Painel lateral (CRM lead com chat) ========== */
.panel-overlay {
  position: fixed; inset: 0; z-index: 850;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(3px);
  display: flex; justify-content: flex-end;
}
.panel {
  background: var(--surface); width: 70vw; max-width: 1100px; min-width: 720px;
  height: 100vh; display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.6);
  border-left: 1px solid var(--borda);
  animation: slideInRight 0.2s ease-out;
}
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-header {
  padding: 14px 18px; border-bottom: 1px solid var(--borda);
  display: flex; justify-content: space-between; align-items: center;
}
.panel-header h2 { color: var(--gold-500); font-size: 18px; }
.panel-body {
  flex: 1; display: grid; grid-template-columns: 320px 1fr;
  overflow: hidden;
}
.panel-side {
  padding: 18px; overflow-y: auto;
  background: var(--bg); border-right: 1px solid var(--borda);
}

/* Chat */
.chat-pane { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.chat-header { padding: 12px 16px; border-bottom: 1px solid var(--borda); font-size: 13px; color: var(--texto-suave); background: var(--surface); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.chat-bubble-wrap { display: flex; }
.chat-bubble-wrap.enviada { justify-content: flex-end; }
.chat-bubble-wrap.recebida { justify-content: flex-start; }
.chat-bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 12px;
  word-wrap: break-word; white-space: pre-wrap; font-size: 13px;
}
.chat-bubble.recebida {
  background: var(--surface-2); color: var(--texto);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--borda);
}
.chat-bubble.enviada {
  background: linear-gradient(135deg, #0a3d2e, #14532d);
  color: #e5e7eb;
  border: 1px solid var(--gold-500);
  border-bottom-right-radius: 3px;
  box-shadow: 0 0 16px rgba(201,169,97,0.18);
}
.chat-meta { font-size: 10px; color: rgba(229,231,235,0.55); margin-top: 4px; }
.chat-bubble.recebida .chat-meta { color: var(--texto-suave); }
.chat-media-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px; font-size: 12px;
  border-left: 3px solid var(--gold-500);
}
.chat-bubble.recebida .chat-media-badge { background: rgba(0,0,0,0.06); }
.chat-doc-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px; font-size: 13px;
  text-decoration: none; color: inherit;
  border-left: 3px solid var(--info);
}
.chat-bubble.recebida .chat-doc-link { background: rgba(0,0,0,0.05); }
.chat-doc-link:hover { background: rgba(255,255,255,0.18); }
.chat-transcricao {
  font-size: 12px; margin-top: 4px;
  padding: 6px 10px; border-left: 2px solid rgba(255,255,255,0.3);
  opacity: 0.85;
}

/* Tags */
.tag-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.tag-chip {
  display: inline-block;
  padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600;
  border: 1px solid;
}
.tag-toggle, .dia-toggle {
  display: inline-block;
  padding: 6px 12px; border-radius: 16px;
  font-size: 12px; cursor: pointer;
  border: 2px solid; background: transparent;
  user-select: none;
  transition: background 0.15s;
  color: var(--texto-suave);
}
.tag-toggle:hover, .dia-toggle:hover { opacity: 0.85; }

/* Status ticks (✓ enviado, ✓✓ entregue, ✓✓ azul lido) */
.msg-tick {
  display: inline-block; margin-left: 6px;
  font-weight: 600; color: rgba(229,231,235,0.6);
}
.msg-tick-double { letter-spacing: -2px; }
.msg-tick-read { color: #3b82f6 !important; }
.msg-tick-error { color: var(--urgent) !important; }
.chat-bubble.recebida .msg-tick { color: var(--texto-suave); }

/* Snippets rápidos */
.chat-snippets {
  display: flex; gap: 6px; padding: 8px 12px;
  border-top: 1px solid var(--borda);
  background: var(--surface);
  overflow-x: auto;
  flex-wrap: nowrap;
}
.chat-snippets::-webkit-scrollbar { height: 4px; }
.chat-snippets::-webkit-scrollbar-thumb { background: var(--borda); border-radius: 2px; }
.snippet-btn {
  flex: 0 0 auto;
  background: var(--surface-2); color: var(--texto);
  border: 1px solid var(--borda);
  border-left: 3px solid var(--gold-500);
  padding: 6px 10px; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.snippet-btn:hover { background: var(--surface-3); }
.chat-input {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--borda); background: var(--surface);
}
.chat-input input {
  flex: 1; background: var(--surface-2); color: var(--texto);
  border: 1px solid var(--borda); border-radius: 6px; padding: 10px 12px;
}
.chat-input input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,169,97,0.18); }

@media (max-width: 900px) {
  .panel { width: 100vw; min-width: 0; }
  .panel-body { grid-template-columns: 1fr; }
  .panel-side { display: none; }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: 1fr; height: auto; }
  .topbar-search { display: none; }
}

/* ============================================
   Dashboard v0.17 — Hero + metrics + sections
   ============================================ */
.dash-hero {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-4); margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.dash-greeting {
  font-family: var(--serif);
  font-size: var(--text-3xl); color: var(--texto);
  line-height: var(--lh-tight);
}
.dash-greeting strong { color: var(--gold-500); font-weight: 700; }
.dash-date {
  font-size: var(--text-sm); color: var(--texto-suave);
  margin-top: var(--space-1); text-transform: capitalize;
}
.dash-quick-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.dash-metrics {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4); margin-bottom: var(--space-6);
}
.dash-card {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-5);
  text-decoration: none; color: inherit;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.metric-card { display: flex; flex-direction: column; gap: var(--space-3); cursor: pointer; }
.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-500);
  box-shadow: var(--shadow-md);
}
.metric-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.metric-card-label {
  font-size: var(--text-xs); color: var(--texto-suave);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.metric-card-icon {
  width: 36px; height: 36px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
}
.metric-card-value {
  font-family: var(--serif); font-size: var(--text-3xl);
  font-weight: 700; color: var(--texto); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-card-foot {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); color: var(--texto-suave);
}
.dash-delta {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600;
}
.dash-delta.good { background: rgba(0,217,126,0.15); color: #00d97e; }
.dash-delta.bad { background: rgba(255,48,48,0.15); color: var(--urgent); }
.dash-delta.flat { background: var(--surface-2); color: var(--texto-suave); }

.dash-grid {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
}
.dash-section { display: flex; flex-direction: column; }
.dash-section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-4);
}
.dash-section-head h2 {
  font-size: var(--text-lg); color: var(--texto); margin: 0;
}
.dash-pill {
  font-size: var(--text-xs); padding: 2px 10px;
  border-radius: var(--radius-pill); font-weight: 600;
}
.dash-pill.pill-warn { background: rgba(255,138,0,0.15); color: var(--warn); }
.dash-pill.pill-ok { background: rgba(0,217,126,0.15); color: var(--ok); }
.dash-link {
  font-size: var(--text-sm); color: var(--gold-500);
  text-decoration: none; font-weight: 500;
  transition: color var(--t-fast);
}
.dash-link:hover { color: var(--gold-300); }

.dash-empty {
  text-align: center; padding: var(--space-8) var(--space-4);
  color: var(--texto-suave);
}
.dash-empty-icon {
  font-size: 32px; margin-bottom: var(--space-2);
  opacity: 0.7;
}

/* Alert list */
.dash-alert-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.dash-alert-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); background: var(--surface-2);
  border-radius: var(--radius-md); cursor: pointer;
  border-left: 3px solid var(--borda);
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.dash-alert-item:hover { background: var(--surface-3); transform: translateX(2px); }
.dash-alert-item.fatal { border-left-color: var(--urgent); }
.dash-alert-icon { font-size: 18px; }
.dash-alert-body { flex: 1; min-width: 0; }
.dash-alert-title { font-size: var(--text-sm); color: var(--texto); font-weight: 500; }
.dash-alert-meta { font-size: var(--text-xs); color: var(--texto-suave); margin-top: 2px; }
.dash-alert-arrow { color: var(--texto-suave); font-size: 18px; }

/* Agenda */
.dash-agenda { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.dash-agenda-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); background: var(--surface-2);
  border-radius: var(--radius-md); cursor: pointer;
  transition: background var(--t-fast);
}
.dash-agenda-item:hover { background: var(--surface-3); }
.dash-agenda-time {
  font-family: var(--serif); font-size: var(--text-lg);
  font-weight: 700; color: var(--gold-500);
  font-variant-numeric: tabular-nums; min-width: 50px;
}
.dash-agenda-title { font-size: var(--text-sm); color: var(--texto); font-weight: 500; }
.dash-agenda-meta { font-size: var(--text-xs); color: var(--texto-suave); }

/* Lead list */
.dash-lead-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.dash-lead-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2); cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--t-fast);
}
.dash-lead-item:hover { background: var(--surface-2); }
.dash-lead-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  color: var(--navy-900); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.dash-lead-body { flex: 1; min-width: 0; }
.dash-lead-name { font-size: var(--text-sm); color: var(--texto); font-weight: 500; }
.dash-lead-meta { font-size: var(--text-xs); color: var(--texto-suave); }
.dash-lead-wa { font-size: 16px; }

/* Stat compact */
.dash-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.dash-stat-item {
  text-align: center; padding: var(--space-3);
  background: var(--surface-2); border-radius: var(--radius-md);
}
.dash-stat-value {
  font-family: var(--serif); font-size: var(--text-2xl);
  color: var(--gold-500); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dash-stat-label {
  font-size: 10px; color: var(--texto-suave);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}

/* Responsive */
@media (max-width: 1024px) {
  .dash-metrics { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .dash-greeting { font-size: var(--text-2xl); }
  .dash-quick-actions { width: 100%; }
  .dash-quick-actions .btn-primary,
  .dash-quick-actions .btn-secondary { flex: 1; justify-content: center; }
  .dash-stat-row { grid-template-columns: 1fr; }
}

/* ============================================
   Financeiro v0.18
   ============================================ */
.fin-hero { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-5); flex-wrap: wrap; gap: var(--space-3); }
.fin-alert {
  display: flex; align-items: center; gap: var(--space-3);
  background: rgba(255,48,48,0.1); border: 1px solid rgba(255,48,48,0.3);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
  color: var(--urgent); animation: pulse-alert 2s ease-in-out infinite;
}
.fin-alert strong { font-size: var(--text-lg); }
@keyframes pulse-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,48,48,0); }
  50% { box-shadow: 0 0 0 6px rgba(255,48,48,0.08); }
}

.fin-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4); margin-bottom: var(--space-5);
}
.fin-card {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-4);
  display: flex; gap: var(--space-3); align-items: center;
  cursor: pointer; transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  border-left: 4px solid var(--borda);
}
.fin-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.fin-card-success { border-left-color: var(--ok); }
.fin-card-success:hover { border-color: var(--ok); }
.fin-card-warn { border-left-color: var(--warn); }
.fin-card-warn:hover { border-color: var(--warn); }
.fin-card-danger { border-left-color: var(--urgent); }
.fin-card-danger:hover { border-color: var(--urgent); }
.fin-card-icon { font-size: 32px; flex-shrink: 0; }
.fin-card-body { flex: 1; min-width: 0; }
.fin-card-label { font-size: var(--text-xs); color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.fin-card-value { font-family: var(--serif); font-size: var(--text-3xl); font-weight: 700; color: var(--texto); font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 2px; }
.fin-card-foot { font-size: var(--text-xs); color: var(--texto-suave); margin-top: 4px; }
.fin-card-foot strong { color: var(--texto); }

.fin-toolbar { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; align-items: center; }
.fin-tabs { display: flex; gap: var(--space-1); background: var(--surface); padding: 4px; border-radius: var(--radius-lg); border: 1px solid var(--borda); flex-wrap: wrap; }
.fin-tab {
  background: transparent; color: var(--texto-suave);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500; cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap;
}
.fin-tab:hover { color: var(--texto); }
.fin-tab.active { background: var(--gold-500); color: var(--navy-900); font-weight: 600; }
.fin-search { position: relative; flex: 1; min-width: 240px; display: flex; align-items: center; }
.fin-search svg { position: absolute; left: var(--space-3); color: var(--texto-suave); pointer-events: none; }
.fin-search input { padding-left: 36px; background: var(--surface); }

.fin-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.fin-badge.pago { background: rgba(0,217,126,0.15); color: var(--ok); }
.fin-badge.pendente { background: rgba(255,138,0,0.15); color: var(--warn); }
.fin-badge.atrasado { background: var(--urgent); color: white; }
tr.row-atrasado { background: rgba(255,48,48,0.04); }
tr.row-atrasado:hover td { background: rgba(255,48,48,0.08) !important; }
.fin-empty { text-align: center; padding: var(--space-12) var(--space-4); }
tfoot tr td { border-bottom: none !important; background: var(--surface-2); padding-top: var(--space-3) !important; padding-bottom: var(--space-3) !important; }

/* ============================================
   Clientes v0.18 — list + grid
   ============================================ */
.cli-hero { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-3); gap: var(--space-3); flex-wrap: wrap; }
.cli-search-bar { margin-bottom: var(--space-4); }
.cli-search { position: relative; display: flex; align-items: center; max-width: 500px; }
.cli-search svg { position: absolute; left: var(--space-3); color: var(--texto-suave); pointer-events: none; }
.cli-search input { padding-left: 36px; background: var(--surface); }
.cli-avatar-mini {
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: var(--text-sm);
  border: 2px solid var(--surface);
}

.cli-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}
.cli-card {
  display: flex; gap: var(--space-3); align-items: center;
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-lg); padding: var(--space-3);
  text-decoration: none; color: inherit;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  animation: cardEnter 300ms var(--ease-out) backwards;
}
.cli-card:hover { transform: translateY(-2px); border-color: var(--gold-500); box-shadow: var(--shadow-md); color: inherit; }
.cli-card-avatar {
  width: 48px; height: 48px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: var(--text-xl);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.cli-card-body { flex: 1; min-width: 0; }
.cli-card-nome { font-weight: 600; color: var(--texto); font-size: var(--text-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-card-meta { font-size: var(--text-xs); color: var(--texto-suave); font-variant-numeric: tabular-nums; margin-top: 2px; }
.cli-card-meta-sub { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--texto-suave); margin-top: 4px; }
.cli-card-meta-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cli-empty { text-align: center; padding: var(--space-12) var(--space-4); }

@media (max-width: 768px) {
  .fin-metrics { grid-template-columns: 1fr; }
  .fin-toolbar { flex-direction: column; align-items: stretch; }
  .cli-grid { grid-template-columns: 1fr; }
}

/* ===== CRM Leads hero ===== */
.crm-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }
.crm-stats { display: flex; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }
.crm-hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

@media (max-width: 768px) {
  .crm-hero { flex-direction: column; }
  .crm-hero-actions { width: 100%; }
  .crm-hero-actions .btn-primary, .crm-hero-actions .btn-secondary { flex: 1; justify-content: center; }
}

/* ===== CRM Lead card v0.18 ===== */
.lead-card .lead-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}
.lead-card .lead-card-nome {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--texto);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.lead-card .lead-origem-badge {
  flex-shrink: 0;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.lead-card .lead-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}
.lead-card .lead-card-assunto {
  font-size: var(--text-xs);
  color: var(--texto-suave);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lead-card .lead-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lead-card .lead-info-item {
  font-size: 11px;
  color: var(--texto-suave);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lead-card .lead-card-footer-left { min-height: 22px; display: flex; align-items: center; }
.lead-card .lead-novas {
  background: var(--urgent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
  animation: pulse-novas 1.5s ease-in-out infinite;
}
@keyframes pulse-novas {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 48, 48, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(255, 48, 48, 0); }
}

/* Tag chips dentro do lead card — compacto */
.lead-card .lead-card-tags .tag-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ============================================
   Cliente — aba Dados v0.18
   ============================================ */
.dados-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.dados-section {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-4);
}
.dados-section-title {
  font-size: var(--text-sm); text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--gold-500);
  margin-bottom: var(--space-3); font-family: var(--sans);
  font-weight: 600;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--borda);
}
.dados-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.dados-actions {
  display: flex; gap: var(--space-2); justify-content: flex-end;
  position: sticky; bottom: 0; background: var(--bg);
  padding: var(--space-3) 0; margin-top: var(--space-2);
}
@media (max-width: 640px) {
  .dados-row-2 { grid-template-columns: 1fr; }
}

/* ============================================
   Processos v0.18
   ============================================ */
.proc-hero {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--space-4); gap: var(--space-3); flex-wrap: wrap;
}
.proc-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.proc-stat-card {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-3) var(--space-4);
  cursor: pointer; transition: all var(--t-fast);
  text-align: left;
}
.proc-stat-card:hover { transform: translateY(-2px); border-color: var(--gold-500); box-shadow: var(--shadow-md); }
.proc-stat-card.active {
  border-color: var(--gold-500);
  background: linear-gradient(135deg, var(--surface), rgba(201,169,97,0.08));
  box-shadow: 0 0 0 1px var(--gold-500);
}
.proc-stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.proc-stat-body { flex: 1; min-width: 0; }
.proc-stat-value {
  font-family: var(--serif); font-size: var(--text-2xl);
  font-weight: 700; color: var(--texto);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.proc-stat-label {
  font-size: var(--text-xs); color: var(--texto-suave);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 2px; font-weight: 600;
}

.proc-toolbar {
  display: flex; gap: var(--space-3); margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.proc-search { position: relative; flex: 1; min-width: 240px; display: flex; align-items: center; }
.proc-search svg { position: absolute; left: var(--space-3); color: var(--texto-suave); pointer-events: none; }
.proc-search input { padding-left: 36px; background: var(--surface); }

.proc-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--radius-pill); white-space: nowrap;
}
.proc-area-chip {
  display: inline-block; font-size: 11px;
  padding: 3px 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--texto-suave);
  font-weight: 500;
}
.proc-empty { text-align: center; padding: var(--space-12) var(--space-4); }

@media (max-width: 1024px) {
  .proc-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .proc-stats { grid-template-columns: 1fr; }
}

/* ============================================
   Cliente - tabs internas v0.18
   ============================================ */
.tab-toolbar {
  display: flex; gap: var(--space-3);
  align-items: center; margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.tab-empty {
  text-align: center; padding: var(--space-10) var(--space-4);
  background: var(--surface); border: 1px dashed var(--borda);
  border-radius: var(--radius-xl);
}

/* === Processos (mini cards) === */
.proc-cards { display: flex; flex-direction: column; gap: var(--space-3); }
.proc-mini-card {
  background: var(--surface); border: 1px solid var(--borda);
  border-left: 4px solid var(--gold-500);
  border-radius: var(--radius-lg); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
  text-decoration: none; color: inherit;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  animation: cardEnter 300ms var(--ease-out) backwards;
}
.proc-mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }
.proc-mini-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-2); flex-wrap: wrap;
}
.proc-mini-num {
  font-family: var(--serif); font-weight: 700; font-size: var(--text-lg);
  color: var(--texto); font-variant-numeric: tabular-nums;
}
.proc-mini-meta {
  display: flex; gap: var(--space-3); flex-wrap: wrap;
  font-size: var(--text-xs); color: var(--texto-suave);
}
.proc-mini-meta span { display: inline-flex; align-items: center; gap: 4px; }
.proc-mini-obj {
  font-size: var(--text-sm); color: var(--texto-suave);
  line-height: 1.5; border-top: 1px dashed var(--borda);
  padding-top: var(--space-2); margin-top: var(--space-1);
}

/* === Prazos (timeline) === */
.prazos-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2); margin-bottom: var(--space-4);
}
.prazos-stat {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-lg); padding: var(--space-3);
  text-align: center; color: var(--texto-suave);
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
}
.prazos-stat strong {
  display: block; font-family: var(--serif);
  font-size: var(--text-2xl); color: var(--texto);
  margin-bottom: 2px; font-variant-numeric: tabular-nums;
}
.prazos-stat.danger { background: rgba(255,48,48,0.08); color: var(--urgent); border-color: rgba(255,48,48,0.3); }
.prazos-stat.danger strong { color: var(--urgent); }
.prazos-stat.warn { background: rgba(255,138,0,0.08); color: var(--warn); border-color: rgba(255,138,0,0.3); }
.prazos-stat.warn strong { color: var(--warn); }
.prazos-stat.success { background: rgba(0,217,126,0.08); color: var(--ok); border-color: rgba(0,217,126,0.3); }
.prazos-stat.success strong { color: var(--ok); }

.prazos-timeline { display: flex; flex-direction: column; gap: var(--space-2); }
.prazo-item {
  display: flex; gap: var(--space-3);
  background: var(--surface); border: 1px solid var(--borda);
  border-left: 4px solid var(--borda);
  border-radius: var(--radius-lg); padding: var(--space-3);
  animation: cardEnter 300ms var(--ease-out) backwards;
  transition: transform var(--t-fast);
}
.prazo-item:hover { transform: translateX(2px); }
.prazo-data {
  text-align: center; min-width: 60px;
  padding-right: var(--space-3); border-right: 1px solid var(--borda);
}
.prazo-dia {
  font-family: var(--serif); font-size: 28px; font-weight: 700;
  color: var(--gold-500); line-height: 1; font-variant-numeric: tabular-nums;
}
.prazo-mes {
  font-size: 10px; text-transform: uppercase;
  color: var(--texto-suave); letter-spacing: 1px;
}
.prazo-hora {
  font-size: 11px; color: var(--texto-suave);
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.prazo-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.prazo-head {
  display: flex; align-items: center; gap: var(--space-2);
  flex-wrap: wrap;
}
.prazo-pill {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: var(--radius-pill); background: var(--surface-2);
  color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.4px;
}
.prazo-pill.danger { background: var(--urgent); color: white; }
.prazo-pill.warn { background: rgba(255,138,0,0.2); color: var(--warn); }
.prazo-pill.ok { background: rgba(0,217,126,0.15); color: var(--ok); }
.prazo-link {
  font-size: var(--text-xs); color: var(--texto-suave);
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.prazo-link:hover { color: var(--gold-500); }

/* === Financeiro tab interna === */
.cli-fin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.cli-fin-stat {
  background: var(--surface); border: 1px solid var(--borda);
  border-left: 4px solid var(--borda);
  border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4);
}
.cli-fin-stat.success { border-left-color: var(--ok); }
.cli-fin-stat.warn { border-left-color: var(--warn); }
.cli-fin-stat.danger { border-left-color: var(--urgent); background: rgba(255,48,48,0.04); }
.cli-fin-stat-label {
  font-size: var(--text-xs); color: var(--texto-suave);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.cli-fin-stat-value {
  font-family: var(--serif); font-size: var(--text-2xl); font-weight: 700;
  color: var(--texto); font-variant-numeric: tabular-nums; margin-top: 2px;
}

/* === Documentos === */
.docs-uploader {
  display: flex; gap: var(--space-3); margin-bottom: var(--space-4);
  align-items: stretch;
}
.dropzone-card {
  flex: 1; display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface); border: 2px dashed var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-3) var(--space-4);
  transition: all var(--t-fast); cursor: pointer;
}
.dropzone-card:hover, .dropzone-card.over {
  border-color: var(--gold-500); background: rgba(201,169,97,0.04);
}
.dropzone-icon { font-size: 28px; }
.dropzone-text { display: flex; flex-direction: column; }
.dropzone-text strong { color: var(--texto); font-size: var(--text-sm); }
.dropzone-text span { color: var(--texto-suave); font-size: var(--text-xs); }
.btn-link {
  background: transparent; color: var(--gold-500);
  font-weight: 600; padding: 0; cursor: pointer;
  border: none; font-family: inherit; font-size: inherit;
  text-decoration: underline; text-underline-offset: 2px;
}

.docs-grid { display: flex; flex-direction: column; gap: var(--space-2); }
.doc-card {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-lg); padding: var(--space-3);
  display: flex; align-items: center; gap: var(--space-3);
  animation: cardEnter 300ms var(--ease-out) backwards;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.doc-card:hover { transform: translateY(-1px); border-color: var(--gold-500); }
.doc-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.doc-card-body { flex: 1; min-width: 0; }
.doc-card-nome {
  display: block; font-weight: 600; color: var(--texto);
  font-size: var(--text-sm); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-card-nome:hover { color: var(--gold-500); }
.doc-card-meta {
  display: flex; gap: var(--space-2); flex-wrap: wrap;
  margin-top: 4px; font-size: var(--text-xs); color: var(--texto-suave);
}
.doc-tipo-chip {
  background: var(--surface-2); padding: 1px 8px;
  border-radius: var(--radius-sm);
}
.doc-card-actions {
  display: flex; gap: var(--space-2); align-items: center;
}
.doc-vis-toggle { cursor: pointer; user-select: none; }
.doc-vis-toggle input { display: none; }
.doc-vis-label {
  font-size: 11px; padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--texto-suave);
  transition: all var(--t-fast); display: inline-flex; align-items: center; gap: 4px;
}
.doc-vis-toggle input:checked + .doc-vis-label {
  background: rgba(0,217,126,0.15); color: var(--ok);
}

/* === Acesso externo === */
.acesso-grid { display: flex; flex-direction: column; gap: var(--space-3); max-width: 720px; }
.acesso-card {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-xl); padding: var(--space-4);
}
.acesso-hero {
  display: flex; gap: var(--space-3); align-items: center;
  background: linear-gradient(135deg, var(--surface), rgba(201,169,97,0.06));
  border-color: var(--gold-500);
}
.acesso-icon { font-size: 36px; }
.acesso-link-wrap {
  display: flex; gap: var(--space-2); margin-top: var(--space-2);
}
.acesso-link-wrap input {
  font-family: monospace;
  font-size: var(--text-xs);
  background: var(--bg);
  color: var(--gold-500);
}
.acesso-share-actions {
  display: flex; gap: var(--space-2); margin-top: var(--space-3);
  flex-wrap: wrap;
}
.acesso-danger {
  background: rgba(255,48,48,0.04);
  border-color: rgba(255,48,48,0.2);
}

@media (max-width: 768px) {
  .prazos-stats { grid-template-columns: repeat(2, 1fr); }
  .docs-uploader { flex-direction: column; }
}

/* ============================================
   Modelos de peças v0.19
   ============================================ */
.modelos-hero {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--space-5); gap: var(--space-3); flex-wrap: wrap;
}
.modelos-grupo { margin-bottom: var(--space-6); }
.modelos-grupo-title {
  font-size: var(--text-base); font-family: var(--sans);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.modelos-grupo-count {
  background: var(--surface-2); color: var(--texto-suave);
  font-size: var(--text-xs); padding: 2px 10px;
  border-radius: var(--radius-pill); font-weight: 700;
}
.modelos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}
.modelo-card {
  background: var(--surface); border: 1px solid var(--borda);
  border-left: 4px solid var(--gold-500);
  border-radius: var(--radius-lg); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
  cursor: pointer;
  animation: cardEnter 300ms var(--ease-out) backwards;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.modelo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.modelo-card-top {
  display: flex; justify-content: space-between; align-items: center;
}
.modelo-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.modelo-card-actions { display: flex; gap: 4px; }
.modelo-card-nome {
  font-family: var(--serif); font-size: var(--text-lg);
  color: var(--texto); margin: 0; line-height: 1.3;
}
.modelo-card-desc {
  font-size: var(--text-xs); color: var(--texto-suave);
  line-height: 1.5; margin: 0;
}
.modelo-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: var(--space-2);
  border-top: 1px dashed var(--borda);
}
.modelo-card-ph {
  font-size: var(--text-xs); color: var(--texto-suave);
}
.modelo-card-ph strong { color: var(--gold-500); }
.modelo-card-arrow {
  color: var(--gold-500); font-size: var(--text-lg);
  font-weight: 700; transition: transform var(--t-fast);
}
.modelo-card:hover .modelo-card-arrow { transform: translateX(4px); }

/* Starters no modal de novo */
.starters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.starter-card {
  background: var(--surface-2);
  border: 1.5px solid var(--borda);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center; cursor: pointer;
  transition: all var(--t-fast);
}
.starter-card:hover { border-color: var(--gold-500); background: var(--surface-3); }
.starter-card.selected {
  border-color: var(--gold-500);
  background: rgba(201,169,97,0.1);
  box-shadow: 0 0 0 1px var(--gold-500);
}
.starter-label {
  font-size: var(--text-sm); font-weight: 600; color: var(--texto);
}

/* ============================================
   Editor de modelos com drag-drop v0.19
   ============================================ */
.mp-editor { display: flex; flex-direction: column; height: calc(100vh - 100px); }
.mp-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: var(--space-4); margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--borda); gap: var(--space-3);
  flex-wrap: wrap;
}
.mp-back {
  font-size: var(--text-sm); color: var(--texto-suave);
  display: inline-block; margin-bottom: 4px;
}
.mp-title { margin: 0 0 6px; font-size: var(--text-2xl); }
.mp-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.mp-cat-chip, .mp-stat-chip {
  font-size: var(--text-xs); padding: 3px 10px;
  border-radius: var(--radius-pill); background: var(--surface-2);
  color: var(--texto-suave);
}
.mp-cat-chip { background: rgba(201,169,97,0.15); color: var(--gold-500); }
.mp-desc {
  font-size: var(--text-sm); color: var(--texto-suave);
  margin-top: var(--space-2); margin-bottom: 0;
}
.mp-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.mp-body {
  display: grid; grid-template-columns: 1fr 320px;
  gap: var(--space-3); flex: 1; min-height: 0;
}

.mp-sidebar {
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-lg); padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-3);
  overflow: hidden;
}
.mp-sidebar-head h3 {
  font-size: var(--text-base); margin: 0 0 4px;
  color: var(--gold-500); font-family: var(--sans);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700;
}
.mp-hint {
  font-size: var(--text-xs); color: var(--texto-suave);
  margin: 0; line-height: 1.4;
}

.mp-ph-search {
  position: relative; display: flex; align-items: center;
}
.mp-ph-search svg {
  position: absolute; left: var(--space-2);
  color: var(--texto-suave); pointer-events: none;
}
.mp-ph-search input {
  padding-left: 32px; font-size: var(--text-sm);
  min-height: 32px; background: var(--surface-2);
}

.mp-cat-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--borda);
}
.mp-cat-tab {
  background: var(--surface-2); color: var(--texto-suave);
  font-size: 11px; padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap;
}
.mp-cat-tab:hover { color: var(--texto); }
.mp-cat-tab.active {
  background: var(--gold-500); color: var(--navy-900); font-weight: 600;
}

.mp-ph-list {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding-right: 4px;
}
.mp-ph-group {
  display: flex; flex-direction: column; gap: 4px;
}
.mp-ph-group-title {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--gold-500);
  font-weight: 700; padding: 4px 0;
}
.mp-ph-empty {
  padding: var(--space-4); text-align: center;
  color: var(--texto-suave); font-style: italic;
  font-size: var(--text-xs);
}

.mp-ph-chip {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--surface-2); border: 1px solid var(--borda);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  cursor: grab; user-select: none;
  transition: all var(--t-fast);
  position: relative;
}
.mp-ph-chip:hover {
  border-color: var(--gold-500);
  background: var(--surface-3);
  transform: translateX(-2px);
}
.mp-ph-chip:active { cursor: grabbing; transform: scale(0.97); }
.mp-ph-chip.dragging { opacity: 0.5; transform: rotate(-2deg); }
.mp-ph-chip.usado { border-color: rgba(0,217,126,0.4); background: rgba(0,217,126,0.06); }
.mp-ph-icon {
  font-size: 18px; flex-shrink: 0;
  width: 28px; text-align: center;
}
.mp-ph-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.mp-ph-label {
  font-size: var(--text-xs); color: var(--texto);
  font-weight: 500; line-height: 1.2;
}
.mp-ph-key {
  font-family: monospace; font-size: 10px;
  color: var(--gold-500); background: transparent;
  padding: 0; line-height: 1;
}
.mp-ph-check {
  color: var(--ok); font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.mp-tips {
  background: var(--surface-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs); color: var(--texto-suave);
  border-left: 3px solid var(--gold-500);
}
.mp-tips strong { color: var(--texto); display: block; margin-bottom: 4px; }
.mp-tips ul { margin: 0; padding-left: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.mp-tips code {
  background: var(--surface-3); padding: 1px 6px;
  border-radius: var(--radius-sm); font-size: 10px;
}

/* Canvas (textarea + preview) */
.mp-canvas {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--borda);
  border-radius: var(--radius-lg); overflow: hidden;
}
.mp-textarea {
  flex: 1;
  background: var(--bg);
  color: var(--texto);
  font-family: 'Georgia', serif;
  font-size: 14px; line-height: 1.7;
  padding: var(--space-5);
  border: none; resize: none;
  width: 100%; min-height: 0;
}
.mp-textarea:focus { outline: none; box-shadow: none; }
.mp-textarea.drag-target {
  background: rgba(201,169,97,0.06);
  outline: 2px dashed var(--gold-500);
  outline-offset: -8px;
}
.mp-preview {
  flex: 1; overflow-y: auto; padding: var(--space-5);
  background: var(--bg);
}
.mp-preview-paper {
  max-width: 800px; margin: 0 auto;
  background: var(--surface);
  color: var(--texto);
  padding: var(--space-8) var(--space-10);
  border-radius: var(--radius-md);
  font-family: 'Georgia', serif;
  font-size: 14px; line-height: 1.7;
  white-space: pre-wrap;
  box-shadow: var(--shadow-lg);
}
.ph-faltando {
  background: rgba(255,48,48,0.2);
  color: var(--urgent);
  padding: 1px 6px; border-radius: 3px;
  font-family: monospace; font-size: 0.9em;
}

.mp-canvas-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border-top: 1px solid var(--borda);
  font-size: var(--text-xs); color: var(--texto-suave);
}
.mp-foot-note code {
  background: var(--surface-3); padding: 1px 5px;
  border-radius: var(--radius-sm); font-size: 11px;
  color: var(--gold-500);
}
.mp-status {
  color: var(--ok); font-weight: 600;
  opacity: 0; transition: opacity 300ms;
}
.mp-status.show { opacity: 1; }

@media (max-width: 1024px) {
  .mp-body { grid-template-columns: 1fr; }
  .mp-sidebar { max-height: 280px; }
}
