/* =====================================================================
   DESIGN SYSTEM — SISTEMA VILELA RH SAUDE
   Limpo, moderno, mobile-first. Sem emoji, sem ruido visual.
   ===================================================================== */

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

:root {
  /* Marca */
  --azul-marinho: #1B3A6E;
  --verde-vida:   #3BB54A;
  --azul-ceu:     #59B8D6;
  --branco-azul:  #F2F8FF;
  --dark-navy:    #0B1C38;

  /* Neutros */
  --branco:   #FFFFFF;
  --cinza-50: #F6F8FB;
  --cinza-100:#EDF1F6;
  --cinza-200:#DDE4ED;
  --cinza-300:#C4CEDB;
  --cinza-400:#94A2B6;
  --cinza-500:#647289;
  --cinza-700:#3A4759;
  --cinza-900:#1A2230;

  /* Semanticas */
  --texto:        #1A2230;
  --texto-suave:  #647289;
  --borda:        #DDE4ED;
  --fundo:        #F6F8FB;
  --sucesso:      #3BB54A;
  --alerta:       #E8A317;
  --erro:         #DC3545;
  --info:         #59B8D6;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h:  64px;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sombra-sm: 0 1px 2px rgba(11,28,56,.06), 0 1px 3px rgba(11,28,56,.08);
  --sombra:    0 2px 8px rgba(11,28,56,.08), 0 4px 16px rgba(11,28,56,.06);
  --sombra-lg: 0 8px 32px rgba(11,28,56,.16);

  --fonte-titulo: 'Montserrat', system-ui, sans-serif;
  --fonte-corpo:  'Inter', system-ui, sans-serif;
  --t: .18s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--fonte-corpo);
  font-size: 14px;
  line-height: 1.55;
  color: var(--texto);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--fonte-titulo); line-height: 1.25; color: var(--azul-marinho); }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--azul-marinho); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--cinza-300); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--cinza-400); background-clip: content-box; }

/* ---------- Tipografia util ---------- */
.titulo-pagina { font-size: 22px; font-weight: 800; }
.subtitulo { color: var(--texto-suave); font-size: 13px; }
.texto-suave { color: var(--texto-suave); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Botoes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--azul-marinho); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #16315c; }
.btn-verde { background: var(--verde-vida); color: #fff; }
.btn-verde:hover:not(:disabled) { background: #33a040; }
.btn-outline { background: #fff; color: var(--azul-marinho); border-color: var(--borda); }
.btn-outline:hover:not(:disabled) { border-color: var(--azul-marinho); background: var(--branco-azul); }
.btn-ghost { background: transparent; color: var(--cinza-500); }
.btn-ghost:hover:not(:disabled) { background: var(--cinza-100); color: var(--texto); }
.btn-danger { background: #fff; color: var(--erro); border-color: var(--borda); }
.btn-danger:hover:not(:disabled) { background: #fdeaec; border-color: var(--erro); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn-bloco { width: 100%; }
.btn-icone { width: 36px; height: 36px; padding: 0; }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo label { font-weight: 600; font-size: 13px; color: var(--cinza-700); }
.campo .dica { font-size: 12px; color: var(--texto-suave); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--borda); border-radius: var(--radius-sm);
  background: #fff; transition: border-color var(--t), box-shadow var(--t);
}
.textarea { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--azul-ceu);
  box-shadow: 0 0 0 3px rgba(89,184,214,.18);
}
.input::placeholder, .textarea::placeholder { color: var(--cinza-400); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23647289' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-form .col-2 { grid-column: 1 / -1; }

/* ---------- Cards ---------- */
.card {
  background: #fff; border: 1px solid var(--borda);
  border-radius: var(--radius); box-shadow: var(--sombra-sm);
}
.card-pad { padding: 20px; }
.card-titulo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--borda);
}
.card-titulo h3 { font-size: 15px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--sombra-sm); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--azul-ceu); }
.kpi.verde::before { background: var(--verde-vida); }
.kpi.marinho::before { background: var(--azul-marinho); }
.kpi.alerta::before { background: var(--alerta); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .03em; }
.kpi-valor { font-family: var(--fonte-titulo); font-size: 28px; font-weight: 800; color: var(--azul-marinho); margin-top: 6px; }
.kpi-rodape { font-size: 12px; color: var(--texto-suave); margin-top: 4px; }

