/**
 * PDV web - Sistema de design v2 (COMPONENTES GLOBAIS)
 *
 * Copia ENXUTA do painel (pague_azul_system/assets/css/v2/painel.css), so com o
 * que o PDV usa, mais o ajuste de BALCAO (alvos de toque maiores, valores
 * grandes e legiveis, 360px ate desktop sem rolagem horizontal).
 * Carregado POR ULTIMO no <head> (depois de style.css e modal-padrao.css): vence
 * o legado no empate. Tudo por token (v2/tokens.css): nenhuma cor literal aqui,
 * exceto branco/preto puros em impressao.
 *
 * Documentacao: .claude/context/knowledge/modules/pdv_design_v2.md
 *
 * Indice
 *  0. Ponte com as variaveis legadas (style.css)
 *  1. Base
 *  2. Layout: sidebar, marca, navegacao, topbar, conteudo
 *  3. Cabecalho de pagina, secoes, cartoes, KPIs, estado vazio
 *  4. Botoes
 *  5. Formularios
 *  6. Selos, alertas, utilitarios de texto
 *  7. Tabelas
 *  8. Modais (.pa-modal) e Modal.alert/confirm do app.js
 *  9. Toast, carregando
 * 10. Estados interativos, acoes de linha, foco, autocomplete, campos nativos
 * 11. Login e selecao de loja
 * 12. Responsivo
 * 13. Impressao
 */

/* ==================== 0. PONTE COM AS VARIAVEIS LEGADAS ==================== */
:root,
html[data-tema="escuro"] {
  --cor-primaria: var(--v2-primaria);
  --cor-primaria-escura: var(--v2-primaria-forte);
  --cor-primaria-media: var(--v2-primaria);
  --cor-primaria-clara: var(--v2-primaria-tint);
  --cor-primaria-bg: var(--v2-primaria-tint);
  --cor-destaque: var(--v2-primaria);
  --cor-destaque-escura: var(--v2-primaria-forte);

  --cor-sucesso: var(--v2-sucesso-solido);
  --cor-sucesso-bg: var(--v2-sucesso-tint);
  --cor-erro: var(--v2-erro-solido);
  --cor-erro-bg: var(--v2-erro-tint);
  --cor-alerta: var(--v2-alerta-solido);
  --cor-alerta-bg: var(--v2-alerta-tint);
  --cor-info: var(--v2-primaria);
  --cor-info-bg: var(--v2-info-tint);

  --cor-branco: var(--v2-superficie);
  --cor-cinza-claro: var(--v2-superficie-2);
  --cor-cinza-medio: var(--v2-campo-borda);
  --cor-cinza-escuro: var(--v2-texto-suave);
  --cor-texto: var(--v2-texto);
  --cor-texto-claro: var(--v2-texto-suave);

  --borda-radius-sm: var(--v2-r-xs);
  --borda-radius-md: var(--v2-r-sm);
  --borda-radius-lg: var(--v2-r-md);
  --sombra-sm: none;
  --sombra-md: var(--v2-sombra-1);
  --sombra-lg: var(--v2-sombra-3);
  --transicao-rapida: 0.15s ease;
  --transicao-normal: 0.2s ease;
  --sidebar-width: var(--v2-sidebar-largura);
}

/* ==================== 1. BASE ==================== */
html {
  background: var(--v2-fundo);
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}
body {
  font-family: var(--v2-fonte);
  font-size: var(--v2-t-md);
  line-height: 1.5;
  background: var(--v2-fundo);
  color: var(--v2-texto);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
input, select, textarea, button { font-family: inherit; }
h1, h2, h3, h4, h5, h6 { color: var(--v2-texto-forte); font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--v2-primaria-forte); }
a:hover { color: var(--v2-primaria-forte); }
::selection { background: var(--v2-primaria-tint); color: var(--v2-texto-forte); }
hr { border: 0; border-top: 1px solid var(--v2-borda); }

.fas, .far, .fab, .fa { -webkit-font-smoothing: antialiased; }

* { scrollbar-width: thin; scrollbar-color: var(--v2-borda-forte) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--v2-borda-forte); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 2. LAYOUT ==================== */
.dashboard-container { background: var(--v2-fundo); }

