/* ================================
   RETOMATECH — v2.css (redesign V2)
   Carregado DEPOIS de style.css, só em login.html e dashboard.html.
   Tudo escopado em body.v2 para não afetar index/cadastro/senha.
   Cores via variáveis (claro em body.v2, escuro em [data-theme="dark"] body.v2).
   ================================ */

body.v2 {
  /* remapeia os tokens do style.css: as ~6000 linhas do dashboard herdam a paleta */
  --azul:   #12294A;   /* títulos / texto de marca */
  --marca:  #0B1A2E;   /* navy da sidebar e do painel do login (fixo nos 2 temas) */
  --botao:  #12294A;   /* botão primário */
  --botao-h:#0B1A2E;
  --verde:  #10B981;
  --azul2:  #2F6BFF;   /* destaque: foco, links, gráfico */
  --cinza:  #F1F4F8;   /* fundo da página */
  --fundo:  #F1F4F8;
  --card:   #FFFFFF;
  --borda:  #E1E7EE;
  --borda-in:#C4CDD8;  /* borda de input */
  --texto:  #1B2A3B;
  --titulo: #0F1F33;
  --sub:    #566474;
  --muted:  #6B7A8C;
  --campo:  #F6F8FB;   /* fundo de busca / cabeçalho de tabela */
  --seg:    #E6EBF1;   /* trilho do segmented control */
  --linha:  #EEF2F6;
  --sombra: 0 1px 2px rgba(15,31,51,.04);
  --sombra2: 0 20px 48px rgba(15,31,51,.08);
  --ok-bg:#E3F3EC;   --ok-texto:#0B6B51;   --ok-borda:#BFE3D3;
  --aviso-bg:#FBEFD5; --aviso-texto:#7A4B00; --aviso-borda:#F1D9A0;
  --erro-bg:#FBE5E5;  --erro-texto:#8A1F1F;  --erro-borda:#F1C2C2;
  --info-bg:#E8EFFF;  --info-texto:#1F4FCC;

  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--texto);
  background: var(--fundo);
}
:root[data-theme="dark"] body.v2 {
  --azul:   #9CC0FF;
  --botao:  #2F6BFF;
  --botao-h:#1F55E0;
  --verde:  #4FD1A5;
  --azul2:  #6B9BFF;
  --cinza:  #0B1626;
  --fundo:  #0B1626;
  --card:   #12233B;
  --borda:  #22364F;
  --borda-in:#2E4663;
  --texto:  #E4EAF2;
  --titulo: #F1F5FA;
  --sub:    #9FB1C6;
  --muted:  #8396AD;
  --campo:  #0F1D31;
  --seg:    #0F1D31;
  --linha:  #1A2D47;
  --sombra: 0 1px 2px rgba(0,0,0,.35);
  --sombra2: 0 20px 48px rgba(0,0,0,.5);
  --ok-bg:rgba(16,185,129,.14);  --ok-texto:#4FD1A5;  --ok-borda:rgba(16,185,129,.35);
  --aviso-bg:rgba(245,158,11,.14); --aviso-texto:#FBBF24; --aviso-borda:rgba(245,158,11,.35);
  --erro-bg:rgba(239,68,68,.14); --erro-texto:#F87171; --erro-borda:rgba(239,68,68,.35);
  --info-bg:rgba(47,107,255,.16); --info-texto:#9CC0FF;
}

/* Fonte: os inline antigos fixavam Plus Jakarta Sans em dezenas de controles */
body.v2 [style*="Plus Jakarta"],
body.v2 button, body.v2 input, body.v2 select, body.v2 textarea, body.v2 .nav-item {
  font-family: inherit !important;
}
body.v2 h1, body.v2 h2 { font-family: 'Source Serif 4', Georgia, serif; }

/* Foco visível padrão */
body.v2 input:focus, body.v2 select:focus, body.v2 textarea:focus {
  outline: 3px solid rgba(47,107,255,.25);
  outline-offset: 0;
  border-color: var(--azul2) !important;
}
body.v2 input, body.v2 select, body.v2 textarea { border-color: var(--borda-in); border-radius: 6px; }