/* ---------- Atalhos rapidos ---------- */
.atalhos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.atalho {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--radius);
  padding: 16px; cursor: pointer; display: flex; align-items: center; gap: 13px;
  box-shadow: var(--sombra-sm); text-align: left;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.atalho:hover { border-color: var(--azul-ceu); box-shadow: var(--sombra); transform: translateY(-2px); }
.atalho-ic {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--branco-azul); color: var(--azul-marinho);
}
.atalho-tit { font-weight: 700; font-size: 14px; color: var(--texto); }
.atalho-sub { font-size: 12px; color: var(--texto-suave); }

/* ---------- Guia de passos ---------- */
.passos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.passo { text-align: center; padding: 6px; position: relative; }
.passo-n {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 8px;
  background: var(--azul-marinho); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fonte-titulo); font-size: 15px;
}
.passo-t { font-size: 12px; font-weight: 600; line-height: 1.35; }

/* ---------- Tabela ---------- */
.tabela-wrap { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--texto-suave);
  padding: 11px 14px; border-bottom: 1px solid var(--borda); white-space: nowrap;
}
.tabela td { padding: 13px 14px; border-bottom: 1px solid var(--cinza-100); vertical-align: middle; }
.tabela tbody tr { transition: background var(--t); }
.tabela tbody tr:hover { background: var(--cinza-50); }
.tabela tbody tr:last-child td { border-bottom: none; }
.tabela .acoes { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--cinza-100); color: var(--cinza-700);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-verde   { background: #e6f6e8; color: #2a8d36; }
.badge-azul    { background: #e7f4f9; color: #2d7f9c; }
.badge-marinho { background: #e7ecf5; color: var(--azul-marinho); }
.badge-alerta  { background: #fcf2dc; color: #9a6b0c; }
.badge-erro    { background: #fdeaec; color: #c32b39; }
.badge-cinza   { background: var(--cinza-100); color: var(--cinza-500); }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--dark-navy); color: #cdd6e4;
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  transition: transform var(--t);
}
.sidebar-marca {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-marca img { height: 30px; width: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-grupo { font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: #5d6b85; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #aab6cc; font-weight: 500; cursor: pointer;
  transition: background var(--t), color var(--t);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.ativo { background: var(--azul-marinho); color: #fff; }
.sidebar-rodape { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }

.area-principal {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-width: 0;
}
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar-titulo { font-family: var(--fonte-titulo); font-weight: 800; font-size: 17px; color: var(--azul-marinho); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--azul-marinho); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.btn-menu { display: none; }
.conteudo { padding: 24px; flex: 1; }
.conteudo-cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(11,28,56,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--sombra-lg); width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: surge .2s ease;
}
.modal-lg { max-width: 860px; }
@keyframes surge { from { opacity: 0; transform: translateY(12px) scale(.99); } }
.modal-cabecalho {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--borda);
}
.modal-corpo { padding: 22px; overflow-y: auto; }
.modal-rodape {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--borda);
}

/* ---------- Toast ---------- */
.toast-area { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border: 1px solid var(--borda); border-left: 4px solid var(--info);
  border-radius: var(--radius-sm); box-shadow: var(--sombra-lg);
  padding: 13px 16px; min-width: 280px; max-width: 380px;
  display: flex; gap: 10px; align-items: flex-start;
  animation: surge .2s ease;
}
.toast.sucesso { border-left-color: var(--sucesso); }
.toast.erro { border-left-color: var(--erro); }
.toast.alerta { border-left-color: var(--alerta); }
.toast-titulo { font-weight: 700; font-size: 13px; }
.toast-msg { font-size: 13px; color: var(--texto-suave); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.kanban-coluna {
  flex: 0 0 264px; background: var(--cinza-50);
  border: 1px solid var(--borda); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: 72vh; scroll-snap-align: start;
}
.kanban-coluna-topo {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--borda);
  font-weight: 700; font-size: 13px; color: var(--azul-marinho);
}
.kanban-coluna-corpo { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.kanban-card {
  background: #fff; border: 1px solid var(--borda); border-radius: var(--radius-sm);
  padding: 12px; cursor: pointer; box-shadow: var(--sombra-sm);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.kanban-card:hover { border-color: var(--azul-ceu); box-shadow: var(--sombra); transform: translateY(-1px); }

/* ---------- Estados ---------- */
.vazio { text-align: center; padding: 48px 20px; color: var(--texto-suave); }
.vazio svg { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--cinza-300); }
.vazio h3 { color: var(--cinza-500); margin-bottom: 4px; }
.carregando { display: flex; align-items: center; justify-content: center; padding: 48px; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--cinza-200); border-top-color: var(--azul-marinho);
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Utilitarios ---------- */
.flex { display: flex; } .flex-col { flex-direction: column; }
.itens-centro { align-items: center; } .entre { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-20 { margin-bottom: 20px; }
.full { width: 100%; } .flex-1 { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.oculto { display: none !important; }
.clicavel { cursor: pointer; }
.texto-direita { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Login ---------- */
.login-tela { display: flex; min-height: 100vh; }
.login-form-lado {
  flex: 0 0 480px; background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 48px 56px;
}
.login-form { width: 100%; max-width: 360px; }
.login-form .logo-topo { height: 50px; width: auto; margin-bottom: 44px; }
.login-form h2 { font-size: 24px; margin-bottom: 4px; }
.login-form .subtitulo { margin-bottom: 28px; }
.login-erro {
  background: #fdeaec; color: #c32b39; border-radius: var(--radius-sm);
  padding: 10px 13px; font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.campo-senha { position: relative; }
.campo-senha .input { padding-right: 46px; }
.olho-btn {
  position: absolute; right: 5px; bottom: 5px;
  width: 32px; height: 32px; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--cinza-400); cursor: pointer; border-radius: 6px;
  transition: color var(--t), background var(--t);
}
.olho-btn:hover { color: var(--cinza-700); background: var(--cinza-100); }

.login-marca {
  flex: 1; background: linear-gradient(155deg, var(--azul-marinho) 0%, var(--dark-navy) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center;
  padding: 64px; position: relative; overflow: hidden;
}
.login-marca::before {
  content: ''; position: absolute; top: -130px; right: -110px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(89,184,214,.26), transparent 70%);
}
.login-marca::after {
  content: ''; position: absolute; bottom: -120px; left: -90px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,181,74,.16), transparent 70%);
}
.login-marca-int { position: relative; max-width: 440px; }
.login-marca-int h1 { color: #fff; font-size: 33px; line-height: 1.32; }
.login-marca-int .lead { color: #aab6cc; margin-top: 14px; font-size: 15px; }
.login-recursos { margin-top: 34px; display: flex; flex-direction: column; gap: 15px; }
.login-recurso { display: flex; align-items: center; gap: 13px; color: #d4dcea; font-size: 14px; }
.login-recurso .ic {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255,255,255,.09); display: flex; align-items: center; justify-content: center;
  color: var(--verde-vida);
}

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--sombra-lg); }
  .sidebar.aberta { transform: translateX(0); }
  .area-principal { margin-left: 0; }
  .btn-menu { display: inline-flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-form { grid-template-columns: 1fr; }
  .atalhos { grid-template-columns: repeat(2, 1fr); }
  .passos { grid-template-columns: 1fr; }
  .passos .passo { display: flex; align-items: center; gap: 12px; text-align: left; padding: 4px; }
  .passos .passo-n { margin: 0; }
  .conteudo { padding: 16px; }
  .login-marca { display: none; }
  .login-form-lado { flex: 1; }
  .backdrop-sidebar { position: fixed; inset: 0; background: rgba(11,28,56,.5); z-index: 39; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .modal-rodape { flex-direction: column-reverse; }
  .modal-rodape .btn { width: 100%; }
}

/* ---------- Impressao ---------- */
@media print {
  .sidebar, .topbar, .toast-area, .btn { display: none !important; }
  .area-principal { margin-left: 0; }
  .conteudo { padding: 0; }
  body { background: #fff; }
}
