/* ═══════════════════════════════════════════════════════
   THE3 FINANCE — Design System
   Manual da Marca: #0F2A44 · #2F80ED · #EAF2FF
   Tipografia: Poppins + Inter
   ═══════════════════════════════════════════════════════ */

:root {
  /* ── Brand Colors ── */
  --navy:        #0F2A44;
  --navy-mid:    #142f4e;
  --navy-light:  #1a3a5c;
  --blue:        #2F80ED;
  --blue-hover:  #1a6ed8;
  --blue-pale:   #EAF2FF;
  --blue-glow:   rgba(47,128,237,0.16);
  --blue-border: rgba(47,128,237,0.28);

  /* ── Surface ── */
  --surface-0:  #080f1a;
  --surface-1:  #0d1b2e;
  --surface-2:  #0f2040;
  --surface-3:  #122444;
  --card-bg:    rgba(15,32,64,0.85);
  --card-border: rgba(47,128,237,0.14);

  /* ── Text ── */
  --text-primary:   #f0f5ff;
  --text-secondary: #7ca3cc;
  --text-muted:     #3d6080;
  --text-white:     #ffffff;

  /* ── Semantic ── */
  --green:      #22c55e;
  --green-bg:   rgba(34,197,94,0.12);
  --green-bdr:  rgba(34,197,94,0.25);
  --red:        #ef4444;
  --red-bg:     rgba(239,68,68,0.12);
  --red-bdr:    rgba(239,68,68,0.25);
  --amber:      #f59e0b;
  --amber-bg:   rgba(245,158,11,0.12);
  --amber-bdr:  rgba(245,158,11,0.25);
  --violet:     #a78bfa;
  --violet-bg:  rgba(167,139,250,0.12);

  /* ── Typography ── */
  --font-display: 'Poppins', sans-serif;
  --font-body:    'Inter', sans-serif;

  /* ── Radius ── */
  --r-xs:  6px;
  --r-sm:  10px;
  --r:     14px;
  --r-lg:  20px;
  --r-xl:  28px;

  /* ── Shadow ── */
  --sh-sm:  0 2px 8px rgba(0,0,0,0.3);
  --sh-md:  0 8px 32px rgba(0,0,0,0.4);
  --sh-lg:  0 20px 60px rgba(0,0,0,0.5);
  --sh-blue:0 8px 30px rgba(47,128,237,0.25);

  /* ── Sidebar ── */
  --sb-w: 240px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--surface-0); color: var(--text-primary); min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

/* ── Pages ── */
.page { min-height: 100vh; }
.page.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════
   LOGIN — Split layout: esquerda escura / direita branca
   Manual da Marca: #0F2A44 · #2F80ED
   ═══════════════════════════════════════════════════════ */

#login-page {
  display: flex;
  min-height: 100vh;
}

.login-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* ══════════════════════════════════════════════════════
   PAINEL ESQUERDO — Fundo animado cobre tela inteira
   ══════════════════════════════════════════════════════ */
.login-left {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #050d1a;
  z-index: 0;
}

/* Canvas de gradiente animado */
.ll-gradient-bg {
  position: absolute;
  inset: 0;
  background: #050d1a;
  z-index: 0;
}

/* Orbs animados */
.ll-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  will-change: transform;
  z-index: 0;
}
.ll-orb.orb1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(47,128,237,0.35) 0%, transparent 65%);
  top: -200px; left: -150px;
  animation: orbFloat1 14s ease-in-out infinite;
}
.ll-orb.orb2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(14,55,120,0.45) 0%, transparent 65%);
  bottom: -150px; right: -100px;
  animation: orbFloat2 18s ease-in-out infinite;
}
.ll-orb.orb3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(96,165,250,0.20) 0%, transparent 65%);
  top: 40%; left: 30%;
  animation: orbFloat3 22s ease-in-out infinite;
}
.ll-orb.orb4 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(30,90,180,0.30) 0%, transparent 65%);
  top: 10%; right: 10%;
  animation: orbFloat4 16s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%,100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(60px, 80px) scale(1.08); }
  66%      { transform: translate(-40px, 50px) scale(0.95); }
}
@keyframes orbFloat2 {
  0%,100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-80px, -60px) scale(1.1); }
  66%      { transform: translate(50px, -40px) scale(0.92); }
}
@keyframes orbFloat3 {
  0%,100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(70px, -90px) scale(1.15); }
}
@keyframes orbFloat4 {
  0%,100% { transform: translate(0, 0); }
  40%      { transform: translate(-60px, 70px) scale(1.05); }
  80%      { transform: translate(40px, -30px) scale(0.95); }
}

/* Grid e linha removidos a pedido do usuário */
.ll-grid { display: none; }
.ll-line { display: none; }

.ll-top { position: relative; z-index: 1; }
.ll-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(47,128,237,0.35));
}

.ll-center {
  position: relative; z-index: 1;
  max-width: 420px;
}

.ll-headline {
  font-family: var(--font-display);
  font-size: 3rem; font-weight: 800;
  line-height: 1.08; letter-spacing: -1.5px;
  color: #ffffff;
  margin-bottom: 1.1rem;
  text-shadow: 0 2px 30px rgba(47,128,237,0.2);
}
.ll-headline span {
  background: linear-gradient(135deg, #60a5fa, #2F80ED, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ll-body {
  font-size: .95rem;
  color: rgba(255,255,255,0.50);
  line-height: 1.75;
  margin-bottom: 2.25rem;
}

.ll-features {
  list-style: none;
  display: flex; flex-direction: column;
  gap: .75rem;
}
.ll-features li {
  display: flex; align-items: center; gap: .85rem;
  font-size: .875rem;
  color: rgba(255,255,255,0.55);
  transition: color .2s;
}
.ll-features li:hover { color: rgba(255,255,255,0.8); }
.lf-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #2F80ED);
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(47,128,237,0.8);
}

