/* ============================================================
   AFP Brasil Gestao - Shell dos modulos (Vendas / Financas)
   Design system da marca AFP. Reutilizavel entre modulos.
   ============================================================ */
:root {
  --navy: #002B49; --navy-800: #012540; --navy-700: #013a61; --navy-600: #0a4d7a;
  --ctp: #0070C0; --fpac: #E8501A; --bg: #F5F5F5; --surface: #FFFFFF;
  --title: #002B49; --text: #3d4a55; --muted: #5f6b76;
  --line: rgba(0,43,73,0.10); --line-strong: rgba(0,43,73,0.18);
  --ok: #1b7a3d; --danger: #C0392B; --warn: #E8501A;
  --shadow-sm: 0 1px 2px rgba(0,43,73,.06), 0 1px 3px rgba(0,43,73,.05);
  --shadow-md: 0 8px 26px rgba(0,43,73,.12);
  --radius: 14px; --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.16,1,0.3,1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
:where(a,button,input,select,textarea):focus-visible { outline: 3px solid var(--ctp); outline-offset: 2px; border-radius: 6px; }

/* ---------- Layout: sidebar + main ---------- */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; min-height: 100svh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh; height: 100svh;
}
.sidebar__logo { width: 172px; height: auto; margin: 2px 4px 22px; }
.sidebar__module {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 0 8px 10px;
}
.sidebar__module::before { content: "/ "; color: var(--ctp); font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(0,43,73,.05); }
.nav-item.active { background: rgba(0,43,73,.06); color: var(--title); font-weight: 600; }
.nav-item.active svg { opacity: 1; color: var(--ctp); }
.sidebar__spacer { flex: 1; }
.sidebar__foot { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.sidebar__foot .nav-item { font-size: 13px; color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px clamp(20px,4vw,40px); background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar__title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--title); margin: 0; }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.topbar__user { font-size: 13px; color: var(--muted); }
.topbar__user b { color: var(--title); font-weight: 600; }
.content { padding: clamp(22px,4vw,36px); max-width: 1160px; width: 100%; }

/* ---------- Componentes ---------- */
.btn { font-family: var(--font); font-size: 14px; font-weight: 600; border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1.5px solid transparent; transition: all .15s var(--ease); display: inline-flex; align-items: center; gap: 8px; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-700); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--title); }
.btn--ghost:hover { border-color: var(--navy); background: rgba(0,43,73,.04); }
.btn--sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.badge { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.badge--ok { color: var(--ok); background: rgba(27,122,61,.10); }
.badge--muted { color: #55606b; background: rgba(0,43,73,.06); }
.badge--warn { color: var(--fpac); background: rgba(232,80,26,.10); }
.badge--info { color: var(--ctp); background: rgba(0,112,192,.10); }
.badge--danger { color: var(--danger); background: rgba(192,57,43,.09); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card--pad { padding: 20px 22px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: clamp(22px,3vw,28px); font-weight: 800; letter-spacing: -.025em; color: var(--title); margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat__label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--title); }
.stat__value small { font-size: 14px; font-weight: 600; color: var(--muted); }

/* Tabelas / listas */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fafbfc; }
.tbl .name { color: var(--title); font-weight: 600; }

/* Kanban */
.board { display: grid; gap: 14px; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; padding-bottom: 8px; }
.col { background: #eef1f6; border-radius: 12px; padding: 12px; min-height: 120px; }
.col__head { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 2px 4px 12px; }
.col__count { background: rgba(0,43,73,.08); border-radius: 999px; padding: 1px 8px; }
.lead-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.lead-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lead-card__name { font-weight: 600; color: var(--title); font-size: 14px; margin-bottom: 4px; }
.lead-card__meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--title); }
.field input, .field select, .field textarea {
  font-family: var(--font); font-size: 14px; color: var(--title); padding: 11px 13px;
  border: 1.5px solid var(--line-strong); border-radius: 9px; background: #fff; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ctp); box-shadow: 0 0 0 4px rgba(0,112,192,.13); }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

/* Tabs */
.tabs { display: inline-flex; gap: 4px; background: #eef1f6; padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.tab { padding: 8px 16px; border-radius: 8px; border: 0; background: transparent; font-family: var(--font); font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--title); box-shadow: var(--shadow-sm); }

/* Estado vazio */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 12px; }
.empty p { margin: 0 0 4px; font-size: 15px; }
.empty small { font-size: 13px; opacity: .8; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,43,73,.4); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 460px; box-shadow: var(--shadow-md); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 18px; font-size: 19px; font-weight: 700; color: var(--title); letter-spacing: -.02em; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .sidebar__logo { margin: 0 12px 0 0; height: 26px; }
  .sidebar__module, .sidebar__spacer { display: none; }
  .sidebar__foot { border-top: 0; padding-top: 0; flex-direction: row; }
  .nav-item { width: auto; }
  .row { grid-template-columns: 1fr; }
}
