/* ═══════════════════════════════════════════════
   Emitto — site.css
   Layout/Design System importado do BuscaNF·e
   Azul-escuro #0F2E5C | Azul #1E40AF | Verde #10B981
   Fundo #F0F2F5 | Tipografia: Inter
═══════════════════════════════════════════════ */

:root {
  /* Paleta BuscaNF·e */
  --azul-escuro:  #0F2E5C;
  --azul:         #1E40AF;
  --verde:        #10B981;
  --verde-escuro: #059669;
  --laranja:      #D97706;
  --vermelho:     #DC2626;
  --cinza-texto:  #6B7280;
  --cinza-claro:  #9CA3AF;
  --borda:        #E5E7EB;

  /* Tokens antigos do Emitto remapeados para a nova paleta
     (mantém compatibilidade com todas as views existentes) */
  --emitto-navy:        #0F2E5C;
  --emitto-navy-dark:   #0A2142;
  --emitto-azul:        #1E40AF;
  --emitto-azul-dark:   #0F2E5C;
  --emitto-azul-claro:  #93C5FD;
  --emitto-teal:        #10B981;
  --emitto-teal-dark:   #059669;
  --emitto-gelo:        #F0F2F5;
  --emitto-cinza:       #6B7280;
  --emitto-border:      #E5E7EB;

  --bs-primary:         #1E40AF;
  --bs-primary-rgb:     30, 64, 175;

  --sidebar-width: 240px;
}

/* ─── Tipografia ─────────────────────────────── */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: #F0F2F5;
  font-size: 0.9rem;
  color: #1F2937;
}

h1, h2, h3, h4, h5, h6,
.fw-nunito,
.page-header h5,
.card-header,
.dash-card .fs-5,
.emitto-sidebar .brand b {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  letter-spacing: -.4px;
}

.font-mono {
  font-family: ui-monospace, 'Courier New', monospace;
}

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

.emitto-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0F2E5C 0%, #1E40AF 100%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .25s ease;
}

.emitto-sidebar .brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.emitto-sidebar .brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
}

.emitto-sidebar .brand b {
  color: #fff;
  font-size: 1.15rem;
  letter-spacing: .2px;
}

.emitto-sidebar .brand b em {
  color: #10B981;
  font-style: normal;
}

.emitto-sidebar .brand small {
  display: block;
  color: #10B981;
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
}

.sidebar-group-label {
  font-size: .68rem;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  border-left: 3px solid transparent;
  background: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.sidebar-link i:first-child {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
  border-left-color: #10B981;
  text-decoration: none;
}

.sidebar-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: #10B981;
}

/* Ícones (emoji) — padrão BuscaNF·e */
.sidebar-link .ico,
.nav-item .ico {
  font-size: 28px;
  width: 34px;
  text-align: center;
  flex-shrink: 0;
  font-style: normal;
}