.ll-content {
  position: fixed;
  top: 0; left: 0;
  width: 55%;
  max-width: 680px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.75rem 3rem;
  z-index: 1;
  pointer-events: none;
}

.ll-bottom {
  position: relative; z-index: 1;
  font-size: .72rem;
  color: rgba(255,255,255,0.22);
  letter-spacing: .02em;
}

/* ══════════════════════════════════════════════════════
   PAINEL DIREITO — card flutuando sobre fundo animado
   ══════════════════════════════════════════════════════ */
.login-right {
  margin-left: auto;
  width: 520px;
  min-width: 460px;
  min-height: 100vh;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  z-index: 2;
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 24px;
  padding: 2.5rem 2.25rem;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.25),
    0 2px 8px rgba(0,0,0,0.12),
    0 0 0 1px rgba(255,255,255,0.9) inset;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: relative;
  z-index: 3;
  transition: box-shadow .3s, transform .3s;
}
.login-card:hover {
  box-shadow:
    0 16px 56px rgba(0,0,0,0.30),
    0 4px 16px rgba(0,0,0,0.15),
    0 0 0 1px rgba(255,255,255,1) inset;
  transform: translateY(-2px);
}

/* Linha decorativa no topo do card */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(47,128,237,0.7), transparent);
  border-radius: 2px;
}