/* Icones de traco (modulos/dashboard/components/icones.php: sidebar e topbar) */
.pa-ico {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item .pa-ico { width: 18px; height: 18px; color: var(--v2-texto-suave); }
.nav-item:hover .pa-ico { color: var(--v2-texto); }
.nav-item.active .pa-ico { color: var(--v2-primaria); }
.btn-toggle-sidebar .pa-ico { width: 20px; height: 20px; }
.btn-logout .pa-ico { width: 17px; height: 17px; }
.pa-sidebar-contexto .pa-ico,
.topbar-cidade .pa-ico { width: 15px; height: 15px; color: var(--v2-texto-suave); }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--v2-sidebar-largura);
  background: var(--v2-sidebar);
  color: var(--v2-texto);
  border-right: 1px solid var(--v2-borda);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.22s var(--v2-ease);
}
.sidebar-header {
  background: transparent;
  border-bottom: 0;
  padding: 16px 16px 8px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--v2-topbar-altura);
}

/* Marca (selo do logo + nome + slogan).
   SELO VIVO (2026-10-13, pedido do dono): UNICA definicao do selo neste app - casca (menu) e login
   usam esta regra; os outros arquivos so mudam tamanho. Cor = --pa-logo-cor (padrao azul de marca
   #2563EB -> #1D4ED8; a cor da cidade entra pelo tema.php, versao com branco 4.5:1). Degrade curto,
   brilho de topo e sombra curta; a MESMA cor nos dois temas (no escuro o azul nao lava). */