/* Botões padrão do sistema → navy (o verde saiu da ação principal) */
body.v2 .btn-success, body.v2 .btn-navy {
  background: var(--botao); color: #fff; border: 0; border-radius: 6px;
  font-weight: 500; transition: background .15s;
}
body.v2 .btn-success:hover, body.v2 .btn-navy:hover { background: var(--botao-h); opacity: 1; }

/* ============================================================
   LOGIN
   ============================================================ */
body.v2-login { background: var(--card); }
.lg-wrap { min-height: 100vh; display: flex; background: var(--card); }

.lg-hero {
  flex: 0 0 52%; position: relative; overflow: hidden; box-sizing: border-box;
  background: #0B1A2E; color: #fff; padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.lg-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lg-brand { position: relative; display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.lg-brand span { font-family: 'Source Serif 4', Georgia, serif; font-weight: 600; font-size: 22px; color: #fff; }
.lg-logo { display: block; height: 150px; width: auto; margin: -12px 0 0 -10px; }
.lg-hero-body { position: relative; max-width: 480px; }
.lg-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #4FD1A5; margin-bottom: 20px; }
.lg-headline { font-family: 'Source Serif 4', Georgia, serif; font-weight: 500; font-size: 44px; line-height: 1.12; letter-spacing: -.02em; }
.lg-points { margin-top: 36px; display: flex; flex-direction: column; gap: 20px; }
.lg-point { display: flex; gap: 16px; align-items: flex-start; }
.lg-point-ico {
  flex: 0 0 40px; height: 40px; border: 1px solid #2A4A74; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; background: rgba(47,107,255,.12);
}
.lg-point strong { display: block; font-size: 15px; font-weight: 600; }
.lg-point span { display: block; font-size: 14px; color: #9FB1C6; line-height: 1.55; }
.lg-foot { position: relative; font-size: 13px; color: #7F93AB; }

.lg-main {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 48px 24px; box-sizing: border-box; background: var(--cinza);
}
body.v2-login .form-card {
  width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--borda);
  border-radius: 12px; padding: 44px 40px; box-shadow: var(--sombra2);
}
body.v2-login .lg-title { margin: 0 0 8px; font-family: 'Source Serif 4', Georgia, serif; font-weight: 500; font-size: 30px; letter-spacing: -.01em; color: var(--titulo); text-align: left; }
body.v2-login .lg-sub { margin: 0 0 28px; font-size: 15px; color: var(--sub); }

body.v2-login .tipo-toggle {
  display: flex; gap: 4px; padding: 4px; background: var(--seg);
  border: 0; border-radius: 8px; margin-bottom: 24px; overflow: visible;
}
body.v2-login .tipo-btn {
  flex: 1; min-height: 42px; border: 0; border-radius: 6px; background: transparent;
  color: var(--sub); font-size: 14px; font-weight: 500; cursor: pointer; padding: 0;
}
body.v2-login .tipo-btn.active { background: var(--card); color: var(--titulo); box-shadow: 0 1px 3px rgba(15,31,51,.15); }

body.v2-login .form-group { margin-bottom: 18px; }
body.v2-login .form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--titulo); margin-bottom: 8px; }
body.v2-login .form-group input {
  width: 100%; box-sizing: border-box; min-height: 50px; padding: 0 16px;
  border: 1px solid var(--borda-in); border-radius: 6px; font-size: 15px;
  color: var(--texto); background: var(--card);
}
.lg-senha-wrap { position: relative; }
.lg-senha-wrap input { padding-right: 84px !important; }
.lg-senha-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 38px;
  padding: 0 12px; border: 0; background: transparent; color: var(--azul2);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.lg-link { font-size: 13px; font-weight: 500; color: var(--azul); text-decoration: none; }
.lg-link:hover { color: var(--ok-texto); }
.lg-row-end { display: flex; justify-content: flex-end; margin-top: 10px; }