/* Eyebrow */
.lc-eyebrow {
  display: flex; align-items: center; gap: .65rem;
  margin-bottom: 1.5rem;
}
.lc-eyebrow__line {
  display: inline-block;
  width: 24px; height: 2px;
  background: linear-gradient(90deg, #2F80ED, #60a5fa);
  border-radius: 2px;
  flex-shrink: 0;
}
.lc-eyebrow span:last-child {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  letter-spacing: .14em;
  color: var(--blue);
  text-transform: uppercase;
}

/* Header */
.lc-header { margin-bottom: 1.75rem; }
.lc-header h2 {
  font-family: var(--font-display);
  font-size: 1.85rem; font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: -.5px;
  margin-bottom: .5rem;
}
.lc-header p {
  font-size: .855rem;
  color: #6b7280;
  line-height: 1.6;
}

/* Fields */
.lc-field { margin-bottom: 1rem; }
.lc-field label {
  display: block;
  font-size: .78rem; font-weight: 600;
  color: #374151;
  margin-bottom: .45rem;
  letter-spacing: .01em;
}

.lc-input-wrap { position: relative; }
.lc-icon {
  position: absolute; left: .9rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: #9ca3af;
  pointer-events: none;
  transition: color .2s;
}
.lc-input-wrap input,
.lc-input-wrap input[type="email"],
.lc-input-wrap input[type="password"],
.lc-input-wrap input[type="text"] {
  width: 100%;
  background: #f8faff !important;
  border: 1.5px solid #dde6f5 !important;
  border-radius: 12px !important;
  color: #0F2A44 !important;
  font-family: var(--font-body);
  font-size: .9rem;
  padding: .82rem .9rem .82rem 2.6rem !important;
  outline: none;
  transition: all .2s;
  box-sizing: border-box;
}
/* Campo com ícone olho (senha) — padding-right maior */
.lc-input-wrap.has-eye input,
.lc-input-wrap.has-eye input[type="password"] {
  padding-right: 2.6rem !important;
}
.lc-input-wrap input:hover {
  border-color: #bfd2f0 !important;
  background: #f3f7ff !important;
}
.lc-input-wrap input:focus {
  border-color: var(--blue) !important;
  background: #fff !important;
  color: #0F2A44 !important;
  box-shadow: 0 0 0 4px rgba(47,128,237,0.10) !important;
}
.lc-input-wrap input::placeholder { color: #aab4c8 !important; }
.lc-input-wrap:focus-within .lc-icon { color: var(--blue); }

.lc-eye {
  position: absolute; right: .9rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #9ca3af; padding: .2rem; display: flex;
  transition: color .2s;
}
.lc-eye:hover { color: var(--navy); }
.lc-eye svg { width: 16px; height: 16px; }

/* Error */
.lc-error {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: 10px;
  color: #dc2626;
  padding: .65rem 1rem;
  font-size: .81rem;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem;
}
.lc-error.hidden { display: none; }

/* Submit */
.lc-submit {
  width: 100%;
  background: linear-gradient(135deg, #0F2A44 0%, #1a3a5c 100%);
  color: white; border: none;
  border-radius: 12px;
  padding: .9rem 1.5rem;
  font-family: var(--font-display);
  font-size: .95rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center;
  justify-content: center; gap: .65rem;
  transition: all .25s;
  box-shadow: 0 4px 16px rgba(15,42,68,0.22), 0 1px 0 rgba(255,255,255,0.08) inset;
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  letter-spacing: .01em;
}
.lc-submit:hover {
  background: linear-gradient(135deg, #2F80ED 0%, #1a6ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(47,128,237,0.38), 0 1px 0 rgba(255,255,255,0.1) inset;
}
.lc-submit:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(15,42,68,0.2); }
.lc-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.lc-submit svg { width: 17px; height: 17px; }

/* Footer */
.lc-footer {
  display: flex; align-items: center;
  justify-content: center; gap: .4rem;
  font-size: .74rem; color: #9ca3af;
}
.lc-footer svg { flex-shrink: 0; color: #9ca3af; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .login-layout { min-height: 100vh; }
  .login-left { position: absolute; inset: 0; }
  .ll-content { display: none; }
  .login-right { width: 100%; min-width: unset; min-height: 100vh; padding: 2rem 1.25rem; margin-left: 0; background: transparent; }
  .login-card { padding: 2rem 1.5rem; border-radius: 20px; }
}
@media (max-width: 480px) {
  .login-card { border-radius: 16px; padding: 1.75rem 1.25rem; }
  .ll-headline { font-size: 1.8rem; }
}


/* ══════════════════════════════════════════════════════
   NEXUS — Nome do Sistema
   ══════════════════════════════════════════════════════ */

/* Login — lado esquerdo, acima do headline */
.ll-nexus {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: .22em;
  background: linear-gradient(135deg, #60a5fa 0%, #ffffff 50%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  line-height: 1;
  margin-bottom: .6rem;
}

/* Login — card direito, badge acima do "Bem-vindo" */
.lc-nexus-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: .2em;
  background: linear-gradient(135deg, var(--blue) 0%, #1a3a5c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .5rem;
}

/* Topbar — nome NEXUS à esquerda do título da página */
.tb-nexus {
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .2em;
  color: var(--blue);
  background: linear-gradient(135deg, var(--blue), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  padding-right: .75rem;
  border-right: 1.5px solid var(--border, #e8ecf0);
  margin-right: .25rem;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════
   APP LAYOUT — Light Theme
   Fundo cinza · Cards brancos · Sombras elegantes
   ═══════════════════════════════════════════════════════ */

/* ── APP LAYOUT ── */
#app-page { display: flex; min-height: 100vh; background: #f0f2f5; }

/* ══════════════════════════════════════════════════════
   SIDEBAR — branca, sombra lateral suave
   ══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sb-w); min-width: var(--sb-w);
  background: #ffffff;
  border-right: 1px solid #e8ecf0;
  box-shadow: 2px 0 12px rgba(0,0,0,0.06);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  overflow: hidden; /* scroll apenas no sb-nav, não na sidebar inteira */
}

.sb-brand {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 1.3rem 1.25rem;
  border-bottom: 1px solid #f0f2f5;
  flex-shrink: 0;
}
.sb-wordmark { line-height: 1.1; }
.sbw-the {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1rem; color: var(--navy); letter-spacing: 1.5px;
}
.sbw-3 {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.3rem; color: var(--blue); letter-spacing: -1px;
}
.sbw-sub { display: block; font-size: 0.67rem; color: #94a3b8; margin-top: 0.1rem; }

/* Nav */
.sb-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0; /* essencial para flex + overflow funcionar */
}
.sb-divider {
  font-size: 0.63rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: #cbd5e1;
  font-weight: 700; padding: 0.9rem 0.5rem 0.35rem;
}
.sb-item {
  display: flex; align-items: center; gap: 0.7rem;
  width: 100%; padding: 0.62rem 0.85rem;
  border: none; border-radius: var(--r-sm);
  background: none; color: #64748b;
  font-family: var(--font-body); font-size: 0.875rem;
  cursor: pointer; text-align: left; position: relative;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 0.05rem;
}
.sb-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sb-item:hover { background: #f1f5f9; color: var(--navy); }
.sb-item.active {
  background: #eff6ff;
  color: var(--blue);
  font-weight: 600;
}
.sb-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--blue);
  border-radius: 0 2px 2px 0;
}
.sb-badge {
  margin-left: auto;
  font-size: 0.67rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  min-width: 20px; text-align: center;
}
.sb-badge.green { background: #dcfce7; color: #16a34a; }
.sb-badge.red   { background: #fee2e2; color: #dc2626; }

/* User */
.sb-user {
  border-top: 1px solid #f0f2f5;
  padding: 0.9rem;
  display: flex; align-items: center; gap: 0.75rem;
  flex-shrink: 0;
}
.sb-user-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--navy));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem; color: white; flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-weight: 600; font-size: 0.82rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 0.7rem; color: #94a3b8; margin-top: 0.05rem; }
.sb-logout {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; padding: 0.4rem;
  border-radius: var(--r-xs);
  transition: background 0.2s, color 0.2s; display: flex;
}
.sb-logout:hover { background: #fee2e2; color: #dc2626; }
.sb-logout svg { width: 17px; height: 17px; }

/* ══════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════ */
.main-area {
  flex: 1; margin-left: var(--sb-w);
  display: flex; flex-direction: column; min-height: 100vh;
  background: #f0f2f5;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
  box-sizing: border-box;
}
/* Largura calculada só no desktop onde a sidebar é fixa */
@media (min-width: 769px) {
  .main-area {
    width: calc(100vw - var(--sb-w));
    max-width: calc(100vw - var(--sb-w));
  }
  .main-area.mini-offset {
    width: calc(100vw - var(--sb-w-mini)) !important;
    max-width: calc(100vw - var(--sb-w-mini)) !important;
  }
}

/* ── TOPBAR ── */
.topbar {
  height: 58px;
  background: #ffffff;
  border-bottom: 1px solid #e8ecf0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  display: flex; align-items: center;
  padding: 0 1.25rem; gap: .75rem;
  position: sticky; top: 0; z-index: 100;
  width: 100%;
  box-sizing: border-box;
}
.tb-menu {
  display: none; background: none; border: none;
  color: #94a3b8; cursor: pointer; padding: 0.4rem;
  border-radius: var(--r-xs);
  flex-shrink: 0;
}
.tb-menu svg { width: 20px; height: 20px; }
.tb-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1rem; color: var(--navy);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-right {
  display: flex; align-items: center; gap: .6rem;
  flex-shrink: 0;
  margin-left: auto;
}
.tb-period { display: flex; gap: 0.5rem; flex-shrink: 0; }
.tb-period select {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--r-xs);
  color: #475569;
  font-family: var(--font-body);
  font-size: 0.8rem; padding: 0.4rem 0.65rem;
  outline: none; cursor: pointer;
  transition: border-color 0.2s;
}
.tb-period select:hover { border-color: var(--blue); color: var(--navy); }

/* ── SECTIONS ── */
.section { padding: 1.75rem; overflow: hidden; min-width: 0; }
.section.hidden { display: none; }
.section.active { display: block; }

/* ── SECTION HEAD ── */
.sec-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.sec-head h2 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  color: var(--navy); margin-bottom: 0.2rem;
}
.sec-head p { font-size: 0.85rem; color: #64748b; }

/* ══════════════════════════════════════════════════════
   KPI CARDS
   ══════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 1rem; margin-bottom: 1.25rem;
  min-width: 0;
}

.kpi {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1.25rem 1.25rem 1.1rem;
  position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.09);
}

.kpi-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.income-accent  { background: linear-gradient(90deg, #22c55e, #86efac); }
.expense-accent { background: linear-gradient(90deg, #ef4444, #fca5a5); }
.balance-accent { background: linear-gradient(90deg, var(--blue), #93c5fd); }
.pending-accent { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.cash-accent    { background: linear-gradient(90deg, #8b5cf6, #c4b5fd); }

.kpi-icon-wrap {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.9rem;
}
.kpi-icon-wrap svg { width: 20px; height: 20px; }
.kpi-icon-wrap.income  { background: #f0fdf4; color: #16a34a; }
.kpi-icon-wrap.expense { background: #fef2f2; color: #dc2626; }
.kpi-icon-wrap.balance { background: #eff6ff; color: var(--blue); }
.kpi-icon-wrap.pending { background: #fffbeb; color: #d97706; }
.kpi-icon-wrap.cash    { background: #f5f3ff; color: #8b5cf6; }

.kpi-label {
  font-size: 0.71rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #94a3b8; margin-bottom: 0.35rem;
}
.kpi-val {
  font-family: var(--font-display); font-size: 1.55rem;
  font-weight: 800; margin-bottom: 0.2rem;
}
.kpi.income .kpi-val  { color: #16a34a; }
.kpi.expense .kpi-val { color: #dc2626; }
.kpi.balance .kpi-val { color: var(--blue); }
.kpi.pending .kpi-val { color: #d97706; }
.kpi.cash    .kpi-val { color: #8b5cf6; }
.kpi-sub { font-size: 0.76rem; color: #94a3b8; }

/* ══════════════════════════════════════════════════════
   CHARTS
   ══════════════════════════════════════════════════════ */
.charts-row {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 1rem; margin-bottom: 1.25rem;
  min-width: 0; /* impede overflow ao redimensionar */
}
.chart-card {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r); padding: 1.35rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  min-width: 0; /* essencial para grid + canvas não vazar */
  overflow: hidden;
}
/* Canvas do Chart.js: respeita o container */
.chart-card canvas {
  max-width: 100% !important;
  width: 100% !important;
  height: 220px !important;
  max-height: 220px !important;
}
.chart-card__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.chart-card__header h3, .chart-card h3 {
  font-family: var(--font-display); font-size: 0.95rem;
  font-weight: 700; color: var(--navy);
}
.chart-card__header select, #annual-year {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--r-xs);
  color: #475569;
  font-family: var(--font-body);
  font-size: 0.78rem; padding: 0.35rem 0.6rem;
  outline: none; cursor: pointer;
}

/* Recent card */
.recent-card {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r); padding: 1.35rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.rc-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.rc-header h3 {
  font-family: var(--font-display); font-size: 0.95rem;
  font-weight: 700; color: var(--navy);
}

/* Recent tx items */
.tx-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.tx-item:hover { background: #f8fafc; border-color: #e8ecf0; }

.tx-type-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tx-type-dot.income  { background: #22c55e; box-shadow: 0 0 5px rgba(34,197,94,0.35); }
.tx-type-dot.expense { background: #ef4444; box-shadow: 0 0 5px rgba(239,68,68,0.35); }

.tx-info { flex: 1; min-width: 0; }
.tx-desc {
  font-size: 0.85rem; font-weight: 500; color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta { font-size: 0.72rem; color: #94a3b8; margin-top: 0.1rem; }

.tx-amount { font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; flex-shrink: 0; }
.tx-amount.income  { color: #16a34a; }
.tx-amount.expense { color: #dc2626; }

/* ══════════════════════════════════════════════════════
   FILTER ROW
   ══════════════════════════════════════════════════════ */
.filter-row {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin-bottom: 1.25rem;
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r); padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.fr-search {
  position: relative; flex: 1; min-width: 180px;
}
.fr-search svg {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px; color: #94a3b8;
  pointer-events: none;
}
.fr-search input {
  padding-left: 2.4rem !important; /* sobrescreve o padding global */
}

/* Global inputs inside app (light) */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"],
textarea, select {
  font-family: var(--font-body); font-size: 0.875rem;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: var(--r-sm);
  color: #1e293b !important;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(47,128,237,0.10) !important;
  background: #ffffff !important;
}
input::placeholder { color: #cbd5e1 !important; }
select option { background: #ffffff; color: #1e293b; }

.filter-row input, .filter-row select {
  flex: 1; min-width: 130px;
}

/* ══════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════ */
.tbl-card {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r); overflow: hidden; overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.83rem;
}
.data-table th {
  text-align: left; padding: 0.8rem 1rem;
  font-size: 0.7rem; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc; white-space: nowrap;
}
.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle; color: #334155;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

.tbl-amount { font-family: var(--font-display); font-weight: 700; }
.tbl-amount.income  { color: #16a34a; }
.tbl-amount.expense { color: #dc2626; }
.tbl-desc { font-weight: 500; color: var(--navy); }
.tbl-note { font-size: 0.72rem; color: #94a3b8; margin-top: 0.1rem; }
.tbl-acts { display: flex; gap: 0.35rem; white-space: nowrap; }

.tbl-foot td {
  border-top: 2px solid #f1f5f9 !important;
  border-bottom: none !important;
  font-weight: 600; font-size: 0.82rem;
  background: #f8fafc !important;
  color: #475569 !important;
}

/* ══════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.24rem 0.7rem; border-radius: 999px;
  font-size: 0.71rem; font-weight: 700;
  letter-spacing: 0.02em; white-space: nowrap;
}
.b-pending   { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.b-paid,
.b-received  { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.b-cancelled { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }
.b-overdue   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--blue); color: white; border: none;
  border-radius: var(--r-sm); padding: 0.7rem 1.25rem;
  font-family: var(--font-display); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(47,128,237,0.25);
}
.btn-primary:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(47,128,237,0.32);
}
.btn-primary svg { width: 16px; height: 16px; }

.btn-outline {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  color: #475569; border-radius: var(--r-sm);
  padding: 0.68rem 1.25rem;
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); box-shadow: 0 2px 8px rgba(47,128,237,0.12); }

.btn-sm { padding: 0.38rem 0.8rem !important; font-size: 0.77rem !important; }

.btn-ok {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  color: #16a34a; border-radius: var(--r-sm);
  padding: 0.35rem 0.75rem; font-size: 0.77rem; font-family: var(--font-body);
  cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-ok:hover { background: #dcfce7; box-shadow: 0 2px 6px rgba(34,197,94,0.15); }

.btn-danger {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #dc2626; border-radius: var(--r-sm);
  padding: 0.35rem 0.75rem; font-size: 0.77rem; font-family: var(--font-body);
  cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-danger:hover { background: #fee2e2; box-shadow: 0 2px 6px rgba(239,68,68,0.15); }

.btn-edit {
  background: #eff6ff; border: 1px solid #bfdbfe;
  color: var(--blue); border-radius: var(--r-sm);
  padding: 0.35rem 0.75rem; font-size: 0.77rem; font-family: var(--font-body);
  cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-edit:hover { background: #dbeafe; box-shadow: 0 2px 6px rgba(47,128,237,0.15); }

.btn-link {
  background: none; border: none;
  color: var(--blue); cursor: pointer;
  font-size: 0.82rem; font-family: var(--font-body); font-weight: 500;
  padding: 0.2rem; transition: color 0.2s;
}
.btn-link:hover { color: var(--blue-hover); }

/* ══════════════════════════════════════════════════════
   ENTITY GRID
   ══════════════════════════════════════════════════════ */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 1rem;
}

.ent-card {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r); padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.ent-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.09);
  border-color: #bfdbfe;
}

.ent-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.85rem; }
.ent-av {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; color: white;
}
.client-av   { background: linear-gradient(135deg, var(--blue), #1d4ed8); }
.employee-av { background: linear-gradient(135deg, #059669, #0891b2); }

.ent-name { font-weight: 600; font-size: 0.95rem; color: var(--navy); }
.ent-sub  { font-size: 0.76rem; color: #94a3b8; margin-top: 0.1rem; }

.ent-details {
  font-size: 0.8rem; color: #475569;
  line-height: 1.75; margin-bottom: 0.85rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 0.85rem;
}
.ent-notes { font-size: 0.76rem; color: #94a3b8; font-style: italic; margin-bottom: 0.75rem; }
.ent-acts { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════
   CATEGORIES
   ══════════════════════════════════════════════════════ */
.cat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.cat-col-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 0.875rem; margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid #f1f5f9;
  display: flex; align-items: center; gap: 0.5rem;
}
.income-t  { color: #16a34a; }
.expense-t { color: #dc2626; }

.cat-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.72rem 0.85rem;
  background: #ffffff; border: 1px solid #e8ecf0;
  border-radius: var(--r-sm); margin-bottom: 0.4rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cat-item:hover { border-color: #bfdbfe; box-shadow: 0 2px 8px rgba(47,128,237,0.08); }
.cat-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.cat-emoji { font-size: 1rem; }
.cat-name { flex: 1; font-size: 0.875rem; color: #334155; font-weight: 500; }
.cat-acts { display: flex; gap: 0.3rem; }

/* ══════════════════════════════════════════════════════
   REPORTS
   ══════════════════════════════════════════════════════ */
.rpt-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem; margin-bottom: 1.25rem;
}
.rpt-stat {
  background: #ffffff; border: 1px solid #e8ecf0;
  border-radius: var(--r); padding: 1rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.rpt-stat .rsl { font-size: 0.72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.35rem; }
.rpt-stat .rsv { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; color: var(--navy); }

/* ══════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-bg.hidden { display: none; }

.modal-box {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  animation: mIn 0.22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mIn { from { opacity:0; transform:scale(0.94) translateY(16px); } to { opacity:1; transform:none; } }

.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid #f1f5f9;
}
.modal-hd h3 {
  font-family: var(--font-display); font-size: 1.05rem;
  font-weight: 700; color: var(--navy);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; padding: 0.3rem; border-radius: var(--r-xs);
  transition: background 0.15s, color 0.15s; display: flex;
}
.modal-close:hover { background: #fef2f2; color: #dc2626; }
.modal-close svg { width: 18px; height: 18px; }
.modal-bd { padding: 1.5rem; }

.fg { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.fg .full { grid-column: 1 / -1; }

.form-field { margin-bottom: 0; }
.form-field label {
  display: block;
  font-size: 0.73rem; font-weight: 600;
  color: #64748b; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.45rem;
}

.form-foot {
  display: flex; gap: 0.65rem; justify-content: flex-end;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
}

/* ══════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════ */
#toasts {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r-sm); padding: 0.85rem 1.1rem;
  font-size: 0.83rem; min-width: 260px; max-width: 350px;
  color: #334155;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: flex; align-items: center; gap: 0.5rem;
  animation: tIn 0.28s cubic-bezier(.34,1.56,.64,1);
}
.toast.ok  { border-left: 3px solid #22c55e; }
.toast.err { border-left: 3px solid #ef4444; }
.toast.inf { border-left: 3px solid var(--blue); }
@keyframes tIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform:none; } }

/* ══════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 3.5rem 1rem;
  color: #94a3b8;
}
.empty-state svg { opacity: 0.3; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.875rem; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.15); }
  .main-area { margin-left: 0; }
  .tb-menu { display: flex; }
  .cat-cols { grid-template-columns: 1fr; }
  .fg { grid-template-columns: 1fr; }
  .section { padding: 1rem; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.g { color: #16a34a !important; }
.r { color: #dc2626 !important; }
.y { color: #d97706 !important; }
.b { color: var(--blue) !important; }

/* ═══════════════════════════════════════════════════════
   SETTINGS / USERS — Light Theme
   ═══════════════════════════════════════════════════════ */

.settings-tabs {
  display: flex; gap: 0.25rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--r);
  padding: 0.35rem;
  margin-bottom: 1.5rem;
  width: fit-content;
}
.stab {
  background: none; border: none;
  color: #64748b;
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500;
  padding: 0.55rem 1.25rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.stab:hover { color: var(--navy); background: #e2e8f0; }
.stab.active {
  background: var(--blue);
  color: white;
  box-shadow: 0 2px 8px rgba(47,128,237,0.25);
}

.settings-card {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1.75rem;
  max-width: 600px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.settings-card h3 {
  font-family: var(--font-display); font-size: 1rem;
  font-weight: 700; color: var(--navy);
  margin-bottom: 0.35rem;
}
.settings-card p { font-size: 0.85rem; color: #64748b; }

.users-table-wrap {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r); overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.user-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: #f8fafc; }
.user-row.inactive { opacity: 0.55; }

.user-row-av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; color: white;
  background: linear-gradient(135deg, var(--blue), var(--navy));
  position: relative;
}
.status-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #ffffff;
}
.status-dot.active   { background: #22c55e; }
.status-dot.inactive { background: #cbd5e1; }

.user-row-info { flex: 1; min-width: 0; }
.user-row-name { font-weight: 600; font-size: 0.9rem; color: var(--navy); }
.user-row-email { font-size: 0.78rem; color: #94a3b8; margin-top: 0.1rem; }
.user-row-role { flex-shrink: 0; }

.role-badge {
  display: inline-flex; align-items: center;
  padding: 0.22rem 0.7rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
}
.role-admin   { background: #eff6ff; color: var(--blue); border: 1px solid #bfdbfe; }
.role-manager { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.role-user    { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

.user-row-acts { display: flex; gap: 0.35rem; flex-shrink: 0; }

.users-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}
.users-header-title {
  font-size: 0.78rem; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.07em;
}
.users-count { font-size: 0.78rem; color: #94a3b8; }
.users-empty { text-align: center; padding: 3rem; color: #94a3b8; font-size: 0.875rem; }

/* ═══════════════════════════════════════════════════════
   AUDIT LOG — Light Theme
   ═══════════════════════════════════════════════════════ */

.log-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 2fr;
  gap: 1rem; margin-bottom: 1.5rem;
}

.log-stat-card {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1.1rem;
  display: flex; align-items: center; gap: 0.85rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}
.log-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.09); }

.lsc-icon { font-size: 1.4rem; flex-shrink: 0; }
.lsc-value {
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 800;
  color: var(--navy); line-height: 1; margin-bottom: 0.2rem;
}
.lsc-label { font-size: 0.72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }

.top-users-row { display: flex; flex-direction: column; gap: 0.4rem; }
.top-user { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; }
.top-user-rank { font-family: var(--font-display); font-weight: 700; color: var(--blue); width: 20px; flex-shrink: 0; }
.top-user-name { flex: 1; color: var(--navy); font-weight: 500; }
.top-user-count {
  font-size: 0.72rem; color: #64748b;
  background: #f1f5f9; padding: .15rem .5rem; border-radius: 999px;
}

.act-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.22rem 0.65rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.act-login   { background: #eff6ff;  color: var(--blue); border: 1px solid #bfdbfe; }
.act-view    { background: #f8fafc;  color: #64748b;     border: 1px solid #e2e8f0; }
.act-report  { background: #f5f3ff;  color: #7c3aed;     border: 1px solid #ddd6fe; }
.act-create  { background: #f0fdf4;  color: #16a34a;     border: 1px solid #bbf7d0; }
.act-edit    { background: #fffbeb;  color: #d97706;     border: 1px solid #fde68a; }
.act-delete  { background: #fef2f2;  color: #dc2626;     border: 1px solid #fecaca; }
.act-admin   { background: #fdf4ff;  color: #9333ea;     border: 1px solid #e9d5ff; }

.log-pagination { margin-top: 1rem; }
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.pg-info { font-size: 0.82rem; color: #64748b; }
.pg-btns { display: flex; align-items: center; gap: 0.4rem; }
.pg-btn {
  background: #f8fafc; border: 1px solid #e2e8f0;
  color: #475569; border-radius: var(--r-xs);
  padding: 0.35rem 0.7rem; font-size: 0.85rem; cursor: pointer;
  transition: all 0.15s;
}
.pg-btn:hover:not(:disabled) { background: #eff6ff; color: var(--blue); border-color: #bfdbfe; }
.pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pg-cur { font-size: 0.82rem; color: #64748b; padding: 0 0.5rem; }

@media (max-width: 1200px) {
  .log-stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .log-stats-row { grid-template-columns: 1fr; }
}

/* ── Audit section explicit light overrides ── */
#section-auditlog {
  background: #f0f2f5;
}
#section-auditlog .filter-row {
  background: #ffffff !important;
  border-color: #e8ecf0 !important;
}
#section-auditlog select,
#section-auditlog input {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}
#section-auditlog select option {
  background: #ffffff;
  color: #1e293b;
}
#section-auditlog .fr-search input {
  background: #f8fafc !important;
  color: #1e293b !important;
}


/* ═══════════════════════════════════════════════════════
   AUDIT FILTER BAR — corrigido
   ═══════════════════════════════════════════════════════ */
.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 1.25rem;
}

.audit-filter-search {
  position: relative;
  flex: 2;
  min-width: 220px;
}
.audit-filter-search svg {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px; color: #94a3b8;
  pointer-events: none;
}
.audit-filter-search input {
  padding-left: 2.4rem !important;
  width: 100%;
}

.audit-filter-bar select {
  flex: 1;
  min-width: 160px;
}

.audit-filter-dates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 260px;
}
.audit-filter-dates input {
  flex: 1;
  min-width: 120px;
}

/* ── Sidebar logo image ── */
.sb-brand {
  padding: 1rem 1.25rem !important;
  display: flex !important;
  align-items: center !important;
  border-bottom: 1px solid #f0f2f5 !important;
  flex-shrink: 0 !important;
}
.sb-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════
   RECORRÊNCIA
   ═══════════════════════════════════════════════════════ */

.recur-box {
  margin-top: 1.25rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.2s;
}
.recur-box:has(input[value="monthly_forever"]:checked),
.recur-box:has(input[value="monthly_period"]:checked) {
  border-color: var(--blue);
}

.recur-box__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.recur-box__header:hover { background: #f1f5f9; }

.recur-box__title {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.875rem; color: var(--navy);
}
.recur-box__title svg { color: var(--blue); }
.recur-box__toggle { font-size: 0.7rem; color: #94a3b8; }

.recur-panel {
  padding: 1rem;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}
.recur-panel.hidden { display: none; }

/* Type cards */
.recur-types {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem;
}
.recur-type-opt { cursor: pointer; }
.recur-type-opt input { display: none; }

.recur-type-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.25rem; padding: 0.85rem 0.5rem;
  border: 1.5px solid #e2e8f0; border-radius: var(--r-sm);
  text-align: center; transition: all 0.15s;
  background: #f8fafc;
}
.recur-type-opt input:checked + .recur-type-card {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(47,128,237,0.1);
}
.recur-type-card:hover { border-color: #93c5fd; background: #f0f9ff; }

.rtc-icon, .rdc-icon { font-size: 1.25rem; }
.rdc-label { font-size: 0.8rem; font-weight: 600; color: var(--navy); }
.rdc-desc  { font-size: 0.7rem; color: #94a3b8; }

/* Info / preview box */
.recur-info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  font-size: 0.82rem; color: #1e40af;
  line-height: 1.6;
  margin-top: 0.75rem;
}
.recur-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem; color: #92400e;
  margin-top: 0.75rem;
}
.recur-preview { margin-top: 0; }

/* Badge recorrente na tabela */
.recur-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.65rem; font-weight: 600;
  background: #eff6ff; color: var(--blue);
  border: 1px solid #bfdbfe;
  border-radius: 999px; padding: 0.1rem 0.45rem;
  margin-left: 0.35rem; vertical-align: middle;
}

/* ── Audit layout fix ── */
#section-auditlog {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

#section-auditlog .log-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 2fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

#section-auditlog .audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 1.25rem;
  width: 100%;
}

#section-auditlog .audit-filter-search {
  position: relative;
  flex: 2;
  min-width: 200px;
}
#section-auditlog .audit-filter-search svg {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px; color: #94a3b8;
  pointer-events: none;
}
#section-auditlog .audit-filter-search input {
  padding-left: 2.4rem !important;
  width: 100%;
}
#section-auditlog select {
  flex: 1;
  min-width: 150px;
}
#section-auditlog .audit-filter-dates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 240px;
}
#section-auditlog .audit-filter-dates input {
  flex: 1;
  min-width: 110px;
}
#section-auditlog #log-table {
  width: 100%;
  overflow-x: auto;
}

@media (max-width: 1200px) {
  #section-auditlog .log-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  #section-auditlog .log-stats-row {
    grid-template-columns: 1fr 1fr;
  }
  #section-auditlog .audit-filter-bar {
    flex-direction: column;
  }
  #section-auditlog .audit-filter-search,
  #section-auditlog select,
  #section-auditlog .audit-filter-dates {
    width: 100%;
    min-width: unset;
  }
}

/* ══ AUDIT LAYOUT FIX FINAL ══════════════════════════ */
#section-auditlog {
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Stats row - primeira card cortada */
#section-auditlog .log-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  width: 100%;
  min-width: 0;
}

/* Força a tabela a respeitar o container */
#section-auditlog .tbl-card {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}
#section-auditlog .data-table {
  min-width: 900px;
}

/* IP badge - fundo escuro demais */
#section-auditlog .data-table code {
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-size: .75rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

/* Filtros dentro do container */
#section-auditlog .audit-filter-bar {
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}

@media (max-width: 1400px) {
  #section-auditlog .log-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 1000px) {
  #section-auditlog .log-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── AUDIT SECTION PADDING FORCE ── */
#section-auditlog > .sec-head,
#section-auditlog > .log-stats-row,
#section-auditlog > .audit-filter-bar,
#section-auditlog > #log-table,
#section-auditlog > #log-pagination {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Fix: first stat card being cut off - ensure grid starts at 0 */
.log-stat-card:first-child {
  margin-left: 0 !important;
}

/* Fix IP address dark background */
code {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0 !important;
  font-size: .76rem !important;
  padding: .18rem .5rem !important;
  border-radius: 4px !important;
}

/* ═══════════════════════════════════════════════════════
   SORTABLE TABLE HEADERS
   ═══════════════════════════════════════════════════════ */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.sortable-th:hover {
  background: #eef2ff !important;
  color: var(--blue) !important;
}
.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: .75rem;
  color: #cbd5e1;
  transition: color 0.15s;
}
.sort-icon.active {
  color: var(--blue);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════
   REPORT FILTERS — novo layout
   ═══════════════════════════════════════════════════════ */
.rp-filters {
  background: #ffffff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 1.5rem;
}

.rp-filters-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr 1.5fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.rp-filter-group { display: flex; flex-direction: column; gap: 0.4rem; }
.rp-filter-group label {
  font-size: 0.72rem; font-weight: 700;
  color: #64748b; text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rp-date-range {
  display: flex; align-items: center; gap: 0.4rem;
}
.rp-date-range input { flex: 1; min-width: 0; }
.rp-date-sep {
  font-size: .78rem; color: #94a3b8; flex-shrink: 0;
}

.rp-filters-actions {
  display: flex; gap: 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

/* Filter description badge */
.rp-filter-desc {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--r-sm);
  padding: .6rem 1rem;
  font-size: .8rem;
  color: #1e40af;
  margin-bottom: 1rem;
  font-weight: 500;
}

@media (max-width: 1100px) {
  .rp-filters-row { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 768px) {
  .rp-filters-row { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════
   MÓDULO DE ORÇAMENTOS
   ═══════════════════════════════════════════════════════ */

/* Section title inside modal */
.bud-section-title {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: .875rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.1rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid #f1f5f9;
}

/* Items header */
.bud-items-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: .7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Item row */
.bud-item-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .6rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
}
.bud-item-row:last-child {
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}
.bud-item-row:hover { background: #f8fafc; }

.bud-item-desc  { flex: 1; min-width: 180px; font-size: .82rem !important; padding: .45rem .6rem !important; }
.bud-item-qty   { width: 65px;  text-align: center; font-size: .82rem !important; padding: .45rem .4rem !important; }
.bud-item-unit  { width: 55px;  text-align: center; font-size: .82rem !important; padding: .45rem .4rem !important; }
.bud-item-price { width: 110px; text-align: right;  font-size: .82rem !important; padding: .45rem .6rem !important; }

.bud-item-total {
  width: 110px;
  text-align: right;
  font-family: var(--font-display);
  font-size: .82rem;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}

/* Total row */
.bud-total-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: .85rem 1rem;
  background: var(--navy);
  border-radius: var(--r-sm);
  margin-bottom: 1.1rem;
  font-size: .875rem;
  color: rgba(255,255,255,.7);
}
.bud-total-row strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #4ade80;
}

/* Budget card in list view (optional grid) */
.budget-card {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: transform .2s, box-shadow .2s;
}
.budget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.09);
}

/* PDF button */
.btn-pdf {
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  color: #7c3aed;
  border-radius: var(--r-sm);
  padding: .35rem .75rem;
  font-size: .77rem;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: background .15s;
}
.btn-pdf:hover { background: #f3e8ff; }

/* Summary stats for budgets page */
.bud-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.bud-stat {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  text-align: center;
}
.bud-stat .bs-val {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: .2rem;
}
.bud-stat .bs-lbl {
  font-size: .72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .05em;
}

@media (max-width: 1100px) {
  .bud-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .bud-stats { grid-template-columns: repeat(2, 1fr); }
  .bud-items-header { display: none; }
  .bud-item-row { flex-wrap: wrap; }
  .bud-item-desc { min-width: 100%; }
}