.pa-marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pa-marca-logo,
.logo-sidebar,
.login-logo {
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 52%, rgba(0, 0, 0, 0.12) 100%),
    linear-gradient(145deg, var(--pa-logo-cor, #2563EB) 0%, var(--pa-logo-cor-funda, #1D4ED8) 100%);
  color: #FFFFFF;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    0 1px 2px rgba(15, 23, 42, 0.22),
    0 3px 8px -3px color-mix(in srgb, var(--pa-logo-cor, #2563EB) 70%, transparent);
  transform: none;
  overflow: hidden;
}
html[data-tema="escuro"] .pa-marca-logo,
html[data-tema="escuro"] .logo-sidebar,
html[data-tema="escuro"] .login-logo {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 3px 10px -3px color-mix(in srgb, var(--pa-logo-cor, #2563EB) 60%, transparent);
}
.logo-sidebar:hover { transform: none; }
.pa-marca-inicial,
.logo-sidebar-icon,
.login-logo-text {
  font-family: var(--v2-fonte);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  color: #FFFFFF;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
  letter-spacing: -0.02em;
}
.pa-marca-logo img,
.logo-sidebar img { width: 100%; height: 100%; object-fit: contain; max-height: none !important; background: var(--v2-elevada); }
.pa-marca-logo.tem-imagem,
html[data-tema="escuro"] .pa-marca-logo.tem-imagem,
.pa-marca-logo:has(img),
.login-logo:has(img) { background: var(--v2-elevada); border: 1px solid var(--v2-borda); box-shadow: none; }
.pa-marca-texto { min-width: 0; display: flex; flex-direction: column; }
.pa-marca-nome,
.sidebar-header h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--v2-texto-forte);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pa-marca-slogan,
.sidebar-header p {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--v2-texto-suave);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Contexto: loja + cidade da sessao */
.pa-sidebar-contexto {
  margin: 4px 12px 4px;
  padding: 10px 12px;
  border-radius: var(--v2-r-sm);
  background: var(--v2-superficie);
  border: 1px solid var(--v2-borda);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--v2-texto);
  min-width: 0;
}
.pa-sidebar-contexto-linha { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pa-sidebar-contexto-linha span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pa-sidebar-contexto-linha.pa-secundaria span { font-weight: 400; color: var(--v2-texto-suave); }

/* Navegacao (alvos de toque de 40px: balcao/tablet) */
.sidebar-nav { padding: 8px 8px 16px; flex: 1; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  margin: 2px 0;
  border-radius: var(--v2-r-sm);
  border-left: 0;
  color: var(--v2-texto-suave);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav-item span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover {
  background: var(--v2-hover);
  color: var(--v2-texto-forte);
}
.nav-item.active {
  background: var(--v2-ativo);
  color: var(--v2-texto-forte);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--v2-primaria);
}
.sidebar-footer { padding: 8px 8px 16px; border-top: 1px solid var(--v2-borda); }
.sidebar-footer .logout-item { color: var(--v2-texto-suave); }
.sidebar-footer .logout-item:hover { background: var(--v2-erro-tint); color: var(--v2-erro-texto); }
.sidebar-footer .logout-item:hover .pa-ico { color: var(--v2-erro-texto); }

.sidebar-overlay { background: var(--v2-overlay); }

/* ---- Area principal ---- */
.main-content {
  margin-left: var(--v2-sidebar-largura);
  max-width: calc(100% - var(--v2-sidebar-largura));
  background: var(--v2-fundo);
  transition: margin-left 0.22s var(--v2-ease);
}
.main-content.expanded { margin-left: 0; max-width: 100%; }

/* ---- Topbar ---- */
.topbar {
  height: var(--v2-topbar-altura);
  padding: 0 24px 0 16px;
  background: var(--v2-fundo);
  border-bottom: 1px solid var(--v2-borda);
  box-shadow: none;
  gap: 16px;
  z-index: 900;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar {
    background: color-mix(in srgb, var(--v2-fundo) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
  }
}
.topbar-left { gap: 10px; min-width: 0; }
.btn-toggle-sidebar,
.pa-btn-icone {
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--v2-r-sm);
  background: transparent;
  color: var(--v2-texto-suave);
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.btn-toggle-sidebar:hover,
.pa-btn-icone:hover { background: var(--v2-neutro); color: var(--v2-texto-forte); }
.pa-btn-icone svg { width: 19px; height: 19px; }
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--v2-texto-forte);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { gap: 8px; min-width: 0; }

/* Loja | cidade (so leitura) */
.topbar .topbar-cidade {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--v2-superficie);
  border: 1px solid var(--v2-borda-forte);
  border-radius: var(--v2-r-sm);
  color: var(--v2-texto);
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
  max-width: 360px;
}
.topbar .topbar-cidade span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .topbar-cidade .pa-sep { width: 1px; height: 14px; background: var(--v2-borda-forte); flex: none; }
.topbar .topbar-cidade .pa-cidade { color: var(--v2-texto-suave); font-weight: 400; }

.topbar-separator { width: 1px; height: 20px; margin: 0 4px; background: var(--v2-borda-forte); flex: none; }

/* Usuario: avatar + nome/perfil */
.pa-usuario { display: flex; align-items: center; gap: 10px; padding-left: 4px; min-width: 0; }
.pa-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--v2-superficie);
  border: 1px solid var(--v2-borda-forte);
  color: var(--v2-texto);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.user-info { text-align: left; line-height: 1.25; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--v2-texto-forte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.user-role { font-size: 12px; color: var(--v2-texto-suave); white-space: nowrap; }

/* Botao de tema (sol/lua) */
.pa-tema-btn .pa-tema-sol { display: none; }
html[data-tema="escuro"] .pa-tema-btn .pa-tema-sol { display: block; }
html[data-tema="escuro"] .pa-tema-btn .pa-tema-lua { display: none; }

/* Sair: botao fantasma discreto */
.btn-logout {
  height: 40px;
  padding: 0 12px;
  gap: 6px;
  border-radius: var(--v2-r-sm);
  background: transparent;
  color: var(--v2-texto-suave);
  border: 0;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;   /* legado tinha "all": atrasava o anel de foco */
}
.btn-logout:hover { background: var(--v2-neutro); color: var(--v2-texto-forte); }

/* ---- Conteudo ---- */
.content-area { padding: 28px 32px 48px; overflow-x: visible; }

/* ==================== 3. CABECALHO, SECOES, CARTOES, KPIs ==================== */
.page-header { margin-bottom: 24px; gap: 16px; align-items: flex-end; }
.page-header h1 {
  font-size: var(--v2-t-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--v2-texto-forte);
}
.page-header p { margin-top: 4px; font-size: var(--v2-t-md); color: var(--v2-texto-suave); }
/* Padrao v2: titulo de pagina so com texto */
.page-header h1 > i.fas, .page-header h1 > i.fa { display: none; }
.page-actions { gap: 8px; flex-wrap: wrap; align-items: center; }

.content-section,
.card,
.table-container,
.table-responsive,
.stat-card {
  background: var(--v2-superficie);
  border: 1px solid var(--v2-borda);
  border-radius: var(--v2-r-md);
  box-shadow: var(--v2-sombra-1);
}
.content-section { padding: 20px 24px; margin-bottom: 16px; }
.card { padding: 0; }
.card:hover,
.stat-card:hover { transform: none; box-shadow: var(--v2-sombra-1); }
.card-header {
  padding: 14px 20px;
  margin: 0;
  border-bottom: 1px solid var(--v2-borda);
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--v2-texto-forte); display: flex; align-items: center; gap: 8px; }
.card-header h3 > i { color: var(--v2-texto-suave); font-size: 14px; }
.card-body { padding: 16px 20px; }
.card-title { color: var(--v2-texto-forte); font-size: 15px; }

/* Tabela dentro de cartao: sem moldura dupla */
.content-section .table-container,
.card .table-responsive {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--v2-texto-forte);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--v2-borda);
  gap: 8px;
  flex-wrap: wrap;
}
.section-title i { color: var(--v2-texto-suave); font-size: 14px; }

