/* ==========================================================================
   Finere ERP + BPO — Modern Executive Design System
   Inspirado no protótipo FinFlow (code.html)
   ========================================================================== */

:root {
  /* Cores Principais (Ink-Navy & Acentos) */
  --ink: #131b2e;
  --ink-2: #1b2540;
  --ink-3: #222e4d;
  --ink-text-muted: #8e99b7;
  --ink-link: #c7cdea;
  --ink-border: rgba(255, 255, 255, 0.12);

  /* Acento Violeta */
  --accent: #712ae2;
  --accent-hover: #5a00c6;
  --accent-container: #8a4cfc;
  --accent-soft: #eaddff;
  --accent-soft-ink: #25005a;
  --accent-gradient: linear-gradient(135deg, #712ae2 0%, #8a4cfc 100%);

  /* Superfícies Neutras */
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-2: #f2f4f6;
  --surface-3: #eceef0;
  --surface-4: #e6e8ea;
  --surface-dark: #0e1526;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  /* Tipografia */
  --text: #191c1e;
  --text-muted: #45464d;
  --text-faint: #76777d;

  /* Estados Semânticos */
  --danger: #ba1a1a;
  --danger-soft: #ffdad6;
  --danger-text: #93000a;
  --success: #0f766e;
  --success-soft: #ccfbf1;
  --success-text: #115e59;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --warning-text: #78350f;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --info-text: #0369a1;

  /* Dimensões do Shell */
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 76px;
  --topbar-height: 64px;

  /* Bootstrap Reskinning Tokens */
  --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary: var(--ink);
}

/* ==========================================================================
   Base & Resets
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--bs-body-font-family);
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}
a:hover {
  color: var(--accent-hover);
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  vertical-align: middle;
  line-height: 1;
}

/* Formatação Numérica Tabular */
.valor, .tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--ink);
  color: var(--ink-link);
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
  user-select: none;
}

.sidebar-header {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid var(--ink-border);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  overflow: hidden;
}
.brand-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(113, 42, 226, 0.35);
}
.brand-logo-icon span {
  font-size: 1.2rem;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffffff;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-text-muted);
  font-weight: 600;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: var(--ink-text-muted);
  padding: 0.35rem;
  border-radius: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* Alternador de Visão (Cockpit BPO / Empresário) */
.sidebar-perspective {
  padding: 0.75rem 0.85rem 0.5rem;
  border-bottom: 1px solid var(--ink-border);
}
.perspective-pill-container {
  display: flex;
  background: var(--ink-2);
  border-radius: 0.5rem;
  padding: 3px;
  gap: 2px;
}
.perspective-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.4rem;
  border-radius: 0.38rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.perspective-btn.active, .perspective-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

/* Card Empresa Ativa */
.sidebar-empresa-card {
  margin: 0.75rem 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background 0.15s ease;
}
.sidebar-empresa-card:hover {
  background: rgba(255, 255, 255, 0.08);
}
.empresa-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.empresa-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-text-muted);
  font-weight: 600;
}
.empresa-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empresa-cnpj {
  font-size: 0.65rem;
  color: var(--ink-text-muted);
}

/* Navegação da Sidebar */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.65rem;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.nav-group {
  margin-bottom: 0.85rem;
}
.nav-group-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-text-muted);
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
  font-weight: 600;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.48rem 0.65rem;
  border-radius: 0.5rem;
  color: var(--ink-link);
  font-size: 0.82rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  white-space: nowrap;
  margin-bottom: 1px;
  transition: all 0.15s ease;
}
.sidebar-nav .nav-link-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.sidebar-nav .nav-link .material-symbols-outlined {
  font-size: 1.15rem;
  flex-shrink: 0;
  color: var(--ink-text-muted);
  transition: color 0.15s ease;
}
.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}
.sidebar-nav .nav-link:hover .material-symbols-outlined {
  color: #ffffff;
}
.sidebar-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
  border-left-color: var(--accent);
}
.sidebar-nav .nav-link.active .material-symbols-outlined {
  color: #ffffff;
}

/* Badges da Sidebar */
.nav-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 1rem;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.nav-badge-pill {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Rodapé da Sidebar */
.sidebar-footer {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--ink-border);
  flex-shrink: 0;
}
.sidebar-collapse-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  color: var(--ink-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Backdrop Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(19, 27, 46, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1025;
}

/* Modo Sidebar Recolhida (Desktop Rail) */
body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-width-collapsed);
}
body.sidebar-collapsed .app-shell {
  margin-left: var(--sidebar-width-collapsed);
}
body.sidebar-collapsed .app-topbar {
  left: var(--sidebar-width-collapsed);
}
body.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .sidebar-perspective,
body.sidebar-collapsed .sidebar-empresa-card,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .nav-group-label {
  display: none !important;
}
body.sidebar-collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding: 0.65rem 0;
  border-left: none;
  border-radius: 0.5rem;
}
body.sidebar-collapsed .sidebar-nav .nav-link.active {
  background: var(--accent);
}