body.v2-login .btn-full {
  width: 100%; min-height: 52px; font-size: 15px; box-shadow: 0 6px 16px rgba(18,41,74,.25);
}
body.v2-login #btn-confirmar-2fa { margin-top: 4px; }
body.v2-login .lg-reenviar {
  background: none; border: 0; color: var(--azul2); cursor: pointer; font-size: 14px; text-decoration: underline;
}

.lg-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; min-height: 46px;
  border: 1px solid var(--borda-in); border-radius: 6px; background: var(--card); color: var(--texto);
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.lg-google:hover { border-color: var(--azul2); }
.lg-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 20px; font-size: 12px; color: var(--muted); }
.lg-divider::before, .lg-divider::after { content: ""; flex: 1; height: 1px; background: var(--borda); }
.lg-cadastros { display: flex; gap: 12px; flex-wrap: wrap; }
.lg-cadastros a {
  flex: 1 1 150px; box-sizing: border-box; min-height: 46px; display: flex; align-items: center;
  justify-content: center; border: 1px solid var(--borda-in); border-radius: 6px;
  font-size: 14px; font-weight: 500; color: var(--azul); text-decoration: none;
}
.lg-cadastros a:hover { border-color: var(--azul2); color: var(--azul2); }
.lg-voltar { text-align: center; margin-top: 20px; font-size: 13px; }

@media (max-width: 960px) { .lg-hero { display: none; } }
@media (max-width: 480px) { body.v2-login .form-card { padding: 32px 22px; } }

/* ============================================================
   DASHBOARD — layout
   ============================================================ */
@media (min-width: 769px) {
  body.v2 .dash-layout { grid-template-columns: 256px 1fr; }
  /* sidebar fixa na altura da tela: o cartão do plano fica sempre visível na base */
  body.v2 .sidebar { position: sticky; top: 0; height: 100vh; align-self: start; }
}
body.v2 .dash-main { background: var(--cinza); }
body.v2 .dash-content { padding: 32px 40px 48px; }
@media (max-width: 768px) { body.v2 .dash-content { padding: 20px 16px 40px; } }