/* KPIs: valor grande e legivel (balcao) */
.stats-grid { gap: 16px; margin-bottom: 16px; }
.stat-card { padding: 16px 18px; gap: 14px; align-items: center; min-width: 0; }
.stat-card .stat-icon,
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--v2-r-sm);
  font-size: 16px;
  background: var(--v2-neutro);
  color: var(--v2-texto);
}
.stat-icon.blue   { background: var(--v2-info-tint);    color: var(--v2-info-texto); }
.stat-icon.green  { background: var(--v2-sucesso-tint); color: var(--v2-sucesso-texto); }
.stat-icon.orange { background: var(--v2-alerta-tint);  color: var(--v2-alerta-texto); }
.stat-icon.red    { background: var(--v2-erro-tint);    color: var(--v2-erro-texto); }
.stat-icon.purple { background: var(--v2-violeta-tint); color: var(--v2-violeta-texto); }
.stat-info { min-width: 0; }
.stat-card .stat-info .stat-value,
.stat-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--v2-texto-forte);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.stat-card .stat-info .stat-label,
.stat-label { font-size: 13px; text-transform: none; color: var(--v2-texto-suave); }
.stat-detalhe { display: block; font-size: 12px; color: var(--v2-texto-suave); margin-top: 2px; }
.stat-value .loading-spinner { width: 22px; height: 22px; border-width: 2px; margin: 3px 0; }

/* Estado vazio */
.pa-vazio,
.historico-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--v2-texto-suave);
  font-size: 14px;
}
.pa-vazio i,
.historico-empty i { display: block; font-size: 28px; margin: 0 auto 10px; color: var(--v2-texto-suave); opacity: 1; }

/* ==================== 4. BOTOES (balcao: 40px; grande 48px) ==================== */
.btn {
  height: 40px;
  padding: 0 16px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--v2-r-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover:not(:disabled) { transform: none !important; box-shadow: none; }
.btn:disabled { opacity: 0.5; }
.btn i { font-size: 13px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; font-weight: 600; }
.btn-lg i { font-size: 15px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--v2-primaria); color: var(--v2-sobre-primaria); }
.btn-primary:hover:not(:disabled) { background: var(--v2-primaria-forte); color: var(--v2-sobre-primaria); }

.btn-secondary {
  background: var(--v2-superficie);
  color: var(--v2-texto);
  border-color: var(--v2-borda-forte);
}
.btn-secondary:hover:not(:disabled) { background: var(--v2-superficie-2); color: var(--v2-texto-forte); border-color: var(--v2-controle); }

.btn-success { background: var(--v2-sucesso-solido); color: var(--v2-sobre-estado); }
.btn-success:hover:not(:disabled) { background: var(--v2-sucesso-solido); filter: brightness(0.94); }
.btn-danger { background: var(--v2-erro-solido); color: var(--v2-sobre-estado); }
.btn-danger:hover:not(:disabled) { background: var(--v2-erro-solido); filter: brightness(0.94); }
.btn-warning { background: var(--v2-alerta-solido); color: var(--v2-sobre-estado); }
.btn-warning:hover:not(:disabled) { background: var(--v2-alerta-solido); filter: brightness(0.94); }
.btn-info { background: var(--v2-info-tint); color: var(--v2-info-texto); }
.btn-info:hover:not(:disabled) { background: var(--v2-info-tint); color: var(--v2-info-texto); box-shadow: inset 0 0 0 1px currentColor; }

.btn-outline { background: transparent; color: var(--v2-primaria-forte); border: 1px solid var(--v2-borda-forte); }
.btn-outline:hover:not(:disabled) { background: var(--v2-primaria-tint); color: var(--v2-primaria-forte); border-color: var(--v2-primaria); }

/* Hierarquia: a acao principal no cabecalho/rodape de modal segue o acento */
.page-actions .btn-success,
.pa-modal-footer .btn-success { background: var(--v2-primaria); color: var(--v2-sobre-primaria); }

/* icone dentro de botao: cor do texto do botao */
html .btn > i, html .btn > .fas, html .btn > .fa { color: inherit; }