/* ==========================================================================
   Shell Principal & Topbar
   ========================================================================== */
.app-shell {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-topbar {
  position: sticky;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 1020;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Topbar Left (Busca Rápida / Command Palette Trigger) */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  max-width: 480px;
}
.search-trigger-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  color: var(--text-faint);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.search-trigger-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(113, 42, 226, 0.08);
  color: var(--text);
}
.search-trigger-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.kbd-shortcut {
  font-size: 0.65rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border-dark);
}

/* Status Badge Topbar */
.bpo-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 2rem;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid rgba(113, 42, 226, 0.18);
  white-space: nowrap;
}

/* Topbar Right (Ações Globais, Notificações, Usuário) */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botão Novo Lançamento */
.btn-quick-new {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--ink);
  color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: 0.55rem;
  border: none;
  box-shadow: 0 2px 5px rgba(19, 27, 46, 0.15);
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn-quick-new:hover {
  background: var(--ink-2);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(19, 27, 46, 0.2);
}
.quick-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 0.45rem;
  margin: 0.15rem 0.35rem;
  transition: background 0.15s ease;
}
.quick-menu-item:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.topbar-divider {
  height: 24px;
  width: 1px;
  background: var(--border);
  margin: 0 0.25rem;
}

/* Botão de Notificações */
.btn-notificacoes {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  border-radius: 0.55rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn-notificacoes:hover {
  background: var(--surface-3);
  color: var(--text);
}
.badge-notification {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 17px;
  height: 17px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

/* Chip do Usuário */
.user-chip-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}
.user-chip-wrapper:hover {
  background: var(--surface-2);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ink);
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 0.45rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Conteúdo Principal */
.app-main {
  flex: 1;
  padding: 1.5rem 1.75rem;
  width: 100%;
}

/* ==========================================================================
   Responsividade Mobile / Tablet
   ========================================================================== */
@media (max-width: 991px) {
  .app-shell {
    margin-left: 0 !important;
  }
  .app-topbar {
    left: 0 !important;
    padding: 0 1rem;
  }
  .app-sidebar {
    transform: translateX(-100%);
  }
  body.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
    width: var(--sidebar-width);
  }
  body.sidebar-mobile-open .sidebar-backdrop {
    display: block;
  }
  .topbar-left {
    max-width: 240px;
  }
  .bpo-status-badge, .user-meta {
    display: none !important;
  }
  .app-main {
    padding: 1rem;
  }
}

/* ==========================================================================
   Cards & Grid de Métricas
   ========================================================================== */
.card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  border-top-left-radius: 0.75rem !important;
  border-top-right-radius: 0.75rem !important;
}

/* Metric Cards Modernos com Linha Superior de Acento */
.metric-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.metric-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}
.metric-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}
.metric-accent-primary { background: var(--ink); }
.metric-accent-success { background: var(--success); }
.metric-accent-warning { background: var(--warning); }
.metric-accent-danger { background: var(--danger); }