/* Sidebar */
body.v2 .sidebar { background: var(--marca); }
body.v2 .sidebar-logo {
  order: 1; padding: 14px 24px 4px; border-bottom: 0; display: flex; align-items: center; justify-content: center;
}
body.v2 .sb-logo-img { display: block; height: 92px; width: auto; max-width: 100%; }
body.v2 .sidebar-logo a { display: flex; align-items: center; gap: 12px; text-decoration: none; }
body.v2 .sidebar-nav { order: 2; padding: 0 0 16px; overflow-y: auto; }
body.v2 .sidebar-label {
  padding: 22px 24px 8px; font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: #6F86A3;
}
body.v2 .nav-item {
  width: auto; margin: 2px 12px; padding: 0 12px; min-height: 42px; gap: 12px;
  font-size: 14px; font-weight: 400; color: #A9BBD0; border-radius: 6px;
  display: flex; align-items: center;
}
body.v2 .nav-item:hover { background: #17335A; color: #fff; }
body.v2 .nav-item.active { background: #1B3C6B; color: #fff; font-weight: 500; box-shadow: inset 3px 0 0 #4FD1A5; }
body.v2 .nav-item svg { flex: 0 0 18px; }
body.v2 .nav-item.nav-sair { color: #F0A3A3; }
body.v2 .nav-item.nav-sair:hover { background: #3A1F2A; color: #FFC9C9; }
/* Topbar */
body.v2 .dash-topbar {
  height: 76px; padding: 0 40px; background: var(--card); border-bottom: 1px solid var(--borda);
  box-sizing: border-box; gap: 20px;
}
@media (max-width: 768px) { body.v2 .dash-topbar { padding: 0 16px; } }
body.v2 .dash-topbar h1 { font-family: 'Source Serif 4', Georgia, serif; font-weight: 500; font-size: 24px; letter-spacing: -.01em; color: var(--titulo); line-height: 1.15; }
body.v2 .dash-topbar p { font-size: 13px; color: var(--sub); }
.tb-right { display: flex; align-items: center; gap: 16px; }
.tb-icon-btn {
  position: relative; width: 42px; height: 42px; border: 1px solid var(--borda); border-radius: 8px;
  background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
  color: var(--sub);
}
.tb-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--botao); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex: 0 0 42px;
}

/* ============================================================
   DASHBOARD — componentes
   ============================================================ */
body.v2 .metrics { gap: 20px; margin-bottom: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
body.v2 .metric-card {
  background: var(--card); border: 1px solid var(--borda); border-radius: 10px; padding: 24px; box-shadow: var(--sombra);
}
body.v2 .metric-label { font-size: 13px; font-weight: 400; color: var(--sub); text-transform: none; letter-spacing: 0; margin-bottom: 14px; }
body.v2 .metric-value { font-size: 32px; font-weight: 600; color: var(--titulo); letter-spacing: -.02em; line-height: 1; }
body.v2 .metric-sub { font-size: 12px; color: var(--muted); margin-top: 12px; }

body.v2 .table-card, body.v2 .perfil-card {
  background: var(--card); border: 1px solid var(--borda); border-radius: 10px; box-shadow: var(--sombra);
}
body.v2 .table-header { padding: 20px 24px; border-bottom: 1px solid var(--borda); }
body.v2 .table-header h3, body.v2 .perfil-card h3 { font-size: 15px; font-weight: 600; color: var(--titulo); }
body.v2 th {
  font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted);
  background: var(--campo); border-bottom: 1px solid var(--borda); padding: 12px 24px;
}
body.v2 td { font-size: 14px; padding: 14px 24px; border-bottom: 1px solid var(--linha); color: var(--texto); }
body.v2 tr:hover td { background: var(--campo); }

body.v2 .graficos-grid { gap: 20px; margin-bottom: 24px; }
body.v2 .grafico-card { padding-bottom: 8px; }

/* Cabeçalho da página inicial + seletor de período */
.pg-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.pg-head h2 { margin: 0 0 6px; font-weight: 500; font-size: 30px; letter-spacing: -.01em; color: var(--titulo); }
.pg-head p { font-size: 14px; color: var(--sub); }
.seg-periodo { display: flex; gap: 4px; padding: 4px; background: var(--seg); border-radius: 8px; }
.seg-periodo button {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent;
  color: var(--sub); font-size: 13px; font-weight: 500; cursor: pointer;
}
.seg-periodo button.on { background: var(--card); color: var(--titulo); box-shadow: 0 1px 3px rgba(15,31,51,.15); }

/* pills de status da tabela "consultas recentes" */
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; display: inline-block; }
.pill.ok { color: var(--ok-texto); background: var(--ok-bg); }
.pill.aviso { color: var(--aviso-texto); background: var(--aviso-bg); }
.pill.erro { color: var(--erro-texto); background: var(--erro-bg); }
.pill.info { color: var(--info-texto); background: var(--info-bg); }
.placa-mono { font-family: ui-monospace, Consolas, monospace; font-weight: 600; letter-spacing: .06em; }
.link-acao { font-size: 13px; font-weight: 500; color: var(--azul2); text-decoration: none; cursor: pointer; background: none; border: 0; }

/* Sino */
body.v2 #btn-notificacoes { border: 1px solid var(--borda); border-radius: 8px; background: var(--card); width: 42px; height: 42px; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--sub); }
body.v2 #badge-notificacoes { top: -6px; right: -6px; }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
  body.v2 .metrics { grid-template-columns: 1fr 1fr; gap: 14px; }
  body.v2 .metric-card { padding: 18px; }
  body.v2 .metric-value { font-size: 26px; }
  body.v2 .dash-topbar h1 { font-size: 20px; }
  body.v2 .dash-topbar p { display: none; }
  .tb-right { gap: 10px; }
  .tb-icon-btn, .tb-avatar { width: 38px; height: 38px; flex-basis: 38px; }
  body.v2 #btn-notificacoes { width: 38px; height: 38px; }
  body.v2 .dash-topbar { min-width: 0; }
  .pg-head { justify-content: stretch !important; }
  .seg-periodo { width: 100%; }
  .seg-periodo button { flex: 1; }
}
@media (max-width: 480px) {
  body.v2 .metrics { grid-template-columns: 1fr; }
}