/* ==================== 5. FORMULARIOS (balcao: 44px) ==================== */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], input[type="time"], input[type="url"],
select, textarea,
:where(input[type="search"], .form-control) {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--v2-controle);       /* borda de controle 3:1 (WCAG 1.4.11) */
  border-radius: var(--v2-r-sm);
  background-color: var(--v2-campo);
  color: var(--v2-texto);
  font-size: 15px;
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { min-height: 80px; }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--v2-texto-suave); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--v2-primaria);
  box-shadow: 0 0 0 3px var(--v2-anel);
}
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] {
  background-color: var(--v2-campo-desab);
  color: var(--v2-texto);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--v2-primaria); }

label { font-size: 13.5px; font-weight: 500; color: var(--v2-texto); margin-bottom: 6px; }
label > i.fas { color: var(--v2-texto-suave); font-size: 12.5px; width: 16px; text-align: center; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; }
small.text-muted { display: block; margin-top: 6px; font-size: 12.5px; }
.form-grid { gap: 4px 20px; }

/* Barra de acoes de formulario (os modulos ajustam no proprio <style>) */
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* Valor monetario em campo: grande, alinhado a direita, numeros tabulares */
.input-valor { font-variant-numeric: tabular-nums; }

/* ==================== 6. SELOS, ALERTAS, TEXTO ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--v2-r-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  background: var(--v2-neutro);
  color: var(--v2-texto);
  white-space: nowrap;
}
.badge-success { background: var(--v2-sucesso-tint) !important; color: var(--v2-sucesso-texto) !important; }
.badge-error, .badge-danger { background: var(--v2-erro-tint) !important; color: var(--v2-erro-texto) !important; }
.badge-warning { background: var(--v2-alerta-tint) !important; color: var(--v2-alerta-texto) !important; }
.badge-info, .badge-primary { background: var(--v2-info-tint) !important; color: var(--v2-info-texto) !important; }
.badge-neutral, .badge-secondary { background: var(--v2-neutro) !important; color: var(--v2-texto) !important; }
.badge-success::before, .badge-error::before, .badge-danger::before, .badge-warning::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--v2-r-sm);
  border: 1px solid var(--v2-borda);
  border-left-width: 1px;
  font-size: 14px;
  gap: 10px;
  background: var(--v2-superficie);
  color: var(--v2-texto);
}
.alert-success { background: var(--v2-sucesso-tint); color: var(--v2-sucesso-texto); border-color: transparent; }
.alert-error, .alert-danger { background: var(--v2-erro-tint); color: var(--v2-erro-texto); border-color: transparent; }
.alert-warning { background: var(--v2-alerta-tint); color: var(--v2-alerta-texto); border-color: transparent; }
.alert-info { background: var(--v2-info-tint); color: var(--v2-info-texto); border-color: transparent; }
.alert strong { color: inherit; }

.text-success { color: var(--v2-sucesso-texto) !important; }
.text-error, .text-danger { color: var(--v2-erro-texto) !important; }
.text-warning { color: var(--v2-alerta-texto) !important; }
.text-info { color: var(--v2-info-texto) !important; }
.text-muted { color: var(--v2-texto-suave) !important; }

/* ==================== 7. TABELAS ==================== */
.table-container, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
html .table { color: var(--v2-texto); border-collapse: collapse; font-size: 14px; }
html .table > thead > tr > th {
  background: transparent;
  color: var(--v2-texto-suave);
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid var(--v2-borda-forte);
  padding: 10px 14px;
  white-space: nowrap;
}
html .table > tbody > tr > td {
  border-bottom: 1px solid var(--v2-borda);
  background: transparent;
  color: var(--v2-texto);
  padding: 12px 14px;
  font-variant-numeric: tabular-nums;
}
html .table tbody tr:hover > td { background: var(--v2-hover); }
html .table tbody tr:last-child td { border-bottom: 0; }
html .table td strong { color: var(--v2-texto-forte); font-weight: 600; }
html .table td.text-center { padding: 28px 14px; }