/* Badge de contagem no menu — padrão BuscaNF·e */
.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  background: rgba(255,255,255,.2);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
}
.nav-badge.laranja { background: #D97706; }

.nav-divisor {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 6px 0;
}

.sidebar-link.sub {
  padding-left: 2.7rem;
  font-size: 12.5px;
}

.sidebar-link.sub.nested {
  padding-left: 4rem;
  font-size: 12px;
}

.sidebar-link .chevron {
  margin-left: auto;
  transition: transform .2s ease;
  font-size: .8rem;
}

.sidebar-link[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.sidebar-submenu {
  display: flex;
  flex-direction: column;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  gap: .6rem;
  align-items: center;
}

/* Botão sair — padrão BuscaNF·e */
.btn-sair {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
  text-align: center;
  text-decoration: none;
  display: block;
}
.btn-sair:hover { background: rgba(220,38,38,.3); border-color: rgba(220,38,38,.4); color: #fff; }

.sidebar-footer .avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10B981, #1E40AF);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-footer .info {
  flex: 1;
  min-width: 0;
}

.sidebar-footer .info b {
  display: block;
  font-size: .8rem;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .info small {
  font-size: .7rem;
  color: rgba(255,255,255,.6);
}

.sidebar-footer .sidebar-logout {
  color: rgba(255,255,255,.7);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-footer .sidebar-logout:hover {
  color: #fde5e2;
}

.emitto-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.emitto-topbar {
  display: none;
  align-items: center;
  gap: .85rem;
  padding: .7rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--emitto-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.emitto-topbar .btn-icon {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--emitto-navy);
  padding: 0 .25rem;
  line-height: 1;
}

.emitto-topbar img {
  height: 26px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 1025;
}

.sidebar-backdrop.show {
  display: block;
}

@media (max-width: 991.98px) {
  .emitto-sidebar {
    transform: translateX(-100%);
  }
  .emitto-sidebar.open {
    transform: translateX(0);
  }
  .emitto-content {
    margin-left: 0;
  }
  .emitto-topbar {
    display: flex;
  }
}

/* ─── Page header (título de página) ─────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h5 {
  font-weight: 800;
  color: var(--emitto-navy);
  margin: 0;
  font-size: 1.2rem;
}

/* ─── Cards ──────────────────────────────────── */
.card {
  border-radius: 14px;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--emitto-border);
  font-weight: 700;
}

/* Cards de dashboard — barra inferior colorida (padrão BuscaNF·e) */
.dash-card {
  border-left: none;
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.dash-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--c, #1E40AF);
}

.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.dash-card .dash-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.dash-card.card-navy  { --c: #0F2E5C; }
.dash-card.card-teal  { --c: #10B981; }
.dash-card.card-azul  { --c: #1E40AF; }
.dash-card.card-green { --c: #059669; }
.dash-card.card-red   { --c: #DC2626; }
.dash-card.card-amber { --c: #D97706; }

/* ─── Botões ──────────────────────────────────── */
/* Azul = o usuário age (ação primária) */
.btn-emitto,
.btn-primary {
  background-color: var(--emitto-azul) !important;
  border-color: var(--emitto-azul) !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 10px;
  transition: background .15s, transform .1s;
}

.btn-emitto:hover,
.btn-primary:hover {
  background-color: var(--emitto-azul-dark) !important;
  border-color: var(--emitto-azul-dark) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-emitto-outline {
  border: 1.5px solid var(--emitto-azul);
  color: var(--emitto-azul);
  border-radius: .6rem;
  font-weight: 600;
  background: transparent;
  transition: background .15s, color .15s;
}

.btn-emitto-outline:hover {
  background-color: var(--emitto-azul);
  color: #fff;
}

/* Teal = o sistema confirma êxito */
.btn-success {
  background-color: var(--emitto-teal) !important;
  border-color: var(--emitto-teal) !important;
}

.btn-success:hover {
  background-color: var(--emitto-teal-dark) !important;
  border-color: var(--emitto-teal-dark) !important;
}

/* ─── Tabelas ────────────────────────────────── */
.table > :not(caption) > * > * {
  padding: .55rem .75rem;
}

.table thead th {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #9CA3AF;
  background-color: #FAFAFA;
  border-bottom: 2px solid #F3F4F6;
  white-space: nowrap;
}

.table-hover tbody tr:hover {
  background-color: #F9FAFB;
  cursor: default;
}

/* ─── Badges de status fiscal / financeiro (padrão BuscaNF·e) ───── */
[class*="badge-"]:is(.badge-autorizada,.badge-pendente,.badge-cancelada,.badge-erro,.badge-aberto,.badge-enviada,.badge-recebido,.badge-pago,.badge-vencido,.badge-cancelado,.badge-estornado) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  font-weight: 700;
}
:is(.badge-autorizada,.badge-pendente,.badge-cancelada,.badge-erro,.badge-aberto,.badge-enviada,.badge-recebido,.badge-pago,.badge-vencido,.badge-cancelado,.badge-estornado)::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-autorizada  { background-color: #D1FAE5; color: #065F46; }
.badge-pendente    { background-color: #FEF3C7; color: #92400E; }
.badge-cancelada   { background-color: #FEE2E2; color: #991B1B; }
.badge-erro        { background-color: #FEE2E2; color: #991B1B; }
.badge-aberto      { background-color: #DBEAFE; color: #1E3A8A; }
.badge-enviada     { background-color: #DBEAFE; color: #1E3A8A; }
.badge-recebido,
.badge-pago        { background-color: #D1FAE5; color: #065F46; }
.badge-vencido     { background-color: #FEE2E2; color: #991B1B; }
.badge-cancelado,
.badge-estornado   { background-color: #F3F4F6; color: #4B5563; }

/* ─── Formulários ────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: #1E40AF;
  box-shadow: 0 0 0 .2rem rgba(30, 64, 175, .12);
}

.form-label {
  font-weight: 500;
  font-size: .85rem;
  color: #374151;
}

/* ─── Barra de progresso MEI ─────────────────── */
.progress {
  border-radius: 6px;
  height: 10px;
}

.progress-bar.bg-emitto {
  background-color: var(--emitto-teal);
}

/* ─── Login page ─────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--emitto-navy) 0%, var(--emitto-azul) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  border: none;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

/* ─── Alertas ─────────────────────────────────── */
.alert {
  border-radius: .6rem;
  border: none;
}

.alert-success { background-color: #D1FAE5; color: #065F46; }
.alert-danger  { background-color: #FEE2E2; color: #991B1B; }
.alert-warning { background-color: #FEF3C7; color: #92400E; }
.alert-info    { background-color: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ─── Breadcrumb ──────────────────────────────── */
.breadcrumb {
  background: transparent;
  padding: 0;
  font-size: .8rem;
}

/* ─── Footer ─────────────────────────────────── */
.footer {
  background-color: #fff;
  font-size: .8rem;
}

/* ─── NF-e item row ──────────────────────────── */
.item-row {
  background: #f9fafb;
  border: 1px solid var(--emitto-border);
  border-radius: .5rem;
  padding: .75rem;
  margin-bottom: .5rem;
}

/* ─── Animações ──────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-menu {
  border: none;
  border-radius: .6rem;
  box-shadow: 0 4px 20px rgba(3, 39, 77, .12);
  animation: fadeIn .15s ease;
}

/* ─── Ambiente badges ───────────────────────── */
.badge-producao    { background: #D1FAE5; color: #065F46; font-size: .7rem; }
.badge-homologacao { background: #FEF3C7; color: #92400E; font-size: .7rem; }

/* ─── Utilitários ────────────────────────────── */
.text-emitto { color: var(--emitto-teal) !important; }
.bg-emitto   { background-color: var(--emitto-teal) !important; }
.text-azul   { color: var(--emitto-azul) !important; }
.bg-azul     { background-color: var(--emitto-azul) !important; }
.text-navy   { color: var(--emitto-navy) !important; }
.bg-navy     { background-color: var(--emitto-navy) !important; }

.border-teal { border-left: 4px solid var(--emitto-teal) !important; }
.border-navy { border-left: 4px solid var(--emitto-navy) !important; }
.border-azul { border-left: 4px solid var(--emitto-azul) !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.senha-requisitos { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-top: .45rem; }
.senha-requisitos [data-regra] { color: #6c757d; transition: color .2s ease; }
.senha-requisitos [data-regra]::before { content: "○ "; }
.senha-requisitos [data-regra].atendido { color: #198754 !important; font-weight: 600; }
.senha-requisitos [data-regra].atendido::before { content: "✓ "; }

/* ─── Responsividade ─────────────────────────── */
@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .dash-card { margin-bottom: .5rem; }
}