.metric-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.metric-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin: 0.35rem 0;
}
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
}
.metric-pill.pill-accent {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.metric-pill.pill-success {
  background: var(--success-soft);
  color: var(--success-text);
}
.metric-pill.pill-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.metric-footer {
  margin: 0.75rem -1.25rem -1.25rem;
  padding: 0.65rem 1.25rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   Banner Executivo de Boas-Vindas & Alerta de Pressão de Caixa
   ========================================================================== */
.context-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.context-banner-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.context-banner-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.status-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(113, 42, 226, 0.2);
}

/* Timeframe Selector Pills */
.timeframe-group {
  display: inline-flex;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
}
.timeframe-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 0.42rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.timeframe-btn:hover {
  color: var(--text);
}
.timeframe-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Alerta Gerencial de Pressão de Caixa */
.alert-caixa-pressao {
  background: #fdf6f6;
  border: 1px solid #f9d2d2;
  border-left: 5px solid var(--danger);
  border-radius: 0.85rem;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 2px 6px rgba(186, 26, 26, 0.05);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
@media (min-width: 992px) {
  .alert-caixa-pressao {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.caixa-pressao-icon {
  width: 42px;
  height: 42px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.caixa-pressao-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--danger-text);
}
.caixa-pressao-desc {
  font-size: 0.8rem;
  color: #4a2828;
  margin: 0;
  line-height: 1.45;
}

/* ==========================================================================
   Tabelas de Alta Usabilidade
   ========================================================================== */
.table {
  color: var(--text);
  margin-bottom: 0;
  vertical-align: middle;
}
.table thead th {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.table-hover tbody tr:hover td {
  background-color: rgba(113, 42, 226, 0.02);
}

/* Badges Semânticos em Formato Pílula */
.badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.3em 0.65em;
  border-radius: 2rem;
  letter-spacing: 0.01em;
}
.badge-status-pago {
  background-color: var(--success-soft) !important;
  color: var(--success-text) !important;
}
.badge-status-vencido {
  background-color: var(--danger-soft) !important;
  color: var(--danger-text) !important;
}
.badge-status-pendente {
  background-color: var(--warning-soft) !important;
  color: var(--warning-text) !important;
}
.badge-status-aprovacao {
  background-color: var(--info-soft) !important;
  color: var(--info-text) !important;
}
.badge-status-cancelado {
  background-color: var(--surface-3) !important;
  color: var(--text-faint) !important;
}

/* ==========================================================================
   Botões & Controles de Ação
   ========================================================================== */
.btn {
  border-radius: 0.55rem;
  font-weight: 500;
  font-size: 0.82rem;
  padding: 0.45rem 0.95rem;
  transition: all 0.15s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.btn-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 0.45rem;
}
.btn-primary {
  background-color: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--ink-2);
  border-color: var(--ink-2);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(19, 27, 46, 0.2);
}
.btn-accent {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-accent:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}
.btn-outline-primary {
  border-color: var(--border-dark);
  color: var(--ink);
  background: transparent;
}
.btn-outline-primary:hover {
  background: var(--surface-2);
  border-color: var(--ink);
  color: var(--ink);
}

/* Abas de Navegação (Tabs) */
.nav-tabs {
  border-bottom: 1px solid var(--border);
  gap: 0.25rem;
}
.nav-tabs .nav-link {
  color: var(--text-muted);
  border: 1px solid transparent;
  border-top-left-radius: 0.55rem;
  border-top-right-radius: 0.55rem;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  transition: all 0.15s ease;
}
.nav-tabs .nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: transparent;
}
.nav-tabs .nav-link.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--surface);
  border-color: var(--border) var(--border) var(--surface);
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.02);
}

/* Formulários */
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.form-control, .form-select {
  border-radius: 0.55rem;
  border-color: var(--border);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(113, 42, 226, 0.12);
}

/* ==========================================================================
   Command Palette (Ctrl+K Modal)
   ========================================================================== */
.command-palette-modal {
  position: fixed;
  inset: 0;
  background: rgba(19, 27, 46, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1060;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.command-palette-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.command-palette-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  transform: translateY(-10px);
  transition: transform 0.2s ease;
}
.command-palette-modal.open .command-palette-dialog {
  transform: translateY(0);
}
.command-palette-header {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  gap: 0.65rem;
}
.command-palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
}
.command-palette-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
}
.command-palette-group-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0.45rem 0.65rem 0.25rem;
}
.command-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.1s ease;
}
.command-palette-item:hover, .command-palette-item.active {
  background: var(--surface-2);
  color: var(--accent);
}
.command-palette-footer {
  padding: 0.5rem 1rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   DRE Gerencial Sintética & Detalhada
   ========================================================================== */
.dre-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.dre-linha:last-child {
  border-bottom: none;
}
.dre-rotulo {
  font-size: 0.85rem;
  font-weight: 500;
}
.dre-valores {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.dre-pct {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  min-width: 3.5rem;
  text-align: right;
}
.dre-valores .valor {
  min-width: 8.5rem;
  text-align: right;
  font-weight: 600;
}

.dre-total {
  background: var(--surface-2);
}
.dre-total .dre-rotulo {
  font-weight: 700;
  color: var(--ink);
  border-left: 3px solid var(--ink);
  padding-left: 0.5rem;
}
.dre-deducao {
  padding-left: 1.85rem;
  color: var(--text-muted);
}
.dre-subtotal {
  background: #f8fafc;
  font-weight: 600;
}
.dre-resultado {
  background: var(--ink);
  color: #ffffff;
  border-radius: 0 0 0.75rem 0.75rem;
  padding: 1rem 1.15rem;
}
.dre-resultado .dre-rotulo {
  font-weight: 700;
  font-size: 0.95rem;
}
.dre-resultado .dre-pct {
  color: var(--ink-text-muted);
}
.dre-resultado .valor {
  font-size: 1.2rem;
  font-weight: 700;
}
.dre-resultado-negativo {
  background: var(--danger);
}

/* ==========================================================================
   Central de Notificações / Toast
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1070;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast-custom {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 0.65rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  min-width: 280px;
  animation: slideIn 0.2s ease forwards;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