/* ==================== 8. MODAIS ==================== */
.pa-modal,
.modal-overlay {
  background: var(--v2-overlay);
  padding: 24px;
}
.pa-modal-box {
  background: var(--v2-elevada);
  color: var(--v2-texto);
  border: 0;
  border-radius: var(--v2-r-lg);
  box-shadow: var(--v2-sombra-3);
  overflow: hidden;
}
.pa-modal-header {
  background: var(--v2-elevada);
  color: var(--v2-texto-forte);
  padding: 14px 16px 14px 24px;
  border-bottom: 1px solid var(--v2-borda);
  border-radius: 0;
  min-height: 60px;
}
.pa-modal-header h1, .pa-modal-header h2, .pa-modal-header h3, .pa-modal-header h4 {
  color: var(--v2-texto-forte);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  gap: 10px;
}
.pa-modal-header h3 > i { color: var(--v2-texto-suave); font-size: 14px; }
.pa-modal-close {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: var(--v2-r-sm);
  background: transparent;
  color: var(--v2-texto-suave);
  font-size: 24px;
  line-height: 1;
  opacity: 1;
  flex: none;
}
.pa-modal-close:hover { background: var(--v2-neutro); color: var(--v2-texto-forte); }
.pa-modal-body {
  background: var(--v2-elevada);
  color: var(--v2-texto);
  padding: 22px 24px;
}
.pa-modal-body > p { margin-bottom: 16px; }
.pa-modal-footer {
  background: var(--v2-elevada);
  border-top: 1px solid var(--v2-borda);
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
  flex-wrap: wrap;
}
/* Modal.alert / Modal.confirm (app.js): texto centralizado vira texto de corpo */
.pa-modal-sm .pa-modal-body > div[style*="text-align: center"] { color: var(--v2-texto); }

/* ==================== 9. TOAST, CARREGANDO ==================== */
.toast-container { top: 16px; right: 16px; gap: 8px; z-index: 9999; }
.toast-container > .toast {
  background: var(--v2-elevada);
  color: var(--v2-texto);
  border: 0;
  border-radius: var(--v2-r-md);
  box-shadow: var(--v2-sombra-3);
  padding: 12px 16px 12px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 380px;
  min-width: 260px;
  align-items: flex-start;
}
.toast-container > .toast > i { font-size: 17px; margin-top: 1px; flex: none; color: var(--v2-info-texto); }
.toast-container > .toast-success > i { color: var(--v2-sucesso-texto); }
.toast-container > .toast-error > i { color: var(--v2-erro-texto); }
.toast-container > .toast-warning > i { color: var(--v2-alerta-texto); }

.loading { border-color: var(--v2-borda-forte); border-top-color: var(--v2-primaria); width: 18px; height: 18px; vertical-align: middle; }
.loading-overlay { background: color-mix(in srgb, var(--v2-fundo) 70%, transparent); }
.loading-spinner { border-color: var(--v2-borda-forte); border-top-color: var(--v2-primaria); width: 32px; height: 32px; border-width: 3px; }
.btn .loading { border-color: color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor; width: 16px; height: 16px; }

/* ==================== 10. ESTADOS INTERATIVOS ==================== */
/* Regras do painel (fase 3): hover/ativo/selecionado SEMPRE por token; acao de linha = botao
   NEUTRO com icone na cor do texto, cor da acao so no hover; foco sempre visivel. */
html :is(td, .pa-acoes-linha) :is(.btn, .btn-icon) {
  background: transparent !important;
  color: var(--v2-texto-suave) !important;
  border: 1px solid var(--v2-borda-forte) !important;
  box-shadow: none !important;
  filter: none !important;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
}
html :is(td, .pa-acoes-linha) :is(.btn, .btn-icon) i { color: inherit !important; }
html :is(td, .pa-acoes-linha) :is(.btn, .btn-icon):is(:hover, :active):not(:disabled) {
  background: var(--v2-elevada) !important;
  border-color: var(--v2-controle) !important;
  color: var(--v2-primaria-forte) !important;
}
html :is(td, .pa-acoes-linha) :is(.btn-danger, :has(> .fa-trash, > .fa-times, > .fa-lock)):is(:hover, :active):not(:disabled) {
  color: var(--v2-erro-texto) !important;
}

/* Foco visivel em tudo que e clicavel */
html :is(a, button, summary, [role="button"], [tabindex]:not([tabindex="-1"]), .btn, .nav-item):focus-visible,
html :is(input[type="checkbox"], input[type="radio"]):focus-visible {
  outline: 2px solid var(--v2-primaria) !important;
  outline-offset: 2px !important;
}
html :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea):focus {
  border-color: var(--v2-primaria) !important;
  box-shadow: 0 0 0 3px var(--v2-anel) !important;
  outline: none;
}

/* Autocomplete (venda_ticket e recarga): lista elevada, hover por token */
html :is(.autocomplete-dropdown, .autocomplete-results) {
  background: var(--v2-elevada);
  color: var(--v2-texto);
  border: 1px solid var(--v2-borda-forte);
  border-radius: var(--v2-r-sm);
  margin-top: 4px;
  box-shadow: var(--v2-sombra-3);
  padding: 4px;
}
html .autocomplete-item {
  color: var(--v2-texto);
  border-bottom: 0;
  border-radius: var(--v2-r-xs);
  min-height: 44px;
}
html .autocomplete-item:hover,
html .autocomplete-item:is(.active, .selected, [aria-selected="true"]) {
  background: var(--v2-neutro) !important;
  color: var(--v2-texto-forte) !important;
}
html .autocomplete-item :is(.cliente-nome, strong) { color: var(--v2-texto-forte); }
html .autocomplete-item :is(.cliente-cpf, small) { color: var(--v2-texto-suave); }
html .autocomplete-item.text-muted { color: var(--v2-texto-suave) !important; }

