/* =====================================================================
   AUREON CRM — Design System
   Baseado no Manual da Marca: preto #191919, ouro #a68a54 / #d3af71,
   cinza #cccccc. Tema escuro premium (fintech). Tipografia Montserrat.
   ===================================================================== */

:root {
  /* Paleta (Manual) */
  --preto: #191919;
  --preto-2: #101010;
  --ouro: #a68a54;
  --ouro-claro: #d3af71;
  --ouro-brilho: #e8c98a;
  --cinza: #cccccc;
  --cinza-2: #dcdcdc;
  --grafite: #323232;

  /* Superfícies */
  --bg: #0e0e0e;
  --surface: #171717;
  --surface-2: #1e1e1e;
  --surface-3: #262626;
  --border: #2c2c2c;
  --border-forte: #3a3a3a;

  /* Texto */
  --txt: #f4f2ec;
  --txt-2: #b9b6ad;
  --txt-muted: #7c7a73;

  /* Estados */
  --ok: #4caf7d;
  --alerta: #d9a441;
  --erro: #d3675f;
  --info: #6b8fb5;

  /* Gradiente dourado da marca */
  --grad-ouro: linear-gradient(135deg, #d3af71 0%, #a68a54 55%, #8a713f 100%);

  /* Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --sidebar-w: 244px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);

  --font: "Montserrat", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-marca: "Monda", "Montserrat", sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(166, 138, 84, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(166, 138, 84, 0.05), transparent 55%),
    var(--bg);
}

a { color: var(--ouro-claro); text-decoration: none; }
a:hover { color: var(--ouro-brilho); }
::selection { background: rgba(166, 138, 84, 0.35); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-forte); }

/* ---------- Marca ---------- */
.brand {
  font-family: var(--font-marca);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
}
.brand .logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--grad-ouro);
  display: grid; place-items: center;
  color: var(--preto); font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 14px rgba(166, 138, 84, 0.35);
}
.brand .logo-txt { font-size: 18px; }
.brand .logo-txt b { color: var(--ouro-claro); font-weight: 700; }
.text-gold { color: var(--ouro-claro); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  border: 1px solid var(--border-forte); background: var(--surface-2); color: var(--txt);
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.btn:hover { border-color: var(--ouro); color: var(--ouro-claro); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--grad-ouro); color: var(--preto); border: none; font-weight: 700;
  box-shadow: 0 6px 18px rgba(166, 138, 84, 0.28);
}
.btn-primary:hover { color: var(--preto-2); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger:hover { border-color: var(--erro); color: var(--erro); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* Botões de canal */
.btn-wa:hover { border-color: #25d366; color: #25d366; }
.btn-mail:hover { border-color: var(--info); color: var(--info); }
.btn-call:hover { border-color: var(--ouro-claro); color: var(--ouro-claro); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.card-title-accent { border-left: 3px solid var(--ouro); padding-left: 12px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; color: var(--txt-2); margin-bottom: 6px; font-weight: 600; letter-spacing: 0.02em; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font-family: var(--font); font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border-forte);
  border-radius: var(--radius-sm); color: var(--txt); transition: var(--transition);
}
input::placeholder, textarea::placeholder { color: var(--txt-muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ouro);
  box-shadow: 0 0 0 3px rgba(166, 138, 84, 0.15);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
select { cursor: pointer; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: auto; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--surface-3); color: var(--txt-2); border: 1px solid var(--border);
}
.badge-gold { background: rgba(166, 138, 84, 0.16); color: var(--ouro-claro); border-color: rgba(166, 138, 84, 0.4); }
.badge-ok { background: rgba(76, 175, 125, 0.15); color: var(--ok); border-color: rgba(76,175,125,0.35); }
.badge-warn { background: rgba(217, 164, 65, 0.15); color: var(--alerta); border-color: rgba(217,164,65,0.35); }
.badge-err { background: rgba(211, 103, 95, 0.15); color: var(--erro); border-color: rgba(211,103,95,0.35); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; cursor: pointer;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-forte);
  font-size: 13px; color: var(--txt-2); transition: var(--transition); user-select: none;
}
.chip:hover { border-color: var(--ouro); color: var(--ouro-claro); }
.chip.active { background: rgba(166,138,84,0.18); border-color: var(--ouro); color: var(--ouro-claro); }

/* ---------- Tabela ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--txt-muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--surface-2); }

/* ---------- Utilidades ---------- */
.muted { color: var(--txt-muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grid { display: grid; } .wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; } .text-right { text-align: right; }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-forte);
  border-left: 3px solid var(--ouro); padding: 12px 18px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 14px; min-width: 240px; max-width: 380px;
  animation: slideIn 220ms ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--erro); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.66); backdrop-filter: blur(3px);
  z-index: 1000; display: grid; place-items: center; padding: 24px; animation: fade 160ms ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-forte); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); width: 100%; max-width: 620px; max-height: 88vh; overflow: auto;
  animation: pop 200ms cubic-bezier(0.34,1.56,0.64,1);
}
.modal-lg { max-width: 900px; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Loader ---------- */
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--surface-3); border-top-color: var(--ouro); border-radius: 50%; animation: spin 0.7s linear infinite; }
.loading-center { display: grid; place-items: center; padding: 60px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--txt-muted); }
.empty .icon { font-size: 40px; opacity: 0.5; margin-bottom: 12px; }