/* Campos nativos: autofill, placeholder, opcoes de select */
html input:-webkit-autofill,
html input:-webkit-autofill:hover,
html input:-webkit-autofill:focus,
html select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--v2-campo) inset !important;
  -webkit-text-fill-color: var(--v2-texto) !important;
  caret-color: var(--v2-texto);
  transition: background-color 9999s ease-out 0s;
}
::placeholder { color: var(--v2-placeholder); opacity: 1; }
/* campo so-leitura (valor/troco calculados): o "R$ 0,00" e conteudo, nao dica */
input[readonly]::placeholder { color: var(--v2-texto-suave); }
select option { background-color: var(--v2-elevada); color: var(--v2-texto); }
input:disabled, select:disabled, textarea:disabled { -webkit-text-fill-color: var(--v2-texto-suave); opacity: 1; }

/* Opcoes de pagamento (venda e recarga): blocos grandes, selecao por token */
.pa-opcao-pagamento {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 12px 10px;
  background: var(--v2-campo);
  border: 1px solid var(--v2-controle);
  border-radius: var(--v2-r-md);
  color: var(--v2-texto);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.pa-opcao-pagamento i { font-size: 20px; margin: 0; color: var(--v2-texto-suave); display: block; }
label:hover > .pa-opcao-pagamento { border-color: var(--v2-texto-suave); background: var(--v2-superficie-2); }
input:checked + .pa-opcao-pagamento {
  background: var(--v2-primaria-tint);
  border-color: var(--v2-primaria);
  box-shadow: inset 0 0 0 1px var(--v2-primaria);
  color: var(--v2-texto-forte);
  font-weight: 600;
}
input:checked + .pa-opcao-pagamento i { color: var(--v2-primaria-forte); }
input:focus-visible + .pa-opcao-pagamento { outline: 2px solid var(--v2-primaria); outline-offset: 2px; }

/* ==================== 11. LOGIN E SELECAO DE LOJA ==================== */
body.login-page {
  min-height: 100vh;
  background: var(--v2-fundo);
  background-image: radial-gradient(900px 420px at 50% -8%, var(--v2-primaria-tint), transparent 72%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-container { flex: 0 1 400px; width: 100%; max-width: 400px; padding: 0; }
.login-container.pa-login-largo { flex-basis: 480px; max-width: 480px; }
.login-box {
  position: relative;
  background: var(--v2-superficie);
  border: 1px solid var(--v2-borda);
  border-radius: var(--v2-r-lg);
  box-shadow: var(--v2-sombra-1);
  padding: 32px 32px 28px;
}
.login-topo { position: absolute; top: 12px; right: 12px; }
.login-marca { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; min-width: 0; padding-right: 44px; }
.login-marca .login-logo { width: 36px; height: 36px; border-radius: 10px; margin: 0; }
.login-marca .login-logo-text { font-size: 19px; }
.login-marca .pa-marca-nome { font-size: 15px; }
.login-title {
  text-align: left;
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--v2-texto-forte);
}
.login-subtitle { text-align: left; margin: 0 0 24px; font-size: 14px; color: var(--v2-texto-suave); }
.login-form .form-group { margin-bottom: 16px; }
.btn-login,
.login-form .btn-login {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--v2-r-sm);
  background: var(--v2-primaria);
  color: var(--v2-sobre-primaria);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.btn-login:hover:not(:disabled),
.login-form .btn-login:hover:not(:disabled) { background: var(--v2-primaria-forte); transform: none; box-shadow: none; }
.btn-login:disabled { opacity: 0.6; }
.login-message { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--v2-r-sm); font-size: 14px; text-align: left; border: 0; }
.login-message.error { background: var(--v2-erro-tint); color: var(--v2-erro-texto); border: 0; }
.login-message.success { background: var(--v2-sucesso-tint); color: var(--v2-sucesso-texto); border: 0; }
.login-voltar { text-align: center; margin-top: 16px; }
.login-voltar a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px;
  border-radius: var(--v2-r-sm); color: var(--v2-texto-suave); font-size: 14px; text-decoration: none;
}
.login-voltar a:hover { background: var(--v2-neutro); color: var(--v2-texto-forte); }

/* Lista de lojas (selecionar_loja.php) */
.lojas-lista { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; margin-bottom: 16px; padding: 2px; }
.loja-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  margin: 0;
  background: var(--v2-campo);
  border: 1px solid var(--v2-controle);
  border-radius: var(--v2-r-md);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.loja-item:hover { background: var(--v2-superficie-2); border-color: var(--v2-texto-suave); }
.loja-item:has(input:checked) { background: var(--v2-primaria-tint); border-color: var(--v2-primaria); box-shadow: inset 0 0 0 1px var(--v2-primaria); }
.loja-item input { width: 18px; height: 18px; min-height: 0; flex: none; margin: 0; }
.loja-item-info { flex: 1; min-width: 0; }
.loja-item-nome { font-weight: 600; color: var(--v2-texto-forte); font-size: 14.5px; }
.loja-item-cidade { font-size: 13px; color: var(--v2-texto-suave); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.loja-item-nome i, .loja-item-cidade i { color: var(--v2-texto-suave); font-size: 12px; }

/* ==================== 12. RESPONSIVO ==================== */
@media (max-width: 1100px) {
  .content-area { padding: 24px 24px 40px; }
  .topbar .topbar-cidade { max-width: 240px; }
}
@media (max-width: 900px) {
  .user-info { display: none; }
}
/* A gaveta abre em <=768px (mesmo limite do app.js: .active no celular, .hidden no desktop) */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; z-index: 1000; }
  .sidebar.active { transform: translateX(0); box-shadow: var(--v2-sombra-3); }
  .main-content, .main-content.expanded { margin-left: 0; max-width: 100%; width: 100%; }
  .topbar { height: auto; min-height: var(--v2-topbar-altura); padding: 8px 10px; flex-wrap: nowrap; }
  .topbar-right { width: auto; margin: 0; padding: 0; border: 0; justify-content: flex-end; gap: 2px; }
  .topbar .topbar-cidade, .topbar-separator { display: none; }
  .btn-logout-text { display: none; }
  .content-area { padding: 16px 14px 32px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header h1 { font-size: 21px; }
  .page-actions { width: 100%; }
  .content-section { padding: 16px; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .stat-card { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-card .stat-icon { width: 32px; height: 32px; font-size: 14px; }
  .stat-card .stat-info .stat-value, .stat-value { font-size: 20px; }
  .stat-card .stat-info .stat-label, .stat-label { font-size: 12.5px; }
  .stat-info { width: 100%; }
  .pa-modal, .modal-overlay { padding: 10px; }
  .pa-modal-box { width: 100%; }
  /* 16px nos campos: o iOS nao da zoom ao focar */
  input[type="text"], input[type="email"], input[type="password"], input[type="number"],
  input[type="tel"], select, textarea { font-size: 16px; }
  .toast-container { left: 10px; right: 10px; top: 10px; }
  .toast-container > .toast { max-width: none; min-width: 0; }
}
@media (max-width: 480px) {
  .topbar-title { font-size: 14.5px; }
  .pa-usuario { display: none; }
  .content-area { padding: 12px 10px 28px; }
  .login-box { padding: 28px 20px 24px; }
  .pa-modal-footer { justify-content: stretch; }
  .pa-modal-footer .btn { flex: 1 1 auto; }
}

/* ==================== 13. IMPRESSAO ==================== */
/* Impressao sempre clara (tokens.css so aplica o escuro em tela) */
@media print {
  html, body, .dashboard-container, .main-content, .content-area { background: #fff !important; color: #000; }
  .sidebar, .topbar, .sidebar-overlay, .toast-container, .page-actions, .pa-tema-btn { display: none !important; }
  .main-content, .main-content.expanded { margin-left: 0 !important; max-width: 100% !important; width: 100% !important; }
  .comprovante-preview, .extrato-recibo { color: #000 !important; background: #fff !important; border: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .main-content, .nav-item, .btn { transition: none !important; }
}

/* Reflexo de topo do selo (pedido do dono 2026-10-13): faixa brilhante curva na metade de cima, como icone
   de app; fica atras do "P" (isolation + z-index -1) e some em logo com imagem. */
.pa-marca-logo::before,
.logo-sidebar::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: -38%;
  height: 78%;
  border-radius: 0 0 50% 50% / 0 0 34% 34%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.16) 70%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
  z-index: -1;
}
.pa-marca-logo,
.logo-sidebar { isolation: isolate; }
.pa-marca-logo.tem-imagem::before,
.pa-marca-logo:has(img)::before,
.logo-sidebar:has(img)::before { display: none; }
